--- a/patches/system-tools-backends-08-users.diff Fri Feb 02 15:16:13 2007 +0000
+++ b/patches/system-tools-backends-08-users.diff Fri Feb 02 16:08:34 2007 +0000
@@ -1,6 +1,6 @@
diff -u system-tools-backends-1.4.2/users-conf.in-orig system-tools-backends-1.4.2/users-conf.in
---- system-tools-backends-1.4.2/users-conf.in-orig Mon Jan 2 15:48:06 2006
-+++ system-tools-backends-1.4.2/users-conf.in Mon Dec 18 12:15:13 2006
+--- system-tools-backends-1.4.2/users-conf.in-orig 2006-01-02 15:48:06.000000000 +0000
++++ system-tools-backends-1.4.2/users-conf.in 2007-02-02 15:53:30.243300000 +0000
@@ -47,6 +47,8 @@
# pw: modifying users/groups and user/group data on FreeBSD.
@@ -26,7 +26,7 @@
@login_defs_names = ( "/etc/login.defs", "/etc/adduser.conf" );
@shell_names = ( "/etc/shells" );
@skel_dir = ( "/usr/share/skel", "/etc/skel" );
-@@ -111,13 +115,17 @@
+@@ -111,13 +115,38 @@
$cmd_gpasswd = &gst_file_locate_tool ("gpasswd");
$cmd_chfn = &gst_file_locate_tool ("chfn");
$cmd_pw = &gst_file_locate_tool ("pw");
@@ -42,14 +42,6 @@
-if ($$tool{"platform"} eq "Linux")
+if ($$tool{"system"} eq "Linux")
- {
- @users_prop_array = (
- "key", 0,
-@@ -138,6 +146,28 @@
- "is_shadow", 15,
- "", "");
- }
-+if ($$tool{"system"} eq "SunOS")
+{
+ @users_prop_array = (
+ "key", 0,
@@ -68,12 +60,20 @@
+ "passwd_disable", 13,
+ "reserved", 14,
+ "is_shadow", 15,
-+ "rbac", 16,
+ "", "");
+}
- else
++if ($$tool{"system"} eq "SunOS")
{
@users_prop_array = (
+ "key", 0,
+@@ -136,6 +165,7 @@
+ "passwd_disable", 13,
+ "reserved", 14,
+ "is_shadow", 15,
++ "rbac", 16,
+ "", "");
+ }
+ else
@@ -157,6 +187,7 @@
$users_prop_map {$users_prop_array[$i]} = $users_prop_array[$i + 1];
$users_prop_map {$users_prop_array[$i + 1]} = $users_prop_array[$i];
@@ -313,7 +313,7 @@
sub add_user
{
my ($data) = @_;
-@@ -932,6 +1094,38 @@
+@@ -932,6 +1094,54 @@
print $pwdpipe $$data[$users_prop_map{"password"}];
&gst_file_close ($pwdpipe);
}
@@ -338,7 +338,23 @@
+ $home_parents =~ s/\/+[^\/]+\/*$//;
+ &gst_file_run ("$tool_mkdir -p $home_parents");
+
-+ $command = "$cmd_useradd" . " -d \'" . $$data[$users_prop_map{"home"}] .
++ $command = "$cmd_useradd";
++ if ($$data[$users_prop_map{"rbac"}] ne undef ) {
++ my (@profiles, $old_user_profiles, $new_user_profiles );
++ $new_user_profiles = $$data[$users_prop_map{"rbac"}];
++ @profiles = ();
++ push( @profiles, @$new_user_profiles );
++ if ( $#profiles >= 0 ) {
++ my $profiles_str = "";
++ foreach ( @profiles ) {
++ $profiles_str .= ',' unless ( $profiles_str eq "" );
++ $profiles_str .= $_;
++ }
++ $command .= " -P \'" . $profiles_str . "\'";
++ }
++ }
++
++ $command .= " -d \'" . $$data[$users_prop_map{"home"}] .
+ "\' -g \'" . $$data[$users_prop_map{"gid"}] .
+ "\' -m -s \'" . $$data[$users_prop_map{"shell"}] .
+ "\' -u \'" . $$data[$users_prop_map{"uid"}] .
@@ -352,7 +368,7 @@
else
{
$home_parents = $$data[$users_prop_map{"home"}];
-@@ -967,9 +1161,76 @@
+@@ -967,9 +1177,76 @@
" -H 0"; # pw(8) reads password from STDIN
$pwdpipe = &gst_file_run_pipe($command, $GST_FILE_WRITE);
@@ -430,7 +446,7 @@
else
{
$command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
-@@ -1026,8 +1287,24 @@
+@@ -1026,8 +1303,24 @@
foreach $user (@$u)
{
@@ -457,7 +473,7 @@
&gst_file_run ($command);
}
}
-@@ -1069,25 +1346,62 @@
+@@ -1069,25 +1362,62 @@
$max_o = $#$o;
for ($i = 0, $j = 0; $i <= &max ($max_n, $max_o); ) {
$r = $$n[$i] cmp $$o[$j];
@@ -533,7 +549,7 @@
}
}
-@@ -1204,8 +1518,10 @@
+@@ -1204,8 +1534,10 @@
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); }
@@ -544,7 +560,7 @@
else
{
&gst_report ("xml_unexp_tag", $$tree[0]);
-@@ -1268,10 +1584,42 @@
+@@ -1268,10 +1600,42 @@
while (@$tree)
{
@@ -588,7 +604,7 @@
else
{
&gst_report ("xml_unexp_tag", $$tree[0]);
-@@ -1323,6 +1671,7 @@
+@@ -1323,6 +1687,7 @@
if ($$tree[0] eq "users") { $line[$groups_prop_map{$$tree[0]}] = $$tree[1]; }
else { $line[$groups_prop_map{$$tree[0]}] = $$tree[1][2]; }
}
@@ -596,7 +612,7 @@
else
{
&gst_report ("xml_unexp_tag", $$tree[0]);
-@@ -1487,11 +1836,18 @@
+@@ -1487,11 +1852,18 @@
my ($hash) = @_;
my ($key, $value, $i, $j, $k);
my ($passwd_last_modified, $users, $desc);
@@ -615,7 +631,7 @@
&gst_xml_print_begin ();
-@@ -1519,8 +1875,23 @@
+@@ -1519,8 +1891,23 @@
&gst_xml_container_enter ('user');
for ($j = 0; $j < ($#users_prop_array - 1) / 2; $j++)
{
@@ -640,7 +656,7 @@
&gst_xml_container_leave ();
}
&gst_xml_container_leave ();
-@@ -1559,9 +1930,30 @@
+@@ -1559,9 +1946,30 @@
&gst_xml_container_leave ();
}
&gst_xml_container_leave ();
@@ -673,7 +689,7 @@
}
-@@ -1590,6 +1982,7 @@
+@@ -1590,6 +1998,7 @@
&gst_file_backup ($_) foreach (@passwd_names);
&gst_file_backup ($_) foreach (@shadow_names);
&gst_file_backup ($_) foreach (@group_names);
@@ -681,7 +697,7 @@
&write_profiledb ($hash);
&write_group_passwd ($hash);
-@@ -1627,6 +2020,7 @@
+@@ -1627,6 +2036,7 @@
$tool = &gst_init ($name, $version, $description, $directives, @ARGV);
&gst_platform_ensure_supported ($tool, @platforms);