patches/system-tools-backends-08-users.diff
author dkenny
Fri, 27 Oct 2006 15:14:00 +0000
changeset 8436 2435bf67bb52
parent 8121 409a296e8eb2
child 8604 c31bc94b8fd9
permissions -rwxr-xr-x
2006-10-27 Darren Kenny <[email protected]> * patches/gnome-system-tools-06-time.diff, patches/gnome-system-tools-07-users.diff, patches/gnome-system-tools-08-services.diff: Remove @pixmapsdir@ reference from .desktop Icon entry. * patches/gnome-system-tools-03-network.diff: Fix error with onboot variable not having valid value by initialising it. Also remove @pixmapsdir@ reference from .desktop Icon entry. * patches/gnome-system-tools-05-shares.diff: Fix bug where two entries (one NFS and the other SAMBA) for the same directory were incorrectly handled and properties dialog was always for the first entry. Also remove @pixmapsdir@ reference from .desktop Icon entry. * patches/system-tools-backends-02-common.diff: Change the gst_file_run sub to trap the stderr output and store it in case of a failure. Also writes this output to the debug log. * patches/system-tools-backends-07-time.diff: Fix sync_now with 1 server selected (bug#6484291) * patches/system-tools-backends-08-users.diff: Add support for setting of RBAC profiles (bug#6484285)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
     1
diff -u system-tools-backends-1.4.2/users-conf.in-orig1 system-tools-backends-1.4.2/users-conf.in
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
     2
--- system-tools-backends-1.4.2/users-conf.in-orig1	2006-01-02 15:48:06.000000000 +0000
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
     3
+++ system-tools-backends-1.4.2/users-conf.in	2006-10-26 11:52:32.542519000 +0100
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" );
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
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
+}
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
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 = (
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
    68
     "key", 0,
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    69
@@ -136,6 +165,7 @@
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    70
     "passwd_disable", 13,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    71
     "reserved", 14,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    72
     "is_shadow", 15,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    73
+    "rbac", 16,
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    74
     "", "");
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    75
 }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
    76
 else
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
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   128
+  'umin'        => 1000,
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/',
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   137
+  'home_prefix' => '/home/$user',
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
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   140
+  'umin'        => 1000,
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) = @_;
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   316
@@ -932,6 +1094,38 @@
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
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   341
+    $command = "$cmd_useradd" . " -d \'" . $$data[$users_prop_map{"home"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   342
+     "\' -g \'"    . $$data[$users_prop_map{"gid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   343
+     "\' -m -s \'"    . $$data[$users_prop_map{"shell"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   344
+     "\' -u \'"    . $$data[$users_prop_map{"uid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   345
+     "\' \'"       . $$data[$users_prop_map{"login"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   346
+    &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   347
+    $username = $$data[$users_prop_map{"login"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   348
+    $newpassword = $$data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   349
+    ref($pamh = new Authen::PAM($service, $username, \&my_conv_func));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   350
+    $pamh->pam_chauthtok(PAM_NO_AUTHTOK_CHECK());
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   351
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   352
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   353
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   354
     $home_parents = $$data[$users_prop_map{"home"}];
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   355
@@ -967,9 +1161,76 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   356
      " -H 0"; # pw(8) reads password from STDIN
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   357
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   358
     $pwdpipe = &gst_file_run_pipe($command, $GST_FILE_WRITE);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   359
-    print $pwdpipe $$data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   360
+    print $pwdpipe $$new_data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   361
     &gst_file_close ($pwdpipe);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   362
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   363
+  elsif ($gst_dist =~ /^nexenta/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   364
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   365
+    $command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   366
+     "\' -g \'" . $$new_data[$users_prop_map{"gid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   367
+     "\' -l \'" . $$new_data[$users_prop_map{"login"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   368
+     "\' -s \'" . $$new_data[$users_prop_map{"shell"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   369
+     "\' -u \'" . $$new_data[$users_prop_map{"uid"}] .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   370
+     "\' \'" . $$old_data[$users_prop_map{"login"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   371
+    &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   372
+    &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
   373
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   374
+  elsif ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   375
+  {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   376
+    $command = "$cmd_usermod" ;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   377
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   378
+    $command .= " -u \'" . $$new_data[$users_prop_map{"uid"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   379
+        if ( $$new_data[$users_prop_map{"uid"}] ne $$old_data[$users_prop_map{"uid"}]  );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   380
+    $command .= " -g \'" . $$new_data[$users_prop_map{"gid"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   381
+        if ( $$new_data[$users_prop_map{"gid"}] ne $$old_data[$users_prop_map{"gid"}]  );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   382
+    $command .= " -d \'" . $$new_data[$users_prop_map{"home"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   383
+        if ( $$new_data[$users_prop_map{"home"}] ne $$old_data[$users_prop_map{"home"}]  );
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   384
+    $command .= " -s \'" . $$new_data[$users_prop_map{"shell"}] . "\'"
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   385
+        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
   386
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   387
+    if ($$new_data[$users_prop_map{"rbac"}] ne undef ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   388
+      my (@profiles, $old_user_profiles, $new_user_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   389
+      $old_user_profiles = $$old_data[$users_prop_map{"rbac"}];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   390
+      $new_user_profiles = $$new_data[$users_prop_map{"rbac"}];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   391
+      @profiles = ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   392
+      if ( $old_user_profiles eq undef ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   393
+        # All new profiles, so just use directly
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   394
+        &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
   395
+        push( @profiles, @$new_user_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   396
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   397
+      else {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   398
+        my @sorted_old_user_profiles = sort(@$old_user_profiles);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   399
+        my @sorted_new_user_profiles = sort(@$new_user_profiles);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   400
+        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
   401
+          &gst_report("RBAC profiles changed for ". $$old_data[$users_prop_map{"login"}] );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   402
+          push( @profiles, @sorted_new_user_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   403
+        }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   404
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   405
+      if ( $#profiles >= 0 ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   406
+        my $profiles_str = "";
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   407
+        foreach ( @profiles ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   408
+          $profiles_str .= ',' unless ( $profiles_str eq "" );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   409
+          $profiles_str .= $_;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   410
+        }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   411
+        $command .= " -P \'" . $profiles_str . "\'";
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
+    }
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   414
+    # If there's nothing to change, then don't... 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   415
+    if ( $command ne $cmd_usermod ) {
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   416
+        $command .= " \'" . $$old_data[$users_prop_map{"login"}] . "\'";
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   417
+        &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   418
+    }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   419
+    $username = $$old_data[$users_prop_map{"login"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   420
+    $oldpassword = $$old_data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   421
+    $newpassword = $$new_data[$users_prop_map{"password"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   422
+    # Should only change password if old and new differ - this is especially
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   423
+    # important since the old password is usually the "crypted" one!! Only if
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   424
+    # 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
   425
+    if ( $newpassword ne undef && $newpassword ne $oldpassword ) {
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   426
+        ref($pamh = new Authen::PAM($service, $username, \&my_conv_func));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   427
+        $pamh->pam_chauthtok(PAM_NO_AUTHTOK_CHECK());
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   428
+    }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   429
+  }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   430
   else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   431
   {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   432
     $command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   433
@@ -1026,8 +1287,24 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   434
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   435
     foreach $user (@$u)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   436
     {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   437
-      $command = "$cmd_gpasswd -a \'" . $user .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   438
-        "\' " . $$data[$groups_prop_map{"name"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   439
+      if ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   440
+      {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   441
+        my ($groups, @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   442
+        $command = "groups \'" . $user . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   443
+        $groups = &gst_file_run_backtick ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   444
+        chomp ($groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   445
+        @a = split (/ /, $groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   446
+        $groups = join (',', @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   447
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   448
+        $command = "$cmd_usermod -G " . $groups . "," .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   449
+                $$data[$groups_prop_map{"name"}] .  " " .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   450
+                $user . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   451
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   452
+      else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   453
+      {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   454
+        $command = "$cmd_gpasswd -a \'" . $user .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   455
+          "\' " . $$data[$groups_prop_map{"name"}];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   456
+      }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   457
       &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   458
     }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   459
   }
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   460
@@ -1069,25 +1346,62 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   461
       $max_o = $#$o;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   462
       for ($i = 0, $j = 0; $i <= &max ($max_n, $max_o); ) {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   463
         $r = $$n[$i] cmp $$o[$j];
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   464
-        $r *= -1 if (($$o[$j] eq "") || ($$n[$i] eq ""));
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   465
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   466
-        if ($r < 0) { # add this user to the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   467
-          $command = "$cmd_gpasswd -a \'" . $$n[$i] . "\' \'" . 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   468
-            $$new_data[$groups_prop_map{"name"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   469
+        if ($r > 0) { # add this user to the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   470
+          if ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   471
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   472
+            my ($groups, @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   473
+            $command = "groups \'" . $$n[$i] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   474
+            $groups = &gst_file_run_backtick ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   475
+            chomp ($groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   476
+            @a = split (/ /, $groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   477
+            $groups = join (',', @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   478
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   479
+            $command = "$cmd_usermod -G " . $groups . "," .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   480
+                $$new_data[$groups_prop_map{"name"}] .  " " .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   481
+                $$n[$i] . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   482
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   483
+          else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   484
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   485
+            $command = "$cmd_gpasswd -a " . $$n[$i] . " " .  $$new_data[$groups_prop_map{"name"}] . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   486
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   487
           $i ++;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   488
-				
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   489
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   490
           &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   491
-			  } elsif ($r > 0) { # delete the user from the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   492
-          $command = "$cmd_gpasswd -d \'" . $$o[$j] . "\' \'" . 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   493
-            $$new_data[$groups_prop_map{"name"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   494
+        } elsif ($r < 0) { # delete the user from the group.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   495
+          if ($gst_dist =~ /^solaris/)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   496
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   497
+            my ($groups, @a, $k);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   498
+            $command = "groups \'" . $$o[$j] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   499
+            $groups = &gst_file_run_backtick ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   500
+            chomp ($groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   501
+            @a = split (/ /, $groups);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   502
+            for ($k = 0; $k < $#a + 1; $k++)
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   503
+            {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   504
+              if ($a[$k] eq $$new_data[$groups_prop_map{"name"}])
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   505
+              {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   506
+                splice (@a, $k, 1);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   507
+                last;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   508
+              }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   509
+            }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   510
+            $groups = join (',', @a);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   511
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   512
+            $command = "$cmd_usermod -G " . $groups . " " .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   513
+                $$o[$j] . " ";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   514
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   515
+          else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   516
+          {
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   517
+            $command = "$cmd_gpasswd -d \'" . $$o[$j] . "\' \'" .
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   518
+              $$new_data[$groups_prop_map{"name"}] . "\'";
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   519
+          }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   520
           $j ++;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   521
-				
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   522
+
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   523
           &gst_file_run ($command);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   524
-			  } else { # The information is the same. Go to next tuple.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   525
+        } else { # The information is the same. Go to next tuple.
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   526
           $i ++; $j ++;
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   527
-			  }	
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   528
-		  }	
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   529
-	  }
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
+    }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   533
   }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   534
 }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   535
 
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   536
@@ -1204,8 +1518,10 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   537
 		elsif ($$tree[0] eq "group_last_modified") { &xml_parse_group_last_modified ($$tree[1], $hash); }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   538
 		elsif ($$tree[0] eq "userdb") { &xml_parse_userdb ($$tree[1], $hash); }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   539
 		elsif ($$tree[0] eq "groupdb") { &xml_parse_groupdb ($$tree[1], $hash); }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   540
+		elsif ($$tree[0] eq "use_md5")  { }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   541
 		elsif ($$tree[0] eq "shelldb")  { }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   542
 		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
   543
+		elsif ($$tree[0] eq "rbacdb")  { } # if rbacdb is there ignore, can't be changed.
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   544
 		else
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   545
 		{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   546
 		  &gst_report ("xml_unexp_tag", $$tree[0]);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   547
@@ -1268,10 +1584,39 @@
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   548
 
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   549
 	while (@$tree)
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   550
 	{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   551
-		if ($users_prop_map{$$tree[0]} ne undef)
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   552
+		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
   553
 		{
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   554
 		  $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
   555
 		}
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   556
+    elsif ($$tree[0] eq "rbac")
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   557
+    {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   558
+      my $rbac = $$tree[1]; # rbac children
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   559
+      shift @$rbac; # Skip attributes
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   560
+      my $rbac_profiles = $$rbac[1]; # rbac children
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   561
+      shift @$rbac_profiles; # Skip attributes
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   562
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   563
+      my @user_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   564
+      # my $users_rbac_profiles = $$hash{"users_rbac_profiles"};
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   565
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   566
+      # 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
   567
+      #  my %dummy = ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   568
+      #  $users_rbac_profiles = \%dummy;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   569
+      #  $$hash{"users_rbac_profiles"} = $users_rbac_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   570
+      #}
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
+      # First include "All" special profile - needs to be always there.
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   573
+      push(@user_profiles, "All" );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   574
+
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   575
+      while (@$rbac_profiles) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   576
+        my $profile = $$rbac_profiles[1][2];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   577
+        push(@user_profiles, $profile ) unless ( $profile eq "All" ); # only include once
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   578
+        shift( @$rbac_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   579
+        shift( @$rbac_profiles );
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   580
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   581
+      #$$users_rbac_profiles{ $line[$users_prop_map{"login"}] } = \@user_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   582
+      #XXX Here
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   583
+		  $line[$users_prop_map{$$tree[0]}] = \@user_profiles;
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   584
+    }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   585
 		else
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
 		  &gst_report ("xml_unexp_tag", $$tree[0]);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   588
@@ -1323,6 +1668,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   589
 		  if ($$tree[0] eq "users") { $line[$groups_prop_map{$$tree[0]}] = $$tree[1]; }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   590
 			else { $line[$groups_prop_map{$$tree[0]}] = $$tree[1][2]; }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   591
 		}
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   592
+		elsif ($$tree[0] eq "allows_to") { }
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   593
 		else
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   594
 		{
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   595
 		  &gst_report ("xml_unexp_tag", $$tree[0]);
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   596
@@ -1487,11 +1833,18 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   597
   my ($hash) = @_;
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   598
   my ($key, $value, $i, $j, $k);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   599
   my ($passwd_last_modified, $users, $desc);
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   600
+  # my ($users_rbac_profiles);
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   601
+  my ($rbac, $rbac_profiles);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   602
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   603
   $passwd_last_modified = $$hash{"passwd_last_modified"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   604
   $users = $$hash{"users"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   605
   $group_last_modified = $$hash{"group_last_modified"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   606
   $groups = $$hash{"groups"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   607
+  if ( $gst_dist =~ /^solaris/ ) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   608
+    $rbac = $$hash{"rbacdb"};
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   609
+    $rbac_profiles = $$rbac{"rbac_profiles"};
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   610
+    # $users_rbac_profiles = $$hash{"users_rbac_profiles"};
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   611
+  }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   612
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   613
   &gst_xml_print_begin ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   614
 
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   615
@@ -1519,8 +1872,23 @@
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   616
 	  &gst_xml_container_enter ('user');
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   617
 		for ($j = 0; $j < ($#users_prop_array - 1) / 2; $j++)
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   618
     {
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   619
-      &gst_xml_print_pcdata ($users_prop_map{$j}, $$i[$j]);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   620
+      if ( $users_prop_map{$j} eq "rbac" && $gst_dist =~ /^solaris/ ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   621
+        my ($user_profiles);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   622
+        &gst_xml_container_enter ('rbac');
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   623
+        &gst_xml_container_enter ('rbac_profiles');
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   624
+        # $user_profiles = $$users_rbac_profiles{$$i[1]};
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   625
+        $user_profiles = $$i[$j];
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   626
+        foreach $prof ( @$user_profiles ) {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   627
+          &gst_xml_print_pcdata ("rbac_profile", $prof);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   628
+        }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   629
+        &gst_xml_container_leave ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   630
+        &gst_xml_container_leave ();
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   631
+      }
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   632
+      else {
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   633
+        &gst_xml_print_pcdata ($users_prop_map{$j}, $$i[$j]);
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   634
+      }
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   635
 		}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   636
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   637
 		&gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   638
 	}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   639
 	&gst_xml_container_leave ();
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   640
@@ -1559,9 +1927,30 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   641
 		&gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   642
 	}
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   643
 	&gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   644
-  &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   645
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   646
-  &gst_xml_print_end ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   647
+    if ( $gst_dist =~ /^solaris/ ) {
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   648
+      &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   649
+
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   650
+      &gst_xml_print_comment ('Now the RBAC Profiles');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   651
+      &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   652
+        
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   653
+      &gst_xml_container_enter ('rbacdb');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   654
+      &gst_xml_container_enter ('rbac_profiles');
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
+      foreach $prof ( sort keys %$rbac_profiles )
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_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   659
+        &gst_xml_container_enter ('rbac_profile');
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   660
+        &gst_xml_print_pcdata ('name', $prof );
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   661
+        &gst_xml_print_pcdata ('description', $$rbac_profiles{$prof} );
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
+      }
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   664
+      &gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   665
+      &gst_xml_container_leave ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   666
+      &gst_xml_print_vspace ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   667
+    }
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_end ();
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   670
 }
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
 
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   673
@@ -1590,6 +1979,7 @@
8121
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   674
     &gst_file_backup ($_) foreach (@passwd_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   675
     &gst_file_backup ($_) foreach (@shadow_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   676
     &gst_file_backup ($_) foreach (@group_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   677
+    &gst_file_backup ($_) foreach (@rbac_names);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   678
 
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   679
     &write_profiledb ($hash);
409a296e8eb2 2006-09-11 Darren Kenny <[email protected]>
darrenk
parents: 7860
diff changeset
   680
     &write_group_passwd ($hash);
8436
2435bf67bb52 2006-10-27 Darren Kenny <[email protected]>
dkenny
parents: 8121
diff changeset
   681
@@ -1627,6 +2017,7 @@
7860
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   682
 $tool = &gst_init ($name, $version, $description, $directives, @ARGV);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   683
 &gst_platform_ensure_supported ($tool, @platforms);
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   684
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   685
+&get_users_prop_array ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   686
 &get_login_defs_prop_array ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   687
 &get_profiles_prop_array   ();
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   688
 
25fd327818d6 Unbump system-tools-backends.
dc144907
parents:
diff changeset
   689