Author: jsuchome Date: Fri Nov 16 15:30:35 2007 New Revision: 42127 URL: http://svn.opensuse.org/viewcvs/yast?rev=42127&view=rev Log: - read /etc/security/pam_mount.conf.xml with ag_anyxml (#332187) - 2.16.3 Modified: trunk/users/VERSION trunk/users/package/yast2-users.changes trunk/users/src/Users.pm trunk/users/src/UsersRoutines.pm trunk/users/src/dialogs.ycp trunk/users/testsuite/tests/EditUser.out trunk/users/testsuite/tests/EditUser.ycp trunk/users/testsuite/tests/EditUsersGroups.out trunk/users/testsuite/tests/EditUsersGroups.ycp trunk/users/yast2-users.spec.in Modified: trunk/users/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/VERSION?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/VERSION (original) +++ trunk/users/VERSION Fri Nov 16 15:30:35 2007 @@ -1 +1 @@ -2.16.2 +2.16.3 Modified: trunk/users/package/yast2-users.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/package/yast2-users.changes?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/package/yast2-users.changes (original) +++ trunk/users/package/yast2-users.changes Fri Nov 16 15:30:35 2007 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Tue Nov 13 14:24:14 CET 2007 - jsuchome@suse.cz + +- read /etc/security/pam_mount.conf.xml with ag_anyxml (#332187) +- 2.16.3 + +------------------------------------------------------------------- Thu Nov 8 11:01:39 CET 2007 - jsuchome@suse.cz - allow '\' in root's password (#337606) Modified: trunk/users/src/Users.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/Users.pm?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/src/Users.pm (original) +++ trunk/users/src/Users.pm Fri Nov 16 15:30:35 2007 @@ -917,8 +917,9 @@ unshift @types_to_look, UsersCache->GetUserType (); } foreach my $type (@types_to_look) { + next if (!$type); if (defined $users_by_uidnumber{$type}{$uid} && - ref ($users_by_uidnumber{$type}{$uid}) eq "HASH" && + (ref ($users_by_uidnumber{$type}{$uid}) eq "HASH") && %{$users_by_uidnumber{$type}{$uid}}) { my $first_username = (keys %{$users_by_uidnumber{$type}{$uid}})[0]; @@ -1758,6 +1759,7 @@ } ##------------------------------------ +# select user by uid BEGIN { $TYPEINFO{SelectUser} = [ "function", "void", "integer"]; Modified: trunk/users/src/UsersRoutines.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/UsersRoutines.pm?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/src/UsersRoutines.pm (original) +++ trunk/users/src/UsersRoutines.pm Fri Nov 16 15:30:35 2007 @@ -22,8 +22,13 @@ ##------------------- global variables # path to cryptconfig -my $cryptconfig = "/usr/sbin/cryptconfig"; +my $cryptconfig = "/usr/sbin/cryptconfig"; +# path to pam_mount configuration file +my $pam_mount_path = "/etc/security/pam_mount.conf.xml"; + +# 'volume' information from pam_mount (info about crypted homes) +my $pam_mount = undef; ##------------------------------------------------------------------------- ##----------------- helper routines --------------------------------------- @@ -305,19 +310,10 @@ my $key_file = undef; my $image_file = undef; - my $org_img = ""; - my $org_key = ""; - # find the original image and key locations - my $out = SCR->Execute (".target.bash_output", "grep '^volume $org_username ' /etc/security/pam_mount.conf | sed -e 's/- //'"); - if (($out->{"exit"} eq 0) && $out->{"stdout"}) { - my $line = $out->{"stdout"}; - chomp $line; - my @l = split (/ /, $line); - $org_img = $l[3] if defined $l[3]; - $org_key = pop @l; - } - + my $org_img = $self->CryptedImagePath ($org_username); + my $org_key = $self->CryptedKeyPath ($org_username); + # solve disabling of crypted directory if ($home_size == 0 && $org_size > 0 && FileUtils->Exists ($org_key) && FileUtils->Exists ($org_img)) @@ -465,7 +461,7 @@ } y2debug ("cmd: $cmd"); - $out = SCR->Execute (".target.bash_output", $cmd); + my $out = SCR->Execute (".target.bash_output", $cmd); if ($out->{"exit"} ne 0 && $out->{"stderr"}) { Report->Error ($out->{"stderr"}); } @@ -490,6 +486,31 @@ return sprintf ("%i", $stat->{"size"} / (1024 * 1024)); } +# Read the 'volume' data from pam_mount config file and fill in the global map +BEGIN { $TYPEINFO{ReadCryptedHomesInfo} = ["function", "boolean"];} +sub ReadCryptedHomesInfo { + + return 1 if (defined $pam_mount); + y2milestone ("pam_mount not read yet, doing it now"); + if (FileUtils->Exists ($pam_mount_path)) { + my $pam_mount_cont = SCR->Read (".anyxml", $pam_mount_path); + if (defined $pam_mount_cont && + defined $pam_mount_cont->{"pam_mount"}{"volume"}) + { + foreach my $usermap (@{$pam_mount_cont->{"pam_mount"}{"volume"}}) { + my $username = $usermap->{"user"}{"value"}; + next if !defined $username; + $pam_mount->{$username} = $usermap; + } + } + return 1 if defined $pam_mount; + } + else { + y2milestone ("file $pam_mount_path not found"); + $pam_mount = {}; + } + return 0; +} ##------------------------------------ # Return the path to user's crypted directory image; returns empty string if there is none defined @@ -500,16 +521,11 @@ my $self = shift; my $user = shift; - my $ret = ""; - - return $ret if (!FileUtils->Exists ("/etc/security/pam_mount.conf")); - my $out = SCR->Execute (".target.bash_output", "grep '^volume $user ' /etc/security/pam_mount.conf | sed -e 's/- //' | cut -f 4 -d ' '"); - if (($out->{"exit"} eq 0) && $out->{"stdout"}) { - $ret = $out->{"stdout"}; - chomp $ret; + if ($self->ReadCryptedHomesInfo ()) { + return $pam_mount->{$user}{"path"}{"value"} || ""; } - return $ret; + return ""; } ##------------------------------------ @@ -521,18 +537,11 @@ my $self = shift; my $user = shift; - my $ret = ""; - - return $ret if (!FileUtils->Exists ("/etc/security/pam_mount.conf")); - my $out = SCR->Execute (".target.bash_output", "grep '^volume $user ' /etc/security/pam_mount.conf | sed -e 's/- //'"); - if (($out->{"exit"} eq 0) && $out->{"stdout"}) { - my $line = $out->{"stdout"}; - chomp $line; - my @l = split (/ /, $line); - $ret = pop @l; + if ($self->ReadCryptedHomesInfo ()) { + return $pam_mount->{$user}{"fskeypath"}{"value"} || ""; } - return $ret; + return ""; } 1 # EOF Modified: trunk/users/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/dialogs.ycp?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/src/dialogs.ycp (original) +++ trunk/users/src/dialogs.ycp Fri Nov 16 15:30:35 2007 @@ -1547,7 +1547,8 @@ if (user_type == "ldap" && !Ldap::file_server) { UI::ChangeWidget (`id (`browse), `Enabled, false); - UI::ChangeWidget (`id (`move_home), `Enabled, false); + if (UI::WidgetExists (`id (`move_home))) + UI::ChangeWidget (`id (`move_home), `Enabled, false); } if (!FileUtils::Exists (home) && UI::WidgetExists (`id (`move_home))) { Modified: trunk/users/testsuite/tests/EditUser.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUser.out?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/testsuite/tests/EditUser.out (original) +++ trunk/users/testsuite/tests/EditUser.out Fri Nov 16 15:30:35 2007 @@ -14,7 +14,7 @@ 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"] -Execute .target.bash_output "grep '^volume hh ' /etc/security/pam_mount.conf | sed -e 's/- //' | cut -f 4 -d ' '" $[] +Read .anyxml "/etc/security/pam_mount.conf.xml" nil Return Dump ---- user 'hh': Dump $["addit_data":"", "cn":"HaHa", "create_home":true, "crypted_home_size":"0", "encrypted":true, "gidnumber":"100", "grouplist":$[], "groupname":"users", "homedirectory":"/home/hh", "loginshell":"/bin/bash", "org_uidnumber":"500", "org_user":$["addit_data":"", "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":"501", "userpassword":"heslo", "what":"edit_user"] @@ -43,7 +43,7 @@ Return nil Dump ---- user 501: Dump $["addit_data":"", "cn":"HaHa", "create_home":true, "crypted_home_size":"0", "encrypted":true, "gidnumber":"100", "grouplist":$[], "groupname":"users", "homedirectory":"/home/hh", "loginshell":"/bin/bash", "org_homedirectory":"/home/hh", "org_uid":"hh", "org_uidnumber":"501", "plugins":[], "shadowexpire":"", "shadowflag":"", "shadowinactive":"", "shadowlastchange":"13727", "shadowmax":"99999", "shadowmin":"0", "shadowwarning":"7", "type":"local", "uid":"hh", "uidnumber":"501", "userpassword":"heslo", "what":"edit_user"] -Execute .target.bash_output "grep '^volume hh ' /etc/security/pam_mount.conf | sed -e 's/- //' | cut -f 4 -d ' '" $["stdout":"hh"] +Read .anyxml "/etc/security/pam_mount.conf.xml" nil Return Dump ---- user 'hh': Dump $["addit_data":"", "cn":"HaHa", "create_home":true, "crypted_home_size":"0", "encrypted":true, "gidnumber":"100", "grouplist":$[], "groupname":"users", "homedirectory":"/new/home/hh", "loginshell":"/bin/bash", "org_homedirectory":"/home/hh", "org_uid":"hh", "org_uidnumber":"501", "org_user":$["addit_data":"", "cn":"HaHa", "create_home":true, "crypted_home_size":"0", "encrypted":true, "gidnumber":"100", "grouplist":$[], "groupname":"users", "homedirectory":"/home/hh", "loginshell":"/bin/bash", "org_homedirectory":"/home/hh", "org_uid":"hh", "org_uidnumber":"501", "plugins":[], "shadowexpire":"", "shadowflag":"", "shadowinactive":"", "shadowlastchange":"13727", "shadowmax":"99999", "shadowmin":"0", "shadowwarning":"7", "type":"local", "uid":"hh", "uidnumber":"501", "userpassword":"heslo", "what":"edit_user"], "plugins":[], "shadowexpire":"", "shadowflag":"", "shadowinactive":"", "shadowlastchange":"13727", "shadowmax":"99999", "shadowmin":"0", "shadowwarning":"7", "type":"local", "uid":"hh", "uidnumber":"501", "userpassword":"heslo", "what":"edit_user"] Modified: trunk/users/testsuite/tests/EditUser.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUser.ycp?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/testsuite/tests/EditUser.ycp (original) +++ trunk/users/testsuite/tests/EditUser.ycp Fri Nov 16 15:30:35 2007 @@ -50,6 +50,7 @@ "INCOMPLETE_TRANSLATION_TRESHOLD" : "99", ] ], + "anyxml" : nil, ]; map WRITE = $[]; map EXEC = $[ Modified: trunk/users/testsuite/tests/EditUsersGroups.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUsersGroups.out?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/testsuite/tests/EditUsersGroups.out (original) +++ trunk/users/testsuite/tests/EditUsersGroups.out Fri Nov 16 15:30:35 2007 @@ -14,7 +14,7 @@ Execute .target.bash_output "echo 'ggl' | grep '^[[:alpha:]_][[:alnum:]_.-]*[[:alnum:]_.$-]\\?$'" $["LANG":"C"] $["stdout":"ggl"] Return Return true -Execute .target.bash_output "grep '^volume hh ' /etc/security/pam_mount.conf | sed -e 's/- //' | cut -f 4 -d ' '" $["stdout":"ggl"] +Read .anyxml "/etc/security/pam_mount.conf.xml" nil Return Execute .target.bash_output "echo 'hh' | grep '^[[:alpha:]_][[:alnum:]_.-]*[[:alnum:]_.$-]\\?$'" $["LANG":"C"] $["stdout":"hh"] Return Modified: trunk/users/testsuite/tests/EditUsersGroups.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/testsuite/tests/EditUsersGroups.ycp?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/testsuite/tests/EditUsersGroups.ycp (original) +++ trunk/users/testsuite/tests/EditUsersGroups.ycp Fri Nov 16 15:30:35 2007 @@ -48,6 +48,7 @@ "INCOMPLETE_TRANSLATION_TRESHOLD" : "99", ] ], + "anyxml" : nil, ]; map WRITE = $[]; map EXEC = $[ Modified: trunk/users/yast2-users.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/yast2-users.spec.in?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- trunk/users/yast2-users.spec.in (original) +++ trunk/users/yast2-users.spec.in Fri Nov 16 15:30:35 2007 @@ -10,8 +10,8 @@ # LDAPInitWithTLSCheck Requires: yast2-ldap-client >= 2.15.8 -# NetworkDevices::ListDevicesExcept -Requires: yast2 >= 2.16.9 +# any_xml agent +Requires: yast2 >= 2.16.11 Summary: Configuration of users and groups -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org