Mailing Lists
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2023
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
List overview
Download
YaST Commits
April 2010
----- 2023 -----
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
yast-commit@lists.opensuse.org
22 participants
399 discussions
Start a n
N
ew thread
[yast-commit] r61919 - in /branches/SuSE-Code-11-Branch/storage: ./ libstorage/src/ libstorage/testsuite/ libstorage/testsuite/single.out/ package/ storage/src/include/ storage/src/modules/
by fehr@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: fehr Date: Thu Apr 29 15:40:41 2010 New Revision: 61919 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61919&view=rev
Log: - backport crypt related fixes to handle L3 (bnc #599998) - 2.17.77 Modified: branches/SuSE-Code-11-Branch/storage/VERSION branches/SuSE-Code-11-Branch/storage/libstorage/src/Container.cc branches/SuSE-Code-11-Branch/storage/libstorage/src/DmCo.cc branches/SuSE-Code-11-Branch/storage/libstorage/src/EtcFstab.cc branches/SuSE-Code-11-Branch/storage/libstorage/src/EtcFstab.h branches/SuSE-Code-11-Branch/storage/libstorage/src/Loop.cc branches/SuSE-Code-11-Branch/storage/libstorage/src/Md.cc branches/SuSE-Code-11-Branch/storage/libstorage/src/Md.h branches/SuSE-Code-11-Branch/storage/libstorage/src/Storage.cc branches/SuSE-Code-11-Branch/storage/libstorage/src/Storage.h branches/SuSE-Code-11-Branch/storage/libstorage/src/StorageInterface.h branches/SuSE-Code-11-Branch/storage/libstorage/src/StorageTmpl.h branches/SuSE-Code-11-Branch/storage/libstorage/src/Volume.cc branches/SuSE-Code-11-Branch/storage/libstorage/src/Volume.h branches/SuSE-Code-11-Branch/storage/libstorage/testsuite/fstab1.cc branches/SuSE-Code-11-Branch/storage/libstorage/testsuite/single.out/fstab1.out branches/SuSE-Code-11-Branch/storage/package/yast2-storage.changes branches/SuSE-Code-11-Branch/storage/storage/src/include/custom_part_lib.ycp branches/SuSE-Code-11-Branch/storage/storage/src/include/ep-dialogs.ycp branches/SuSE-Code-11-Branch/storage/storage/src/modules/Storage.ycp Modified: branches/SuSE-Code-11-Branch/storage/VERSION URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/V…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/VERSION (original) +++ branches/SuSE-Code-11-Branch/storage/VERSION Thu Apr 29 15:40:41 2010 @@ -1 +1 @@ -2.17.76 +2.17.77 Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/Container.cc URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/Container.cc (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/Container.cc Thu Apr 29 15:40:41 2010 @@ -120,9 +120,11 @@ ret = doCreate( vol ); else if( vol->needExtend() ) ret = doResize( vol ); + if (vol->needCrsetup(false)) + ret = vol->doCrsetup(); break; case FORMAT: - if( vol->needCrsetup() ) + if (vol->needCrsetup(true)) ret = vol->doCrsetup(); if( ret==0 && vol->getFormat() ) ret = vol->doFormat(); @@ -131,7 +133,11 @@ break; case MOUNT: if( vol->needRemount() ) + { + if (vol->needCrsetup(true)) + vol->doCrsetup(); ret = vol->doMount(); + } if( ret==0 && vol->needFstabUpdate() ) { ret = vol->doFstabUpdate(); Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/DmCo.cc URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/DmCo.cc (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/DmCo.cc Thu Apr 29 15:40:41 2010 @@ -91,7 +91,7 @@ keysize = extractNthWord( 1, line ); } - if( cipher == "aes-cbc-essiv:sha256" ) + if( cipher == "aes-cbc-essiv:sha256" || cipher == "aes-cbc-plain") ret = ENC_LUKS; else if( cipher == "twofish-cbc-plain" ) ret = ENC_TWOFISH; Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/EtcFstab.cc URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/EtcFstab.cc (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/EtcFstab.cc Thu Apr 29 15:40:41 2010 @@ -3,7 +3,6 @@ Textdomain "storage" */ - #include <fstream> #include <algorithm> @@ -74,6 +73,8 @@ if( i!=l.end() ) *i++ >> p->old.passno; p->old.calcDependent(); + if( checkNormalFile(p->old.device) ) + p->old.loop = true; p->nnew = p->old; co.push_back( *p ); delete p; @@ -478,14 +479,15 @@ { ls.push_back( e.loop_dev ); } - ls.push_back( e.dentry ); + if( e.dmcrypt && e.optUser() ) + ls.push_back( e.device ); + else + ls.push_back( e.dentry ); ls.push_back( e.mount ); - if( e.dmcrypt && e.noauto ) + if( e.dmcrypt && e.optUser() ) ls.push_back( "crypt" ); else - { ls.push_back( (e.fs!="ntfs")?e.fs:"ntfs-3g" ); - } if( e.crypto ) { ls.push_back( Volume::encTypeString(e.encr) ); @@ -528,8 +530,7 @@ string EtcFstab::createTabLine( const FstabEntry& e ) { - y2milestone( "device:%s mp:%s", e.dentry.c_str(), e.mount.c_str() ); - y2mil( "entry:" << e ); + y2mil("dentry:" << e.dentry << " mount:" << e.mount << " device:" << e.device); list<string> ls; makeStringList( e, ls ); y2mil( "list:" << ls ); @@ -740,6 +741,15 @@ i->old = i->nnew; i->op = Entry::NONE; } + else if( findCrtab( i->nnew, crypttab, lineno )) + { + string line = createTabLine( i->nnew ); + if (!i->nnew.mount.empty()) + fstab->append( line ); + if( i->old.cryptt > i->nnew.cryptt && + findCrtab( i->old, crypttab, lineno )) + crypttab.remove( lineno, 1 ); + } else ret = FSTAB_UPDATE_ENTRY_NOT_FOUND; break; @@ -873,7 +883,11 @@ return( txt ); } - +bool +FstabEntry::optUser() const + { + return find( opts.begin(), opts.end(), "user" ) != opts.end(); + } unsigned EtcFstab::fstabFields[] = { 20, 20, 10, 21, 1, 1 }; unsigned EtcFstab::cryptotabFields[] = { 11, 15, 20, 10, 10, 1 }; Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/EtcFstab.h URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/EtcFstab.h (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/EtcFstab.h Thu Apr 29 15:40:41 2010 @@ -41,6 +41,7 @@ storage::MountByType mount_by; void calcDependent(); + bool optUser() const; }; inline std::ostream& operator<< (std::ostream& s, const FstabEntry &v ) Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/Loop.cc URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/Loop.cc (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/Loop.cc Thu Apr 29 15:40:41 2010 @@ -53,7 +53,7 @@ else { numeric = false; - setEncryption( ENC_LUKS ); + initEncryption( ENC_LUKS ); if( !dm_dev.empty() ) { setDmcryptDev( dm_dev ); @@ -102,7 +102,7 @@ else { numeric = false; - setEncryption( ENC_LUKS ); + initEncryption( ENC_LUKS ); if( dmcrypt_dev.empty() ) dmcrypt_dev = getDmcryptName(); setDmcryptDev( dmcrypt_dev, false ); @@ -122,13 +122,15 @@ void Loop::init() { - reuseFile = delFile = false; + delFile = false; + reuseFile = true; } void Loop::setDmcryptDev( const string& dm_dev, bool active ) { dev = dm_dev; + y2mil( "dm_dev:" << dm_dev << " active:" << active ); nm = dm_dev.substr( dm_dev.find_last_of( '/' )+1); if( active ) { Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/Md.cc URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/Md.cc (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/Md.cc Thu Apr 29 15:40:41 2010 @@ -545,6 +545,13 @@ return( ret ); } +string Md::mdDevice( unsigned num ) + { + string dev( "/dev/md" ); + dev += decString(num); + return( dev ); + } + void Md::setPersonality( MdType val ) { md_type=val; Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/Md.h URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/Md.h (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/Md.h Thu Apr 29 15:40:41 2010 @@ -43,6 +43,8 @@ static const string& pName( storage::MdType t ) { return md_names[t]; } static bool mdStringNum( const string& name, unsigned& num ); + static string mdDevice( unsigned num ); + friend std::ostream& operator<< (std::ostream& s, const Md& m ); virtual void print( std::ostream& s ) const { s << *this; } string removeText( bool doing ) const; Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/Storage.cc URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/Storage.cc (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/Storage.cc Thu Apr 29 15:40:41 2010 @@ -1005,6 +1005,8 @@ else { ret = i->createPartition( type, start, size, device, true ); + if( ret==0 ) + checkPwdBuf( device ); } } } @@ -1019,6 +1021,8 @@ else { ret = i->createPartition( type, start, size, device, true ); + if( ret==0 ) + checkPwdBuf( device ); } } } @@ -1934,6 +1938,40 @@ } int +Storage::verifyCryptFilePassword( const string& file, const string& pwd ) + { + int ret = VOLUME_CRYPT_NOT_DETECTED; + assertInit(); + y2mil("file:" << file << " l:" << pwd.length()); +#ifdef DEBUG_LOOP_CRYPT_PASSWORD + y2mil("password:" << pwd); +#endif + + VolIterator vol; + if (readonly) + { + ret = STORAGE_CHANGE_READONLY; + } + else + { + ProcPart ppart; + LoopCo* co = new LoopCo(this, false, ppart); + if( co ) + { + Loop* loop = new Loop( *co, file, true, 0, true ); + if( loop && loop->setCryptPwd( pwd )==0 && + loop->detectEncryption()!=ENC_UNKNOWN ) + ret = 0; + if( loop ) + delete loop; + delete co; + } + } + y2mil("ret:" << ret); + return( ret ); + } + +int Storage::changeMkfsOptVolume( const string& device, const string& opts ) { int ret = 0; @@ -2265,6 +2303,8 @@ { ret = STORAGE_VOLUME_NOT_FOUND; } + if( !val ) + pwdBuf.erase(device); if( ret==0 ) { ret = checkCache(); @@ -2294,7 +2334,7 @@ } int -Storage::setCryptPassword( const string& device, const string& pwd ) +Storage::verifyCryptPassword( const string& device, const string& pwd ) { int ret = 0; assertInit(); @@ -2311,10 +2351,43 @@ else if( findVolume( device, vol ) ) { ret = vol->setCryptPwd( pwd ); + if( ret==0 && vol->detectEncryption()==ENC_UNKNOWN ) + ret = VOLUME_CRYPT_NOT_DETECTED; + vol->clearCryptPwd(); } else { - ret = STORAGE_VOLUME_NOT_FOUND; + ret = verifyCryptFilePassword( device, pwd ); + } + y2mil("ret:" << ret); + return( ret ); + } + +int +Storage::setCryptPassword( const string& device, const string& pwd ) + { + int ret = 0; + assertInit(); + y2mil("device:" << device << " l:" << pwd.length()); +#ifdef DEBUG_LOOP_CRYPT_PASSWORD + y2mil("password:" << pwd); +#endif + + VolIterator vol; + map<string,string>::iterator i = pwdBuf.find(device); + if (readonly) + { + ret = STORAGE_CHANGE_READONLY; + } + else if( findVolume( device, vol ) ) + { + ret = vol->setCryptPwd( pwd ); + if( i!=pwdBuf.end() ) + pwdBuf.erase(i); + } + else + { + mapInsertOrReplace( pwdBuf, device, pwd ); } if( ret==0 ) { @@ -2342,11 +2415,45 @@ } else { - ret = STORAGE_VOLUME_NOT_FOUND; + map<string,string>::iterator i = pwdBuf.find(device); + if( i!=pwdBuf.end() ) + pwdBuf.erase(i); + else + ret = STORAGE_VOLUME_NOT_FOUND; } - if( ret==0 ) + y2mil("ret:" << ret); + return( ret ); + } + +bool +Storage::needCryptPassword( const string& device ) + { + bool ret = true; + bool volFound = false; + assertInit(); + y2mil("device:" << device); + + VolIterator vol; + if( checkNormalFile(device) ) { - ret = checkCache(); + ConstLoopPair p = loopPair(Loop::notDeleted); + ConstLoopIterator i = p.begin(); + while( i != p.end() && i->loopFile()!=device ) + ++i; + if( i != p.end() ) + { + ret = i->needCryptPwd(); + volFound = true; + } + } + else if( findVolume( device, vol ) ) + { + ret = vol->needCryptPwd(); + volFound = true; + } + if( !volFound ) + { + ret = pwdBuf.find( device )==pwdBuf.end(); } y2mil("ret:" << ret); return( ret ); @@ -2367,11 +2474,11 @@ } else { - ret = STORAGE_VOLUME_NOT_FOUND; - } - if( ret==0 ) - { - ret = checkCache(); + map<string,string>::const_iterator i = pwdBuf.find(device); + if( i!=pwdBuf.end() ) + pwd = i->second; + else + ret = STORAGE_VOLUME_NOT_FOUND; } #ifdef DEBUG_LOOP_CRYPT_PASSWORD y2milestone( "password:%s", pwd.c_str() ); @@ -2694,6 +2801,8 @@ else if( i != lvgEnd() ) { ret = i->createLv( name, sizeM*1024, stripe, device ); + if( ret==0 ) + checkPwdBuf( device ); } else { @@ -2937,6 +3046,8 @@ list<string> d; d.insert( d.end(), devs.begin(), devs.end() ); ret = md->createMd( num, rtype, d ); + if( ret==0 ) + checkPwdBuf( Md::mdDevice(num) ); } if( !have_md ) { @@ -2981,6 +3092,8 @@ list<string> d; d.insert( d.end(), devs.begin(), devs.end() ); ret = md->createMd( num, rtype, d ); + if( ret==0 ) + checkPwdBuf( Md::mdDevice(num) ); } if( !have_md ) { @@ -5867,6 +5980,20 @@ } } +void Storage::checkPwdBuf( const string& device ) + { + if( !pwdBuf.empty() ) + { + map<string,string>::iterator i=pwdBuf.find(device); + if( i!=pwdBuf.end() ) + { + VolIterator vol; + if( findVolume( device, vol ) ) + vol->setCryptPwd( i->second ); + pwdBuf.erase(i); + } + } + } int Storage::zeroDevice(const string& device, unsigned long long sizeK, bool random, Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/Storage.h URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/Storage.h (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/Storage.h Thu Apr 29 15:40:41 2010 @@ -341,6 +341,9 @@ int addFstabOptions( const string&, const string& options ); int removeFstabOptions( const string&, const string& options ); int setCryptPassword( const string& device, const string& pwd ); + int verifyCryptPassword( const string& device, const string& pwd ); + int verifyCryptFilePassword( const string& file, const string& pwd ); + bool needCryptPassword( const string& device ); int forgetCryptPassword( const string& device ); int getCryptPassword( const string& device, string& pwd ); int setCrypt( const string& device, bool val ); @@ -1690,6 +1693,7 @@ bool also_del=false ); bool findContainer( const string& device, ContIterator& c ); + void checkPwdBuf( const string& device ); bool haveMd( MdCo*& md ); bool haveNfs( NfsCo*& co ); bool haveLoop( LoopCo*& loop ); @@ -1755,6 +1759,7 @@ string extendedError; std::map<string,CCont> backups; std::map<string,FreeInfo> freeInfo; + std::map<string,string> pwdBuf; std::list<std::pair<string,string> > infoPopupTxts; }; Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/StorageInterface.h URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/StorageInterface.h (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/StorageInterface.h Thu Apr 29 15:40:41 2010 @@ -1264,6 +1264,22 @@ virtual int getCryptPassword( const string& device, string& pwd ) = 0; /** + * Verify password of a volume + * + * @param device name of volume, e.g. /dev/hda1 + * @param pwd crypt password for this volume + * @return zero if password is ok, a negative number to indicate an error + */ + virtual int verifyCryptPassword( const string& device, const string& pwd ) = 0; + /** + * Check if crypt password is required + * + * @param device name of volume, e.g. /dev/hda1 + * @return true if password is required, false otherwise + */ + virtual bool needCryptPassword( const string& device ) = 0; + + /** * Set encryption state of a volume * * @param device name of volume, e.g. /dev/hda1 Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/StorageTmpl.h URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/StorageTmpl.h (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/StorageTmpl.h Thu Apr 29 15:40:41 2010 @@ -122,6 +122,16 @@ l.insert( i, e ); } +template<typename Map, typename Key, typename Value> +typename Map::iterator mapInsertOrReplace(Map& m, const Key& k, const Value& v) + { + typename Map::iterator pos = m.lower_bound(k); + if (pos != m.end() && !typename Map::key_compare()(k, pos->first)) + pos->second = v; + else + pos = m.insert(pos, typename Map::value_type(k, v)); + return pos; + } template<class Num> string decString(Num number) { Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/Volume.cc URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/Volume.cc (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/Volume.cc Thu Apr 29 15:40:41 2010 @@ -287,7 +287,7 @@ classic(file); file.read( buf, sizeof(buf) ); if( file.good() && strncmp( buf, "LUKS", 4 )==0 ) - setEncryption( ENC_LUKS ); + initEncryption( ENC_LUKS ); file.close(); } } @@ -985,6 +985,8 @@ int Volume::cryptUnsetup( bool force ) { int ret=0; + y2mil( "force:" << force << " active:" << dmcrypt_active << + " table:" << dmcrypt_dev ); if( dmcrypt_active || force ) { string table = dmcrypt_dev; @@ -1320,11 +1322,23 @@ is_loop = false; encryption = ENC_NONE; crypt_pwd.erase(); + orig_crypt_pwd.erase(); } else { if( !loop_active && !isTmpCryptMp(mp) && crypt_pwd.empty() ) ret = VOLUME_CRYPT_NO_PWD; + if( !isTmpCryptMp(mp) ) + { + if( !dmcrypt_active && crypt_pwd.empty() ) + ret = VOLUME_CRYPT_NO_PWD; + if( ret==0 && !dmcrypt_active && + !pwdLengthOk(typ,crypt_pwd,format) ) + { + ret = VOLUME_CRYPT_PWD_TOO_SHORT; + clearCryptPwd(); + } + } if( ret == 0 && cType()==NFSC ) ret = VOLUME_CRYPT_NFS_IMPOSSIBLE; if( ret==0 && (format||loop_active) ) @@ -1582,6 +1596,26 @@ return( cmd ); } +bool Volume::pwdLengthOk( storage::EncryptType typ, const string& val, + bool fmt ) const + { + bool ret = true; + if( fmt ) + { + ret = val.size()>=8; + } + else + { + if( typ==ENC_TWOFISH_OLD ) + ret = val.size()>=5; + else if( typ==ENC_TWOFISH || typ==ENC_TWOFISH256_OLD ) + ret = val.size()>=8; + else + ret = val.size()>=1; + } + return( ret ); + } + int Volume::setCryptPwd( const string& val ) { @@ -1590,18 +1624,12 @@ #endif int ret = 0; - if( ((encryption==ENC_UNKNOWN||encryption==ENC_TWOFISH_OLD|| - encryption==ENC_NONE) && val.size()<5) || - ((encryption==ENC_TWOFISH||encryption==ENC_TWOFISH256_OLD) && - val.size()<8) || - (encryption==ENC_LUKS && val.size()<1)) - { - if( !isTmpCryptMp(mp) ) - ret = VOLUME_CRYPT_PWD_TOO_SHORT; - } + if( !pwdLengthOk(encryption,val,format) && !isTmpCryptMp(mp) ) + ret = VOLUME_CRYPT_PWD_TOO_SHORT; else { - crypt_pwd=val; + orig_crypt_pwd = crypt_pwd; + crypt_pwd = val; if( encryption==ENC_UNKNOWN ) detectEncryption(); } @@ -1609,25 +1637,47 @@ return( ret ); } -bool Volume::needLosetup() const +bool +Volume::needCryptPwd() const { - return( (is_loop!=loop_active) && - (encryption==ENC_NONE || !crypt_pwd.empty() || - (dmcrypt()&&cont->type()==LOOP)) ); + bool ret = crypt_pwd.empty(); + if( ret && is_loop ) + ret = ret && !loop_active; + if( ret && dmcrypt() ) + ret = ret && !dmcrypt_active; + y2mil("ret:" << ret); + return( ret ); } -bool Volume::needCryptsetup() const +bool Volume::needLosetup( bool urgent ) const { - if (dmcrypt() && encryption != orig_encryption) - return true; + bool ret = (is_loop!=loop_active) && + (encryption==ENC_NONE || !crypt_pwd.empty() || + (dmcrypt() && cType() == LOOP)); + if( !urgent && loop_dev.empty() ) + ret = false; + if( is_loop && encryption!=ENC_NONE && + !crypt_pwd.empty() && crypt_pwd!=orig_crypt_pwd ) + ret = true; + return( ret ); + } - return( dmcrypt()!=dmcrypt_active && - (encryption==ENC_NONE || !crypt_pwd.empty() || isTmpCryptMp(mp))); +bool Volume::needCryptsetup() const + { + bool ret = (dmcrypt()!=dmcrypt_active) && + (encryption==ENC_NONE || encryption!=orig_encryption || + !crypt_pwd.empty() || isTmpCryptMp(mp)); + if( dmcrypt() && encryption!=ENC_NONE && + !crypt_pwd.empty() && crypt_pwd!=orig_crypt_pwd ) + ret = true; + y2mil( "vol:" << *this ); + y2mil( "ret:" << ret ); + return( ret ); } -bool Volume::needCrsetup() const +bool Volume::needCrsetup( bool urgent ) const { - return( needLosetup()||needCryptsetup() ); + return( needLosetup(urgent)||needCryptsetup() ); } bool Volume::needFstabUpdate() const @@ -1733,12 +1783,15 @@ { is_loop = cont->type()==LOOP; ret = encryption = orig_encryption = try_order[pos]; + orig_crypt_pwd = crypt_pwd; } else { is_loop = false; dmcrypt_dev.erase(); loop_dev.erase(); + crypt_pwd.erase(); + orig_crypt_pwd.erase(); ret = encryption = orig_encryption = ENC_UNKNOWN; } unlink( fname.c_str() ); @@ -1782,6 +1835,8 @@ SystemCmd c( getLosetupCmd( encryption, fname )); if( c.retcode()!=0 ) ret = VOLUME_LOSETUP_FAILED; + else + orig_crypt_pwd = crypt_pwd; if( !fname.empty() ) { unlink( fname.c_str() ); @@ -1908,6 +1963,8 @@ ret = VOLUME_CRYPTSETUP_FAILED; } } + if( ret==0 ) + orig_crypt_pwd = crypt_pwd; unlink( fname.c_str() ); rmdir( cont->getStorage()->tmpDir().c_str() ); cont->getStorage()->waitForDevice( dmcrypt_dev ); @@ -1943,7 +2000,7 @@ { int ret = 0; bool losetup_done = false; - if( needLosetup() ) + if( needLosetup(true) ) { ret = doLosetup(); losetup_done = ret==0; @@ -2264,6 +2321,11 @@ l.push_back( new commitAction( FORMAT, cont->type(), formatText(false), this, true )); } + else if ( needCrsetup(false) ) + { + 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") ) { @@ -2444,7 +2506,7 @@ changed = true; che.dentry = de; } - if( fs != detected_fs ) + if( fs != detected_fs || che.fs!=fs_names[fs] ) { changed = true; che.fs = fs_names[fs]; @@ -2764,6 +2826,9 @@ #ifdef DEBUG_LOOP_CRYPT_PASSWORD if( is_loop && encryption!=ENC_NONE && !crypt_pwd.empty() ) file << " pwd:" << crypt_pwd; + if( is_loop && encryption!=ENC_NONE && !orig_crypt_pwd.empty() && + orig_crypt_pwd!=crypt_pwd ) + file << " orig_pwd:" << orig_crypt_pwd; #endif file << endl; return( file ); @@ -2805,7 +2870,7 @@ encryption = orig_encryption = toEncType(i->second); i = m.find( "pwd" ); if( i!=m.end() ) - crypt_pwd = i->second; + orig_crypt_pwd = crypt_pwd = i->second; } namespace storage @@ -2902,6 +2967,8 @@ s << " orig_encr:" << v.enc_names[v.orig_encryption]; #ifdef DEBUG_LOOP_CRYPT_PASSWORD s << " pwd:" << v.crypt_pwd; + if( v.orig_crypt_pwd.empty() && v.crypt_pwd!=v.orig_crypt_pwd ) + s << " orig_pwd:" << v.orig_crypt_pwd; #endif } if( !v.dmcrypt_dev.empty() ) @@ -3103,6 +3170,7 @@ loop_dev = rhs.loop_dev; fstab_loop_dev = rhs.fstab_loop_dev; crypt_pwd = rhs.crypt_pwd; + orig_crypt_pwd = rhs.orig_crypt_pwd; uby = rhs.uby; alt_names = rhs.alt_names; return( *this ); Modified: branches/SuSE-Code-11-Branch/storage/libstorage/src/Volume.h URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/src/Volume.h (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/src/Volume.h Thu Apr 29 15:40:41 2010 @@ -70,19 +70,20 @@ bool dmcrypt() const { return encryption != ENC_NONE && encryption != ENC_UNKNOWN; } bool loopActive() const { return( is_loop&&loop_active ); } bool dmcryptActive() const { return( dmcrypt()&&dmcrypt_active ); } - bool needCrsetup() const; + bool needCrsetup( bool urgent=true ) const; const string& getUuid() const { return uuid; } const string& getLabel() const { return label; } int setLabel( const string& val ); int eraseLabel() { label.erase(); orig_label.erase(); return 0; } bool needLabel() const { return( label!=orig_label ); } storage::EncryptType getEncryption() const { return encryption; } - void setEncryption( storage::EncryptType val=storage::ENC_LUKS ) + void initEncryption( storage::EncryptType val=storage::ENC_LUKS ) { encryption=orig_encryption=val; } 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(); } + void clearCryptPwd() { crypt_pwd.erase(); orig_crypt_pwd.erase(); } + bool needCryptPwd() const; const string& getMount() const { return mp; } bool hasOrigMount() const { return !orig_mp.empty(); } bool needRemount() const; @@ -222,12 +223,14 @@ bool getLoopFile( string& fname ) const; void setExtError( const SystemCmd& cmd, bool serr=true ); string getDmcryptName(); - bool needLosetup() const; + bool needLosetup( bool urgent ) const; bool needCryptsetup() const; int doLosetup(); int doCryptsetup(); int loUnsetup( bool force=false ); int cryptUnsetup( bool force=false ); + bool pwdLengthOk( storage::EncryptType typ, const string& val, + bool format ) const; std::ostream& logVolume( std::ostream& file ) const; string getLosetupCmd( storage::EncryptType, const string& pwdfile ) const; @@ -270,6 +273,7 @@ string dmcrypt_dev; string fstab_loop_dev; string crypt_pwd; + string orig_crypt_pwd; string nm; std::list<string> alt_names; unsigned num; Modified: branches/SuSE-Code-11-Branch/storage/libstorage/testsuite/fstab1.cc URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/testsuite/fstab1.cc (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/testsuite/fstab1.cc Thu Apr 29 15:40:41 2010 @@ -104,10 +104,15 @@ bool val = false; + cout << s->changeFormatVolume("/dev/hda1", true, EXT3 ) << '\n'; cout << s->setCryptPassword ("/dev/hda1", "test") << '\n'; // FAILS - cout << s->setCrypt ("/dev/hda1", true) << '\n'; // FAILS + cout << s->changeFormatVolume("/dev/hda1", false, EXT3 ) << '\n'; + cout << s->setCryptPassword("/dev/hda1", "test") << '\n'; + cout << s->setCrypt("/dev/hda1", true) << '\n'; + + cout << s->changeFormatVolume("/dev/hda1", true, EXT3 ) << '\n'; cout << s->setCryptPassword ("/dev/hda1", "hello-world") << '\n'; cout << s->setCrypt ("/dev/hda1", true) << '\n'; Modified: branches/SuSE-Code-11-Branch/storage/libstorage/testsuite/single.out/fstab1.out URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/l…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/libstorage/testsuite/single.out/fstab1.out (original) +++ branches/SuSE-Code-11-Branch/storage/libstorage/testsuite/single.out/fstab1.out Thu Apr 29 15:40:41 2010 @@ -35,11 +35,16 @@ 0 user_xattr,noauto crypt1 +0 -3015 -3014 0 0 0 +0 +0 +0 +0 1 0 0 Modified: branches/SuSE-Code-11-Branch/storage/package/yast2-storage.changes URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/p…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/package/yast2-storage.changes (original) +++ branches/SuSE-Code-11-Branch/storage/package/yast2-storage.changes Thu Apr 29 15:40:41 2010 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Apr 28 11:47:19 CEST 2010 - fehr(a)suse.de + +- backport crypt related fixes to handle L3 (bnc #599998) +- 2.17.77 + +------------------------------------------------------------------- Mon Jan 18 12:47:39 CET 2010 - aschnell(a)suse.de - fixed resizing of LVM logical volumes on S390 (bnc #571159) Modified: branches/SuSE-Code-11-Branch/storage/storage/src/include/custom_part_lib.ycp URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/s…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/storage/src/include/custom_part_lib.ycp (original) +++ branches/SuSE-Code-11-Branch/storage/storage/src/include/custom_part_lib.ycp Thu Apr 29 15:40:41 2010 @@ -626,8 +626,6 @@ ret["ok"] = Storage::SetCryptPwd( dev, fs_passwd ) && (new["format"]:false || Storage::SetCrypt( dev, true, new["format"]:false )); - if( ret["ok"]:false && new["type"]:`unknown == `loop ) - Storage::UpdateClassified( new["fpath"]:"", fs_passwd ); if( popup ) UI::CloseDialog(); } Modified: branches/SuSE-Code-11-Branch/storage/storage/src/include/ep-dialogs.ycp URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/s…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/storage/src/include/ep-dialogs.ycp (original) +++ branches/SuSE-Code-11-Branch/storage/storage/src/include/ep-dialogs.ycp Thu Apr 29 15:40:41 2010 @@ -73,15 +73,13 @@ boolean AskPassword() { - if (!NeedPassword()) - return false; - - // TODO: this is ugly - string key = (data["type"]:`unknown != `loop) ? (data["device"]:"error") : (data["fpath"]:"error"); - if (Storage::HasClassified(key)) - return false; - - return true; + boolean ret = NeedPassword(); + if( ret && !do_format && size(data["mount"]:"")>0 ) + { + string key = (data["type"]:`unknown != `loop) ? (data["device"]:"error") : (data["fpath"]:"error"); + ret = Storage::NeedCryptPwd(key); + } + return ret; } @@ -490,6 +488,8 @@ UI::ChangeWidget(`id(`pw1), `Value, ""); UI::ChangeWidget(`id(`pw2), `Value, ""); + string dev = (data["type"]:`unknown != `loop) ? data["device"]:"" + : data["fpath"]:""; repeat { widget = MiniWorkflow::UserInput(); @@ -543,10 +543,7 @@ if (widget == `next) { - if (data["type"]:`unknown != `loop) - Storage::UpdateClassified(data["device"]:"", pw1); - else - Storage::UpdateClassified(data["fpath"]:"", pw1); + Storage::SetCryptPwd(dev, pw1); widget = `finish; } Modified: branches/SuSE-Code-11-Branch/storage/storage/src/modules/Storage.ycp URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/storage/s…
============================================================================== --- branches/SuSE-Code-11-Branch/storage/storage/src/modules/Storage.ycp (original) +++ branches/SuSE-Code-11-Branch/storage/storage/src/modules/Storage.ycp Thu Apr 29 15:40:41 2010 @@ -69,9 +69,6 @@ import "LibStorage::CommitInfo"; -global void UpdateClassified(string key, string pwd); - - map<string,any> conv_ctype = $[ "def_sym" : `CT_UNKNOWN, "def_int" : LibStorage::CUNKNOWN(), @@ -164,7 +161,6 @@ map DiskMapVersion = $[]; map DiskMap = $[]; -map<string, string> ClassifiedSettings = $[]; map type_order = $[ `CT_DISK : 0, `CT_MD : 1, `CT_DMRAID : 2, `CT_DMMULTIPATH : 3, `CT_LOOP : 4, `CT_DM : 5, `CT_LVM : 6, `CT_NFS : 7 ]; list<string> hw_packages = []; @@ -729,6 +725,12 @@ ``(p["device"]:""==device )); pa = part[0]:$[]; } + if( size(pa)==0 && search(device, "/dev/mapper/")==0 ) + { + part = filter( map p, tg["/dev/loop","partitions"]:[], + ``(p["device"]:""==device )); + pa = part[0]:$[]; + } if( size(pa)>0 ) ret = add( ret, pa ); }); @@ -2633,21 +2635,6 @@ else y2milestone( "ChangeVolumeProperties sint ret:%1", ret ); } - if( ret==0 && - part["enc_type"]:`none != `none && haskey( ClassifiedSettings, dev ) ) - { - changed = true; - if( size(ClassifiedSettings[dev]:"")>0 ) - { - string pwd = ClassifiedSettings[dev]:""; - ret = LibStorage::StorageInterface::setCryptPassword( sint, dev, - pwd ); - if( ret<0 ) - y2error( "ChangeVolumeProperties sint ret:%1", ret ); - else - y2milestone( "ChangeVolumeProperties sint ret:%1", ret ); - } - } if( ret==0 && part["enc_type"]:`none != curr["enc_type"]:`none ) { changed = true; @@ -2992,23 +2979,52 @@ return ret; } +global string GetCryptPwd( string device ) + { + string pwd=""; + y2milestone( "GetCryptPwd device:%1", device ); + integer ret = 0; + ret = LibStorage::StorageInterface::getCryptPassword( sint, device, pwd ); + if( ret<0 ) + y2error( "GetCryptPwd sint ret:%1", ret ); + else + y2milestone( "GetCryptPwd empty:%1", size(pwd)==0 ); + return( pwd ); + } + +global boolean SetCryptPwd( string device, string pwd ) + { + y2milestone( "SetCryptPwd device:%1", device ); + integer ret = 0; + ret = LibStorage::StorageInterface::setCryptPassword( sint, device, pwd ); + if( ret<0 ) + y2error( "SetCryptPwd sint ret:%1", ret ); + else + y2milestone( "SetCryptPwd sint ret:%1", ret ); + return( ret==0 ); + } + +global boolean NeedCryptPwd( string device ) + { + boolean ret = false; + ret = LibStorage::StorageInterface::needCryptPassword( sint, device ); + y2milestone( "NeedCryptPwd device:%1 ret:%2", device, ret ); + return( ret ); + } + global string CreateLoop( string file, boolean create, integer sizeK, string mp ) { y2milestone( "CreateLoop file:%1 create:%2 sizeK:%3 mp:%4", file, create, sizeK, mp ); string dev = ""; - integer ret = -9999; - if( haskey( ClassifiedSettings, file )) - { - string pwd = ClassifiedSettings[file]:""; - ret = LibStorage::StorageInterface::createFileLoop( sint, file, !create, - sizeK, mp, pwd, - dev ); - UpdateClassified(dev, pwd); - } + integer ret = 0; + string pwd = GetCryptPwd( file ); + ret = LibStorage::StorageInterface::createFileLoop( sint, file, !create, + sizeK, mp, pwd, dev ); if( ret<0 ) y2error( "CreateLoop sint ret:%1", ret ); + LibStorage::StorageInterface::forgetCryptPassword( sint, file ); UpdateTargetMapDisk( "/dev/loop" ); y2milestone( "CreateLoop dev:%1", dev ); return( dev ); @@ -3036,19 +3052,6 @@ } */ -global void UpdateClassified( string key, string pwd ) - { - ClassifiedSettings[key] = pwd; - //y2milestone( "ClassifiedSettings %1", ClassifiedSettings ); - } - - -global boolean HasClassified(string key) -{ - return haskey(ClassifiedSettings, key); -} - - define void HandleModulesOnBoot( map<string,map> targetMap ); global boolean UpdateLoop( string dev, string file, boolean create, @@ -3078,43 +3081,6 @@ return( ret==0 ); } -global string GetCryptPwd( string device ) - { - string pwd=""; - y2milestone( "GetCryptPwd device:%1", device ); - if( size(ClassifiedSettings[device]:"")>0 ) - pwd = ClassifiedSettings[device]:""; - else - { - integer ret = 0; - ret = LibStorage::StorageInterface::getCryptPassword( sint, device, - pwd ); - if( ret<0 ) - y2error( "GetCryptPwd sint ret:%1", ret ); - } - y2milestone( "GetCryptPwd empty:%1", size(pwd)==0 ); - return( pwd ); - } - -global boolean SetCryptPwd( string device, string pwd ) - { - y2milestone( "SetCryptPwd device:%1", device ); - integer ret = LibStorage::StorageInterface::setCryptPassword( sint, device, - pwd ); - y2milestone( "SetCryptPwd sint ret:%1", ret ); - map p = GetPartition( GetTargetMap(), device ); - if( ret==LibStorage::STORAGE_VOLUME_NOT_FOUND() || p["create"]:false ) - { - ClassifiedSettings[device] = pwd; - y2milestone( "setting classified %1 pwd size %2", device, size(pwd) ); - ret = 0; - } - else if( ret<0 ) - y2error( "SetCryptPwd sint ret:%1", ret ); - return( ret==0 ); - } - - global string DefaultDiskLabel(integer size_k) { y2milestone("DefaultDiskLabel size_k:%1", size_k ); @@ -3724,7 +3690,6 @@ integer ret = LibStorage::StorageInterface::commit( sint ); if( ret<0 ) y2error( "CommitChanges sint ret:%1", ret ); - ClassifiedSettings = $[]; return( ret ); } @@ -6552,5 +6517,20 @@ return size(LibStorage::StorageInterface::getCommitActions( sint, true )); } +global boolean CheckCryptOk( string dev, string fs_passwd ) + { + integer i = LibStorage::StorageInterface::verifyCryptPassword( sint, dev, fs_passwd ); + if( i!=0 ) + Popup::Error( sformat(_("Could not set encryption. +System error code is %1. + +The crypt password provided could be incorrect. +"), i )); + y2milestone( "CheckCryptOk dev:%1 pwlen:%2 ret:%3", + dev, size(fs_passwd), i==0 ); + return( i==0 ); + } + } + -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r61918 - /trunk/storage/storage/src/modules/Storage.ycp
by aschnell@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: aschnell Date: Thu Apr 29 15:37:08 2010 New Revision: 61918 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61918&view=rev
Log: - stricter return type Modified: trunk/storage/storage/src/modules/Storage.ycp Modified: trunk/storage/storage/src/modules/Storage.ycp URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Stor…
============================================================================== --- trunk/storage/storage/src/modules/Storage.ycp (original) +++ trunk/storage/storage/src/modules/Storage.ycp Thu Apr 29 15:37:08 2010 @@ -804,6 +804,7 @@ list<map> swaps = (list<map>) SCR::Read(.proc.swaps); if (swaps == nil) { y2error("SCR::Read(.proc.swaps) returned nil"); + y2milestone("/proc/swaps is %1", SCR::Execute(.target.bash_output, "cat /proc/swaps")); swaps = []; } swaps = filter(map e, swaps, ``(e["type"]:""=="partition")); @@ -2080,22 +2081,19 @@ symbol extended_type_key= `extended; -global map NextPartition( string disk, symbol ptype ) +global map<string, any> NextPartition( string disk, symbol ptype ) { y2milestone( "NextPartition disk:%1 ptype:%2", disk, ptype ); - map ret = $[]; integer pt = fromSymbol(conv_ptype,ptype); y2milestone( "NextPartition type:%1 pt:%2", ptype, pt ); integer num = 0; string dev = ""; - integer r = LibStorage::StorageInterface::nextFreePartition( sint, disk, - pt, num, dev ); + integer r = LibStorage::StorageInterface::nextFreePartition( sint, disk, pt, num, dev ); if( r<0 ) y2error( "NextPartition ret %1", r ); - ret["device"] = dev; - ret["nr"] = num; + map<string, any> ret = $[ "device" : dev, "nr" : num ]; y2milestone( "NextPartition sint ret:%1 map:%2", r, ret ); - return( ret ); + return ret; } @@ -3143,7 +3141,7 @@ * @param target Disk map * @return map<string,map> modified target */ -global map<string, map> AddSwapMp( map<string, map> target ) +map<string, map> AddSwapMp( map<string, map> target ) { list<string> swaps = SwappingPartitions(); y2milestone( "AddSwapMp swaps %1", swaps ); -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r61917 - in /branches/SuSE-Code-11-SP1-Branch/storage: VERSION libstorage/src/Disk.cc libstorage/src/Disk.h libstorage/src/Storage.cc libstorage/src/Storage.h package/yast2-storage.changes
by fehr@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: fehr Date: Thu Apr 29 15:12:44 2010 New Revision: 61917 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61917&view=rev
Log: - fix handling of multiple xbd devices with same basename (e.g. xvda1,xvda2) bnc #587658 - ignore changes of partition id on readonly disks Modified: branches/SuSE-Code-11-SP1-Branch/storage/VERSION branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.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/stora…
============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/VERSION (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/VERSION Thu Apr 29 15:12:44 2010 @@ -1 +1 @@ -2.17.98 +2.17.99 Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/stora…
============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc Thu Apr 29 15:12:44 2010 @@ -77,15 +77,9 @@ size_k = SizeK; head = new_head = 16; sector = new_sector = 32; - cyl = new_cyl = std::max( size_k*2 / head / sector, 1ULL ); byte_cyl = head * sector * 512; - unsigned long long sz = size_k; - Partition *p = new Partition( *this, num, sz, 0, cyl, PRIMARY ); - if( ppart.getSize( p->device(), sz ) && sz>0 ) - { - p->setSize( sz ); - } - addToList( p ); + cyl = new_cyl = 0; + addPartition( num, size_k, ppart ); } Disk::Disk( Storage * const s, const string& fname ) : @@ -1840,15 +1834,17 @@ } if( readonly() ) { - ret = DISK_CHANGE_READONLY; + y2war( "trying to chang partition id on readonly disk - ignoring" ); + i->changeIdDone(); + ret = 0; } - if( ret==0 ) + else { ret = i->changeId( id ); } y2mil("ret:" << ret); return ret; -} + } int Disk::forgetChangePartitionId( unsigned nr ) @@ -2713,6 +2709,21 @@ return( ret ); } +void Disk::addPartition( unsigned num, unsigned long long sz, + ProcPart& ppart ) + { + y2mil( "dev:" << device() << " num:" << num << " sizek" << sz ); + unsigned long cyl_inc = std::max( sz*2 / head / sector, 1ULL ); + Partition *p = new Partition( *this, num, sz, cyl, cyl_inc, PRIMARY ); + cyl += cyl_inc; + new_cyl = cyl; + if( ppart.getSize( p->device(), sz ) && sz>0 ) + { + p->setSize( sz ); + } + addToList( p ); + } + unsigned Disk::numPartitions() const { return(partPair( notDeleted ).length()); Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/stora…
============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h Thu Apr 29 15:12:44 2010 @@ -213,6 +213,8 @@ bool getPartedSectors( const Partition *p, unsigned long long& start, unsigned long long& end ); const Partition * getPartitionAfter( const Partition * p ); + void addPartition( unsigned num, unsigned long long sz, + ProcPart& ppart ); virtual void print( std::ostream& s ) const { s << *this; } virtual Container* getCopy() const { return( new Disk( *this ) ); } void getGeometry( const string& line, unsigned long& c, 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/stora…
============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc Thu Apr 29 15:12:44 2010 @@ -794,51 +794,63 @@ void -Storage::initDisk( DiskData& data, ProcPart& pp ) +Storage::initDisk( list<DiskData>& dl, ProcPart& pp ) { - y2mil( "data:" << data ); - data.dev = data.name; - string::size_type pos = data.dev.find('!'); - while( pos!=string::npos ) - { - data.dev[pos] = '/'; - pos = data.dev.find('!',pos+1); - } - y2milestone( "name sysfs:%s parted:%s", data.name.c_str(), - data.dev.c_str() ); - Disk * d = NULL; - switch( data.typ ) + y2mil( "dl: " << dl ); + for( list<DiskData>::iterator i = dl.begin(); i!=dl.end(); ++i ) { - case DiskData::DISK: - d = new Disk( this, data.dev, data.s ); - break; - case DiskData::DASD: - d = new Dasd( this, data.dev, data.s ); - break; - case DiskData::XEN: + DiskData& data( *i ); + y2mil( "data:" << data ); + data.dev = data.name; + string::size_type pos = data.dev.find('!'); + while( pos!=string::npos ) + { + data.dev[pos] = '/'; + pos = data.dev.find('!',pos+1); + } + y2milestone( "name sysfs:%s parted:%s", data.name.c_str(), + data.dev.c_str() ); + Disk * d = NULL; + switch( data.typ ) { - string::size_type p = data.dev.find_last_not_of( "0123456789" ); - int nr = -1; - data.dev.substr( p+1 ) >> nr; - data.dev.erase( p+1 ); - if( nr>=0 ) + case DiskData::DISK: + d = new Disk( this, data.dev, data.s ); + break; + case DiskData::DASD: + d = new Dasd( this, data.dev, data.s ); + break; + case DiskData::XEN: { - d = new Disk( this, data.dev, (unsigned)nr, data.s, pp ); + string::size_type p = data.dev.find_last_not_of( "0123456789" ); + int nr = -1; + data.dev.substr( p+1 ) >> nr; + data.dev.erase( p+1 ); + y2mil( "data dev:" << data.dev << " nr:" << nr ); + if( nr>=0 ) + { + list<DiskData>::iterator j = dl.begin(); + while( j!=dl.end() && j->dev!=data.dev ) + ++j; + if( j!=dl.end() && j->d ) + j->d->addPartition( (unsigned)nr, data.s, pp ); + else + d = new Disk( this, data.dev, (unsigned)nr, data.s, pp ); + } + break; } - break; } - } - if( d && - (d->getSysfsInfo(SYSFSDIR "/" + data.name)||data.typ==DiskData::XEN) && - (data.typ==DiskData::XEN||d->detect(pp))) - { - if( max_log_num>0 ) - d->logData( logdir() ); - data.d = d; - } - else if( d ) - { - delete d; + if( d && + (d->getSysfsInfo(SYSFSDIR "/" + data.name)||data.typ==DiskData::XEN) && + (data.typ==DiskData::XEN||d->detect(pp))) + { + if( max_log_num>0 ) + d->logData( logdir() ); + data.d = d; + } + else if( d ) + { + delete d; + } } } @@ -890,11 +902,7 @@ } } closedir( Dir ); - y2mil( "dl: " << dl ); - for( list<DiskData>::iterator i = dl.begin(); i!=dl.end(); ++i ) - { - initDisk(*i, parts); - } + initDisk(dl, parts); y2mil( "dl: " << dl ); for( list<DiskData>::const_iterator i = dl.begin(); i!=dl.end(); ++i ) { Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/stora…
============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h Thu Apr 29 15:12:44 2010 @@ -1854,7 +1854,7 @@ void detectDmraid( ProcPart& ppart ); void detectDmmultipath( ProcPart& ppart ); void detectDm(ProcPart& ppart, bool only_crypt); - void initDisk( DiskData& data, ProcPart& pp ); + void initDisk( list<DiskData>& dl, ProcPart& pp ); void detectFsData( const VolIterator& begin, const VolIterator& end, ProcMounts& mounts ); void detectFsDataTestMode( const string& file, 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/stora…
============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes Thu Apr 29 15:12:44 2010 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Wed Apr 28 16:48:04 CEST 2010 - fehr(a)suse.de + +- fix handling of multiple xbd devices with same basename + (e.g. xvda1,xvda2) bnc #587658 +- ignore changes of partition id on readonly disks + +------------------------------------------------------------------- Thu Apr 22 16:25:56 CEST 2010 - fehr(a)suse.de - add missing hunk to finally fix bnc #592197 -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r61916 - /tags/stable-2_19_4/ncurses/
by gs@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: gs Date: Thu Apr 29 15:00:50 2010 New Revision: 61916 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61916&view=rev
Log: Created tag stable-2_19_4 for ncurses Added: tags/stable-2_19_4/ncurses/ - copied from r61915, trunk/ncurses/ -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r61915 - in /trunk/ncurses: VERSION package/yast2-ncurses.changes
by gs@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: gs Date: Thu Apr 29 15:00:02 2010 New Revision: 61915 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61915&view=rev
Log: V 2.19.4 Modified: trunk/ncurses/VERSION trunk/ncurses/package/yast2-ncurses.changes Modified: trunk/ncurses/VERSION URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/VERSION?rev=61915&r1=619…
============================================================================== --- trunk/ncurses/VERSION (original) +++ trunk/ncurses/VERSION Thu Apr 29 15:00:02 2010 @@ -1 +1 @@ -2.19.3 +2.19.4 Modified: trunk/ncurses/package/yast2-ncurses.changes URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/package/yast2-ncurses.ch…
============================================================================== --- trunk/ncurses/package/yast2-ncurses.changes (original) +++ trunk/ncurses/package/yast2-ncurses.changes Thu Apr 29 15:00:02 2010 @@ -3,6 +3,7 @@ - NCTextPad: do not append \n after the very last line (bnc #573553) +- V 2.19.4 ------------------------------------------------------------------- Wed Apr 14 10:49:16 CEST 2010 - aschnell(a)suse.de -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r61914 - /trunk/ncurses/src/NCtoY2Event.cc
by gs@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: gs Date: Thu Apr 29 14:58:28 2010 New Revision: 61914 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61914&view=rev
Log: check widget pointer Modified: trunk/ncurses/src/NCtoY2Event.cc Modified: trunk/ncurses/src/NCtoY2Event.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCtoY2Event.cc?rev=6…
============================================================================== --- trunk/ncurses/src/NCtoY2Event.cc (original) +++ trunk/ncurses/src/NCtoY2Event.cc Thu Apr 29 14:58:28 2010 @@ -52,7 +52,7 @@ case button: - if ( widget->isValid() ) + if ( widget && widget->isValid() ) return new YWidgetEvent( dynamic_cast<YWidget *>( widget ), reason ); else return 0; @@ -70,7 +70,7 @@ return new YTimeoutEvent(); case key: - if ( widget->isValid() ) + if ( widget && widget->isValid() ) return new YKeyEvent( keySymbol, dynamic_cast<YWidget *>( widget ) ); else return 0; -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r61913 - /trunk/storage/storage/src/modules/Storage.ycp
by aschnell@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: aschnell Date: Thu Apr 29 14:09:40 2010 New Revision: 61913 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61913&view=rev
Log: - read Partition only once ffrom /etc/install.inf Modified: trunk/storage/storage/src/modules/Storage.ycp Modified: trunk/storage/storage/src/modules/Storage.ycp URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Stor…
============================================================================== --- trunk/storage/storage/src/modules/Storage.ycp (original) +++ trunk/storage/storage/src/modules/Storage.ycp Thu Apr 29 14:09:40 2010 @@ -2018,24 +2018,25 @@ { if (part_insts == nil) { + part_insts = ""; + if (Stage::initial()) { string tmp = (string) SCR::Read(.etc.install_inf.Partition); if (tmp != nil && !isempty(tmp)) { + y2milestone("IsInstallationSource .etc.install_inf.Partition:\"%1\"", tmp); + map<string, any> info = $[]; if (GetContVolInfo("/dev/" + tmp, info)) part_insts = info["vdevice"]:""; - else - y2error("unknown device %1", "/dev/" + tmp); } - - y2milestone("IsInstallationSource .etc.install_inf.Partition \"%1\" part_insts:%2", - tmp, part_insts); } + + y2milestone("IsInstallationSource part_insts:\"%1\"", part_insts); } - return !isempty(device) && device == part_insts; + return !isempty(part_insts) && device == part_insts; } -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r61912 - /tags/stable-2_19_9/product-creator/
by jsuchome@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: jsuchome Date: Thu Apr 29 13:26:10 2010 New Revision: 61912 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61912&view=rev
Log: Created tag stable-2_19_9 for product-creator Added: tags/stable-2_19_9/product-creator/ - copied from r61911, trunk/product-creator/ -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r61911 - in /trunk/product-creator: VERSION package/yast2-product-creator.changes src/kiwi_dialogs.ycp
by jsuchome@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: jsuchome Date: Thu Apr 29 13:26:01 2010 New Revision: 61911 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61911&view=rev
Log: - check availability of selected packages and report problem (bnc#599952) - 2.19.9 Modified: trunk/product-creator/VERSION trunk/product-creator/package/yast2-product-creator.changes trunk/product-creator/src/kiwi_dialogs.ycp Modified: trunk/product-creator/VERSION URL:
http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/VERSION?rev=6191…
============================================================================== --- trunk/product-creator/VERSION (original) +++ trunk/product-creator/VERSION Thu Apr 29 13:26:01 2010 @@ -1 +1 @@ -2.19.8 +2.19.9 Modified: trunk/product-creator/package/yast2-product-creator.changes URL:
http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/package/yast2-pr…
============================================================================== --- trunk/product-creator/package/yast2-product-creator.changes (original) +++ trunk/product-creator/package/yast2-product-creator.changes Thu Apr 29 13:26:01 2010 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Thu Apr 29 13:24:34 CEST 2010 - jsuchome(a)suse.cz + +- check availability of selected packages and report problem + (bnc#599952) +- 2.19.9 + +------------------------------------------------------------------- Wed Apr 28 16:55:50 CEST 2010 - jsuchome(a)suse.cz - better check for URLs of local repositories, so local repository Modified: trunk/product-creator/src/kiwi_dialogs.ycp URL:
http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/kiwi_dialogs…
============================================================================== --- trunk/product-creator/src/kiwi_dialogs.ycp (original) +++ trunk/product-creator/src/kiwi_dialogs.ycp Thu Apr 29 13:26:01 2010 @@ -40,6 +40,12 @@ string content_key = Kiwi::content_key; + map section_type_label = $[ + "image" : _("Packages for Image"), + "bootstrap" : _("Bootstrap"), + "xen" : _("Xen Specific Packages") + ]; + // read available the images under /usr/share/kiwi/image/ directory list<term> GetAvailableImages (string subdir) { @@ -1858,6 +1864,38 @@ ]; } +/** + * Check if selected packages are available (some of them may not after + * deleting some repository) + */ +define boolean CheckForAvailablePackages () { + + UI::BusyCursor (); + foreach (map pmap, KiwiConfig["packages"]:[], { + string type = pmap["type"]:""; + if (type != "delete") + { + list<string> n_a = []; + foreach (map p, pmap["package"]:[], { + if (p["name"]:"" != "" && !Package::Available (p["name"]:"")) + n_a = add (n_a, p["name"]:""); + }); + if (size (n_a) > 0) + { + string type_label = section_type_label[type]:type; + // popup headline + Popup::LongText (_("Missing packages"), + // popup text + `RichText (sformat (_("<p>These packages from section '%1' are not available with selected repositories:</p> +<p>%2.</p> +<p>Check the list of packages and package repositories.</p>"), type_label, mergestring (sort (n_a), "<br>"))), 70, 25); + } + } + }); + UI::NormalCursor (); + return true; +} + /** * Main dialog for Kiwi image configuration */ @@ -1865,6 +1903,8 @@ InitImageConfiguration (); +CheckForAvailablePackages (); + map<string, map> widget_descr = get_widget_description (); widget_descr["tab"] = CWMTab::CreateWidget($[ "tab_order" : [ -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r61910 - /tags/branch-Code-11-SP1-2_17_34/product-creator/
by jsuchome@svn.opensuse.org
29 Apr '10
29 Apr '10
Author: jsuchome Date: Thu Apr 29 13:25:16 2010 New Revision: 61910 URL:
http://svn.opensuse.org/viewcvs/yast?rev=61910&view=rev
Log: Created tag branch-Code-11-SP1-2_17_34 for product-creator Added: tags/branch-Code-11-SP1-2_17_34/product-creator/ (props changed) - copied from r61909, branches/SuSE-Code-11-SP1-Branch/product-creator/ -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
← Newer
1
2
3
4
5
6
...
40
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Results per page:
10
25
50
100
200