Hello community, here is the log from the commit of package yast2-users checked in at Wed Apr 4 19:46:03 CEST 2007. -------- --- yast2-users/yast2-users.changes 2007-03-29 10:48:40.000000000 +0200 +++ /mounts/work_src_done/STABLE/yast2-users/yast2-users.changes 2007-04-04 09:35:49.553262000 +0200 @@ -1,0 +2,8 @@ +Wed Apr 4 09:20:16 CEST 2007 - jsuchome@suse.cz + +- do not ask for password when user doesn't have encrypted home + directory (#259874) +- correctly find image and key files of crypted home directory (#259880) +- 2.15.20 + +------------------------------------------------------------------- Old: ---- yast2-users-2.15.19.tar.bz2 New: ---- yast2-users-2.15.20.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-users.spec ++++++ --- /var/tmp/diff_new_pack.B22153/_old 2007-04-04 19:42:49.000000000 +0200 +++ /var/tmp/diff_new_pack.B22153/_new 2007-04-04 19:42:49.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package yast2-users (Version 2.15.19) +# spec file for package yast2-users (Version 2.15.20) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,12 +11,12 @@ # norootforbuild Name: yast2-users -Version: 2.15.19 +Version: 2.15.20 Release: 1 License: GNU General Public License (GPL) Group: System/YaST BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: yast2-users-2.15.19.tar.bz2 +Source0: yast2-users-2.15.20.tar.bz2 prefix: /usr BuildRequires: cracklib-devel doxygen gcc-c++ perl-Digest-SHA1 perl-XML-Writer update-desktop-files yast2 yast2-core-devel yast2-devtools yast2-ldap-client yast2-mail-aliases yast2-perl-bindings yast2-security yast2-testsuite Requires: yast2 yast2-perl-bindings yast2-country yast2-pam yast2-security yast2-mail-aliases cracklib perl-Digest-SHA1 perl-X500-DN perl-gettext yast2-ldap-client @@ -42,7 +42,7 @@ Jiri Suchomel <jsuchome@suse.cz> %prep -%setup -n yast2-users-2.15.19 +%setup -n yast2-users-2.15.20 %build %{prefix}/bin/y2tool y2autoconf @@ -86,6 +86,11 @@ %doc %{prefix}/share/doc/packages/yast2-users %changelog +* Wed Apr 04 2007 - jsuchome@suse.cz +- do not ask for password when user doesn't have encrypted home + directory (#259874) +- correctly find image and key files of crypted home directory (#259880) +- 2.15.20 * Thu Mar 29 2007 - jsuchome@suse.cz - check if ypbind is installed before reading service status (#256407) - 2.15.19 ++++++ yast2-users-2.15.19.tar.bz2 -> yast2-users-2.15.20.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.15.19/src/dialogs.ycp new/yast2-users-2.15.20/src/dialogs.ycp --- old/yast2-users-2.15.19/src/dialogs.ycp 2007-03-26 13:07:24.000000000 +0200 +++ new/yast2-users-2.15.20/src/dialogs.ycp 2007-04-03 07:46:25.000000000 +0200 @@ -1585,22 +1585,14 @@ ( crypted_home_size != org_crypted_home_size || - org_username != username - || - org_home != home - || - // only password was changed - (crypted_home_size > 0 && user["encrypted"]:false == false) + (crypted_home_size > 0 && + (org_username != username || org_home != home || + // only password was changed + user["encrypted"]:false == false) + ) ) ) -//FIXME also when changing the password! { - if (false) - { - // popup message - Report::Error (_("To encrypt the user's home directory, you must change the password.")); - } - // do not ask when enabling for first time and password was already entered if ((user["encrypted"]:false == false || user["text_userpassword"]:nil != nil) && org_crypted_home_size == 0) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.15.19/src/UsersLDAP.pm new/yast2-users-2.15.20/src/UsersLDAP.pm --- old/yast2-users-2.15.19/src/UsersLDAP.pm 2007-03-14 14:10:28.000000000 +0100 +++ new/yast2-users-2.15.20/src/UsersLDAP.pm 2007-04-04 09:19:19.000000000 +0200 @@ -114,7 +114,7 @@ # purposes only my @user_internal_keys = ("create_home", "grouplist", "groupname", "modified", "org_username", - "org_uid", "plugins", "text_userpassword", "plugins_to_remove", + "org_uid", "plugins", "text_userpassword", "current_text_userpassword", "plugins_to_remove", "org_uidnumber", "org_homedirectory","org_user", "type", "org_groupname", "org_type", "what", "encrypted", "no_skeleton", "disabled", "enabled", "dn", "org_dn", "removed_grouplist", "delete_home", "addit_data", @@ -1418,7 +1418,9 @@ if ($create_home) { UsersRoutines->MoveHome ($org_home, $home); } - UsersRoutines->ChownHome ($uid, $gid, $home); + if (!defined $user->{"crypted_home_size"} || $user->{"crypted_home_size"} eq 0){ + UsersRoutines->ChownHome ($uid, $gid, $home); + } } } } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.15.19/src/Users.pm new/yast2-users-2.15.20/src/Users.pm --- old/yast2-users-2.15.19/src/Users.pm 2007-03-29 10:18:37.000000000 +0200 +++ new/yast2-users-2.15.20/src/Users.pm 2007-04-04 09:19:19.000000000 +0200 @@ -4,7 +4,7 @@ # Package: Configuration of users and groups # Summary: I/O routines + main data structures # -# $Id: Users.pm 37111 2007-03-26 11:07:22Z jsuchome $ +# $Id: Users.pm 37200 2007-03-29 08:48:57Z jsuchome $ # package Users; @@ -2121,13 +2121,10 @@ } # check if user is using crypted directory - my $h = $user_in_work{"homedirectory"} || ""; - my $hp = substr ($h, 0, rindex ($h, "/")); - if (FileUtils->Exists ("$hp/$username.img")) { - $user_in_work{"crypted_home_size"} = UsersRoutines->FileSizeInMB ("$hp/$username.img"); - } - else { - $user_in_work{"crypted_home_size"} = 0; + $user_in_work{"crypted_home_size"} = 0; + my $dir = UsersRoutines->CryptedImagePath ($username); + if ($dir && FileUtils->Exists ($dir)) { + $user_in_work{"crypted_home_size"} = UsersRoutines->FileSizeInMB ($dir); } # save first map for later checks of modification (in Commit) @@ -3364,6 +3361,9 @@ $ret = 1; } } + if (!$ret && defined $org_user{"crypted_home_size"} && defined $user{"crypted_home_size"}) { + $ret = ($org_user{"crypted_home_size"} ne $user{"crypted_home_size"}); + } return $ret; } @@ -4411,6 +4411,7 @@ elsif ($user_mod eq "edited" && $home ne "/var/lib/nobody") { my $org_home = $user{"org_user"}{"homedirectory"} || $home; my $org_uid = $user{"org_user"}{"uidnumber"} || $uid; + # chown only when directory was changed (#39417) if ($home ne $org_home || $uid ne $org_uid) { # move the home directory if (bool ($create_home)) { @@ -4420,8 +4421,10 @@ elsif (not %{SCR->Read (".target.stat", $home)}) { UsersRoutines->CreateHome ($skel, $home); } - # chown only when directory was changed (#39417) - UsersRoutines->ChownHome ($uid, $gid, $home); + # do not change root's ownership of home directories + if (!defined $user{"crypted_home_size"} || $user{"crypted_home_size"} eq 0){ + UsersRoutines->ChownHome ($uid, $gid, $home); + } } } } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.15.19/src/UsersRoutines.pm new/yast2-users-2.15.20/src/UsersRoutines.pm --- old/yast2-users-2.15.19/src/UsersRoutines.pm 2007-03-12 12:11:37.000000000 +0100 +++ new/yast2-users-2.15.20/src/UsersRoutines.pm 2007-04-04 09:19:19.000000000 +0200 @@ -242,25 +242,24 @@ my $self = shift; my $home = shift; my $username = shift; - - my $home_path = substr ($home, 0, rindex ($home, "/")); - my $path = "$home_path/$username"; - my $ret = 1; return 0 if ((not defined $home) || (not defined $username)); - if (%{SCR->Read (".target.stat", "$path.key")}) { - my $out = SCR->Execute (".target.bash_output", "/bin/rm -rf $path.key"); + my $img_path = $self->CryptedImagePath ($username); + my $key_path = $self->CryptedKeyPath ($username); + + if (%{SCR->Read (".target.stat", $key_path)}) { + my $out = SCR->Execute (".target.bash_output", "/bin/rm -rf $key_path"); if (($out->{"exit"} || 0) ne 0) { - y2error ("error while removing $path.key file: ", $out->{"stderr"} || ""); + y2error ("error while removing $key_path file: ", $out->{"stderr"} || ""); $ret = 0; } } - if (%{SCR->Read (".target.stat", "$path.img")}) { - my $out = SCR->Execute (".target.bash_output", "/bin/rm -rf $path.img"); + if (%{SCR->Read (".target.stat", $img_path)}) { + my $out = SCR->Execute (".target.bash_output", "/bin/rm -rf $img_path"); if (($out->{"exit"} || 0) ne 0) { - y2error ("error while removing $path.img file: ", $out->{"stderr"} || ""); + y2error ("error while removing $img_path file: ", $out->{"stderr"} || ""); $ret = 0; } my $command = "$cryptconfig pm-disable $username"; @@ -310,9 +309,18 @@ my $key_file = undef; my $image_file = undef; - my $org_hp = substr ($org_home, 0, rindex ($org_home, "/")); - my $org_img = "$org_hp/$org_username.img"; - my $org_key = "$org_hp/$org_username.key"; + 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; + } # solve disabling of crypted directory if ($home_size == 0 && $org_size > 0 && @@ -384,32 +392,30 @@ } # check user renaming or directory move - my $hp = substr ($home, 0, rindex ($home, "/")); - if ($hp ne $org_hp || $org_username ne $username) { + if ($home ne $org_home || $org_username ne $username) { if (FileUtils->Exists ($org_img)) { - my $command = "/bin/mv $org_img $hp/$username.img"; - my %out = %{SCR->Execute (".target.bash_output", $command)}; - if (($out{"stderr"} || "") ne "") { - y2error ("error calling $command: ", $out{"stderr"} || ""); - return 0; + $image_file = "$home.img"; + if ($org_img ne $image_file) { + my $command = "/bin/mv $org_img $image_file"; + my %out = %{SCR->Execute (".target.bash_output", $command)}; + if (($out{"stderr"} || "") ne "") { + y2error ("error calling $command: ", $out{"stderr"} || ""); + return 0; + } } - $image_file = "$hp/$username.img"; } if (FileUtils->Exists ($org_key)) { - my $command = "/bin/mv $org_key $hp/$username.key"; - my %out = %{SCR->Execute (".target.bash_output", $command)}; - if (($out{"stderr"} || "") ne "") { - y2error ("error calling $command: ", $out{"stderr"} || ""); - return 0; + $key_file = "$home.key"; + if ($org_key ne $key_file) { + my $command = "/bin/mv $org_key $key_file"; + my %out = %{SCR->Execute (".target.bash_output", $command)}; + if (($out{"stderr"} || "") ne "") { + y2error ("error calling $command: ", $out{"stderr"} || ""); + return 0; + } } - $key_file = "$hp/$username.key"; } } - elsif ($home ne $org_home && $modified eq "edited") { - $image_file = "$hp/$username.img"; - $key_file = "$hp/$username.key"; - - } SCR->Write (".target.string", $pw_path, $pw); if (defined $key_file || defined $image_file) { @@ -427,11 +433,9 @@ } # now check if existing image doesn't need resizing - if (FileUtils->Exists ("$hp/$username.img") && FileUtils->Exists ("$hp/$username.key")) { - $key_file = "$hp/$username.key"; - $image_file = "$hp/$username.img"; - } - + $key_file = $org_key if (!defined $key_file && FileUtils->Exists ($org_key)); + $image_file = $org_img if (!defined $image_file && FileUtils->Exists ($org_img)); + # now solve user password change if ($modified eq "edited" && defined $key_file && defined $new_pw && $new_pw ne $pw) { SCR->Write (".target.string", $pw_path, "$pw\n$new_pw"); @@ -465,7 +469,7 @@ } y2debug ("cmd: $cmd"); - my $out = SCR->Execute (".target.bash_output", $cmd); + $out = SCR->Execute (".target.bash_output", $cmd); if ($out->{"exit"} ne 0 && $out->{"stderr"}) { Report->Error ($out->{"stderr"}); } @@ -490,5 +494,45 @@ return sprintf ("%i", $stat->{"size"} / (1024 * 1024)); } + +##------------------------------------ +# Return the path to user's crypted directory image; returns empty string if there is none defined +# @param user name +# @return string +BEGIN { $TYPEINFO{CryptedImagePath} = ["function", "string", "string"];} +sub CryptedImagePath { + + my $self = shift; + my $user = shift; + my $ret = ""; + + 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; + } + return $ret; +} + +##------------------------------------ +# Return the path to user's crypted directory key; returns empty string if there is none defined +# @param user name +# @return string +BEGIN { $TYPEINFO{CryptedKeyPath} = ["function", "string", "string"];} +sub CryptedKeyPath { + + my $self = shift; + my $user = shift; + my $ret = ""; + + 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; + } + return $ret; +} 1 # EOF diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.15.19/src/widgets.ycp new/yast2-users-2.15.20/src/widgets.ycp --- old/yast2-users-2.15.19/src/widgets.ycp 2007-02-22 10:07:20.000000000 +0100 +++ new/yast2-users-2.15.20/src/widgets.ycp 2007-04-04 09:19:19.000000000 +0200 @@ -19,6 +19,7 @@ import "Users"; import "UsersCache"; import "UsersLDAP"; +import "UsersRoutines"; import "Wizard"; include "users/complex.ycp"; @@ -616,10 +617,10 @@ boolean no_home = false; // check if dir exists with this owner map stat = (map)SCR::Read (.target.stat, home); - if (stat == $[]) // check crypted dir image + string crypted_img = UsersRoutines::CryptedImagePath (username); + if (crypted_img != "") // check crypted dir image { - string home_pth = substring (home, 0, findlastof (home, "/")); - stat = (map)SCR::Read (.target.stat, sformat ("%1/%2.img", home_pth, username)); + stat = (map)SCR::Read (.target.stat, crypted_img); } if ((type == "ldap" && !Ldap::file_server) || (stat["uid"]:-1 != uid)) { diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.15.19/VERSION new/yast2-users-2.15.20/VERSION --- old/yast2-users-2.15.19/VERSION 2007-03-29 10:38:37.000000000 +0200 +++ new/yast2-users-2.15.20/VERSION 2007-04-04 09:20:43.000000000 +0200 @@ -1 +1 @@ -2.15.19 +2.15.20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org