Author: fehr
Date: Thu Dec 10 18:50:28 2009
New Revision: 60061
URL: http://svn.opensuse.org/viewcvs/yast?rev=60061&view=rev
Log:
- verify entered crypt passwords in existing crypted devices (#467987)
- get rid of ClassifiedSettings in Storage.ycp
Modified:
trunk/storage/package/yast2-storage.changes
trunk/storage/storage/src/include/custom_part_lib.ycp
trunk/storage/storage/src/include/ep-dialogs.ycp
trunk/storage/storage/src/modules/Storage.ycp
trunk/storage/storage/src/modules/StorageProposal.ycp
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=60061&r1=60060&r2=60061&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Thu Dec 10 18:50:28 2009
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Dec 10 18:48:13 CET 2009 - fehr@suse.de
+
+- verify entered crypt passwords in existing crypted devices (#467987)
+- get rid of ClassifiedSettings in Storage.ycp
+
+-------------------------------------------------------------------
Thu Dec 10 15:34:07 CET 2009 - fehr@suse.de
- make removal of loop based files work again (#480738)
Modified: trunk/storage/storage/src/include/custom_part_lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_lib.ycp?rev=60061&r1=60060&r2=60061&view=diff
==============================================================================
--- trunk/storage/storage/src/include/custom_part_lib.ycp (original)
+++ trunk/storage/storage/src/include/custom_part_lib.ycp Thu Dec 10 18:50:28 2009
@@ -581,8 +581,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: trunk/storage/storage/src/include/ep-dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-dialogs.ycp?rev=60061&r1=60060&r2=60061&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-dialogs.ycp (original)
+++ trunk/storage/storage/src/include/ep-dialogs.ycp Thu Dec 10 18:50:28 2009
@@ -90,15 +90,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 );
}
/* MiniWorkflowStepPartitionSize data:
@@ -514,6 +512,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();
@@ -522,8 +522,11 @@
{
password = (string) UI::QueryWidget(`id(`pw1), `Value);
string tmp = (string) UI::QueryWidget(`id(`pw2), `Value);
+ boolean need_verify = !data["format"]:false &&
+ size(data["mount"]:"")>0;
- if (!Storage::CheckEncryptionPasswords(password, tmp, min_pw_len, empty_pw_allowed))
+ if (!Storage::CheckEncryptionPasswords(password, tmp, min_pw_len, empty_pw_allowed) ||
+ (need_verify && !Storage::CheckCryptOk(dev, password)) )
{
UI::SetFocus(`id(`pw1) );
widget = `again;
@@ -534,10 +537,7 @@
if (widget == `next)
{
- if (data["type"]:`unknown != `loop)
- Storage::UpdateClassified(data["device"]:"", password);
- else
- Storage::UpdateClassified(data["fpath"]:"", password);
+ Storage::SetCryptPwd(dev, password);
widget = `finish;
}
Modified: trunk/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=60061&r1=60060&r2=60061&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Storage.ycp (original)
+++ trunk/storage/storage/src/modules/Storage.ycp Thu Dec 10 18:50:28 2009
@@ -80,9 +80,6 @@
// end of resizing functions
-global void UpdateClassified(string key, string pwd);
-
-
map conv_ctype =
$[ "def_sym" : `CT_UNKNOWN,
"def_int" : LibStorage::CUNKNOWN(),
@@ -175,7 +172,6 @@
map DiskMapVersion = $[];
map DiskMap = $[];
-map 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 = [];
@@ -2315,21 +2311,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;
@@ -2674,42 +2655,61 @@
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 );
}
-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 targetMap );
global boolean UpdateLoop( string dev, string file, boolean create,
@@ -2739,42 +2739,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)
{
@@ -3404,7 +3368,6 @@
integer ret = LibStorage::StorageInterface::commit( sint );
if( ret<0 )
y2error( "CommitChanges sint ret:%1", ret );
- ClassifiedSettings = $[];
return( ret );
}
@@ -5353,4 +5316,18 @@
return 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 );
+ }
+
}
Modified: trunk/storage/storage/src/modules/StorageProposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/StorageProposal.ycp?rev=60061&r1=60060&r2=60061&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/StorageProposal.ycp (original)
+++ trunk/storage/storage/src/modules/StorageProposal.ycp Thu Dec 10 18:50:28 2009
@@ -191,7 +191,7 @@
{
y2debug("setting encryption for %1", part_device);
partition["enc_type"] = `luks;
- Storage::UpdateClassified(part_device, proposal_password);
+ Storage::SetCryptPwd(part_device, proposal_password);
}
return partition;
});
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org