[yast-commit] r62316 - in /trunk/storage: package/yast2-storage.changes storage/src/include/custom_part_dialogs.ycp storage/src/include/ep-import.ycp

Author: fehr Date: Thu Jul 29 15:54:42 2010 New Revision: 62316 URL: http://svn.opensuse.org/viewcvs/yast?rev=62316&view=rev Log: fix bug that destroys encrypted volumes when wron password is entered in read fstab dialog (#625490) Modified: trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/include/custom_part_dialogs.ycp trunk/storage/storage/src/include/ep-import.ycp Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.cha... ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Thu Jul 29 15:54:42 2010 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Jul 29 15:53:11 CEST 2010 - fehr@suse.de + +- fix bug that destroys encrypted volumes when wron password is + entered in read fstab dialog (#625490) + +------------------------------------------------------------------- Tue Jul 20 11:26:30 CEST 2010 - fehr@suse.de - add support for additional parity values for raid5, raid6, raid10 Modified: trunk/storage/storage/src/include/custom_part_dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custo... ============================================================================== --- trunk/storage/storage/src/include/custom_part_dialogs.ycp (original) +++ trunk/storage/storage/src/include/custom_part_dialogs.ycp Thu Jul 29 15:54:42 2010 @@ -41,20 +41,23 @@ symbol check_devices_used( list<map> partitions, boolean not_cr ); -define string DlgCreateCryptFs( string device, integer minpwlen, boolean format, +define string DlgPasswdCryptFs( string device, integer minpwlen, boolean format, boolean tmpcrypt ) ``{ string helptext = GetCreateCryptFsHelptext(minpwlen, format, tmpcrypt); - y2milestone( "DlgCreateCryptFs device:%1 minpwlen:%2 format:%3 tmpcrypt:%4", + y2milestone( "DlgPasswdCryptFs device:%1 minpwlen:%2 format:%3 tmpcrypt:%4", device, minpwlen, format, tmpcrypt ); // heading text string h = _("Enter your Password for the Encrypted File System."); - // label text - string label = _("Don't forget what you enter here!"); + string label = ""; + if( format ) + // label text + label = _("Don't forget what you enter here!"); if( tmpcrypt ) { - label = label + " "; + if( size(label)>0 ) + label = label + " "; label = label + _("Empty password allowed."); } Modified: trunk/storage/storage/src/include/ep-import.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-im... ============================================================================== --- trunk/storage/storage/src/include/ep-import.ycp (original) +++ trunk/storage/storage/src/include/ep-import.ycp Thu Jul 29 15:54:42 2010 @@ -357,31 +357,59 @@ boolean format_sys = true; string device = FstabAddDialog(target_map, fstabs, format_sys); + map<string, map> new_target_map = $[]; + boolean import_ok = false; if (!isempty(device)) { y2milestone("ImportMountPoints device:%1", device); list<map> fstab = (list<map>) fstabs[device]:[]; + import_ok = true; - map<string, map> new_target_map = AddFstabToTargetMap(target_map, fstab, format_sys); + new_target_map = AddFstabToTargetMap(target_map, fstab, format_sys); foreach(string d, map disk, new_target_map, { foreach(map p, disk["partitions"]:[], { + string key = (p["type"]:`unknown != `loop) ? (p["device"]:"error") : (p["fpath"]:"error"); if (!isempty(p["mount"]:"") && p["enc_type"]:`none!=`none && - !p["tmpcrypt"]:false) + !p["tmpcrypt"]:false && Storage::NeedCryptPwd(key) ) { - string pwd = DlgCreateCryptFs( p["device"]:"", 1, false, false ); - if( pwd != nil && !isempty(pwd) ) - Storage::SetCryptPwd( p["device"]:"", pwd ); + boolean ok = false; + string dev = p["device"]:""; + string pwd = ""; + do + { + ok = false; + pwd = DlgPasswdCryptFs( dev, 1, false, false ); + if( pwd != nil && !isempty(pwd) ) + { + if( Storage::CheckCryptOk( dev, pwd, true, + false ) ) + { + ok = Storage::SetCryptPwd( dev, pwd ) && + Storage::SetCrypt( dev, true, false ); + } + else + { + Popup::Error(_("Wrong Password provided.")); + } + } + else if( size(pwd)==0 ) + { + ok = true; + import_ok = false; + } + } + while( !ok ); + } }); }); - Storage::SetTargetMap(new_target_map); } + if( import_ok ) + Storage::SetTargetMap(new_target_map); else - { Storage::RestoreTargetBackup("import"); - } Storage::DisposeTargetBackup("import"); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
fehr@svn.opensuse.org