--- a/patches/system-tools-backends-08-users.diff Mon May 29 11:42:37 2006 +0000
+++ b/patches/system-tools-backends-08-users.diff Mon May 29 13:29:34 2006 +0000
@@ -1,5 +1,6 @@
---- /usr/tmp/clean/system-tools-backends-1.4.2/users-conf.in Mon Jan 2 15:48:06 2006
-+++ system-tools-backends-1.4.2/users-conf.in Mon Apr 10 15:21:15 2006
+diff -u ./users-conf.in-clean ./users-conf.in
+--- ./users-conf.in-clean Mon May 15 14:35:50 2006
++++ ./users-conf.in Fri May 19 11:07:42 2006
@@ -47,6 +47,8 @@
# pw: modifying users/groups and user/group data on FreeBSD.
@@ -39,28 +40,38 @@
%groups_prop_map = ();
@groups_prop_array = (
-@@ -315,6 +322,20 @@
+@@ -315,6 +322,30 @@
}
}
+my $nexenta_logindefs_defaults = {
++ 'login_defs' => 0, # Open Solaris doesn't have a login.defs file.
+ 'shell' => '/bin/bash',
+ 'group' => 'users',
+ 'skel_dir' => '/etc/skel/',
+ 'home_prefix' => '/export/home/$user',
++ 'gmin' => 1000,
++ 'gmax' => 2147483647, # Based on MAXUID from sys/param.h
++ 'umin' => 1000,
++ 'umax' => 2147483647, # Based on MAXUID from sys/param.h
+};
+
+my $solaris_logindefs_defaults = {
++ 'login_defs' => 0, # Open Solaris doesn't have a login.defs file.
+ 'shell' => '/bin/bash',
+ 'group' => 'users',
+ 'skel_dir' => '/etc/skel/',
+ 'home_prefix' => '/home/$user',
++ 'gmin' => 1000,
++ 'gmax' => 2147483647, # Based on MAXUID from sys/param.h
++ 'umin' => 1000,
++ 'umax' => 2147483647, # Based on MAXUID from sys/param.h
+};
+
my $rh_logindefs_defaults = {
'shell' => '/bin/bash',
'group' => '$user',
-@@ -362,6 +383,8 @@
+@@ -362,6 +393,8 @@
'debian-2.2' => $rh_logindefs_defaults,
'debian-3.0' => $rh_logindefs_defaults,
'debian-sarge' => $rh_logindefs_defaults,
@@ -69,7 +80,24 @@
'vine-3.0' => $rh_logindefs_defaults,
'vine-3.1' => $rh_logindefs_defaults,
'gentoo' => $gentoo_logindefs_defaults,
-@@ -740,7 +763,40 @@
+@@ -553,11 +586,11 @@
+ }
+ else
+ {
+- # Put safe defaults for distros/OS that don't have any defaults file
+- $logindefs->{"umin"} = '1000';
+- $logindefs->{"umax"} = '60000';
+- $logindefs->{"gmin"} = '1000';
+- $logindefs->{"gmax"} = '60000';
++ # Put safe defaults for distros/OS that don't have any defaults set
++ $logindefs->{"umin"} = '1000' unless ($logindefs->{"umin"});
++ $logindefs->{"umax"} = '60000' unless ($logindefs->{"umax"});
++ $logindefs->{"gmin"} = '1000' unless ($logindefs->{"gmin"});
++ $logindefs->{"gmax"} = '60000' unless ($logindefs->{"gmax"});
+ }
+ }
+
+@@ -740,7 +773,40 @@
push (@shells, "/bin/false") if (stat ("/bin/false"));
$ifh = &gst_file_open_read_from_names(@shell_names);
@@ -111,7 +139,7 @@
while (<$ifh>)
{
-@@ -879,6 +935,11 @@
+@@ -879,6 +945,11 @@
{
$command = "$cmd_pw usermod -n " . $username . " -c \'" . $comment . "\'";
}
@@ -123,7 +151,7 @@
else
{
($fname, $office, $office_phone, $home_phone) = @line;
-@@ -886,7 +947,7 @@
+@@ -886,7 +957,7 @@
$fname = "-f \'" . $fname . "\'";
$home_phone = "-h \'" . $home_phone . "\'";
@@ -132,7 +160,7 @@
{
$office = "-r \'" . $office . "\'";
$office_phone = "-w \'" . $office_phone . "\'";
-@@ -903,6 +964,30 @@
+@@ -903,6 +974,30 @@
&gst_file_run ($command);
}
@@ -163,7 +191,7 @@
sub add_user
{
my ($data) = @_;
-@@ -932,6 +1017,38 @@
+@@ -932,6 +1027,38 @@
print $pwdpipe $$data[$users_prop_map{"password"}];
&gst_file_close ($pwdpipe);
}
@@ -202,7 +230,7 @@
else
{
$home_parents = $$data[$users_prop_map{"home"}];
-@@ -967,9 +1084,33 @@
+@@ -967,9 +1094,48 @@
" -H 0"; # pw(8) reads password from STDIN
$pwdpipe = &gst_file_run_pipe($command, $GST_FILE_WRITE);
@@ -223,21 +251,36 @@
+ }
+ elsif ($gst_dist =~ /^solaris/)
+ {
-+ $command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
-+ "\' -g \'" . $$new_data[$users_prop_map{"gid"}] .
-+ "\' -s \'" . $$new_data[$users_prop_map{"shell"}] .
-+ "\' -u \'" . $$new_data[$users_prop_map{"uid"}] .
-+ "\' \'" . $$old_data[$users_prop_map{"login"}] . "\'";
-+ &gst_file_run ($command);
++ $command = "$cmd_usermod" ;
++
++ $command .= " -u \'" . $$new_data[$users_prop_map{"uid"}] . "\'"
++ if ( $$new_data[$users_prop_map{"uid"}] ne $$old_data[$users_prop_map{"uid"}] );
++ $command .= " -g \'" . $$new_data[$users_prop_map{"gid"}] . "\'"
++ if ( $$new_data[$users_prop_map{"gid"}] ne $$old_data[$users_prop_map{"gid"}] );
++ $command .= " -d \'" . $$new_data[$users_prop_map{"home"}] . "\'"
++ if ( $$new_data[$users_prop_map{"home"}] ne $$old_data[$users_prop_map{"home"}] );
++ $command .= " -s \'" . $$new_data[$users_prop_map{"shell"}] . "\'"
++ if ( $$new_data[$users_prop_map{"shell"}] ne $$old_data[$users_prop_map{"shell"}] );
++ # If there's nothing to change, then don't...
++ if ( $command ne $cmd_usermod ) {
++ $command .= "\'" . $$old_data[$users_prop_map{"login"}] . "\'";
++ &gst_file_run ($command);
++ }
+ $username = $$old_data[$users_prop_map{"login"}];
++ $oldpassword = $$old_data[$users_prop_map{"password"}];
+ $newpassword = $$new_data[$users_prop_map{"password"}];
-+ ref($pamh = new Authen::PAM($service, $username, \&my_conv_func));
-+ $pamh->pam_chauthtok(PAM_NO_AUTHTOK_CHECK());
++ # Should only change password if old and new differ - this is especially
++ # important since the old password is usually the "crypted" one!! Only if
++ # it's different has a user entered a clear string here.
++ if ( $newpassword ne $oldpassword ) {
++ ref($pamh = new Authen::PAM($service, $username, \&my_conv_func));
++ $pamh->pam_chauthtok(PAM_NO_AUTHTOK_CHECK());
++ }
+ }
else
{
$command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
-@@ -1026,8 +1167,24 @@
+@@ -1026,8 +1192,24 @@
foreach $user (@$u)
{
@@ -264,7 +307,7 @@
&gst_file_run ($command);
}
}
-@@ -1069,25 +1226,62 @@
+@@ -1069,25 +1251,62 @@
$max_o = $#$o;
for ($i = 0, $j = 0; $i <= &max ($max_n, $max_o); ) {
$r = $$n[$i] cmp $$o[$j];
@@ -340,7 +383,7 @@
}
}
-@@ -1204,6 +1398,7 @@
+@@ -1204,6 +1423,7 @@
elsif ($$tree[0] eq "group_last_modified") { &xml_parse_group_last_modified ($$tree[1], $hash); }
elsif ($$tree[0] eq "userdb") { &xml_parse_userdb ($$tree[1], $hash); }
elsif ($$tree[0] eq "groupdb") { &xml_parse_groupdb ($$tree[1], $hash); }
@@ -348,7 +391,7 @@
elsif ($$tree[0] eq "shelldb") { }
elsif ($$tree[0] eq "profiledb") { &xml_parse_profiledb ($$tree[1], $hash); }
else
-@@ -1323,6 +1518,7 @@
+@@ -1323,6 +1543,7 @@
if ($$tree[0] eq "users") { $line[$groups_prop_map{$$tree[0]}] = $$tree[1]; }
else { $line[$groups_prop_map{$$tree[0]}] = $$tree[1][2]; }
}
@@ -356,7 +399,7 @@
else
{
&gst_report ("xml_unexp_tag", $$tree[0]);
-@@ -1627,6 +1823,7 @@
+@@ -1627,6 +1848,7 @@
$tool = &gst_init ($name, $version, $description, $directives, @ARGV);
&gst_platform_ensure_supported ($tool, @platforms);
@@ -364,3 +407,4 @@
&get_login_defs_prop_array ();
&get_profiles_prop_array ();
+