Author: aschnell Date: Fri Dec 4 14:42:05 2009 New Revision: 59957 URL: http://svn.opensuse.org/viewcvs/yast?rev=59957&view=rev Log: - avoid data loss on encrypted partitions using non-LUKS encryption when integrating them into system (#557607) (backport from head) Modified: branches/SuSE-Code-11-SP1-Branch/storage/VERSION branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes Modified: branches/SuSE-Code-11-SP1-Branch/storage/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/VERSION?rev=59957&r1=59956&r2=59957&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/VERSION (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/VERSION Fri Dec 4 14:42:05 2009 @@ -1 +1 @@ -2.17.85 +2.17.86 Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc?rev=59957&r1=59956&r2=59957&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc Fri Dec 4 14:42:05 2009 @@ -2631,7 +2631,7 @@ } else if( findVolume( device, cont, vol ) ) { - ret = vol->setEncryption(val, typ, true); + ret = vol->setEncryption( val, typ ); } else { Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc?rev=59957&r1=59956&r2=59957&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc Fri Dec 4 14:42:05 2009 @@ -1328,7 +1328,7 @@ int - Volume::setEncryption(bool val, EncryptType typ, bool force) + Volume::setEncryption(bool val, EncryptType typ) { int ret = 0; y2milestone( "val:%d typ:%d", val, typ ); @@ -1351,25 +1351,19 @@ ret = VOLUME_CRYPT_NO_PWD; if( ret == 0 && cType()==NFSC ) ret = VOLUME_CRYPT_NFS_IMPOSSIBLE; - if (ret == 0 && (create || format || loop_active)) + if (ret == 0 && (create || format || loop_active || mp.empty())) { encryption = typ; is_loop = cont->type()==LOOP; dmcrypt_dev = getDmcryptName(); } - if (ret == 0 && !create && !format && !loop_active) + if (ret == 0 && !create && !format && !loop_active && !mp.empty()) { - if( detectEncryption()==ENC_UNKNOWN && !force) + if( detectEncryption()==ENC_UNKNOWN ) ret = VOLUME_CRYPT_NOT_DETECTED; - else if (force) - { - encryption = typ; - is_loop = cont->type()==LOOP; - dmcrypt_dev = getDmcryptName(); } } } - } if( ret==0 ) { updateFstabOptions(); @@ -1887,8 +1881,8 @@ int Volume::doCryptsetup() { int ret = 0; - y2milestone( "device:%s mp:%s dmcrypt:%d active:%d", - dev.c_str(), mp.c_str(), dmcrypt(), dmcrypt_active ); + y2mil("device:" << dev << " mp:" << mp << " dmcrypt:" << dmcrypt() << + " active:" << dmcrypt_active << " format:" << format ); if( !silent() && dmcrypt() ) { cont->getStorage()->showInfoCb( crsetupText(true) ); @@ -1916,7 +1910,8 @@ pwdfile << crypt_pwd; pwdfile.close(); SystemCmd cmd; - if( (encryption != orig_encryption) || format || (isTmpCryptMp(mp)&&crypt_pwd.empty()) ) + if( format || (isTmpCryptMp(mp)&&crypt_pwd.empty()) || + (encryption!=ENC_NONE&&mp.empty()) ) { string cmdline = getCryptsetupCmd( encryption, dmcrypt_dev, mp, fname, true, crypt_pwd.empty() ); @@ -2305,9 +2300,10 @@ l.push_back( new commitAction( FORMAT, cont->type(), formatText(false), this, true )); } - else if (encryption != orig_encryption) + else if ( encryption != ENC_NONE ) { - l.push_back(new commitAction(FORMAT, cont->type(), crsetupText(false), this, true)); + l.push_back(new commitAction(mp.empty()?INCREASE:FORMAT, cont->type(), + crsetupText(false), this, mp.empty())); } else if( mp != orig_mp || (cont->getStorage()->instsys()&&mp=="swap") ) Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h?rev=59957&r1=59956&r2=59957&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h Fri Dec 4 14:42:05 2009 @@ -101,8 +101,7 @@ storage::EncryptType getEncryption() const { return encryption; } void setEncryption( storage::EncryptType val=storage::ENC_LUKS ) { encryption=orig_encryption=val; } - virtual int setEncryption(bool val, storage::EncryptType typ = storage::ENC_LUKS, - bool force = false); + virtual int setEncryption(bool val, storage::EncryptType typ = storage::ENC_LUKS ); const string& getCryptPwd() const { return crypt_pwd; } int setCryptPwd( const string& val ); void clearCryptPwd() { crypt_pwd.erase(); } Modified: branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes?rev=59957&r1=59956&r2=59957&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes Fri Dec 4 14:42:05 2009 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Thu Dec 03 10:38:39 CET 2009 - fehr@suse.de + +- avoid data loss on encrypted partitions using non-LUKS encryption + when integrating them into system (#557607) +- 2.17.86 + +------------------------------------------------------------------- Fri Nov 27 17:08:15 CET 2009 - aschnell@suse.de - enable boot.crypt-early along with boot.crypto (bnc #558888) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org