patches/system-tools-backends-08-users.diff
author mattman
Mon, 13 Aug 2007 17:31:35 +0000
changeset 10303 cf9f0c6127b2
parent 9165 e6b1518f60ba
child 10454 5358e2411d36
permissions -rwxr-xr-x
* patches/system-tools-backend-08-users.diff : Bug : 6591890, change UID min for showing users from 1000 to 100 for nexenta and Solaris as default user creation UID's start at 100 for Solaris.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8847
cf3a94737768 2006-12-18 Darren Kenny <[email protected]>
dkenny
parents: 8604
diff changeset
     1
diff -u system-tools-backends-1.4.2/users-conf.in-orig system-tools-backends-1.4.2/users-conf.in
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
     2
--- system-tools-backends-1.4.2/users-conf.in-orig	2006-01-02 15:48:06.000000000 +0000
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
     3
+++ system-tools-backends-1.4.2/users-conf.in	2007-02-02 15:53:30.243300000 +0000
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     4
@@ -47,6 +47,8 @@
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     5
 # pw: modifying users/groups and user/group data on FreeBSD.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     6
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     7
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     8
+use Authen::PAM;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
     9
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    10
 BEGIN {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    11
   $SCRIPTSDIR = "@scriptsdir@";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    12
   if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    13
@@ -74,6 +76,7 @@
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    14
               "mandrake-7.1", "mandrake-7.2", "mandrake-9.0", "mandrake-9.1", "mandrake-9.2",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    15
               "mandrake-10.0", "mandrake-10.1",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    16
               "debian-2.2", "debian-3.0", "debian-sarge",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    17
+               "nexenta-1.0", "solaris-2.11",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    18
               "suse-7.0", "suse-9.0", "suse-9.1", "turbolinux-7.0",
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    19
               "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
    20
               "freebsd-4", "freebsd-5", "freebsd-6",
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    21
@@ -93,6 +96,7 @@
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    22
 @passwd_names =     ( "/etc/passwd" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    23
 @shadow_names =     ( "/etc/shadow", "/etc/master.passwd" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    24
 @group_names =      ( "/etc/group" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    25
+@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
    26
 @login_defs_names = ( "/etc/login.defs", "/etc/adduser.conf" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    27
 @shell_names =      ( "/etc/shells" );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    28
 @skel_dir =         ( "/usr/share/skel", "/etc/skel" );
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    29
@@ -111,13 +115,38 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    30
 $cmd_gpasswd  = &gst_file_locate_tool ("gpasswd");	
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    31
 $cmd_chfn     = &gst_file_locate_tool ("chfn");
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    32
 $cmd_pw       = &gst_file_locate_tool ("pw");
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    33
+$cmd_profiles = &gst_file_locate_tool ("profiles");
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")
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    45
+{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    46
+  @users_prop_array = (
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    47
+    "key", 0,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    48
+    "login", 1,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    49
+    "password", 2,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    50
+    "uid", 3,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    51
+    "gid", 4,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    52
+    "comment", 5,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    53
+    "home", 6,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    54
+    "shell", 7,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    55
+    "last_mod", 8, # Read shadow (5) for these.
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    56
+    "passwd_min_life", 9,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    57
+    "passwd_max_life", 10,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    58
+    "passwd_exp_warn", 11,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    59
+    "passwd_exp_disable", 12,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    60
+    "passwd_disable", 13,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    61
+    "reserved", 14,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    62
+    "is_shadow", 15,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    63
+    "", "");
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    64
+}
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    65
+if ($$tool{"system"} eq "SunOS")
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    66
 {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    67
   @users_prop_array = (
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    68
     "key", 0,
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    69
@@ -136,6 +165,7 @@
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    70
     "passwd_disable", 13,
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    71
     "reserved", 14,
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    72
     "is_shadow", 15,
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    73
+    "rbac", 16,
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    74
     "", "");
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    75
 }
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
    76
 else
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    77
@@ -157,6 +187,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    78
   $users_prop_map {$users_prop_array[$i]} = $users_prop_array[$i + 1];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    79
   $users_prop_map {$users_prop_array[$i + 1]} = $users_prop_array[$i];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    80
 }
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
 %groups_prop_map = ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    84
 @groups_prop_array = (
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    85
@@ -193,6 +224,30 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    86
 %login_defs_prop_map = ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    87
 %profiles_prop_map = ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    88
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    89
+sub read_rbac() {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    90
+  return unless ( $gst_dist =~ /^solaris/ );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    91
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    92
+  my ($hash) = @_;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    93
+  my ($buffer, $line, $profile, $description, $dummy);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    94
+  my (%rbac, %rbac_profiles);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    95
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    96
+  %rbac=();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    97
+  %rbac_profiles=();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    98
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
    99
+  $buffer = &gst_file_buffer_load("/etc/security/prof_attr"); 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   100
+  foreach $line ( @$buffer ) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   101
+    # Skip comments, blank lines and the "All" special profile.
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   102
+    next if ( $line =~ /^#|^\s*$|^All:/ );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   103
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   104
+    ($profile, $dummy, $dummy, $description, $dummy ) = split(/:/, $line, 5);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   105
+    $rbac_profiles{$profile} = &gst_xml_quote($description);
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
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   108
+  $rbac{"rbac_profiles"} = \%rbac_profiles;
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
+  $$hash{"rbacdb"} = \%rbac;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   111
+}
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
 sub get_login_defs_prop_array
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   114
 {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   115
   my @prop_array;
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   116
@@ -315,6 +370,30 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   117
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   118
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   119
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   120
+my $nexenta_logindefs_defaults = {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   121
+  'login_defs'  => 0, # Open Solaris doesn't have a login.defs file.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   122
+  'shell'       => '/bin/bash',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   123
+  'group'       => 'users',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   124
+  'skel_dir'    => '/etc/skel/',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   125
+  'home_prefix' => '/export/home/$user',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   126
+  'gmin'        => 1000,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   127
+  '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
   128
+  'umin'        => 100,
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   129
+  'umax'        => 2147483647, # Based on MAXUID from sys/param.h
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   130
+};
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   131
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   132
+my $solaris_logindefs_defaults = {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   133
+  'login_defs'  => 0, # Open Solaris doesn't have a login.defs file.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   134
+  'shell'       => '/bin/bash',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   135
+  'group'       => 'users',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   136
+  'skel_dir'    => '/etc/skel/',
8847
cf3a94737768 2006-12-18 Darren Kenny <[email protected]>
dkenny
parents: 8604
diff changeset
   137
+  'home_prefix' => '/export/home/$user',
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   138
+  'gmin'        => 1000,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   139
+  '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
   140
+  'umin'        => 100,
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   141
+  'umax'        => 2147483647, # Based on MAXUID from sys/param.h
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   142
+};
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   143
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   144
 my $rh_logindefs_defaults = {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   145
   'shell'       => '/bin/bash',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   146
   'group'       => '$user',
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   147
@@ -362,6 +441,8 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   148
   'debian-2.2'      => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   149
   'debian-3.0'      => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   150
   'debian-sarge'    => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   151
+  'nexenta-1.0'    => $nexenta_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   152
+  'solaris-2.11'    => $solaris_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   153
   'vine-3.0'        => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   154
   'vine-3.1'        => $rh_logindefs_defaults,
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   155
   'gentoo'	        => $gentoo_logindefs_defaults,
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   156
@@ -419,7 +500,8 @@
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   157
 	my ($a1, $a2) = @_;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   158
 	my $i;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   159
 	
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   160
-	return -1 if ($#$a1 != $#$a2);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   161
+  return 0 if ( ( $#$a1 < 0 || $#$a2 < 0 ) && $#$a1 == $#$a2 );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   162
+	return -1 if ($#$a1 != $#$a2 || $#$a1 < 0 || $#$a2 < 0 );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   163
 	
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   164
 	for ($i = 0; $i <= $#$a1; $i++) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   165
 	  if (ref ($$a1[$i]) eq "ARRAY") { # see if this is a reference.
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   166
@@ -453,6 +535,7 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   167
   &read_passwd_shadow (\%hash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   168
   &read_profiledb     (\%hash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   169
   &read_shells        (\%hash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   170
+  &read_rbac          (\%hash) if ( $gst_dist =~ /^solaris/);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   171
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   172
   return \%hash;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   173
 }
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   174
@@ -553,11 +636,11 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   175
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   176
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   177
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   178
-    # Put safe defaults for distros/OS that don't have any defaults file
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   179
-    $logindefs->{"umin"} = '1000';
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   180
-    $logindefs->{"umax"} = '60000';
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   181
-    $logindefs->{"gmin"} = '1000';
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   182
-    $logindefs->{"gmax"} = '60000';
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   183
+    # Put safe defaults for distros/OS that don't have any defaults set
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   184
+    $logindefs->{"umin"} = '1000' unless ($logindefs->{"umin"});
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   185
+    $logindefs->{"umax"} = '60000' unless ($logindefs->{"umax"});
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   186
+    $logindefs->{"gmin"} = '1000' unless ($logindefs->{"gmin"});
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   187
+    $logindefs->{"gmax"} = '60000' unless ($logindefs->{"gmax"});
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   188
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   189
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   190
 
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   191
@@ -602,6 +685,7 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   192
   my ($ifh, @users, %users_hash, $passwd_last_modified);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   193
   my (@line, $copy, %tmphash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   194
   my $login_pos = $users_prop_map{"login"};
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   195
+  #my (%users_rbac_profiles);
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   196
   my $i = 0;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   197
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   198
   # Find the passwd file.
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   199
@@ -660,6 +744,22 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   200
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   201
     &gst_file_close ($ifh);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   202
   }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   203
+  if ($gst_dist =~ /^solaris/ ) {
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   204
+    my $rbac_pos = $users_prop_map{"rbac"};
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   205
+    my ($fd);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   206
+    foreach $user (@users) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   207
+      my @profiles;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   208
+      my $logname = $$user[1];
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   209
+      my $command = $cmd_profiles . " " . $logname;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   210
+      $fd = &gst_file_run_pipe_read( $command );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   211
+      @profiles = <$fd>;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   212
+      &gst_file_close($fd);
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   213
+      # $users_rbac_profiles{$logname} = \@profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   214
+      chomp( @profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   215
+      @{$tmphash{$logname}}[$rbac_pos] = \@profiles;
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   216
+    }
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   217
+    #$$hash{"users_rbac_profiles"} = \%users_rbac_profiles;
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   218
+  }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   219
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   220
   $$hash{"users"}      = \@users;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   221
   $$hash{"users_hash"} = \%users_hash;
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   222
@@ -740,7 +840,40 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   223
   push (@shells, "/bin/false") if (stat ("/bin/false"));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   224
   
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   225
   $ifh = &gst_file_open_read_from_names(@shell_names);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   226
-  return unless $ifh;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   227
+  unless ($ifh)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   228
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   229
+     if ($gst_dist =~ /solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   230
+     {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   231
+       push (@shells, "/bin/bash");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   232
+       push (@shells, "/bin/csh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   233
+       push (@shells, "/bin/jsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   234
+       push (@shells,  "/bin/ksh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   235
+       push (@shells,  "/bin/pfcsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   236
+       push (@shells, "/bin/pfksh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   237
+       push (@shells, "/bin/pfsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   238
+       push (@shells, "/bin/sh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   239
+       push (@shells, "/bin/tcsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   240
+       push (@shells, "/bin/zsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   241
+       push (@shells, "/sbin/jsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   242
+       push (@shells, "/sbin/jsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   243
+       push (@shells, "/sbin/pfsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   244
+       push (@shells, "/sbin/sh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   245
+       push (@shells, "/usr/bin/bash");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   246
+       push (@shells, "/usr/bin/csh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   247
+       push (@shells, "/usr/bin/jsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   248
+       push (@shells, "/usr/bin/ksh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   249
+       push (@shells, "/usr/bin/pfcsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   250
+       push (@shells, "/usr/bin/pfksh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   251
+       push (@shells, "/usr/bin/pfsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   252
+       push (@shells, "/usr/bin/sh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   253
+       push (@shells, "/usr/bin/tcsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   254
+       push (@shells, "/usr/bin/zsh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   255
+       push (@shells, "/usr/xpg4/bin/sh");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   256
+       $$hash{"shelldb"} = \@shells;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   257
+     }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   258
+     return;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   259
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   260
+  
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   261
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   262
   while (<$ifh>)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   263
   {
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   264
@@ -879,6 +1012,11 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   265
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   266
     $command = "$cmd_pw usermod -n " . $username . " -c \'" . $comment . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   267
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   268
+  elsif ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   269
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   270
+    ($fname, $office, $office_phone, $home_phone) = @line;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   271
+    $command = "$cmd_usermod" . " -c \'" . $fname . "\' " . $username; 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   272
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   273
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   274
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   275
     ($fname, $office, $office_phone, $home_phone) = @line;
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   276
@@ -886,7 +1024,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   277
     $fname = "-f \'" . $fname . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   278
     $home_phone = "-h \'" . $home_phone . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   279
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   280
-    if ($gst_dist =~ /^debian/  || $gst_dist =~ /^archlinux/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   281
+    if ($gst_dist =~ /^debian/  || $gst_dist =~ /^archlinux/ || $gst_dist =~ /^nexenta/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   282
     {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   283
       $office = "-r \'" . $office . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   284
       $office_phone = "-w \'" . $office_phone . "\'";
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   285
@@ -903,6 +1041,30 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   286
   &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   287
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   288
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   289
+$service = "passwd";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   290
+$username = "";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   291
+$newpassword = "";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   292
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   293
+sub my_conv_func {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   294
+  my @res;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   295
+  while ( @_ ) {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   296
+      my $code = shift;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   297
+      my $msg = shift;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   298
+      my $ans = "";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   299
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   300
+      $ans = $username if ($code == PAM_PROMPT_ECHO_ON() );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   301
+      if ($code == PAM_PROMPT_ECHO_OFF() ) {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   302
+        $ans = $newpassword;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   303
+        $ans = $newpassword;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   304
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   305
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   306
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   307
+      push @res, (PAM_SUCCESS(),$ans);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   308
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   309
+  push @res, PAM_SUCCESS();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   310
+  return @res;
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
 sub add_user
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   314
 {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   315
 	my ($data) = @_;
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   316
@@ -932,6 +1094,54 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   317
     print $pwdpipe $$data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   318
     &gst_file_close ($pwdpipe);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   319
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   320
+  elsif ($gst_dist =~ /^nexenta/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   321
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   322
+    my $pwdpipe;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   323
+    $home_parents = $$data[$users_prop_map{"home"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   324
+    $home_parents =~ s/\/+[^\/]+\/*$//;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   325
+    &gst_file_run ("$tool_mkdir -p $home_parents");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   326
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   327
+    $command = "$cmd_useradd" . " -d \'" . $$data[$users_prop_map{"home"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   328
+     "\' -g \'"    . $$data[$users_prop_map{"gid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   329
+     "\' -s \'"    . $$data[$users_prop_map{"shell"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   330
+     "\' -u \'"    . $$data[$users_prop_map{"uid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   331
+     "\' \'"       . $$data[$users_prop_map{"login"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   332
+    &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   333
+    &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
   334
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   335
+  elsif ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   336
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   337
+    $home_parents = $$data[$users_prop_map{"home"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   338
+    $home_parents =~ s/\/+[^\/]+\/*$//;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   339
+    &gst_file_run ("$tool_mkdir -p $home_parents");
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   340
+
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   341
+    $command = "$cmd_useradd";
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   342
+    if ($$data[$users_prop_map{"rbac"}] ne undef ) {
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   343
+      my (@profiles, $old_user_profiles, $new_user_profiles );
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   344
+      $new_user_profiles = $$data[$users_prop_map{"rbac"}];
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   345
+      @profiles = ();
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   346
+      push( @profiles, @$new_user_profiles );
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   347
+      if ( $#profiles >= 0 ) {
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   348
+        my $profiles_str = "";
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   349
+        foreach ( @profiles ) {
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   350
+          $profiles_str .= ',' unless ( $profiles_str eq "" );
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   351
+          $profiles_str .= $_;
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   352
+        }
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   353
+        $command .= " -P \'" . $profiles_str . "\'";
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   354
+      }
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   355
+    }
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   356
+
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   357
+    $command .= " -d \'" . $$data[$users_prop_map{"home"}] .
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   358
+     "\' -g \'"    . $$data[$users_prop_map{"gid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   359
+     "\' -m -s \'"    . $$data[$users_prop_map{"shell"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   360
+     "\' -u \'"    . $$data[$users_prop_map{"uid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   361
+     "\' \'"       . $$data[$users_prop_map{"login"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   362
+    &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   363
+    $username = $$data[$users_prop_map{"login"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   364
+    $newpassword = $$data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   365
+    ref($pamh = new Authen::PAM($service, $username, \&my_conv_func));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   366
+    $pamh->pam_chauthtok(PAM_NO_AUTHTOK_CHECK());
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   367
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   368
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   369
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   370
     $home_parents = $$data[$users_prop_map{"home"}];
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   371
@@ -967,9 +1177,76 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   372
      " -H 0"; # pw(8) reads password from STDIN
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   373
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   374
     $pwdpipe = &gst_file_run_pipe($command, $GST_FILE_WRITE);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   375
-    print $pwdpipe $$data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   376
+    print $pwdpipe $$new_data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   377
     &gst_file_close ($pwdpipe);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   378
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   379
+  elsif ($gst_dist =~ /^nexenta/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   380
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   381
+    $command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   382
+     "\' -g \'" . $$new_data[$users_prop_map{"gid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   383
+     "\' -l \'" . $$new_data[$users_prop_map{"login"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   384
+     "\' -s \'" . $$new_data[$users_prop_map{"shell"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   385
+     "\' -u \'" . $$new_data[$users_prop_map{"uid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   386
+     "\' \'" . $$old_data[$users_prop_map{"login"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   387
+    &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   388
+    &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
   389
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   390
+  elsif ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   391
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   392
+    $command = "$cmd_usermod" ;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   393
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   394
+    $command .= " -u \'" . $$new_data[$users_prop_map{"uid"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   395
+        if ( $$new_data[$users_prop_map{"uid"}] ne $$old_data[$users_prop_map{"uid"}]  );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   396
+    $command .= " -g \'" . $$new_data[$users_prop_map{"gid"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   397
+        if ( $$new_data[$users_prop_map{"gid"}] ne $$old_data[$users_prop_map{"gid"}]  );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   398
+    $command .= " -d \'" . $$new_data[$users_prop_map{"home"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   399
+        if ( $$new_data[$users_prop_map{"home"}] ne $$old_data[$users_prop_map{"home"}]  );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   400
+    $command .= " -s \'" . $$new_data[$users_prop_map{"shell"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   401
+        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
   402
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   403
+    if ($$new_data[$users_prop_map{"rbac"}] ne undef ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   404
+      my (@profiles, $old_user_profiles, $new_user_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   405
+      $old_user_profiles = $$old_data[$users_prop_map{"rbac"}];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   406
+      $new_user_profiles = $$new_data[$users_prop_map{"rbac"}];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   407
+      @profiles = ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   408
+      if ( $old_user_profiles eq undef ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   409
+        # All new profiles, so just use directly
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   410
+        &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
   411
+        push( @profiles, @$new_user_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   412
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   413
+      else {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   414
+        my @sorted_old_user_profiles = sort(@$old_user_profiles);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   415
+        my @sorted_new_user_profiles = sort(@$new_user_profiles);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   416
+        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
   417
+          &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
   418
+          push( @profiles, @$new_user_profiles ); # Copy unsorted list
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   419
+        }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   420
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   421
+      if ( $#profiles >= 0 ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   422
+        my $profiles_str = "";
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   423
+        foreach ( @profiles ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   424
+          $profiles_str .= ',' unless ( $profiles_str eq "" );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   425
+          $profiles_str .= $_;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   426
+        }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   427
+        $command .= " -P \'" . $profiles_str . "\'";
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   428
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   429
+    }
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   430
+    # If there's nothing to change, then don't... 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   431
+    if ( $command ne $cmd_usermod ) {
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   432
+        $command .= " \'" . $$old_data[$users_prop_map{"login"}] . "\'";
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   433
+        &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   434
+    }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   435
+    $username = $$old_data[$users_prop_map{"login"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   436
+    $oldpassword = $$old_data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   437
+    $newpassword = $$new_data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   438
+    # Should only change password if old and new differ - this is especially
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   439
+    # important since the old password is usually the "crypted" one!! Only if
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   440
+    # 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
   441
+    if ( $newpassword ne undef && $newpassword ne $oldpassword ) {
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   442
+        ref($pamh = new Authen::PAM($service, $username, \&my_conv_func));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   443
+        $pamh->pam_chauthtok(PAM_NO_AUTHTOK_CHECK());
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   444
+    }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   445
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   446
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   447
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   448
     $command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   449
@@ -1026,8 +1303,24 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   450
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   451
     foreach $user (@$u)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   452
     {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   453
-      $command = "$cmd_gpasswd -a \'" . $user .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   454
-        "\' " . $$data[$groups_prop_map{"name"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   455
+      if ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   456
+      {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   457
+        my ($groups, @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   458
+        $command = "groups \'" . $user . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   459
+        $groups = &gst_file_run_backtick ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   460
+        chomp ($groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   461
+        @a = split (/ /, $groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   462
+        $groups = join (',', @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   463
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   464
+        $command = "$cmd_usermod -G " . $groups . "," .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   465
+                $$data[$groups_prop_map{"name"}] .  " " .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   466
+                $user . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   467
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   468
+      else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   469
+      {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   470
+        $command = "$cmd_gpasswd -a \'" . $user .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   471
+          "\' " . $$data[$groups_prop_map{"name"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   472
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   473
       &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   474
     }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   475
   }
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   476
@@ -1069,25 +1362,62 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   477
       $max_o = $#$o;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   478
       for ($i = 0, $j = 0; $i <= &max ($max_n, $max_o); ) {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   479
         $r = $$n[$i] cmp $$o[$j];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   480
-        $r *= -1 if (($$o[$j] eq "") || ($$n[$i] eq ""));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   481
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   482
-        if ($r < 0) { # add this user to the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   483
-          $command = "$cmd_gpasswd -a \'" . $$n[$i] . "\' \'" . 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   484
-            $$new_data[$groups_prop_map{"name"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   485
+        if ($r > 0) { # add this user to the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   486
+          if ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   487
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   488
+            my ($groups, @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   489
+            $command = "groups \'" . $$n[$i] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   490
+            $groups = &gst_file_run_backtick ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   491
+            chomp ($groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   492
+            @a = split (/ /, $groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   493
+            $groups = join (',', @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   494
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   495
+            $command = "$cmd_usermod -G " . $groups . "," .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   496
+                $$new_data[$groups_prop_map{"name"}] .  " " .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   497
+                $$n[$i] . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   498
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   499
+          else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   500
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   501
+            $command = "$cmd_gpasswd -a " . $$n[$i] . " " .  $$new_data[$groups_prop_map{"name"}] . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   502
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   503
           $i ++;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   504
-				
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   505
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   506
           &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   507
-			  } elsif ($r > 0) { # delete the user from the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   508
-          $command = "$cmd_gpasswd -d \'" . $$o[$j] . "\' \'" . 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   509
-            $$new_data[$groups_prop_map{"name"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   510
+        } elsif ($r < 0) { # delete the user from the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   511
+          if ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   512
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   513
+            my ($groups, @a, $k);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   514
+            $command = "groups \'" . $$o[$j] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   515
+            $groups = &gst_file_run_backtick ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   516
+            chomp ($groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   517
+            @a = split (/ /, $groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   518
+            for ($k = 0; $k < $#a + 1; $k++)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   519
+            {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   520
+              if ($a[$k] eq $$new_data[$groups_prop_map{"name"}])
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   521
+              {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   522
+                splice (@a, $k, 1);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   523
+                last;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   524
+              }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   525
+            }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   526
+            $groups = join (',', @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   527
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   528
+            $command = "$cmd_usermod -G " . $groups . " " .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   529
+                $$o[$j] . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   530
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   531
+          else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   532
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   533
+            $command = "$cmd_gpasswd -d \'" . $$o[$j] . "\' \'" .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   534
+              $$new_data[$groups_prop_map{"name"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   535
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   536
           $j ++;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   537
-				
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   538
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   539
           &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   540
-			  } else { # The information is the same. Go to next tuple.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   541
+        } else { # The information is the same. Go to next tuple.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   542
           $i ++; $j ++;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   543
-			  }	
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   544
-		  }	
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   545
-	  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   546
+        }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   547
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   548
+    }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   549
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   550
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   551
 
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   552
@@ -1204,8 +1534,10 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   553
 		elsif ($$tree[0] eq "group_last_modified") { &xml_parse_group_last_modified ($$tree[1], $hash); }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   554
 		elsif ($$tree[0] eq "userdb") { &xml_parse_userdb ($$tree[1], $hash); }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   555
 		elsif ($$tree[0] eq "groupdb") { &xml_parse_groupdb ($$tree[1], $hash); }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   556
+		elsif ($$tree[0] eq "use_md5")  { }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   557
 		elsif ($$tree[0] eq "shelldb")  { }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   558
 		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
   559
+		elsif ($$tree[0] eq "rbacdb")  { } # if rbacdb is there ignore, can't be changed.
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   560
 		else
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   561
 		{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   562
 		  &gst_report ("xml_unexp_tag", $$tree[0]);
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   563
@@ -1268,10 +1600,42 @@
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   564
 
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   565
 	while (@$tree)
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   566
 	{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   567
-		if ($users_prop_map{$$tree[0]} ne undef)
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   568
+		if ($users_prop_map{$$tree[0]} ne undef && $$tree[0] ne "rbac")
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   569
 		{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   570
 		  $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
   571
 		}
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   572
+    elsif ($$tree[0] eq "rbac")
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   573
+    {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   574
+      my $rbac = $$tree[1]; # rbac children
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   575
+      shift @$rbac; # Skip attributes
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   576
+      my $rbac_profiles = $$rbac[1]; # rbac children
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   577
+      shift @$rbac_profiles; # Skip attributes
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   578
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   579
+      my @user_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   580
+      # my $users_rbac_profiles = $$hash{"users_rbac_profiles"};
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   581
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   582
+      # 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
   583
+      #  my %dummy = ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   584
+      #  $users_rbac_profiles = \%dummy;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   585
+      #  $$hash{"users_rbac_profiles"} = $users_rbac_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   586
+      #}
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   587
+
8604
c31bc94b8fd9 2006-11-18 Darren Kenny <[email protected]>
dkenny
parents: 8436
diff changeset
   588
+      my $basic_solaris_user = 0; # will be set to 1 if we find this profile in list
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   589
+      while (@$rbac_profiles) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   590
+        my $profile = $$rbac_profiles[1][2];
8604
c31bc94b8fd9 2006-11-18 Darren Kenny <[email protected]>
dkenny
parents: 8436
diff changeset
   591
+        $basic_solaris_user = 1 if ( $profile eq "Basic Solaris User" ); # take note
c31bc94b8fd9 2006-11-18 Darren Kenny <[email protected]>
dkenny
parents: 8436
diff changeset
   592
+        push(@user_profiles, $profile ) unless ( $profile eq "All" || $profile eq "Basic Solaris User" ); # only include once
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   593
+        shift( @$rbac_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   594
+        shift( @$rbac_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   595
+      }
8604
c31bc94b8fd9 2006-11-18 Darren Kenny <[email protected]>
dkenny
parents: 8436
diff changeset
   596
+      # First include "All" special profile - needs to be always there.
c31bc94b8fd9 2006-11-18 Darren Kenny <[email protected]>
dkenny
parents: 8436
diff changeset
   597
+      push(@user_profiles, "All" );
c31bc94b8fd9 2006-11-18 Darren Kenny <[email protected]>
dkenny
parents: 8436
diff changeset
   598
+      push(@user_profiles, "Basic Solaris User" ) if ( $basic_solaris_user == 1 );
c31bc94b8fd9 2006-11-18 Darren Kenny <[email protected]>
dkenny
parents: 8436
diff changeset
   599
+
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   600
+      #$$users_rbac_profiles{ $line[$users_prop_map{"login"}] } = \@user_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   601
+      #XXX Here
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   602
+		  $line[$users_prop_map{$$tree[0]}] = \@user_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   603
+    }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   604
 		else
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   605
 		{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   606
 		  &gst_report ("xml_unexp_tag", $$tree[0]);
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   607
@@ -1323,6 +1687,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   608
 		  if ($$tree[0] eq "users") { $line[$groups_prop_map{$$tree[0]}] = $$tree[1]; }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   609
 			else { $line[$groups_prop_map{$$tree[0]}] = $$tree[1][2]; }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   610
 		}
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   611
+		elsif ($$tree[0] eq "allows_to") { }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   612
 		else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   613
 		{
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   614
 		  &gst_report ("xml_unexp_tag", $$tree[0]);
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   615
@@ -1487,11 +1852,18 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   616
   my ($hash) = @_;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   617
   my ($key, $value, $i, $j, $k);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   618
   my ($passwd_last_modified, $users, $desc);
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   619
+  # my ($users_rbac_profiles);
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   620
+  my ($rbac, $rbac_profiles);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   621
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   622
   $passwd_last_modified = $$hash{"passwd_last_modified"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   623
   $users = $$hash{"users"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   624
   $group_last_modified = $$hash{"group_last_modified"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   625
   $groups = $$hash{"groups"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   626
+  if ( $gst_dist =~ /^solaris/ ) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   627
+    $rbac = $$hash{"rbacdb"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   628
+    $rbac_profiles = $$rbac{"rbac_profiles"};
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   629
+    # $users_rbac_profiles = $$hash{"users_rbac_profiles"};
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   630
+  }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   631
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   632
   &gst_xml_print_begin ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   633
 
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   634
@@ -1519,8 +1891,23 @@
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   635
 	  &gst_xml_container_enter ('user');
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   636
 		for ($j = 0; $j < ($#users_prop_array - 1) / 2; $j++)
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   637
     {
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   638
-      &gst_xml_print_pcdata ($users_prop_map{$j}, $$i[$j]);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   639
+      if ( $users_prop_map{$j} eq "rbac" && $gst_dist =~ /^solaris/ ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   640
+        my ($user_profiles);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   641
+        &gst_xml_container_enter ('rbac');
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   642
+        &gst_xml_container_enter ('rbac_profiles');
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   643
+        # $user_profiles = $$users_rbac_profiles{$$i[1]};
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   644
+        $user_profiles = $$i[$j];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   645
+        foreach $prof ( @$user_profiles ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   646
+          &gst_xml_print_pcdata ("rbac_profile", $prof);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   647
+        }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   648
+        &gst_xml_container_leave ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   649
+        &gst_xml_container_leave ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   650
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   651
+      else {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   652
+        &gst_xml_print_pcdata ($users_prop_map{$j}, $$i[$j]);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   653
+      }
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   654
 		}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   655
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   656
 		&gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   657
 	}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   658
 	&gst_xml_container_leave ();
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   659
@@ -1559,9 +1946,30 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   660
 		&gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   661
 	}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   662
 	&gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   663
-  &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   664
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   665
-  &gst_xml_print_end ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   666
+    if ( $gst_dist =~ /^solaris/ ) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   667
+      &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   668
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   669
+      &gst_xml_print_comment ('Now the RBAC Profiles');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   670
+      &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   671
+        
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   672
+      &gst_xml_container_enter ('rbacdb');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   673
+      &gst_xml_container_enter ('rbac_profiles');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   674
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   675
+      foreach $prof ( sort keys %$rbac_profiles )
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   676
+      {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   677
+        &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   678
+        &gst_xml_container_enter ('rbac_profile');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   679
+        &gst_xml_print_pcdata ('name', $prof );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   680
+        &gst_xml_print_pcdata ('description', $$rbac_profiles{$prof} );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   681
+        &gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   682
+      }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   683
+      &gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   684
+      &gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   685
+      &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   686
+    }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   687
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   688
+    &gst_xml_print_end ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   689
 }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   690
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   691
 
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   692
@@ -1590,6 +1998,7 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   693
     &gst_file_backup ($_) foreach (@passwd_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   694
     &gst_file_backup ($_) foreach (@shadow_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   695
     &gst_file_backup ($_) foreach (@group_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   696
+    &gst_file_backup ($_) foreach (@rbac_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   697
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   698
     &write_profiledb ($hash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   699
     &write_group_passwd ($hash);
9165
e6b1518f60ba 2007-02-02 Darren Kenny <[email protected]>
dkenny
parents: 8847
diff changeset
   700
@@ -1627,6 +2036,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   701
 $tool = &gst_init ($name, $version, $description, $directives, @ARGV);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   702
 &gst_platform_ensure_supported ($tool, @platforms);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   703
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   704
+&get_users_prop_array ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   705
 &get_login_defs_prop_array ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   706
 &get_profiles_prop_array   ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   707
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   708