patches/system-tools-backends-08-users.diff
author jim
Fri, 14 Nov 2008 06:15:22 +0000
changeset 14599 e7524d60f11c
parent 13240 86b4073e507e
child 15693 503a24a43b0f
permissions -rwxr-xr-x
2008-11-14 Jim Li <[email protected]> * patches/system-tools-backends-08-users.diff: filter out no existed shell from shell lists
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14599
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
     1
--- system-tools-backends-1.4.2.orig/users-conf.in	Mon Jan  2 23:48:06 2006
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
     2
+++ system-tools-backends-1.4.2/users-conf.in	Fri Nov 14 13:54:34 2008
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     3
@@ -47,6 +47,8 @@
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     4
 # pw: modifying users/groups and user/group data on FreeBSD.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     5
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     6
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     7
+use Authen::PAM;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     8
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     9
 BEGIN {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    10
   $SCRIPTSDIR = "@scriptsdir@";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    11
   if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    12
@@ -74,6 +76,7 @@
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    13
               "mandrake-7.1", "mandrake-7.2", "mandrake-9.0", "mandrake-9.1", "mandrake-9.2",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    14
               "mandrake-10.0", "mandrake-10.1",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    15
               "debian-2.2", "debian-3.0", "debian-sarge",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    16
+               "nexenta-1.0", "solaris-2.11",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    17
               "suse-7.0", "suse-9.0", "suse-9.1", "turbolinux-7.0",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    18
               "slackware-8.0.0", "slackware-8.1", "slackware-9.0.0", "slackware-9.1.0", "slackware-10.0.0", "slackware-10.1.0", "slackware-10.2.0",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    19
               "freebsd-4", "freebsd-5", "freebsd-6",
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    20
@@ -93,6 +96,7 @@
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    21
 @passwd_names =     ( "/etc/passwd" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    22
 @shadow_names =     ( "/etc/shadow", "/etc/master.passwd" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    23
 @group_names =      ( "/etc/group" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    24
+@rbac_names =       ( "/etc/user_attr" ); # Files that will be changed by RBAC commands
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    25
 @login_defs_names = ( "/etc/login.defs", "/etc/adduser.conf" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    26
 @shell_names =      ( "/etc/shells" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    27
 @skel_dir =         ( "/usr/share/skel", "/etc/skel" );
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
    28
@@ -111,13 +115,18 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    29
 $cmd_gpasswd  = &gst_file_locate_tool ("gpasswd");	
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    30
 $cmd_chfn     = &gst_file_locate_tool ("chfn");
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    31
 $cmd_pw       = &gst_file_locate_tool ("pw");
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    32
+$cmd_profiles = &gst_file_locate_tool ("profiles");
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
    33
+$cmd_roles    = &gst_file_locate_tool ("roles");
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    34
 
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    35
 # --- Mapping constants --- #
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    36
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    37
 %users_prop_map = ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    38
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    39
+sub get_users_prop_array
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    40
+{
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    41
 @users_prop_array = ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    42
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    43
-if ($$tool{"platform"} eq "Linux")
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    44
+if ($$tool{"system"} eq "Linux")
11320
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
    45
 {
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
    46
   @users_prop_array = (
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
    47
     "key", 0,
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
    48
@@ -138,6 +147,29 @@
11320
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
    49
     "is_shadow", 15,
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
    50
     "", "");
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
    51
 }
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
    52
+if ($$tool{"system"} eq "SunOS")
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    53
+{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    54
+  @users_prop_array = (
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    55
+    "key", 0,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    56
+    "login", 1,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    57
+    "password", 2,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    58
+    "uid", 3,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    59
+    "gid", 4,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    60
+    "comment", 5,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    61
+    "home", 6,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    62
+    "shell", 7,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    63
+    "last_mod", 8, # Read shadow (5) for these.
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    64
+    "passwd_min_life", 9,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    65
+    "passwd_max_life", 10,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    66
+    "passwd_exp_warn", 11,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    67
+    "passwd_exp_disable", 12,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    68
+    "passwd_disable", 13,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    69
+    "reserved", 14,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    70
+    "is_shadow", 15,
11320
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
    71
+    "rbac", 16,
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
    72
+    "role", 17,
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    73
+    "", "");
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    74
+}
11320
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
    75
 else
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    76
 {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    77
   @users_prop_array = (
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
    78
@@ -157,6 +189,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    79
   $users_prop_map {$users_prop_array[$i]} = $users_prop_array[$i + 1];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    80
   $users_prop_map {$users_prop_array[$i + 1]} = $users_prop_array[$i];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    81
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    82
+}
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    83
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    84
 %groups_prop_map = ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    85
 @groups_prop_array = (
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
    86
@@ -193,6 +226,66 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    87
 %login_defs_prop_map = ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    88
 %profiles_prop_map = ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    89
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    90
+sub read_rbac() {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    91
+  return unless ( $gst_dist =~ /^solaris/ );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    92
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    93
+  my ($hash) = @_;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    94
+  my ($buffer, $line, $profile, $description, $dummy);
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
    95
+  my ($user, $attr);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
    96
+  my (%rbac, %rbac_profiles, %role, %rbac_roles);
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    97
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    98
+  %rbac=();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    99
+  %rbac_profiles=();
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   100
+  %rbac_roles=();
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   101
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   102
+  $buffer = &gst_file_buffer_load("/etc/security/prof_attr"); 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   103
+  foreach $line ( @$buffer ) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   104
+    # Skip comments, blank lines and the "All" special profile.
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   105
+    next if ( $line =~ /^#|^\s*$|^All:/ );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   106
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   107
+    ($profile, $dummy, $dummy, $description, $dummy ) = split(/:/, $line, 5);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   108
+    $rbac_profiles{$profile} = &gst_xml_quote($description);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   109
+  }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   110
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   111
+  $rbac{"rbac_profiles"} = \%rbac_profiles;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   112
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   113
+  $$hash{"rbacdb"} = \%rbac;
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   114
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   115
+  $buffer = &gst_file_buffer_load("/etc/user_attr");
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   116
+  foreach $line ( @$buffer ) {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   117
+    # Skip comments, blank lines.
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   118
+    next if ( $line =~ /^#|^\s*$/ );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   119
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   120
+    ($user, $dummy, $dummy, $dummy, $attr) = split(/:/, $line, 5);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   121
+    $rbac_roles{$user} = &gst_xml_quote($user) if ( $attr =~ /type=role/ );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   122
+  }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   123
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   124
+  $role{"rbac_roles"} = \%rbac_roles;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   125
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   126
+  $$hash{"roledb"} = \%role;
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   127
+}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   128
+
11808
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   129
+sub read_rbac_default_profiles
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   130
+{
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   131
+  return unless ( $gst_dist =~ /^solaris/ );
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   132
+
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   133
+  my ($buffer, $line, $dummy, @def_prof, $def_prof_ref);
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   134
+  $buffer = &gst_file_buffer_load("/etc/security/policy.conf");
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   135
+  foreach $line ( @$buffer ) {
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   136
+    chomp $line;
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   137
+    if ( $line =~ /^PROFS_GRANTED=/ )
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   138
+      {
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   139
+        ($dummy, $def_line) = split(/=/, $line, 2);
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   140
+        @def_prof = split (/,/, $def_line);
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   141
+        foreach ( @def_prof ) {
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   142
+          $def_prof_ref->{$_} = 1;
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   143
+        }
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   144
+        return $def_prof_ref;
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   145
+      }
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   146
+    next;
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   147
+  }
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   148
+}
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   149
+
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   150
 sub get_login_defs_prop_array
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   151
 {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   152
   my @prop_array;
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   153
@@ -315,6 +408,30 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   154
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   155
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   156
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   157
+my $nexenta_logindefs_defaults = {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   158
+  'login_defs'  => 0, # Open Solaris doesn't have a login.defs file.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   159
+  'shell'       => '/bin/bash',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   160
+  'group'       => 'users',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   161
+  'skel_dir'    => '/etc/skel/',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   162
+  'home_prefix' => '/export/home/$user',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   163
+  'gmin'        => 1000,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   164
+  'gmax'        => 2147483647, # Based on MAXUID from sys/param.h
10303
cf9f0c6127b2 * patches/system-tools-backend-08-users.diff : Bug : 6591890, change
mattman
parents: 9165
diff changeset
   165
+  'umin'        => 100,
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   166
+  'umax'        => 2147483647, # Based on MAXUID from sys/param.h
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   167
+};
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   168
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   169
+my $solaris_logindefs_defaults = {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   170
+  'login_defs'  => 0, # Open Solaris doesn't have a login.defs file.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   171
+  'shell'       => '/bin/bash',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   172
+  'group'       => 'users',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   173
+  'skel_dir'    => '/etc/skel/',
8847
cf3a94737768 2006-12-18 Darren Kenny <[email protected]>
dkenny
parents: 8604
diff changeset
   174
+  'home_prefix' => '/export/home/$user',
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   175
+  'gmin'        => 1000,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   176
+  'gmax'        => 2147483647, # Based on MAXUID from sys/param.h
10303
cf9f0c6127b2 * patches/system-tools-backend-08-users.diff : Bug : 6591890, change
mattman
parents: 9165
diff changeset
   177
+  'umin'        => 100,
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   178
+  'umax'        => 2147483647, # Based on MAXUID from sys/param.h
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   179
+};
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   180
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   181
 my $rh_logindefs_defaults = {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   182
   'shell'       => '/bin/bash',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   183
   'group'       => '$user',
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   184
@@ -362,6 +479,8 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   185
   'debian-2.2'      => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   186
   'debian-3.0'      => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   187
   'debian-sarge'    => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   188
+  'nexenta-1.0'    => $nexenta_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   189
+  'solaris-2.11'    => $solaris_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   190
   'vine-3.0'        => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   191
   'vine-3.1'        => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   192
   'gentoo'	        => $gentoo_logindefs_defaults,
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   193
@@ -419,7 +538,8 @@
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   194
 	my ($a1, $a2) = @_;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   195
 	my $i;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   196
 	
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   197
-	return -1 if ($#$a1 != $#$a2);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   198
+  return 0 if ( ( $#$a1 < 0 || $#$a2 < 0 ) && $#$a1 == $#$a2 );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   199
+	return -1 if ($#$a1 != $#$a2 || $#$a1 < 0 || $#$a2 < 0 );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   200
 	
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   201
 	for ($i = 0; $i <= $#$a1; $i++) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   202
 	  if (ref ($$a1[$i]) eq "ARRAY") { # see if this is a reference.
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   203
@@ -453,6 +573,7 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   204
   &read_passwd_shadow (\%hash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   205
   &read_profiledb     (\%hash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   206
   &read_shells        (\%hash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   207
+  &read_rbac          (\%hash) if ( $gst_dist =~ /^solaris/);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   208
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   209
   return \%hash;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   210
 }
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   211
@@ -553,11 +674,11 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   212
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   213
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   214
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   215
-    # Put safe defaults for distros/OS that don't have any defaults file
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   216
-    $logindefs->{"umin"} = '1000';
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   217
-    $logindefs->{"umax"} = '60000';
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   218
-    $logindefs->{"gmin"} = '1000';
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   219
-    $logindefs->{"gmax"} = '60000';
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   220
+    # Put safe defaults for distros/OS that don't have any defaults set
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   221
+    $logindefs->{"umin"} = '1000' unless ($logindefs->{"umin"});
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   222
+    $logindefs->{"umax"} = '60000' unless ($logindefs->{"umax"});
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   223
+    $logindefs->{"gmin"} = '1000' unless ($logindefs->{"gmin"});
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   224
+    $logindefs->{"gmax"} = '60000' unless ($logindefs->{"gmax"});
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   225
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   226
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   227
 
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   228
@@ -602,6 +723,7 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   229
   my ($ifh, @users, %users_hash, $passwd_last_modified);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   230
   my (@line, $copy, %tmphash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   231
   my $login_pos = $users_prop_map{"login"};
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   232
+  #my (%users_rbac_profiles);
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   233
   my $i = 0;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   234
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   235
   # Find the passwd file.
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   236
@@ -660,7 +782,36 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   237
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   238
     &gst_file_close ($ifh);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   239
   }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   240
+  if ($gst_dist =~ /^solaris/ ) {
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   241
+    my $rbac_pos = $users_prop_map{"rbac"};
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   242
+    my $role_pos = $users_prop_map{"role"};
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   243
+    my ($fd);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   244
+    foreach $user (@users) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   245
+      my @profiles;
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   246
+      my @roles, $tmproles;
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   247
+      my $logname = $$user[1];
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   248
 
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   249
+      my $command = $cmd_profiles . " " . $logname;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   250
+      $fd = &gst_file_run_pipe_read( $command );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   251
+      @profiles = <$fd>;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   252
+      &gst_file_close($fd);
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   253
+      # $users_rbac_profiles{$logname} = \@profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   254
+      chomp( @profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   255
+      @{$tmphash{$logname}}[$rbac_pos] = \@profiles;
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   256
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   257
+      $command = $cmd_roles . " " . $logname;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   258
+      $fd = &gst_file_run_pipe_read( $command );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   259
+      $tmproles = <$fd>;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   260
+      &gst_file_close($fd);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   261
+      chomp( $tmproles );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   262
+      next if ($tmproles eq "No roles");
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   263
+      @roles = split ',', $tmproles, -1;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   264
+      @{$tmphash{$logname}}[$role_pos] = \@roles;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   265
+
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   266
+    }
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   267
+    #$$hash{"users_rbac_profiles"} = \%users_rbac_profiles;
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   268
+  }
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   269
+
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   270
   $$hash{"users"}      = \@users;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   271
   $$hash{"users_hash"} = \%users_hash;
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   272
   $$hash{"passwd_last_modified"} = $passwd_last_modified;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   273
@@ -740,7 +891,40 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   274
   push (@shells, "/bin/false") if (stat ("/bin/false"));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   275
   
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   276
   $ifh = &gst_file_open_read_from_names(@shell_names);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   277
-  return unless $ifh;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   278
+  unless ($ifh)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   279
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   280
+     if ($gst_dist =~ /solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   281
+     {
14599
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   282
+       push (@shells, "/bin/bash") if (stat ("/bin/bash"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   283
+       push (@shells, "/bin/csh") if (stat ("/bin/csh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   284
+       push (@shells, "/bin/jsh") if (stat ("/bin/jsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   285
+       push (@shells,  "/bin/ksh") if (stat ("/bin/ksh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   286
+       push (@shells,  "/bin/pfcsh") if (stat ("/bin/pfcsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   287
+       push (@shells, "/bin/pfksh") if (stat ("/bin/pfksh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   288
+       push (@shells, "/bin/pfsh") if (stat ("/bin/pfsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   289
+       push (@shells, "/bin/sh") if (stat ("/bin/sh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   290
+       push (@shells, "/bin/tcsh") if (stat ("/bin/tcsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   291
+       push (@shells, "/bin/zsh") if (stat ("/bin/zsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   292
+       push (@shells, "/bin/jsh") if (stat ("/bin/jsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   293
+       push (@shells, "/sbin/jsh") if (stat ("/sbin/jsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   294
+       push (@shells, "/sbin/pfsh") if (stat ("/sbin/pfsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   295
+       push (@shells, "/sbin/sh") if (stat ("/sbin/sh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   296
+       push (@shells, "/usr/bin/bash") if (stat ("/usr/bin/bash"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   297
+       push (@shells, "/usr/bin/csh") if (stat ("/usr/bin/csh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   298
+       push (@shells, "/usr/bin/jsh") if (stat ("/usr/bin/jsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   299
+       push (@shells, "/usr/bin/ksh") if (stat ("/usr/bin/ksh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   300
+       push (@shells, "/usr/bin/pfcsh") if (stat ("/usr/bin/pfcsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   301
+       push (@shells, "/usr/bin/pfksh") if (stat ("/usr/bin/pfksh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   302
+       push (@shells, "/usr/bin/pfsh") if (stat ("/usr/bin/pfsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   303
+       push (@shells, "/usr/bin/sh") if (stat ("/usr/bin/sh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   304
+       push (@shells, "/usr/bin/tcsh") if (stat ("/usr/bin/tcsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   305
+       push (@shells, "/usr/bin/zsh") if (stat ("/usr/bin/zsh"));
e7524d60f11c 2008-11-14 Jim Li <[email protected]>
jim
parents: 13240
diff changeset
   306
+       push (@shells, "/usr/xpg4/bin/sh") if (stat ("/usr/xpg4/bin/sh"));
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   307
+       $$hash{"shelldb"} = \@shells;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   308
+     }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   309
+     return;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   310
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   311
+  
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   312
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   313
   while (<$ifh>)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   314
   {
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   315
@@ -879,6 +1063,11 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   316
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   317
     $command = "$cmd_pw usermod -n " . $username . " -c \'" . $comment . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   318
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   319
+  elsif ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   320
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   321
+    ($fname, $office, $office_phone, $home_phone) = @line;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   322
+    $command = "$cmd_usermod" . " -c \'" . $fname . "\' " . $username; 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   323
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   324
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   325
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   326
     ($fname, $office, $office_phone, $home_phone) = @line;
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   327
@@ -886,7 +1075,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   328
     $fname = "-f \'" . $fname . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   329
     $home_phone = "-h \'" . $home_phone . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   330
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   331
-    if ($gst_dist =~ /^debian/  || $gst_dist =~ /^archlinux/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   332
+    if ($gst_dist =~ /^debian/  || $gst_dist =~ /^archlinux/ || $gst_dist =~ /^nexenta/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   333
     {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   334
       $office = "-r \'" . $office . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   335
       $office_phone = "-w \'" . $office_phone . "\'";
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   336
@@ -903,6 +1092,30 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   337
   &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   338
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   339
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   340
+$service = "passwd";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   341
+$username = "";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   342
+$newpassword = "";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   343
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   344
+sub my_conv_func {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   345
+  my @res;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   346
+  while ( @_ ) {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   347
+      my $code = shift;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   348
+      my $msg = shift;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   349
+      my $ans = "";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   350
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   351
+      $ans = $username if ($code == PAM_PROMPT_ECHO_ON() );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   352
+      if ($code == PAM_PROMPT_ECHO_OFF() ) {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   353
+        $ans = $newpassword;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   354
+        $ans = $newpassword;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   355
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   356
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   357
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   358
+      push @res, (PAM_SUCCESS(),$ans);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   359
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   360
+  push @res, PAM_SUCCESS();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   361
+  return @res;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   362
+}
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   363
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   364
 sub add_user
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   365
 {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   366
 	my ($data) = @_;
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   367
@@ -932,6 +1145,56 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   368
     print $pwdpipe $$data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   369
     &gst_file_close ($pwdpipe);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   370
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   371
+  elsif ($gst_dist =~ /^nexenta/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   372
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   373
+    my $pwdpipe;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   374
+    $home_parents = $$data[$users_prop_map{"home"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   375
+    $home_parents =~ s/\/+[^\/]+\/*$//;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   376
+    &gst_file_run ("$tool_mkdir -p $home_parents");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   377
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   378
+    $command = "$cmd_useradd" . " -d \'" . $$data[$users_prop_map{"home"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   379
+     "\' -g \'"    . $$data[$users_prop_map{"gid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   380
+     "\' -s \'"    . $$data[$users_prop_map{"shell"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   381
+     "\' -u \'"    . $$data[$users_prop_map{"uid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   382
+     "\' \'"       . $$data[$users_prop_map{"login"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   383
+    &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   384
+    &gst_file_run("echo " . $$data[$users_prop_map{"login"}] . ":" . $$data[$users_prop_map{"password"}] . " | chpasswd -e");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   385
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   386
+  elsif ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   387
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   388
+    $home_parents = $$data[$users_prop_map{"home"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   389
+    $home_parents =~ s/\/+[^\/]+\/*$//;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   390
+    &gst_file_run ("$tool_mkdir -p $home_parents");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   391
+
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   392
+    $command = "$cmd_useradd";
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   393
+    if ($$data[$users_prop_map{"rbac"}] ne undef ) {
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   394
+      my (@profiles, $old_user_profiles, $new_user_profiles );
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   395
+      $new_user_profiles = $$data[$users_prop_map{"rbac"}];
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   396
+      @profiles = ();
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   397
+      push( @profiles, @$new_user_profiles );
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   398
+      if ( $#profiles >= 0 ) {
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   399
+        my $profiles_str = "";
11808
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   400
+        my $def_profiles = read_rbac_default_profiles();
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   401
+        foreach ( @profiles ) {
11808
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   402
+          next if ( exists ($def_profiles->{$_}) );
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   403
+          $profiles_str .= ',' unless ( $profiles_str eq "" );
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   404
+          $profiles_str .= $_;
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   405
+        }
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   406
+        $command .= " -P \'" . $profiles_str . "\'";
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   407
+      }
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   408
+    }
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   409
+
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   410
+    $command .= " -d \'" . $$data[$users_prop_map{"home"}] .
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   411
+     "\' -g \'"    . $$data[$users_prop_map{"gid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   412
+     "\' -m -s \'"    . $$data[$users_prop_map{"shell"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   413
+     "\' -u \'"    . $$data[$users_prop_map{"uid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   414
+     "\' \'"       . $$data[$users_prop_map{"login"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   415
+    &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   416
+    $username = $$data[$users_prop_map{"login"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   417
+    $newpassword = $$data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   418
+    ref($pamh = new Authen::PAM($service, $username, \&my_conv_func));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   419
+    $pamh->pam_chauthtok(PAM_NO_AUTHTOK_CHECK());
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   420
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   421
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   422
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   423
     $home_parents = $$data[$users_prop_map{"home"}];
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   424
@@ -967,9 +1230,109 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   425
      " -H 0"; # pw(8) reads password from STDIN
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   426
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   427
     $pwdpipe = &gst_file_run_pipe($command, $GST_FILE_WRITE);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   428
-    print $pwdpipe $$data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   429
+    print $pwdpipe $$new_data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   430
     &gst_file_close ($pwdpipe);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   431
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   432
+  elsif ($gst_dist =~ /^nexenta/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   433
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   434
+    $command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   435
+     "\' -g \'" . $$new_data[$users_prop_map{"gid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   436
+     "\' -l \'" . $$new_data[$users_prop_map{"login"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   437
+     "\' -s \'" . $$new_data[$users_prop_map{"shell"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   438
+     "\' -u \'" . $$new_data[$users_prop_map{"uid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   439
+     "\' \'" . $$old_data[$users_prop_map{"login"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   440
+    &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   441
+    &gst_file_run("echo " . $$new_data[$users_prop_map{"login"}] . ":" . $$new_data[$users_prop_map{"password"}] . " | chpasswd -e");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   442
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   443
+  elsif ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   444
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   445
+    $command = "$cmd_usermod" ;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   446
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   447
+    $command .= " -u \'" . $$new_data[$users_prop_map{"uid"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   448
+        if ( $$new_data[$users_prop_map{"uid"}] ne $$old_data[$users_prop_map{"uid"}]  );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   449
+    $command .= " -g \'" . $$new_data[$users_prop_map{"gid"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   450
+        if ( $$new_data[$users_prop_map{"gid"}] ne $$old_data[$users_prop_map{"gid"}]  );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   451
+    $command .= " -d \'" . $$new_data[$users_prop_map{"home"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   452
+        if ( $$new_data[$users_prop_map{"home"}] ne $$old_data[$users_prop_map{"home"}]  );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   453
+    $command .= " -s \'" . $$new_data[$users_prop_map{"shell"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   454
+        if ( $$new_data[$users_prop_map{"shell"}] ne $$old_data[$users_prop_map{"shell"}]  );
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   455
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   456
+    if ($$new_data[$users_prop_map{"rbac"}] ne undef ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   457
+      my (@profiles, $old_user_profiles, $new_user_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   458
+      $old_user_profiles = $$old_data[$users_prop_map{"rbac"}];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   459
+      $new_user_profiles = $$new_data[$users_prop_map{"rbac"}];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   460
+      @profiles = ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   461
+      if ( $old_user_profiles eq undef ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   462
+        # All new profiles, so just use directly
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   463
+        &gst_report("RBAC profiles created for ". $$old_data[$users_prop_map{"login"}] );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   464
+        push( @profiles, @$new_user_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   465
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   466
+      else {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   467
+        my @sorted_old_user_profiles = sort(@$old_user_profiles);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   468
+        my @sorted_new_user_profiles = sort(@$new_user_profiles);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   469
+        if ( &arr_cmp_recurse( \@sorted_new_user_profiles, \@sorted_old_user_profiles) ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   470
+          &gst_report("RBAC profiles changed for ". $$old_data[$users_prop_map{"login"}] );
8604
c31bc94b8fd9 2006-11-18 Darren Kenny <[email protected]>
dkenny
parents: 8436
diff changeset
   471
+          push( @profiles, @$new_user_profiles ); # Copy unsorted list
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   472
+        }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   473
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   474
+      if ( $#profiles >= 0 ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   475
+        my $profiles_str = "";
11808
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   476
+        my $def_profiles = read_rbac_default_profiles();
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   477
+        foreach ( @profiles ) {
11808
0351aab173c0 2008-03-06 Jim Li <[email protected]>
jim
parents: 11320
diff changeset
   478
+          next if ( exists ($def_profiles->{$_}) );
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   479
+          $profiles_str .= ',' unless ( $profiles_str eq "" );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   480
+          $profiles_str .= $_;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   481
+        }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   482
+        $command .= " -P \'" . $profiles_str . "\'";
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   483
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   484
+    }
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   485
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   486
+    if ($$new_data[$users_prop_map{"role"}] ne undef ) {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   487
+      my (@roles, $old_user_roles, $new_user_roles );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   488
+      $old_user_roles = $$old_data[$users_prop_map{"role"}];
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   489
+      $new_user_roles = $$new_data[$users_prop_map{"role"}];
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   490
+      @roles = ();
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   491
+      if ( $old_user_roles eq undef ) {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   492
+        # All new roles, so just use directly
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   493
+        &gst_report("RBAC roles created for ". $$old_data[$users_prop_map{"login"}] );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   494
+        push( @roles, @$new_user_roles );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   495
+      }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   496
+      else {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   497
+        my @sorted_old_user_roles = sort(@$old_user_roles);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   498
+        my @sorted_new_user_roles = sort(@$new_user_roles);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   499
+        if ( &arr_cmp_recurse( \@sorted_new_user_roles, \@sorted_old_user_roles) ) {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   500
+          &gst_report("RBAC roles changed for ". $$old_data[$users_prop_map{"login"}] );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   501
+          push( @roles, @$new_user_roles ); # Copy unsorted list
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   502
+        }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   503
+      }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   504
+      if ( $#roles >= 0 ) {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   505
+        my $roles_str = "";
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   506
+        foreach ( @roles ) {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   507
+          $roles_str .= ',' unless ( $roles_str eq "" );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   508
+          $roles_str .= $_;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   509
+        }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   510
+        $command .= " -R \'" . $roles_str . "\'";
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   511
+      } else {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   512
+        $command .= " -R \'\'";
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   513
+      }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   514
+    }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   515
+
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   516
+    # If there's nothing to change, then don't... 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   517
+    if ( $command ne $cmd_usermod ) {
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   518
+        $command .= " \'" . $$old_data[$users_prop_map{"login"}] . "\'";
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   519
+        &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   520
+    }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   521
+    $username = $$old_data[$users_prop_map{"login"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   522
+    $oldpassword = $$old_data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   523
+    $newpassword = $$new_data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   524
+    # Should only change password if old and new differ - this is especially
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   525
+    # important since the old password is usually the "crypted" one!! Only if
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   526
+    # it's different has a user entered a clear string here.
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   527
+    if ( $newpassword ne undef && $newpassword ne $oldpassword ) {
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   528
+        ref($pamh = new Authen::PAM($service, $username, \&my_conv_func));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   529
+        $pamh->pam_chauthtok(PAM_NO_AUTHTOK_CHECK());
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   530
+    }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   531
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   532
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   533
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   534
     $command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   535
@@ -1026,8 +1389,24 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   536
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   537
     foreach $user (@$u)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   538
     {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   539
-      $command = "$cmd_gpasswd -a \'" . $user .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   540
-        "\' " . $$data[$groups_prop_map{"name"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   541
+      if ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   542
+      {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   543
+        my ($groups, @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   544
+        $command = "groups \'" . $user . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   545
+        $groups = &gst_file_run_backtick ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   546
+        chomp ($groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   547
+        @a = split (/ /, $groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   548
+        $groups = join (',', @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   549
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   550
+        $command = "$cmd_usermod -G " . $groups . "," .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   551
+                $$data[$groups_prop_map{"name"}] .  " " .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   552
+                $user . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   553
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   554
+      else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   555
+      {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   556
+        $command = "$cmd_gpasswd -a \'" . $user .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   557
+          "\' " . $$data[$groups_prop_map{"name"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   558
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   559
       &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   560
     }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   561
   }
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   562
@@ -1052,10 +1431,18 @@
11320
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   563
   }
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   564
   else
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   565
   {
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   566
-    $command = "$cmd_groupmod -g \'" . $$new_data[$groups_prop_map{"gid"}] .
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   567
-      "\' -n \'" . $$new_data[$groups_prop_map{"name"}] . "\' " .
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   568
-      "\'" . $$old_data[$groups_prop_map{"name"}] . "\'";
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   569
-  
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   570
+    if ( $$new_data[$groups_propmap{"name"}] eq $$old_data[$group_prop_map{"name"}] )
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   571
+    {
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   572
+      $command = "$cmd_groupmod -g \'" . $$new_data[$groups_prop_map{"gid"}] .
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   573
+        "\' \'" . $$old_data[$groups_prop_map{"name"}] . "\'";
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   574
+    }
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   575
+    else
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   576
+    {
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   577
+      $command = "$cmd_groupmod -g \'" . $$new_data[$groups_prop_map{"gid"}] .
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   578
+        "\' -n \'" . $$new_data[$groups_prop_map{"name"}] . "\' " .
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   579
+        "\'" . $$old_data[$groups_prop_map{"name"}] . "\'";
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   580
+    }
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   581
+
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   582
     &gst_file_run ($command);
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   583
 	
d94d62fd42bc 2007-12-14 Jim Li <[email protected]>
jim
parents: 10454
diff changeset
   584
     # Let's see if the users that compose the group have changed.
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   585
@@ -1069,25 +1456,62 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   586
       $max_o = $#$o;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   587
       for ($i = 0, $j = 0; $i <= &max ($max_n, $max_o); ) {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   588
         $r = $$n[$i] cmp $$o[$j];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   589
-        $r *= -1 if (($$o[$j] eq "") || ($$n[$i] eq ""));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   590
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   591
-        if ($r < 0) { # add this user to the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   592
-          $command = "$cmd_gpasswd -a \'" . $$n[$i] . "\' \'" . 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   593
-            $$new_data[$groups_prop_map{"name"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   594
+        if ($r > 0) { # add this user to the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   595
+          if ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   596
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   597
+            my ($groups, @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   598
+            $command = "groups \'" . $$n[$i] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   599
+            $groups = &gst_file_run_backtick ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   600
+            chomp ($groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   601
+            @a = split (/ /, $groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   602
+            $groups = join (',', @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   603
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   604
+            $command = "$cmd_usermod -G " . $groups . "," .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   605
+                $$new_data[$groups_prop_map{"name"}] .  " " .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   606
+                $$n[$i] . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   607
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   608
+          else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   609
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   610
+            $command = "$cmd_gpasswd -a " . $$n[$i] . " " .  $$new_data[$groups_prop_map{"name"}] . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   611
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   612
           $i ++;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   613
-				
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   614
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   615
           &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   616
-			  } elsif ($r > 0) { # delete the user from the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   617
-          $command = "$cmd_gpasswd -d \'" . $$o[$j] . "\' \'" . 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   618
-            $$new_data[$groups_prop_map{"name"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   619
+        } elsif ($r < 0) { # delete the user from the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   620
+          if ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   621
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   622
+            my ($groups, @a, $k);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   623
+            $command = "groups \'" . $$o[$j] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   624
+            $groups = &gst_file_run_backtick ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   625
+            chomp ($groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   626
+            @a = split (/ /, $groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   627
+            for ($k = 0; $k < $#a + 1; $k++)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   628
+            {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   629
+              if ($a[$k] eq $$new_data[$groups_prop_map{"name"}])
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   630
+              {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   631
+                splice (@a, $k, 1);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   632
+                last;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   633
+              }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   634
+            }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   635
+            $groups = join (',', @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   636
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   637
+            $command = "$cmd_usermod -G " . $groups . " " .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   638
+                $$o[$j] . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   639
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   640
+          else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   641
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   642
+            $command = "$cmd_gpasswd -d \'" . $$o[$j] . "\' \'" .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   643
+              $$new_data[$groups_prop_map{"name"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   644
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   645
           $j ++;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   646
-				
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   647
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   648
           &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   649
-			  } else { # The information is the same. Go to next tuple.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   650
+        } else { # The information is the same. Go to next tuple.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   651
           $i ++; $j ++;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   652
-			  }	
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   653
-		  }	
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   654
-	  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   655
+        }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   656
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   657
+    }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   658
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   659
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   660
 
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   661
@@ -1204,8 +1628,11 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   662
 		elsif ($$tree[0] eq "group_last_modified") { &xml_parse_group_last_modified ($$tree[1], $hash); }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   663
 		elsif ($$tree[0] eq "userdb") { &xml_parse_userdb ($$tree[1], $hash); }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   664
 		elsif ($$tree[0] eq "groupdb") { &xml_parse_groupdb ($$tree[1], $hash); }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   665
+		elsif ($$tree[0] eq "use_md5")  { }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   666
 		elsif ($$tree[0] eq "shelldb")  { }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   667
 		elsif ($$tree[0] eq "profiledb")  { &xml_parse_profiledb ($$tree[1], $hash); }
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   668
+		elsif ($$tree[0] eq "rbacdb")  { } # if rbacdb is there ignore, can't be changed.
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   669
+                elsif ($$tree[0] eq "roledb")  { } # if roledb is there ignore, can't be changed.
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   670
 		else
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   671
 		{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   672
 		  &gst_report ("xml_unexp_tag", $$tree[0]);
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   673
@@ -1268,19 +1695,61 @@
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   674
 
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   675
 	while (@$tree)
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   676
 	{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   677
-		if ($users_prop_map{$$tree[0]} ne undef)
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   678
+		if ($users_prop_map{$$tree[0]} ne undef && $$tree[0] ne "rbac" && $$tree[0] ne "role" )
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   679
 		{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   680
 		  $line[$users_prop_map{$$tree[0]}] = &gst_xml_unquote($$tree[1][2]);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   681
 		}
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   682
-		else
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   683
-		{
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   684
-		  &gst_report ("xml_unexp_tag", $$tree[0]);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   685
-		}
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   686
-		
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   687
-		shift @$tree;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   688
-		shift @$tree;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   689
-	}
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   690
+    elsif ($$tree[0] eq "rbac")
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   691
+    {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   692
+      my $rbac = $$tree[1]; # rbac children
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   693
+      shift @$rbac; # Skip attributes
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   694
+      my $rbac_profiles = $$rbac[1]; # rbac children
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   695
+      shift @$rbac_profiles; # Skip attributes
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   696
 
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   697
+      my @user_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   698
+      # my $users_rbac_profiles = $$hash{"users_rbac_profiles"};
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   699
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   700
+      # if ( $users_rbac_profiles eq undef ) { # Allocate a new one if none exists
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   701
+      #  my %dummy = ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   702
+      #  $users_rbac_profiles = \%dummy;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   703
+      #  $$hash{"users_rbac_profiles"} = $users_rbac_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   704
+      #}
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   705
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   706
+      while (@$rbac_profiles) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   707
+        my $profile = $$rbac_profiles[1][2];
10454
5358e2411d36 2007-09-06 Lin Ma <[email protected]>
lin
parents: 10303
diff changeset
   708
+        push(@user_profiles, $profile );
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   709
+        shift( @$rbac_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   710
+        shift( @$rbac_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   711
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   712
+      #$$users_rbac_profiles{ $line[$users_prop_map{"login"}] } = \@user_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   713
+      #XXX Here
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   714
+		  $line[$users_prop_map{$$tree[0]}] = \@user_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   715
+    }
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   716
+    elsif ($$tree[0] eq "role")
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   717
+    {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   718
+      my $role = $$tree[1]; # role children
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   719
+      shift @$role; # Skip attributes
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   720
+      my $role_lists = $$role[1]; # role children
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   721
+      shift @$role_lists; # Skip attributes
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   722
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   723
+      my @user_roles;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   724
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   725
+      while (@$role_lists) {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   726
+	my $role = $$role_lists[1][2];
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   727
+	push(@user_roles, $role );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   728
+	shift( @$role_lists );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   729
+	shift( @$role_lists );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   730
+      }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   731
+      $line[$users_prop_map{$$tree[0]}] = \@user_roles;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   732
+    }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   733
+    else
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   734
+    {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   735
+      &gst_report ("xml_unexp_tag", $$tree[0]);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   736
+    }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   737
+      shift @$tree;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   738
+      shift @$tree;
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   739
+    }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   740
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   741
   $$users_hash{sprintf ("%06d", $line[0])} = [@line];
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   742
   push (@$users, [@line]);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   743
 }	
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   744
@@ -1323,6 +1792,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   745
 		  if ($$tree[0] eq "users") { $line[$groups_prop_map{$$tree[0]}] = $$tree[1]; }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   746
 			else { $line[$groups_prop_map{$$tree[0]}] = $$tree[1][2]; }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   747
 		}
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   748
+		elsif ($$tree[0] eq "allows_to") { }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   749
 		else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   750
 		{
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   751
 		  &gst_report ("xml_unexp_tag", $$tree[0]);
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   752
@@ -1487,11 +1957,20 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   753
   my ($hash) = @_;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   754
   my ($key, $value, $i, $j, $k);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   755
   my ($passwd_last_modified, $users, $desc);
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   756
+  # my ($users_rbac_profiles);
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   757
+  my ($rbac, $rbac_profiles, $role, $rbac_roles);
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   758
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   759
   $passwd_last_modified = $$hash{"passwd_last_modified"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   760
   $users = $$hash{"users"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   761
   $group_last_modified = $$hash{"group_last_modified"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   762
   $groups = $$hash{"groups"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   763
+  if ( $gst_dist =~ /^solaris/ ) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   764
+    $rbac = $$hash{"rbacdb"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   765
+    $rbac_profiles = $$rbac{"rbac_profiles"};
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   766
+    $role = $$hash{"roledb"};
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   767
+    $rbac_roles = $$role{"rbac_roles"};
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   768
+    # $users_rbac_profiles = $$hash{"users_rbac_profiles"};
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   769
+  }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   770
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   771
   &gst_xml_print_begin ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   772
 
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   773
@@ -1519,8 +1998,35 @@
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   774
 	  &gst_xml_container_enter ('user');
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   775
 		for ($j = 0; $j < ($#users_prop_array - 1) / 2; $j++)
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   776
     {
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   777
-      &gst_xml_print_pcdata ($users_prop_map{$j}, $$i[$j]);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   778
+      if ( $users_prop_map{$j} eq "rbac" && $gst_dist =~ /^solaris/ ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   779
+        my ($user_profiles);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   780
+        &gst_xml_container_enter ('rbac');
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   781
+        &gst_xml_container_enter ('rbac_profiles');
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   782
+        # $user_profiles = $$users_rbac_profiles{$$i[1]};
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   783
+        $user_profiles = $$i[$j];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   784
+        foreach $prof ( @$user_profiles ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   785
+          &gst_xml_print_pcdata ("rbac_profile", $prof);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   786
+        }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   787
+        &gst_xml_container_leave ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   788
+        &gst_xml_container_leave ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   789
+      }
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   790
+      elsif ( $users_prop_map{$j} eq "role" && $gst_dist =~ /^solaris/ ) {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   791
+        my ($user_roles);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   792
+        &gst_xml_container_enter ('role');
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   793
+        &gst_xml_container_enter ('rbac_roles');
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   794
+        # $user_profiles = $$users_rbac_profiles{$$i[1]};
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   795
+        $user_roles = $$i[$j];
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   796
+        foreach $role ( @$user_roles ) {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   797
+          &gst_xml_print_pcdata ("rbac_role", $role);
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   798
+        }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   799
+        &gst_xml_container_leave ();
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   800
+        &gst_xml_container_leave ();
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   801
+      }
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   802
+      else {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   803
+        &gst_xml_print_pcdata ($users_prop_map{$j}, $$i[$j]);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   804
+      }
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   805
 		}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   806
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   807
 		&gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   808
 	}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   809
 	&gst_xml_container_leave ();
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   810
@@ -1559,9 +2065,47 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   811
 		&gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   812
 	}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   813
 	&gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   814
-  &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   815
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   816
-  &gst_xml_print_end ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   817
+    if ( $gst_dist =~ /^solaris/ ) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   818
+      &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   819
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   820
+      &gst_xml_print_comment ('Now the RBAC Profiles');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   821
+      &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   822
+        
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   823
+      &gst_xml_container_enter ('rbacdb');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   824
+      &gst_xml_container_enter ('rbac_profiles');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   825
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   826
+      foreach $prof ( sort keys %$rbac_profiles )
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   827
+      {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   828
+        &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   829
+        &gst_xml_container_enter ('rbac_profile');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   830
+        &gst_xml_print_pcdata ('name', $prof );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   831
+        &gst_xml_print_pcdata ('description', $$rbac_profiles{$prof} );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   832
+        &gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   833
+      }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   834
+      &gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   835
+      &gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   836
+      &gst_xml_print_vspace ();
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   837
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   838
+      &gst_xml_print_comment ('Now the ROLE');
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   839
+      &gst_xml_print_vspace ();
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   840
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   841
+      &gst_xml_container_enter ('roledb');
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   842
+      &gst_xml_container_enter ('rbac_roles');
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   843
+
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   844
+      foreach $role ( sort keys %$rbac_roles )
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   845
+      {
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   846
+    	&gst_xml_print_vspace ();
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   847
+    	&gst_xml_container_enter ('rbac_role');
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   848
+    	&gst_xml_print_pcdata ('role', $role );
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   849
+    	&gst_xml_container_leave ();
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   850
+      }
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   851
+      &gst_xml_container_leave ();
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   852
+      &gst_xml_container_leave ();
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   853
+      &gst_xml_print_vspace ();
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   854
+    }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   855
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   856
+    &gst_xml_print_end ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   857
 }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   858
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   859
 
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   860
@@ -1590,6 +2134,7 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   861
     &gst_file_backup ($_) foreach (@passwd_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   862
     &gst_file_backup ($_) foreach (@shadow_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   863
     &gst_file_backup ($_) foreach (@group_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   864
+    &gst_file_backup ($_) foreach (@rbac_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   865
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   866
     &write_profiledb ($hash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   867
     &write_group_passwd ($hash);
13240
86b4073e507e 2008-08-22 Jim Li <[email protected]>
jim
parents: 11808
diff changeset
   868
@@ -1627,6 +2172,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   869
 $tool = &gst_init ($name, $version, $description, $directives, @ARGV);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   870
 &gst_platform_ensure_supported ($tool, @platforms);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   871
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   872
+&get_users_prop_array ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   873
 &get_login_defs_prop_array ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   874
 &get_profiles_prop_array   ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   875