Hello community,

here is the log from the commit of package yast2-users for openSUSE:Factory
checked in at Mon Mar 14 10:48:02 CET 2011.



--------
--- yast2-users/yast2-users.changes     2011-02-17 11:10:47.000000000 +0100
+++ /mounts/work_src_done/STABLE/yast2-users/yast2-users.changes        
2011-03-11 11:40:35.000000000 +0100
@@ -1,0 +2,13 @@
+Fri Mar 11 11:39:21 CET 2011 - jsuch...@suse.cz
+
+- added tests for encrypted directories
+- 2.21.1 
+
+-------------------------------------------------------------------
+Thu Mar 10 15:58:17 CET 2011 - jsuch...@suse.cz
+
+- added possibility to take old encrypted directory by new user
+  (bnc#425745)
+- 2.21.0 
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


Old:
----
  yast2-users-2.20.2.tar.bz2

New:
----
  yast2-users-2.21.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-users.spec ++++++
--- /var/tmp/diff_new_pack.lyFjTr/_old  2011-03-14 10:44:08.000000000 +0100
+++ /var/tmp/diff_new_pack.lyFjTr/_new  2011-03-14 10:44:08.000000000 +0100
@@ -19,11 +19,11 @@
 
 
 Name:           yast2-users
-Version:        2.20.2
+Version:        2.21.1
 Release:        1
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-Source0:        yast2-users-2.20.2.tar.bz2
+Source0:        yast2-users-2.21.1.tar.bz2
 
 Prefix:         /usr
 
@@ -50,7 +50,7 @@
 This package provides GUI for maintenance of linux users and groups.
 
 %prep
-%setup -n yast2-users-2.20.2
+%setup -n yast2-users-2.21.1
 
 %build
 %{prefix}/bin/y2tool y2autoconf

++++++ yast2-users-2.20.2.tar.bz2 -> yast2-users-2.21.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-2.20.2/VERSION 
new/yast2-users-2.21.1/VERSION
--- old/yast2-users-2.20.2/VERSION      2011-02-17 11:00:16.000000000 +0100
+++ new/yast2-users-2.21.1/VERSION      2011-03-11 11:39:36.000000000 +0100
@@ -1 +1 @@
-2.20.2
+2.21.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-2.20.2/src/Users.pm 
new/yast2-users-2.21.1/src/Users.pm
--- old/yast2-users-2.20.2/src/Users.pm 2010-12-03 12:42:55.000000000 +0100
+++ new/yast2-users-2.21.1/src/Users.pm 2011-03-11 10:56:26.000000000 +0100
@@ -4,7 +4,7 @@
 # Package:             Configuration of users and groups
 # Summary:             I/O routines + main data structures
 #
-# $Id: Users.pm 62935 2010-12-03 11:42:55Z jsuchome $
+# $Id: Users.pm 63559 2011-03-10 15:00:13Z jsuchome $
 #
 
 package Users;
@@ -3445,7 +3445,8 @@
 
     return 0 if ($home_size == 0 && $org_size == 0); # nothing to do
     return 0 if (!defined $pw && !defined $new_pw); # no change without 
password provided :-(
-    return 0 if ($home eq $org_home && $username eq $org_username && 
$home_size == $org_size && $pw eq $new_pw);
+    return 0 if ($home eq $org_home && $username eq $org_username && 
$home_size == $org_size &&
+               (($pw || "") eq ($new_pw || "")));
     return 1;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-2.20.2/src/UsersRoutines.pm 
new/yast2-users-2.21.1/src/UsersRoutines.pm
--- old/yast2-users-2.20.2/src/UsersRoutines.pm 2009-02-27 12:24:37.000000000 
+0100
+++ new/yast2-users-2.21.1/src/UsersRoutines.pm 2011-03-11 11:03:35.000000000 
+0100
@@ -16,6 +16,7 @@
 ##------------------------------------
 ##------------------- global imports
 
+YaST::YCP::Import ("FileUtils");
 YaST::YCP::Import ("Pam");
 YaST::YCP::Import ("Report");
 YaST::YCP::Import ("SCR");
@@ -32,6 +33,12 @@
 # 'volume' information from pam_mount (info about crypted homes)
 my $pam_mount          = undef;
 
+# owners of img files
+my $img2user           = undef;
+
+# owners of key files
+my $key2user           = undef;
+
 # could we use pam_mount? currntly not if fingerprint dev is in use 
(bnc#390810)
 my $crypted_homes_enabled      = undef;
 
@@ -335,7 +342,7 @@
     {
        SCR->Write (".target.string", $pw_path, $pw);
        my $command = "$cryptconfig open --key-file=$org_key $org_img < 
$pw_path";
-       y2debug ("cmd: $command");
+       y2milestone ("cmd: $command");
        my $out = SCR->Execute (".target.bash_output", $command);
        SCR->Execute (".target.remove", $pw_path);
        if ($out->{"exit"} ne 0) {
@@ -354,7 +361,7 @@
        SCR->Execute (".target.bash", "/bin/rm -rf $mnt_dir") if 
(FileUtils->Exists ($mnt_dir));
        SCR->Execute (".target.mkdir", $mnt_dir);
        $command = "mount -o loop $image_path $mnt_dir";
-       y2debug ("cmd: $command");
+       y2milestone ("cmd: $command");
        $out = SCR->Execute (".target.bash_output", $command);
        if ($out->{"exit"} ne 0 && $out->{"stderr"}) {
            y2error ("error calling $command: ", $out->{"stderr"}); 
@@ -363,21 +370,21 @@
        }
        # copy the directory content to tmp home
        $command = "/bin/cp -ar $mnt_dir $tmpdir/$username";
-       y2debug ("cmd: $command");
+       y2milestone ("cmd: $command");
        $out    = SCR->Execute (".target.bash_output", $command);
        if ($out->{"exit"} ne 0 && $out->{"stderr"}) {
            y2error ("error calling $command: ", $out->{"stderr"});
            return 0;
        }
        $command = "umount $mnt_dir";
-       y2debug ("cmd: $command");
+       y2milestone ("cmd: $command");
        $out = SCR->Execute (".target.bash_output", $command);
        if ($out->{"exit"} ne 0 && $out->{"stderr"}) {
            y2error ("error calling $command: ", $out->{"stderr"}); 
            return 0;
        }
        $command = "$cryptconfig pm-disable $username";
-       y2debug ("cmd: $command");
+       y2milestone ("cmd: $command");
        $out    = SCR->Execute (".target.bash_output", $command);
        if ($out->{"exit"} ne 0 && $out->{"stderr"}) {
            y2error ("error calling $command: ", $out->{"stderr"});
@@ -385,7 +392,7 @@
            return 0;
        }
        $command = "$cryptconfig close $org_img";
-       y2debug ("cmd: $command");
+       y2milestone ("cmd: $command");
        $out    = SCR->Execute (".target.bash_output", $command);
        if ($out->{"exit"} ne 0 && $out->{"stderr"}) {
            y2error ("error calling $command: ", $out->{"stderr"});
@@ -402,7 +409,6 @@
        SCR->Execute (".target.bash", "/bin/rm -rf $org_key");
        return 1;
     }
-
     # check user renaming or directory move
     if ($home ne $org_home || $org_username ne $username) {
        if (FileUtils->Exists ($org_img)) {
@@ -428,22 +434,27 @@
            }
        }
     }
-    SCR->Write (".target.string", $pw_path, $pw);
+    if (defined $user->{"take_existing_image"}) {
+       $image_file     = "$home.img" if FileUtils->Exists ("$home.img");
+       $key_file       = "$home.key" if FileUtils->Exists ("$home.key");
+       y2milestone ("going to yake image $image_file by user $username");
+    }
 
     if (defined $key_file || defined $image_file) {
        $cmd = "$cryptconfig pm-enable --replace ";
        $cmd = $cmd."--key-file=$key_file " if defined $key_file;
        $cmd = $cmd."--image-file=$image_file " if defined $image_file;
        $cmd = $cmd."$username";
-       y2debug ("cmd: $cmd");
+       y2milestone ("cmd: $cmd");
        my $out = SCR->Execute (".target.bash_output", $cmd);
        if ($out->{"exit"} ne 0 && $out->{"stderr"}) {
            Report->Error ($out->{"stderr"});
-           SCR->Execute (".target.remove", $pw_path);
            return 0; 
        }
     }
 
+    SCR->Write (".target.string", $pw_path, $pw);
+
     # now check if existing image doesn't need resizing
     $key_file  = $org_key if (!defined $key_file && FileUtils->Exists 
($org_key));
     $image_file        = $org_img if (!defined $image_file && 
FileUtils->Exists ($org_img));
@@ -452,7 +463,7 @@
     if ($modified eq "edited" && defined $key_file && defined $new_pw && 
$new_pw ne $pw) {
        SCR->Write (".target.string", $pw_path, "$pw\n$new_pw");
        my $command = "$cryptconfig passwd --no-verify $key_file < $pw_path";
-       y2debug ("cmd: $command");
+       y2milestone ("cmd: $command");
        my $out = SCR->Execute (".target.bash_output", $command);
        if ($out->{"exit"} ne 0) {
            y2error ("error calling $command");
@@ -478,12 +489,12 @@
     }
     # ok, only password change was needed
     else {
-       y2debug ("nothing to do");
+       y2milestone ("nothing to do");
        SCR->Execute (".target.remove", $pw_path);
        return 1;
     }
 
-    y2debug ("cmd: $cmd");
+    y2milestone ("cmd: $cmd");
     my $out = SCR->Execute (".target.bash_output", $cmd);
     if ($out->{"exit"} ne 0 && $out->{"stderr"}) {
        Report->Error ($out->{"stderr"});
@@ -507,8 +518,11 @@
 
     my $stat   = SCR->Read (".target.stat", $file);
 
-    return "0" if not defined $stat->{"size"};
-    return sprintf ("%i", $stat->{"size"} / (1024 * 1024));
+    my $size   = $stat->{"size"};
+    return "0" if not $size;
+
+    my $mb     = 1024 * 1024;
+    return ($size < $mb) ? "1" : sprintf ("%i", $size / $mb);
 }
 
 # Read the 'volume' data from pam_mount config file and fill in the global map
@@ -528,6 +542,10 @@
                    my $username        = $usermap->{"user"};
                    next if !defined $username;
                    $pam_mount->{$username}     = $usermap;
+                   my $img     = $usermap->{"path"} || "";
+                   $img2user->{$img}   = $username if $img;
+                   my $key     = $usermap->{"fskeypath"} || "";
+                   $key2user->{$key}   = $username if $key;
                }
            }
        }
@@ -541,6 +559,38 @@
 }
 
 ##------------------------------------
+# Return the owner of given crypted directory image
+# @param image name
+# @return string
+BEGIN { $TYPEINFO{CryptedImageOwner} = ["function", "string", "string"];}
+sub CryptedImageOwner {
+
+    my $self    = shift;
+    my $img_file= shift;
+
+    if ($self->ReadCryptedHomesInfo ()) {
+       return $img2user->{$img_file} || "";
+    }
+    return "";
+}
+
+##------------------------------------
+# Return the owner of given crypted directory key
+# @param key name
+# @return string
+BEGIN { $TYPEINFO{CryptedKeyOwner} = ["function", "string", "string"];}
+sub CryptedKeyOwner {
+
+    my $self    = shift;
+    my $key_file= shift;
+
+    if ($self->ReadCryptedHomesInfo ()) {
+       return $key2user->{$key_file} || "";
+    }
+    return "";
+}
+
+##------------------------------------
 # Return the path to user's crypted directory image; returns empty string if 
there is none defined
 # @param user name
 # @return string
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-2.20.2/src/UsersSimple.pm 
new/yast2-users-2.21.1/src/UsersSimple.pm
--- old/yast2-users-2.20.2/src/UsersSimple.pm   2011-02-17 11:05:57.000000000 
+0100
+++ new/yast2-users-2.21.1/src/UsersSimple.pm   2011-02-17 11:10:14.000000000 
+0100
@@ -4,7 +4,7 @@
 # Package:     Configuration of users and groups
 # Summary:     module for first stage user configuration
 #
-# $Id: UsersSimple.pm 61042 2010-02-26 13:48:03Z jsuchome $
+# $Id: UsersSimple.pm 63435 2011-02-17 10:10:13Z jsuchome $
 #
 
 package UsersSimple;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-2.20.2/src/dialogs.ycp 
new/yast2-users-2.21.1/src/dialogs.ycp
--- old/yast2-users-2.20.2/src/dialogs.ycp      2010-02-26 14:59:42.000000000 
+0100
+++ new/yast2-users-2.21.1/src/dialogs.ycp      2011-03-10 16:00:14.000000000 
+0100
@@ -5,7 +5,7 @@
  * Authors:    Johannes Buchhold <jb...@suse.de>,
  *             Jiri Suchomel <jsuch...@suse.cz>
  *
- * $Id: dialogs.ycp 61042 2010-02-26 13:48:03Z jsuchome $
+ * $Id: dialogs.ycp 63559 2011-03-10 15:00:13Z jsuchome $
  */
 
 {
@@ -309,6 +309,20 @@
     }
 
     /**
+     * helper function: show a popup if existing crypted home directory file
+     * should be used by current user
+     */
+    boolean ask_take_image (string img_file, string key_file) {
+
+       // yes/no popup label, %1,%2 are file paths
+       return Popup::YesNo (sformat (_("Crypted directory image and key files
+'%1' and '%2'
+were found. Use them for current user?
+
+This means that data from this image will be used instead of current home 
directory."), img_file, key_file));
+    }
+
+    /**
      * helper function: show a popup if existing home directory should be used
      * and its ownership should be changed
      */
@@ -324,7 +338,7 @@
                `CheckBox (`id(`chown_home), _("&Change directory owner"),
                chown_default)
            ),
-           `HBox(
+           `ButtonBox(
                `PushButton (`id(`yes), `opt(`default), Label::YesButton()),
                `PushButton (`id(`no), Label::NoButton())
            ),
@@ -1736,8 +1750,26 @@
                )
            )
            {
+               string img_file = sformat ("%1.img", home);
+               string key_file = sformat ("%1.key", home);
+               // ask to take existing orphaned image by user
+               // without current directory encrypted (bnc#425745)
+               if (org_crypted_home_size == 0 &&
+                   FileUtils::Exists (img_file) && FileUtils::Exists 
(key_file) &&
+                   UsersRoutines::CryptedImageOwner (img_file) == "" &&
+                   UsersRoutines::CryptedImageOwner (key_file) == "" &&
+                   ask_take_image (img_file, key_file)
+               )
+               {
+                   user["take_existing_image"] = img_file;
+               }
+
+
                // do not ask when enabling for first time and password was 
already entered
-               if ((user["encrypted"]:false == false || 
user["text_userpassword"]:nil != nil) &&
+               // do not ask when taking existing image, pw not needed for 
that FIXME really?
+               if ((user["encrypted"]:false == false ||
+                    user["text_userpassword"]:nil != nil ||
+                    user["take_existing_image"]:"" != "") &&
                    org_crypted_home_size == 0)
                {
                    user["current_text_userpassword"]   = 
(user["text_userpassword"]:nil != nil) ?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/CryptedDirTests.out 
new/yast2-users-2.21.1/testsuite/tests/CryptedDirTests.out
--- old/yast2-users-2.20.2/testsuite/tests/CryptedDirTests.out  1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/CryptedDirTests.out  2011-03-11 
10:29:07.000000000 +0100
@@ -0,0 +1,17 @@
+Read   .target.stat "/etc/security/pam_mount.conf.xml" $["size":1]
+Read   .anyxml "/etc/security/pam_mount.conf.xml" 
$["pam_mount":[$["volume":[$["fskeypath":"/home/hh.key", "path":"/home/hh.img", 
"user":"hh"]]]]]
+Return true
+Return /home/hh.key
+Return /home/hh.img
+Return 
+Return hh
+Return hh
+Return 
+Read   .target.stat "/home/hh.img" $[]
+Return 0
+Read   .target.stat "/home/hh.img" $["size":1024]
+Return 1
+Read   .target.stat "/home/hh.img" $["size":1048576]
+Return 1
+Read   .target.stat "/home/hh.img" $["size":44040192]
+Return 42
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/CryptedDirTests.ycp 
new/yast2-users-2.21.1/testsuite/tests/CryptedDirTests.ycp
--- old/yast2-users-2.20.2/testsuite/tests/CryptedDirTests.ycp  1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/CryptedDirTests.ycp  2011-03-11 
11:39:55.000000000 +0100
@@ -0,0 +1,67 @@
+/**
+ * File                : CryptedDirTests.ycp
+ * Module      : Users configurator
+ * Summary     : Testing functions from UsersRoutines related to crypted dirs
+ * Author      : Jiri Suchomel <jsuch...@suse.cz>
+ *
+ * $Id: CryptedDirTests.ycp 63561 2011-03-11 10:39:53Z jsuchome $
+ */
+
+{
+    import "Directory";
+    import "Mode";
+    import "UsersRoutines";
+
+    map READ = $[
+       "target": $[
+           "stat"      : $[ "size" : 1 ],
+           "size"      : -1,
+           "tmpdir"    : "/tmp/YaST"
+       ],
+       "anyxml"        : $[
+           "pam_mount" : [
+               $[
+                   "volume":   [
+                       $[
+                           "user"      : "hh",
+                           "path"      : "/home/hh.img",
+                           "fskeypath" : "/home/hh.key"
+                       ]
+                   ]
+               ]
+           ]
+       ]
+    ];
+    map WRITE = $[];
+    map EXEC = $[];
+
+    import "Testsuite";
+
+    Mode::SetTest ("test");
+
+    Testsuite::Test (``(UsersRoutines::ReadCryptedHomesInfo ()), [ READ, 
WRITE, EXEC], 0);
+
+    Testsuite::Test (``(UsersRoutines::CryptedKeyPath ("hh")), [], 0);
+    Testsuite::Test (``(UsersRoutines::CryptedImagePath ("hh")), [], 0);
+    // no such user -> empty string
+    Testsuite::Test (``(UsersRoutines::CryptedKeyPath ("hhh")), [], 0);
+
+    Testsuite::Test (``(UsersRoutines::CryptedImageOwner ("/home/hh.img")), 
[], 0);
+    Testsuite::Test (``(UsersRoutines::CryptedKeyOwner ("/home/hh.key")), [], 
0);
+    // no such key file -> empty string
+    Testsuite::Test (``(UsersRoutines::CryptedKeyOwner ("/home/hh.img")), [], 
0);
+
+    map RSIZE  = $[
+       "target": $[
+           "stat"      : $[]
+       ],
+    ];
+    Testsuite::Test (``(UsersRoutines::FileSizeInMB ("/home/hh.img")), [ 
RSIZE, $[], $[]], 0);
+    RSIZE["target","stat","size"]      = 1024;
+    Testsuite::Test (``(UsersRoutines::FileSizeInMB ("/home/hh.img")), [ 
RSIZE, $[], $[]], 0);
+    RSIZE["target","stat","size"]      = 1024 * 1024;
+    Testsuite::Test (``(UsersRoutines::FileSizeInMB ("/home/hh.img")), [ 
RSIZE, $[], $[]], 0);
+    RSIZE["target","stat","size"]      = 1024 * 1024 * 42;
+    Testsuite::Test (``(UsersRoutines::FileSizeInMB ("/home/hh.img")), [ 
RSIZE, $[], $[]], 0);
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/DeleteUserCryptedDir.out 
new/yast2-users-2.21.1/testsuite/tests/DeleteUserCryptedDir.out
--- old/yast2-users-2.20.2/testsuite/tests/DeleteUserCryptedDir.out     
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/DeleteUserCryptedDir.out     
2011-03-11 11:25:05.000000000 +0100
@@ -0,0 +1,38 @@
+Read   .etc.default.useradd."expire" 0
+Read   .etc.default.useradd."group" 100
+Read   .etc.default.useradd."groups" "audio,video"
+Read   .etc.default.useradd."home" "/home"
+Read   .etc.default.useradd."inactive" 0
+Read   .etc.default.useradd."shell" 0
+Read   .etc.default.useradd."skel" 0
+Read   .etc.default.useradd."umask" 0
+Read   .target.string "/etc/shells" 0
+Read   .etc.nsswitch_conf.passwd 0
+Read   .etc.nsswitch_conf.passwd 0
+Write  .target.ycp "/var/lib/YaST2/users.ycp" $[] true
+Return 
+Return nil
+Dump   ---- user 'hh':
+Dump    $["addit_data":"", "cn":"HaHa", "gidNumber":"100", "grouplist":$[], 
"groupname":"users", "homeDirectory":"/home/hh", "loginShell":"/bin/bash", 
"shadowExpire":"", "shadowFlag":"", "shadowInactive":"", 
"shadowLastChange":"13727", "shadowMax":"99999", "shadowMin":"0", 
"shadowWarning":"7", "type":"local", "uid":"hh", "uidNumber":"500", 
"userPassword":"heslo"]
+Dump   ==================== running delete ======================
+Return true
+Return true
+Return nil
+Return nil
+Return nil
+Read   .anyxml "/etc/security/pam_mount.conf.xml" 
$["pam_mount":[$["volume":[$["fskeypath":"/home/hh.key", "path":"/home/hh.img", 
"user":"hh"]]]]]
+Read   .target.stat "/home/hh.key" $["isdir":true]
+Execute        .target.bash_output "/bin/rm -rf /home/hh.key" $["exit":0]
+Read   .target.stat "/home/hh.img" $["isdir":true]
+Execute        .target.bash_output "/bin/rm -rf /home/hh.img" $["exit":0]
+Execute        .target.bash_output "/usr/sbin/cryptconfig pm-disable hh" 
$["exit":0]
+Execute        .target.bash "/bin/cp /etc/passwd /etc/passwd.YaST2save" 0
+Write  .target.string "/etc/passwd" "at:x:25:25:Batch jobs 
daemon:/var/spool/atjobs:/bin/bash\nbin:x:1:1:bin:/bin:/bin/bash\ndaemon:x:2:2:Daemon:/sbin:/bin/bash\nmail:x:8:12:Mailer
 
daemon:/var/spool/clientmqueue:/bin/false\nnobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash\nroot:x:0:0:root:/root:/bin/bash\nuucp:x:10:14:Unix-to-Unix
 CoPy system:/etc/uucp:/bin/bash\nii:x:555:100:Test 
user:/home/ii:/bin/bash\n+::::::\n" true
+Execute        .target.bash_output "diff -U 1 /etc/passwd.YaST2save 
/etc/passwd" $["exit":0]
+Execute        .target.bash "/bin/cp /etc/shadow /etc/shadow.YaST2save" 0
+Write  .target.string "/etc/shadow" 
"at:!:13636:0:99999:7:::\nbin:*:13636::::::\ndaemon:*:13636::::::\nmail:*:13636::::::\nnobody:*:13636::::::\nroot:password:13636::::::\nuucp:*:13636::::::\n+::0:0:0::::\n"
 true
+Execute        .target.bash "/usr/sbin/nscd -i passwd" 0
+Read   .target.stat "/home/hh" $["isdir":true]
+Execute        .target.bash_output "/bin/rm -rf /home/hh" $["exit":0]
+Write  .target.ycp "/var/lib/YaST2/users.ycp" $["custom_groups":["local"], 
"custom_users":["local"], "dont_warn_when_nisserver_notdes":false, 
"dont_warn_when_uppercase":false] true
+Return 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/DeleteUserCryptedDir.ycp 
new/yast2-users-2.21.1/testsuite/tests/DeleteUserCryptedDir.ycp
--- old/yast2-users-2.20.2/testsuite/tests/DeleteUserCryptedDir.ycp     
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/DeleteUserCryptedDir.ycp     
2011-03-11 11:25:34.000000000 +0100
@@ -0,0 +1,116 @@
+/**
+ * File:
+ *  DeleteUserCryptedDir.ycp
+ *
+ * Module:
+ *  Users configurator
+ *
+ * Summary:
+ *  Deleting user with encrypted directory
+ *
+ * Authors:
+ *  Jiri Suchomel <jsuch...@suse.cz>
+ *
+ */
+
+{
+    // testedfiles: Users.pm UsersPasswd.pm
+
+    import "Users";
+    import "UsersPasswd";
+    import "Mode";
+    import "Directory";
+    import "Progress";
+    import "Report";
+
+    string tmpdir      = Directory::tmpdir;
+    foreach (string file, [ "passwd", "group", "shadow" ], {
+       string cmd      = sformat ("/bin/cp ./%1 %2/", file, tmpdir);
+       SCR::Execute (.target.bash_output, cmd);
+    });
+    Users::SetBaseDirectory (tmpdir);
+    Users::ReadLocal ();
+
+    map READ = $[
+       "etc" : $[
+           "fstab": [],
+           "cryptotab": [],
+           "default": $[
+               "useradd": $[
+                   "home":     "/home",
+                   "groups":   "audio,video",
+                   "group":    100
+               ]
+           ],
+       ],
+       "product": $[
+               "features": $[
+                   "USE_DESKTOP_SCHEDULER"     : "no",
+                   "IO_SCHEDULER"              : "",
+                   "ENABLE_AUTOLOGIN"          : "false",
+                   "UI_MODE"                   : "simple",
+                   "EVMS_CONFIG"               : "no",
+                   "INCOMPLETE_TRANSLATION_TRESHOLD"   : "99",
+               ]
+       ],
+       "target": $[
+           "size":     -1,
+           "stat":     $[],
+       ],
+    ];
+
+    map WRITE = $[];
+    map EXEC = $[
+       "passwd" : $[
+           "init"      : true
+       ],
+       "target" : $[
+           "bash"      : 0,
+           "bash_output"       : $[
+               "exit"  : 0
+           ],
+       ],
+    ];
+    map RW     = $[
+       "target": $[
+           "stat"      : $["isdir":true],
+           "size"      : -1,
+           "tmpdir"    : "/tmp/YaST"
+       ],
+       "anyxml"        : $[
+           "pam_mount" : [
+               $[
+                   "volume":   [
+                       $[
+                           "user"      : "hh",
+                           "path"      : "/home/hh.img",
+                           "fskeypath" : "/home/hh.key"
+                       ]
+                   ]
+               ]
+           ]
+       ]
+    ];
+
+    import "Testsuite";
+
+    Mode::SetTest ("test");
+
+    Testsuite::Test (``(Users::Read ()), [READ, WRITE, EXEC], 0);
+
+    Testsuite::Test (``(Users::SelectUserByName ("hh")), [], 0);
+
+    Testsuite::Dump (sformat ("---- user 'hh':\n %1", Users::GetCurrentUser 
()));
+
+    Testsuite::Dump ("==================== running delete 
======================");
+
+    Testsuite::Test(``(Users::DeleteUser (true)), [READ], 0);
+    Testsuite::Test(``(Users::CommitUser ()), [READ], 0);
+
+    Testsuite::Test (``(Users::SetBaseDirectory ("/etc")), [], 0);
+    Testsuite::Test (``(UsersPasswd::SetBaseDirectory ("/etc")), [], 0);
+    Testsuite::Test (``(Directory::ResetTmpDir ()), [RW, WRITE, EXEC], 0);
+
+    Testsuite::Test (``(Users::Write ()), [RW, WRITE, EXEC], 0);
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirCreate.out 
new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirCreate.out
--- old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirCreate.out 
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirCreate.out 
2011-03-11 10:59:46.000000000 +0100
@@ -0,0 +1,34 @@
+Dump   ==========================================================
+Read   .etc.default.useradd."expire" 0
+Read   .etc.default.useradd."group" 100
+Read   .etc.default.useradd."groups" "audio,video"
+Read   .etc.default.useradd."home" "/home"
+Read   .etc.default.useradd."inactive" 0
+Read   .etc.default.useradd."shell" 0
+Read   .etc.default.useradd."skel" 0
+Read   .etc.default.useradd."umask" 0
+Read   .target.string "/etc/shells" 0
+Read   .etc.nsswitch_conf.passwd 0
+Read   .etc.nsswitch_conf.passwd 0
+Write  .target.ycp "/var/lib/YaST2/users.ycp" $[] true
+Return 
+Return nil
+Read   .anyxml "/etc/security/pam_mount.conf.xml" 
$["pam_mount":[$["volume":[$["fskeypath":"/home/hh.key", "path":"/home/hh.img", 
"user":"not-hh"]]]]]
+Return 
+Dump   ---- user 'hh':
+Dump    $["addit_data":"", "chown_home":true, "cn":"HaHa", "create_home":true, 
"crypted_home_size":"100", "current_text_userpassword":"password", 
"encrypted":true, "gidNumber":"100", "grouplist":$[], "groupname":"users", 
"homeDirectory":"/home/hh", "loginShell":"/bin/bash", 
"org_user":$["addit_data":"", "chown_home":true, "cn":"HaHa", 
"create_home":true, "crypted_home_size":"0", "encrypted":true, 
"gidNumber":"100", "grouplist":$[], "groupname":"users", 
"homeDirectory":"/home/hh", "loginShell":"/bin/bash", "shadowExpire":"", 
"shadowFlag":"", "shadowInactive":"", "shadowLastChange":"13727", 
"shadowMax":"99999", "shadowMin":"0", "shadowWarning":"7", "type":"local", 
"uid":"hh", "uidNumber":"500", "userPassword":"heslo"], "plugins":[], 
"shadowExpire":"", "shadowFlag":"", "shadowInactive":"", 
"shadowLastChange":"13727", "shadowMax":"99999", "shadowMin":"0", 
"shadowWarning":"7", "type":"local", "uid":"hh", "uidNumber":"500", 
"userPassword":"heslo", "what":"edit_user"]
+Return true
+Return nil
+Return nil
+Return nil
+Execute        .target.bash "/bin/cp /etc/passwd /etc/passwd.YaST2save" 0
+Write  .target.string "/etc/passwd" "at:x:25:25:Batch jobs 
daemon:/var/spool/atjobs:/bin/bash\nbin:x:1:1:bin:/bin:/bin/bash\ndaemon:x:2:2:Daemon:/sbin:/bin/bash\nmail:x:8:12:Mailer
 
daemon:/var/spool/clientmqueue:/bin/false\nnobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash\nroot:x:0:0:root:/root:/bin/bash\nuucp:x:10:14:Unix-to-Unix
 CoPy 
system:/etc/uucp:/bin/bash\nhh:x:500:100:HaHa:/home/hh:/bin/bash\nii:x:555:100:Test
 user:/home/ii:/bin/bash\n+::::::\n" true
+Execute        .target.bash_output "diff -U 1 /etc/passwd.YaST2save 
/etc/passwd" $["exit":0]
+Execute        .target.bash "/bin/cp /etc/shadow /etc/shadow.YaST2save" 0
+Write  .target.string "/etc/shadow" 
"at:!:13636:0:99999:7:::\nbin:*:13636::::::\ndaemon:*:13636::::::\nmail:*:13636::::::\nnobody:*:13636::::::\nroot:password:13636::::::\nuucp:*:13636::::::\nhh:heslo:13727:0:99999:7:::\n+::0:0:0::::\n"
 true
+Execute        .target.bash "/usr/sbin/nscd -i passwd" 0
+Write  .target.string "/tmp/YaST/pw" "password" true
+Execute        .target.bash_output "/usr/sbin/cryptconfig enlarge-image 
--key-file=  100 <  /tmp/YaST/pw" $["exit":0]
+Execute        .target.remove "/tmp/YaST/pw" 0
+Write  .target.ycp "/var/lib/YaST2/users.ycp" $["custom_groups":["local"], 
"custom_users":["local"], "dont_warn_when_nisserver_notdes":false, 
"dont_warn_when_uppercase":false] true
+Return 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirCreate.ycp 
new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirCreate.ycp
--- old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirCreate.ycp 
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirCreate.ycp 
2011-03-11 11:39:55.000000000 +0100
@@ -0,0 +1,122 @@
+/**
+ * File                : EditUserCryptedDir.ycp
+ * Module      : Users configurator
+ * Summary     : Test of Users::EditUser function
+ * Author      : Jiri Suchomel <jsuch...@suse.cz>
+ *
+ * $Id: EditUserCryptedDirCreate.ycp 63561 2011-03-11 10:39:53Z jsuchome $
+ */
+
+{
+    // testedfiles: Users.pm UsersPasswd.pm
+
+    import "Directory";
+    import "Mode";
+    import "Users";
+    import "UsersPasswd";
+    import "UsersRoutines";
+
+    string tmpdir      = Directory::tmpdir;
+    foreach (string file, [ "passwd", "group", "shadow" ], {
+       string cmd      = sformat ("/bin/cp ./%1 %2/", file, tmpdir);
+       SCR::Execute (.target.bash_output, cmd);
+    });
+    Users::SetBaseDirectory (tmpdir);
+    Users::ReadLocal ();
+
+    map READ = $[
+       "etc" : $[
+           "fstab": [],
+           "cryptotab": [],
+           "default": $[
+               "useradd": $[
+                   "home":     "/home",
+                   "groups":   "audio,video",
+                   "group":    100
+               ]
+           ],
+       ],
+       "target": $[
+           "stat"      : $[],
+           "size"      : -1,
+           "tmpdir"    : "/tmp/YaST"
+       ],
+       "product": $[
+               "features": $[
+                   "USE_DESKTOP_SCHEDULER"     : "no",
+                   "IO_SCHEDULER"              : "",
+                   "ENABLE_AUTOLOGIN"          : "false",
+                   "UI_MODE"                   : "simple",
+                   "EVMS_CONFIG"               : "no",
+                   "INCOMPLETE_TRANSLATION_TRESHOLD"   : "99",
+               ]
+       ],
+       "anyxml"        : $[
+           "pam_mount" : [
+               $[
+                   "volume":   [
+                       $[
+                           "user"      : "not-hh",
+                           "path"      : "/home/hh.img",
+                           "fskeypath" : "/home/hh.key"
+                       ]
+                   ]
+               ]
+           ]
+       ]
+    ];
+    map WRITE = $[];
+    map EXEC = $[
+       "passwd" : $[
+           "init"      : true
+       ],
+       "target" : $[
+           "bash"              : 0,
+           "bash_output"       : $[
+               "exit"          : 0,
+           ],
+       ],
+    ];
+    map RW     = $[
+       "target": $[
+           // this is wrong. key_file and img_file from CryptHome should _not_ 
exist, but cryptconfig binary has to
+           "stat"      : $[ "a" : "b"],
+           "size"      : -1,
+           "tmpdir"    : "/tmp/YaST"
+       ],
+    ];
+
+    import "Testsuite";
+
+    Testsuite::Dump 
("==========================================================");
+
+    Mode::SetTest ("test");
+
+    Testsuite::Test (``(Users::Read ()), [READ, WRITE, EXEC], 0);
+
+    // for home directory checks
+    READ["target","stat","isdir"]      = true;
+
+    Testsuite::Test (``(Users::SelectUserByName ("hh")), [], 0);
+
+    map<string,any> changes = $[
+       "crypted_home_size"             : 100,
+       "current_text_userpassword"     : "password" // needed for cryptconfig
+    ];
+
+
+    Testsuite::Test (``(Users::EditUser (changes)), [READ, WRITE, EXEC], 0);
+
+    Testsuite::Dump (sformat ("---- user 'hh':\n %1", Users::GetCurrentUser 
()));
+
+    Testsuite::Test (``(Users::CommitUser ()), [READ, WRITE, EXEC], 0);
+
+    Testsuite::Test (``(Users::SetBaseDirectory ("/etc")), [], 0);
+    Testsuite::Test (``(UsersPasswd::SetBaseDirectory ("/etc")), [], 0);
+
+    Testsuite::Test (``(Directory::ResetTmpDir ()), [RW, WRITE, EXEC], 0);
+
+    // this incorrectly calles 'cryptconfig enlarge-image' instead of
+    // 'cryptconfig make-ehd' because of the mess in FileUtils->Exists
+    Testsuite::Test (``(Users::Write ()), [RW, WRITE, EXEC], 0);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirEnlarge.out 
new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirEnlarge.out
--- old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirEnlarge.out        
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirEnlarge.out        
2011-03-11 10:30:14.000000000 +0100
@@ -0,0 +1,36 @@
+Dump   ==========================================================
+Read   .etc.default.useradd."expire" 0
+Read   .etc.default.useradd."group" 100
+Read   .etc.default.useradd."groups" "audio,video"
+Read   .etc.default.useradd."home" "/home"
+Read   .etc.default.useradd."inactive" 0
+Read   .etc.default.useradd."shell" 0
+Read   .etc.default.useradd."skel" 0
+Read   .etc.default.useradd."umask" 0
+Read   .target.string "/etc/shells" 0
+Read   .etc.nsswitch_conf.passwd 0
+Read   .etc.nsswitch_conf.passwd 0
+Write  .target.ycp "/var/lib/YaST2/users.ycp" $[] true
+Return 
+Return nil
+Read   .anyxml "/etc/security/pam_mount.conf.xml" 
$["pam_mount":[$["volume":[$["fskeypath":"/home/hh.key", "path":"/home/hh.img", 
"user":"hh"]]]]]
+Read   .target.stat "/home/hh.img" $["isdir":true, "size":104857600]
+Return 
+Dump   ---- user 'hh':
+Dump    $["addit_data":"", "chown_home":true, "cn":"HaHa", "create_home":true, 
"crypted_home_size":"200", "current_text_userpassword":"password", 
"encrypted":true, "gidNumber":"100", "grouplist":$[], "groupname":"users", 
"homeDirectory":"/home/hh", "loginShell":"/bin/bash", 
"org_user":$["addit_data":"", "chown_home":true, "cn":"HaHa", 
"create_home":true, "crypted_home_size":"100", "encrypted":true, 
"gidNumber":"100", "grouplist":$[], "groupname":"users", 
"homeDirectory":"/home/hh", "loginShell":"/bin/bash", "shadowExpire":"", 
"shadowFlag":"", "shadowInactive":"", "shadowLastChange":"13727", 
"shadowMax":"99999", "shadowMin":"0", "shadowWarning":"7", "type":"local", 
"uid":"hh", "uidNumber":"500", "userPassword":"heslo"], "plugins":[], 
"shadowExpire":"", "shadowFlag":"", "shadowInactive":"", 
"shadowLastChange":"13727", "shadowMax":"99999", "shadowMin":"0", 
"shadowWarning":"7", "type":"local", "uid":"hh", "uidNumber":"500", 
"userPassword":"heslo", "what":"edit_user"]
+Dump   ---- commit user:
+Return true
+Return nil
+Return nil
+Return nil
+Execute        .target.bash "/bin/cp /etc/passwd /etc/passwd.YaST2save" 0
+Write  .target.string "/etc/passwd" "at:x:25:25:Batch jobs 
daemon:/var/spool/atjobs:/bin/bash\nbin:x:1:1:bin:/bin:/bin/bash\ndaemon:x:2:2:Daemon:/sbin:/bin/bash\nmail:x:8:12:Mailer
 
daemon:/var/spool/clientmqueue:/bin/false\nnobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash\nroot:x:0:0:root:/root:/bin/bash\nuucp:x:10:14:Unix-to-Unix
 CoPy 
system:/etc/uucp:/bin/bash\nhh:x:500:100:HaHa:/home/hh:/bin/bash\nii:x:555:100:Test
 user:/home/ii:/bin/bash\n+::::::\n" true
+Execute        .target.bash_output "diff -U 1 /etc/passwd.YaST2save 
/etc/passwd" $[]
+Execute        .target.bash "/bin/cp /etc/shadow /etc/shadow.YaST2save" 0
+Write  .target.string "/etc/shadow" 
"at:!:13636:0:99999:7:::\nbin:*:13636::::::\ndaemon:*:13636::::::\nmail:*:13636::::::\nnobody:*:13636::::::\nroot:password:13636::::::\nuucp:*:13636::::::\nhh:heslo:13727:0:99999:7:::\n+::0:0:0::::\n"
 true
+Execute        .target.bash "/usr/sbin/nscd -i passwd" 0
+Write  .target.string "/tmp/YaST/pw" "password" true
+Execute        .target.bash_output "/usr/sbin/cryptconfig enlarge-image 
--key-file=/home/hh.key /home/hh.img 100 <  /tmp/YaST/pw" $[]
+Execute        .target.remove "/tmp/YaST/pw" 0
+Write  .target.ycp "/var/lib/YaST2/users.ycp" $["custom_groups":["local"], 
"custom_users":["local"], "dont_warn_when_nisserver_notdes":false, 
"dont_warn_when_uppercase":false] true
+Return 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirEnlarge.ycp 
new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirEnlarge.ycp
--- old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirEnlarge.ycp        
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirEnlarge.ycp        
2011-03-11 11:39:55.000000000 +0100
@@ -0,0 +1,121 @@
+/**
+ * File                : EditUserCryptedDir.ycp
+ * Module      : Users configurator
+ * Summary     : Test of Users::EditUser function
+ * Author      : Jiri Suchomel <jsuch...@suse.cz>
+ *
+ * $Id: EditUserCryptedDirEnlarge.ycp 63561 2011-03-11 10:39:53Z jsuchome $
+ */
+
+{
+    // testedfiles: Users.pm UsersPasswd.pm
+
+    import "Directory";
+    import "Mode";
+    import "Users";
+    import "UsersPasswd";
+    import "UsersRoutines";
+
+    string tmpdir      = Directory::tmpdir;
+    foreach (string file, [ "passwd", "group", "shadow" ], {
+       string cmd      = sformat ("/bin/cp ./%1 %2/", file, tmpdir);
+       SCR::Execute (.target.bash_output, cmd);
+    });
+    Users::SetBaseDirectory (tmpdir);
+    Users::ReadLocal ();
+
+    map READ = $[
+       "etc" : $[
+           "fstab": [],
+           "cryptotab": [],
+           "default": $[
+               "useradd": $[
+                   "home":     "/home",
+                   "groups":   "audio,video",
+                   "group":    100
+               ]
+           ],
+       ],
+       "target": $[
+           "stat"      : $[],
+           "size"      : -1,
+           "tmpdir"    : "/tmp/YaST"
+       ],
+       "product": $[
+               "features": $[
+                   "USE_DESKTOP_SCHEDULER"     : "no",
+                   "IO_SCHEDULER"              : "",
+                   "ENABLE_AUTOLOGIN"          : "false",
+                   "UI_MODE"                   : "simple",
+                   "EVMS_CONFIG"               : "no",
+                   "INCOMPLETE_TRANSLATION_TRESHOLD"   : "99",
+               ]
+       ],
+       "anyxml"        : $[
+           "pam_mount" : [
+               $[
+                   "volume":   [
+                       $[
+                           "user"      : "hh",
+                           "path"      : "/home/hh.img",
+                           "fskeypath" : "/home/hh.key"
+                       ]
+                   ]
+               ]
+           ]
+       ]
+    ];
+    map WRITE = $[];
+    map EXEC = $[
+       "passwd" : $[
+           "init"      : true
+       ],
+       "target" : $[
+           "bash"              : 0,
+           "bash_output"       : $[],
+       ],
+    ];
+    map RW     = $[
+       "target": $[
+           "stat"      : $["isdir":true],
+           "size"      : -1,
+           "tmpdir"    : "/tmp/YaST"
+       ],
+    ];
+
+    import "Testsuite";
+
+    Testsuite::Dump 
("==========================================================");
+
+    Mode::SetTest ("test");
+
+    Testsuite::Test (``(Users::Read ()), [READ, WRITE, EXEC], 0);
+
+    // for home directory checks
+    READ["target","stat","isdir"]      = true;
+
+    Testsuite::Test (``(Users::SelectUserByName ("hh")), [], 0);
+
+    map<string,any> changes = $[
+       "crypted_home_size"             : 200,
+       "current_text_userpassword"     : "password" // needed for cryptconfig
+    ];
+
+    // img.file size
+    READ["target","stat","size"]       = 100 * 1024 * 1024;
+
+
+    Testsuite::Test (``(Users::EditUser (changes)), [READ, WRITE, EXEC], 0);
+
+    Testsuite::Dump (sformat ("---- user 'hh':\n %1", Users::GetCurrentUser 
()));
+
+    Testsuite::Dump ("---- commit user:");
+    Testsuite::Test (``(Users::CommitUser ()), [READ, WRITE, EXEC], 0);
+
+    Testsuite::Test (``(Users::SetBaseDirectory ("/etc")), [], 0);
+    Testsuite::Test (``(UsersPasswd::SetBaseDirectory ("/etc")), [], 0);
+
+    Testsuite::Test (``(Directory::ResetTmpDir ()), [RW, WRITE, EXEC], 0);
+    Testsuite::Test (``(Users::Write ()), [RW, WRITE, EXEC], 0);
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirRemove.out 
new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirRemove.out
--- old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirRemove.out 
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirRemove.out 
2011-03-11 10:47:54.000000000 +0100
@@ -0,0 +1,46 @@
+Dump   ==========================================================
+Read   .etc.default.useradd."expire" 0
+Read   .etc.default.useradd."group" 100
+Read   .etc.default.useradd."groups" "audio,video"
+Read   .etc.default.useradd."home" "/home"
+Read   .etc.default.useradd."inactive" 0
+Read   .etc.default.useradd."shell" 0
+Read   .etc.default.useradd."skel" 0
+Read   .etc.default.useradd."umask" 0
+Read   .target.string "/etc/shells" 0
+Read   .etc.nsswitch_conf.passwd 0
+Read   .etc.nsswitch_conf.passwd 0
+Write  .target.ycp "/var/lib/YaST2/users.ycp" $[] true
+Return 
+Return nil
+Read   .anyxml "/etc/security/pam_mount.conf.xml" 
$["pam_mount":[$["volume":[$["fskeypath":"/home/hh.key", "path":"/home/hh.img", 
"user":"hh"]]]]]
+Read   .target.stat "/home/hh.img" $["isdir":true, "size":104857600]
+Return 
+Dump   ---- user 'hh':
+Dump    $["addit_data":"", "chown_home":true, "cn":"HaHa", "create_home":true, 
"crypted_home_size":"0", "current_text_userpassword":"password", 
"encrypted":true, "gidNumber":"100", "grouplist":$[], "groupname":"users", 
"homeDirectory":"/home/hh", "loginShell":"/bin/bash", 
"org_user":$["addit_data":"", "chown_home":true, "cn":"HaHa", 
"create_home":true, "crypted_home_size":"100", "encrypted":true, 
"gidNumber":"100", "grouplist":$[], "groupname":"users", 
"homeDirectory":"/home/hh", "loginShell":"/bin/bash", "shadowExpire":"", 
"shadowFlag":"", "shadowInactive":"", "shadowLastChange":"13727", 
"shadowMax":"99999", "shadowMin":"0", "shadowWarning":"7", "type":"local", 
"uid":"hh", "uidNumber":"500", "userPassword":"heslo"], "plugins":[], 
"shadowExpire":"", "shadowFlag":"", "shadowInactive":"", 
"shadowLastChange":"13727", "shadowMax":"99999", "shadowMin":"0", 
"shadowWarning":"7", "type":"local", "uid":"hh", "uidNumber":"500", 
"userPassword":"heslo", "what":"edit_user"]
+Return true
+Return nil
+Return nil
+Return nil
+Execute        .target.bash "/bin/cp /etc/passwd /etc/passwd.YaST2save" 0
+Write  .target.string "/etc/passwd" "at:x:25:25:Batch jobs 
daemon:/var/spool/atjobs:/bin/bash\nbin:x:1:1:bin:/bin:/bin/bash\ndaemon:x:2:2:Daemon:/sbin:/bin/bash\nmail:x:8:12:Mailer
 
daemon:/var/spool/clientmqueue:/bin/false\nnobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash\nroot:x:0:0:root:/root:/bin/bash\nuucp:x:10:14:Unix-to-Unix
 CoPy 
system:/etc/uucp:/bin/bash\nhh:x:500:100:HaHa:/home/hh:/bin/bash\nii:x:555:100:Test
 user:/home/ii:/bin/bash\n+::::::\n" true
+Execute        .target.bash_output "diff -U 1 /etc/passwd.YaST2save 
/etc/passwd" $["exit":0, "stdout":"/home/hh.img"]
+Execute        .target.bash "/bin/cp /etc/shadow /etc/shadow.YaST2save" 0
+Write  .target.string "/etc/shadow" 
"at:!:13636:0:99999:7:::\nbin:*:13636::::::\ndaemon:*:13636::::::\nmail:*:13636::::::\nnobody:*:13636::::::\nroot:password:13636::::::\nuucp:*:13636::::::\nhh:heslo:13727:0:99999:7:::\n+::0:0:0::::\n"
 true
+Execute        .target.bash "/usr/sbin/nscd -i passwd" 0
+Write  .target.string "/tmp/YaST/pw" "password" true
+Execute        .target.bash_output "/usr/sbin/cryptconfig open 
--key-file=/home/hh.key /home/hh.img < /tmp/YaST/pw" $["exit":0, 
"stdout":"/home/hh.img"]
+Execute        .target.remove "/tmp/YaST/pw" 0
+Execute        .target.bash "/bin/rm -rf /tmp/YaST/mnt" 0
+Execute        .target.mkdir "/tmp/YaST/mnt" 0
+Execute        .target.bash_output "mount -o loop /home/hh.im /tmp/YaST/mnt" 
$["exit":0, "stdout":"/home/hh.img"]
+Execute        .target.bash_output "/bin/cp -ar /tmp/YaST/mnt /tmp/YaST/hh" 
$["exit":0, "stdout":"/home/hh.img"]
+Execute        .target.bash_output "umount /tmp/YaST/mnt" $["exit":0, 
"stdout":"/home/hh.img"]
+Execute        .target.bash_output "/usr/sbin/cryptconfig pm-disable hh" 
$["exit":0, "stdout":"/home/hh.img"]
+Execute        .target.bash_output "/usr/sbin/cryptconfig close /home/hh.img" 
$["exit":0, "stdout":"/home/hh.img"]
+Execute        .target.bash "/bin/rm -rf /home/hh" 0
+Execute        .target.bash_output "/bin/mv /tmp/YaST/hh /home/hh" $["exit":0, 
"stdout":"/home/hh.img"]
+Execute        .target.bash "/bin/rm -rf /home/hh.img" 0
+Execute        .target.bash "/bin/rm -rf /home/hh.key" 0
+Write  .target.ycp "/var/lib/YaST2/users.ycp" $["custom_groups":["local"], 
"custom_users":["local"], "dont_warn_when_nisserver_notdes":false, 
"dont_warn_when_uppercase":false] true
+Return 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirRemove.ycp 
new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirRemove.ycp
--- old/yast2-users-2.20.2/testsuite/tests/EditUserCryptedDirRemove.ycp 
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-users-2.21.1/testsuite/tests/EditUserCryptedDirRemove.ycp 
2011-03-11 11:39:55.000000000 +0100
@@ -0,0 +1,123 @@
+/**
+ * File                : EditUserCryptedDir.ycp
+ * Module      : Users configurator
+ * Summary     : Test of Users::EditUser function
+ * Author      : Jiri Suchomel <jsuch...@suse.cz>
+ *
+ * $Id: EditUserCryptedDirRemove.ycp 63561 2011-03-11 10:39:53Z jsuchome $
+ */
+
+{
+    // testedfiles: Users.pm UsersPasswd.pm
+
+    import "Directory";
+    import "Mode";
+    import "Users";
+    import "UsersPasswd";
+    import "UsersRoutines";
+
+    string tmpdir      = Directory::tmpdir;
+    foreach (string file, [ "passwd", "group", "shadow" ], {
+       string cmd      = sformat ("/bin/cp ./%1 %2/", file, tmpdir);
+       SCR::Execute (.target.bash_output, cmd);
+    });
+    Users::SetBaseDirectory (tmpdir);
+    Users::ReadLocal ();
+
+    map READ = $[
+       "etc" : $[
+           "fstab": [],
+           "cryptotab": [],
+           "default": $[
+               "useradd": $[
+                   "home":     "/home",
+                   "groups":   "audio,video",
+                   "group":    100
+               ]
+           ],
+       ],
+       "target": $[
+           "stat"      : $[],
+           "size"      : -1,
+           "tmpdir"    : "/tmp/YaST"
+       ],
+       "product": $[
+               "features": $[
+                   "USE_DESKTOP_SCHEDULER"     : "no",
+                   "IO_SCHEDULER"              : "",
+                   "ENABLE_AUTOLOGIN"          : "false",
+                   "UI_MODE"                   : "simple",
+                   "EVMS_CONFIG"               : "no",
+                   "INCOMPLETE_TRANSLATION_TRESHOLD"   : "99",
+               ]
+       ],
+       "anyxml"        : $[
+           "pam_mount" : [
+               $[
+                   "volume":   [
+                       $[
+                           "user"      : "hh",
+                           "path"      : "/home/hh.img",
+                           "fskeypath" : "/home/hh.key"
+                       ]
+                   ]
+               ]
+           ]
+       ]
+    ];
+    map WRITE = $[];
+    map EXEC = $[
+       "passwd" : $[
+           "init"      : true
+       ],
+       "target" : $[
+           "bash"              : 0,
+           "bash_output"       : $[
+               "exit"          : 0,
+               // cryptconfig open prints img path
+               "stdout"        : "/home/hh.img"
+           ],
+       ],
+    ];
+    map RW     = $[
+       "target": $[
+           "stat"      : $["isdir":true],
+           "size"      : -1,
+           "tmpdir"    : "/tmp/YaST"
+       ],
+    ];
+
+    import "Testsuite";
+
+    Testsuite::Dump 
("==========================================================");
+
+    Mode::SetTest ("test");
+
+    Testsuite::Test (``(Users::Read ()), [READ, WRITE, EXEC], 0);
+
+    // for home directory checks
+    READ["target","stat","isdir"]      = true;
+
+    Testsuite::Test (``(Users::SelectUserByName ("hh")), [], 0);
+
+    map<string,any> changes = $[
+       "crypted_home_size"             : 0,
+       "current_text_userpassword"     : "password" // needed for cryptconfig
+    ];
+
+    // img.file size
+    READ["target","stat","size"]       = 100 * 1024 * 1024;
+
+
+    Testsuite::Test (``(Users::EditUser (changes)), [READ, WRITE, EXEC], 0);
+
+    Testsuite::Dump (sformat ("---- user 'hh':\n %1", Users::GetCurrentUser 
()));
+
+    Testsuite::Test (``(Users::CommitUser ()), [READ, WRITE, EXEC], 0);
+
+    Testsuite::Test (``(Users::SetBaseDirectory ("/etc")), [], 0);
+    Testsuite::Test (``(UsersPasswd::SetBaseDirectory ("/etc")), [], 0);
+
+    Testsuite::Test (``(Directory::ResetTmpDir ()), [RW, WRITE, EXEC], 0);
+    Testsuite::Test (``(Users::Write ()), [RW, WRITE, EXEC], 0);
+}


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

--
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to