1 |
slords |
1.1 |
diff -up e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-modify-unix.supp-groups e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-modify-unix |
2 |
|
|
--- e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-modify-unix.supp-groups 2010-11-07 20:52:51.000000000 -0700 |
3 |
|
|
+++ e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-modify-unix 2010-11-07 20:55:37.000000000 -0700 |
4 |
|
|
@@ -62,25 +62,6 @@ foreach my $u (@users) |
5 |
|
|
die "Account $userName is not a user account; modify user failed.\n" |
6 |
|
|
unless ( ($userName eq 'admin') or ($type eq 'user') ); |
7 |
|
|
|
8 |
|
|
- # cpu usermod called without "-G list,of,supplementary,groups" causes user |
9 |
|
|
- # to be removed from all it's supplementary groups. Thus, to be able to call |
10 |
|
|
- # cpu usermod properly we need to know user supplementary groups. |
11 |
|
|
- |
12 |
|
|
- my $cmd = "/usr/bin/id -G -n '$userName'"; |
13 |
|
|
- my $groups = `$cmd 2>/dev/null`; |
14 |
|
|
- if ($? != 0) |
15 |
|
|
- { |
16 |
|
|
- die "Failed to get supplementary group list for $userName.\n"; |
17 |
|
|
- } |
18 |
|
|
- chomp ($groups); |
19 |
|
|
- |
20 |
|
|
- my @groupList = split (/\s+/, $groups); |
21 |
|
|
- @groupList = grep (!/^$userName$/, @groupList); |
22 |
|
|
- |
23 |
|
|
- # root user/group isn't in ldap |
24 |
|
|
- @groupList = grep (!/^root$/, @groupList); |
25 |
|
|
- $groups = join (',', sort (@groupList)); |
26 |
|
|
- |
27 |
|
|
setpwent; |
28 |
|
|
my ($comment, $shell) = (getpwnam($userName))[5,8]; |
29 |
|
|
endpwent; |
30 |
|
|
@@ -100,7 +81,7 @@ foreach my $u (@users) |
31 |
|
|
or ( $x = 255, warn "Failed to modify shell of (unix) account $userName.\n" ); |
32 |
|
|
} |
33 |
|
|
|
34 |
|
|
- system("/usr/sbin/cpu", "usermod", '-s', "$new_shell", "-G", "$groups", $userName) == 0 |
35 |
|
|
+ system("/usr/sbin/cpu", "usermod", '-s', "$new_shell", $userName) == 0 |
36 |
|
|
or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify shell of (ldap) account $userName.\n" ); |
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
@@ -120,7 +101,7 @@ foreach my $u (@users) |
40 |
|
|
or ( $x = 255, warn "Failed to modify comment of (unix) account $userName.\n" ); |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
- system("/usr/sbin/cpu", "usermod", "-c", "$first $last", "-f", "$first", "-E", "$last", "-G", "$groups", $userName) == 0 |
44 |
|
|
+ system("/usr/sbin/cpu", "usermod", "-c", "$first $last", "-f", "$first", "-E", "$last", $userName) == 0 |
45 |
|
|
or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify comment/name of (ldap) account $userName.\n" ); |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
@@ -137,7 +118,7 @@ foreach my $u (@users) |
49 |
|
|
print $tmpattr "l: $new_city\n"; |
50 |
|
|
print $tmpattr "street: $new_street\n"; |
51 |
|
|
$tmpattr->flush(); |
52 |
|
|
- system("/usr/sbin/cpu", "usermod", "-a", "$tmpattr", "-e", "$userName\@$domain", "-G", "$groups", $userName) == 0 |
53 |
|
|
+ system("/usr/sbin/cpu", "usermod", "-a", "$tmpattr", "-e", "$userName\@$domain", $userName) == 0 |
54 |
|
|
or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify email of (ldap) account $userName.\n" ); |
55 |
|
|
undef $tmpattr; |
56 |
|
|
} |