patches/system-tools-backends-08-users.diff
changeset 11320 d94d62fd42bc
parent 10454 5358e2411d36
child 11808 0351aab173c0
--- a/patches/system-tools-backends-08-users.diff	Thu Dec 13 02:52:26 2007 +0000
+++ b/patches/system-tools-backends-08-users.diff	Fri Dec 14 14:11:53 2007 +0000
@@ -1,5 +1,5 @@
---- system-tools-backends-1.4.2/users-conf.in.org	2007-08-28 17:22:18.052218000 +0800
-+++ system-tools-backends-1.4.2/users-conf.in	2007-08-28 17:35:02.121728000 +0800
+--- system-tools-backends-1.4.2.orig/users-conf.in	Mon Jan  2 23:48:06 2006
++++ system-tools-backends-1.4.2/users-conf.in	Fri Dec 14 16:05:24 2007
 @@ -47,6 +47,8 @@
  # pw: modifying users/groups and user/group data on FreeBSD.
  
@@ -25,7 +25,7 @@
  @login_defs_names = ( "/etc/login.defs", "/etc/adduser.conf" );
  @shell_names =      ( "/etc/shells" );
  @skel_dir =         ( "/usr/share/skel", "/etc/skel" );
-@@ -111,13 +115,38 @@
+@@ -111,13 +115,17 @@
  $cmd_gpasswd  = &gst_file_locate_tool ("gpasswd");	
  $cmd_chfn     = &gst_file_locate_tool ("chfn");
  $cmd_pw       = &gst_file_locate_tool ("pw");
@@ -41,6 +41,14 @@
  
 -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,
@@ -59,20 +67,12 @@
 +    "passwd_disable", 13,
 +    "reserved", 14,
 +    "is_shadow", 15,
++    "rbac", 16,
 +    "", "");
 +}
-+if ($$tool{"system"} eq "SunOS")
+ else
  {
    @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];
@@ -472,7 +472,30 @@
        &gst_file_run ($command);
      }
    }
-@@ -1069,25 +1362,62 @@
+@@ -1052,10 +1345,18 @@
+   }
+   else
+   {
+-    $command = "$cmd_groupmod -g \'" . $$new_data[$groups_prop_map{"gid"}] .
+-      "\' -n \'" . $$new_data[$groups_prop_map{"name"}] . "\' " .
+-      "\'" . $$old_data[$groups_prop_map{"name"}] . "\'";
+-  
++    if ( $$new_data[$groups_propmap{"name"}] eq $$old_data[$group_prop_map{"name"}] )
++    {
++      $command = "$cmd_groupmod -g \'" . $$new_data[$groups_prop_map{"gid"}] .
++        "\' \'" . $$old_data[$groups_prop_map{"name"}] . "\'";
++    }
++    else
++    {
++      $command = "$cmd_groupmod -g \'" . $$new_data[$groups_prop_map{"gid"}] .
++        "\' -n \'" . $$new_data[$groups_prop_map{"name"}] . "\' " .
++        "\'" . $$old_data[$groups_prop_map{"name"}] . "\'";
++    }
++
+     &gst_file_run ($command);
+ 	
+     # Let's see if the users that compose the group have changed.
+@@ -1069,25 +1370,62 @@
        $max_o = $#$o;
        for ($i = 0, $j = 0; $i <= &max ($max_n, $max_o); ) {
          $r = $$n[$i] cmp $$o[$j];
@@ -548,7 +571,7 @@
    }
  }
  
-@@ -1204,8 +1534,10 @@
+@@ -1204,8 +1542,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); }
@@ -559,7 +582,7 @@
  		else
  		{
  		  &gst_report ("xml_unexp_tag", $$tree[0]);
-@@ -1268,10 +1600,36 @@
+@@ -1268,10 +1608,36 @@
  
  	while (@$tree)
  	{
@@ -597,7 +620,7 @@
  		else
  		{
  		  &gst_report ("xml_unexp_tag", $$tree[0]);
-@@ -1323,6 +1681,7 @@
+@@ -1323,6 +1689,7 @@
  		  if ($$tree[0] eq "users") { $line[$groups_prop_map{$$tree[0]}] = $$tree[1]; }
  			else { $line[$groups_prop_map{$$tree[0]}] = $$tree[1][2]; }
  		}
@@ -605,7 +628,7 @@
  		else
  		{
  		  &gst_report ("xml_unexp_tag", $$tree[0]);
-@@ -1487,11 +1846,18 @@
+@@ -1487,11 +1854,18 @@
    my ($hash) = @_;
    my ($key, $value, $i, $j, $k);
    my ($passwd_last_modified, $users, $desc);
@@ -624,7 +647,7 @@
  
    &gst_xml_print_begin ();
  
-@@ -1519,8 +1885,23 @@
+@@ -1519,8 +1893,23 @@
  	  &gst_xml_container_enter ('user');
  		for ($j = 0; $j < ($#users_prop_array - 1) / 2; $j++)
      {
@@ -649,7 +672,7 @@
  		&gst_xml_container_leave ();
  	}
  	&gst_xml_container_leave ();
-@@ -1559,9 +1940,30 @@
+@@ -1559,9 +1948,30 @@
  		&gst_xml_container_leave ();
  	}
  	&gst_xml_container_leave ();
@@ -682,7 +705,7 @@
  }
  
  
-@@ -1590,6 +1992,7 @@
+@@ -1590,6 +2000,7 @@
      &gst_file_backup ($_) foreach (@passwd_names);
      &gst_file_backup ($_) foreach (@shadow_names);
      &gst_file_backup ($_) foreach (@group_names);
@@ -690,7 +713,7 @@
  
      &write_profiledb ($hash);
      &write_group_passwd ($hash);
-@@ -1627,6 +2030,7 @@
+@@ -1627,6 +2038,7 @@
  $tool = &gst_init ($name, $version, $description, $directives, @ARGV);
  &gst_platform_ensure_supported ($tool, @platforms);