Mailinglist Archive: yast-commit (195 mails)

< Previous Next >
[yast-commit] r63561 - in /trunk/users: ./ package/ src/ testsuite/tests/
Author: jsuchome
Date: Fri Mar 11 11:39:53 2011
New Revision: 63561

URL: http://svn.opensuse.org/viewcvs/yast?rev=63561&view=rev
Log:
- added tests for encrypted directories
- 2.21.1


Added:
trunk/users/testsuite/tests/CryptedDirTests.err
trunk/users/testsuite/tests/CryptedDirTests.out
trunk/users/testsuite/tests/CryptedDirTests.ycp (with props)
trunk/users/testsuite/tests/DeleteUserCryptedDir.err
trunk/users/testsuite/tests/DeleteUserCryptedDir.out
trunk/users/testsuite/tests/DeleteUserCryptedDir.ycp (with props)
trunk/users/testsuite/tests/EditUserCryptedDirCreate.err
trunk/users/testsuite/tests/EditUserCryptedDirCreate.out
trunk/users/testsuite/tests/EditUserCryptedDirCreate.ycp (with props)
trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.err
trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.out
trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.ycp (with props)
trunk/users/testsuite/tests/EditUserCryptedDirRemove.err
trunk/users/testsuite/tests/EditUserCryptedDirRemove.out
trunk/users/testsuite/tests/EditUserCryptedDirRemove.ycp (with props)
Modified:
trunk/users/VERSION
trunk/users/package/yast2-users.changes
trunk/users/src/UsersRoutines.pm

Modified: trunk/users/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/VERSION?rev=63561&r1=63560&r2=63561&view=diff
==============================================================================
--- trunk/users/VERSION (original)
+++ trunk/users/VERSION Fri Mar 11 11:39:53 2011
@@ -1 +1 @@
-2.21.0
+2.21.1

Modified: trunk/users/package/yast2-users.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/package/yast2-users.changes?rev=63561&r1=63560&r2=63561&view=diff
==============================================================================
--- trunk/users/package/yast2-users.changes (original)
+++ trunk/users/package/yast2-users.changes Fri Mar 11 11:39:53 2011
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Fri Mar 11 11:39:21 CET 2011 - jsuchome@xxxxxxx
+
+- added tests for encrypted directories
+- 2.21.1
+
+-------------------------------------------------------------------
Thu Mar 10 15:58:17 CET 2011 - jsuchome@xxxxxxx

- added possibility to take old encrypted directory by new user

Modified: trunk/users/src/UsersRoutines.pm
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/src/UsersRoutines.pm?rev=63561&r1=63560&r2=63561&view=diff
==============================================================================
--- trunk/users/src/UsersRoutines.pm (original)
+++ trunk/users/src/UsersRoutines.pm Fri Mar 11 11:39:53 2011
@@ -518,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

Added: trunk/users/testsuite/tests/CryptedDirTests.err
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/CryptedDirTests.err?rev=63561&view=auto
==============================================================================
(empty)

Added: trunk/users/testsuite/tests/CryptedDirTests.out
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/CryptedDirTests.out?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/CryptedDirTests.out (added)
+++ trunk/users/testsuite/tests/CryptedDirTests.out Fri Mar 11 11:39:53 2011
@@ -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

Added: trunk/users/testsuite/tests/CryptedDirTests.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/CryptedDirTests.ycp?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/CryptedDirTests.ycp (added)
+++ trunk/users/testsuite/tests/CryptedDirTests.ycp Fri Mar 11 11:39:53 2011
@@ -0,0 +1,67 @@
+/**
+ * File : CryptedDirTests.ycp
+ * Module : Users configurator
+ * Summary : Testing functions from UsersRoutines related to crypted dirs
+ * Author : Jiri Suchomel <jsuchome@xxxxxxx>
+ *
+ * $Id$
+ */
+
+{
+ 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);
+
+}

Added: trunk/users/testsuite/tests/DeleteUserCryptedDir.err
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/DeleteUserCryptedDir.err?rev=63561&view=auto
==============================================================================
(empty)

Added: trunk/users/testsuite/tests/DeleteUserCryptedDir.out
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/DeleteUserCryptedDir.out?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/DeleteUserCryptedDir.out (added)
+++ trunk/users/testsuite/tests/DeleteUserCryptedDir.out Fri Mar 11 11:39:53
2011
@@ -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

Added: trunk/users/testsuite/tests/DeleteUserCryptedDir.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/DeleteUserCryptedDir.ycp?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/DeleteUserCryptedDir.ycp (added)
+++ trunk/users/testsuite/tests/DeleteUserCryptedDir.ycp Fri Mar 11 11:39:53
2011
@@ -0,0 +1,116 @@
+/**
+ * File:
+ * DeleteUserCryptedDir.ycp
+ *
+ * Module:
+ * Users configurator
+ *
+ * Summary:
+ * Deleting user with encrypted directory
+ *
+ * Authors:
+ * Jiri Suchomel <jsuchome@xxxxxxx>
+ *
+ */
+
+{
+ // 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);
+
+}

Added: trunk/users/testsuite/tests/EditUserCryptedDirCreate.err
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUserCryptedDirCreate.err?rev=63561&view=auto
==============================================================================
(empty)

Added: trunk/users/testsuite/tests/EditUserCryptedDirCreate.out
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUserCryptedDirCreate.out?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/EditUserCryptedDirCreate.out (added)
+++ trunk/users/testsuite/tests/EditUserCryptedDirCreate.out Fri Mar 11
11:39:53 2011
@@ -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

Added: trunk/users/testsuite/tests/EditUserCryptedDirCreate.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUserCryptedDirCreate.ycp?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/EditUserCryptedDirCreate.ycp (added)
+++ trunk/users/testsuite/tests/EditUserCryptedDirCreate.ycp Fri Mar 11
11:39:53 2011
@@ -0,0 +1,122 @@
+/**
+ * File : EditUserCryptedDir.ycp
+ * Module : Users configurator
+ * Summary : Test of Users::EditUser function
+ * Author : Jiri Suchomel <jsuchome@xxxxxxx>
+ *
+ * $Id$
+ */
+
+{
+ // 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);
+}

Added: trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.err
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.err?rev=63561&view=auto
==============================================================================
(empty)

Added: trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.out
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.out?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.out (added)
+++ trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.out Fri Mar 11
11:39:53 2011
@@ -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

Added: trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.ycp?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.ycp (added)
+++ trunk/users/testsuite/tests/EditUserCryptedDirEnlarge.ycp Fri Mar 11
11:39:53 2011
@@ -0,0 +1,121 @@
+/**
+ * File : EditUserCryptedDir.ycp
+ * Module : Users configurator
+ * Summary : Test of Users::EditUser function
+ * Author : Jiri Suchomel <jsuchome@xxxxxxx>
+ *
+ * $Id$
+ */
+
+{
+ // 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);
+
+}

Added: trunk/users/testsuite/tests/EditUserCryptedDirRemove.err
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUserCryptedDirRemove.err?rev=63561&view=auto
==============================================================================
(empty)

Added: trunk/users/testsuite/tests/EditUserCryptedDirRemove.out
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUserCryptedDirRemove.out?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/EditUserCryptedDirRemove.out (added)
+++ trunk/users/testsuite/tests/EditUserCryptedDirRemove.out Fri Mar 11
11:39:53 2011
@@ -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

Added: trunk/users/testsuite/tests/EditUserCryptedDirRemove.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUserCryptedDirRemove.ycp?rev=63561&view=auto
==============================================================================
--- trunk/users/testsuite/tests/EditUserCryptedDirRemove.ycp (added)
+++ trunk/users/testsuite/tests/EditUserCryptedDirRemove.ycp Fri Mar 11
11:39:53 2011
@@ -0,0 +1,123 @@
+/**
+ * File : EditUserCryptedDir.ycp
+ * Module : Users configurator
+ * Summary : Test of Users::EditUser function
+ * Author : Jiri Suchomel <jsuchome@xxxxxxx>
+ *
+ * $Id$
+ */
+
+{
+ // 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);
+}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages