61 |
+ "/usr/sbin/cpu", "groupadd", |
+ "/usr/sbin/cpu", "groupadd", |
62 |
+ "-g", $gid, |
+ "-g", $gid, |
63 |
+ $groupName |
+ $groupName |
64 |
+ ) == 0 or ( $x = 255, warn "Failed to create (ldap) group $groupName.\n" ); |
+ ) == 0 or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to create (ldap) group $groupName.\n" ); |
65 |
+ |
+ |
66 |
+# Now create the dummy user account (in ldap) |
+# Now create the dummy user account (in ldap) |
67 |
+system( |
+system( |
74 |
+ "-s", |
+ "-s", |
75 |
+ "/bin/false", |
+ "/bin/false", |
76 |
+ "$groupName" |
+ "$groupName" |
77 |
+ ) == 0 or ( $x = 255, warn "Failed to create (ldap) user $groupName.\n" ); |
+ ) == 0 or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to create (ldap) user $groupName.\n" ); |
78 |
+ |
+ |
79 |
# Release lock if we have one |
# Release lock if we have one |
80 |
$lock && esmith::lockfile::UnlockFile($lock); |
$lock && esmith::lockfile::UnlockFile($lock); |
111 |
+ $groups = join (',', sort (@groupList)); |
+ $groups = join (',', sort (@groupList)); |
112 |
+ |
+ |
113 |
+ system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-G", "$groups", "$member") == 0 |
+ system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-G", "$groups", "$member") == 0 |
114 |
+ or ( $x = 255, warn "Failed to modify supplementary (ldap) group list for $member.\n" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to modify supplementary (ldap) group list for $member.\n" ); |
115 |
} |
} |
116 |
|
|
117 |
-exit (0); |
-exit (0); |
150 |
|
|
151 |
-exit (0); |
-exit (0); |
152 |
+system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "userdel", "$groupName") == 0 |
+system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "userdel", "$groupName") == 0 |
153 |
+ or ( $x = 255, warn "Failed to delete dummy user for (ldap) group $groupName.\n" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to delete dummy user for (ldap) group $groupName.\n" ); |
154 |
+ |
+ |
155 |
+system("/usr/sbin/cpu", "groupdel", "$groupName") == 0 |
+system("/usr/sbin/cpu", "groupdel", "$groupName") == 0 |
156 |
+ or ( $x = 255, warn "Failed to delete (ldap) group $groupName.\n" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to delete (ldap) group $groupName.\n" ); |
157 |
+ |
+ |
158 |
+exit ($x); |
+exit ($x); |
159 |
diff -up e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-modify-unix.better-ldap e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-modify-unix |
diff -up e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-modify-unix.better-ldap e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-modify-unix |
185 |
} |
} |
186 |
|
|
187 |
+ system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-c", "$groupDesc", "$groupName") == 0 |
+ system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-c", "$groupDesc", "$groupName") == 0 |
188 |
+ or ( $x = 255, warn "Failed to modify (ldap) group description for $groupName.\n" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to modify (ldap) group description for $groupName.\n" ); |
189 |
+ |
+ |
190 |
my ($name, $passwd, $gid, $members) = getgrnam ($groupName); |
my ($name, $passwd, $gid, $members) = getgrnam ($groupName); |
191 |
my @oldMembers = split (/\s+/, $members); |
my @oldMembers = split (/\s+/, $members); |
225 |
+ $groups = join (',', sort (@groupList)); |
+ $groups = join (',', sort (@groupList)); |
226 |
+ |
+ |
227 |
+ system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-G", "$groups", "$member") == 0 |
+ system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-G", "$groups", "$member") == 0 |
228 |
+ or ( $x = 255, warn "Failed to modify supplementary (ldap) group list for $member.\n" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to modify supplementary (ldap) group list for $member.\n" ); |
229 |
} |
} |
230 |
} |
} |
231 |
|
|
301 |
+ "-g", |
+ "-g", |
302 |
+ $gid, |
+ $gid, |
303 |
+ $userName |
+ $userName |
304 |
+ ) == 0 or ( $x = 255, warn "Failed to create (ldap) group $userName.\n" ); |
+ ) == 0 or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to create (ldap) group $userName.\n" ); |
305 |
+ |
+ |
306 |
+# Now create the user account (in ldap) |
+# Now create the user account (in ldap) |
307 |
+system( |
+system( |
317 |
+ "-k/etc/e-smith/skel/user", |
+ "-k/etc/e-smith/skel/user", |
318 |
+ "-s", "$shell", |
+ "-s", "$shell", |
319 |
+ $userName |
+ $userName |
320 |
+ ) == 0 or ( $x = 255, warn "Failed to create (ldap) account $userName.\n" ); |
+ ) == 0 or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to create (ldap) account $userName.\n" ); |
321 |
+ |
+ |
322 |
|
|
323 |
# Release lock if we have one |
# Release lock if we have one |
339 |
+ and ( $x = 255, warn "Could not lock (unix) password for $userName\n" ); |
+ and ( $x = 255, warn "Could not lock (unix) password for $userName\n" ); |
340 |
} |
} |
341 |
+system("/usr/sbin/cpu", "usermod", "-L", "$userName") |
+system("/usr/sbin/cpu", "usermod", "-L", "$userName") |
342 |
+ and ( $x = 255, warn "Could not lock (ldap) password for $userName\n" ); |
+ and ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Could not lock (ldap) password for $userName\n" ); |
343 |
system("/usr/bin/smbpasswd", "-a", "-d", "$userName") |
system("/usr/bin/smbpasswd", "-a", "-d", "$userName") |
344 |
- and warn("Could not lock smb password for $userName\n");; |
- and warn("Could not lock smb password for $userName\n");; |
345 |
+ and ( $x = 255, warn "Could not lock (smb) password for $userName\n" ); |
+ and ( $x = 255, warn "Could not lock (smb) password for $userName\n" ); |
384 |
|
|
385 |
-exit (0); |
-exit (0); |
386 |
+system("/usr/sbin/cpu", "userdel", "-r", $userName) == 0 |
+system("/usr/sbin/cpu", "userdel", "-r", $userName) == 0 |
387 |
+ or ( $x = 255, warn "Failed to delete (ldap) account $userName.\n" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to delete (ldap) account $userName.\n" ); |
388 |
+ |
+ |
389 |
+system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "groupdel", $userName) == 0 |
+system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "groupdel", $userName) == 0 |
390 |
+ or ( $x = 255, warn "Failed to delete (ldap) group account $userName.\n" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to delete (ldap) group account $userName.\n" ); |
391 |
+ |
+ |
392 |
+exit ($x); |
+exit ($x); |
393 |
diff -up e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-lock-passwd.better-ldap e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-lock-passwd |
diff -up e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-lock-passwd.better-ldap e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-lock-passwd |
418 |
+ or ( $x = 255, warn "Error locking (unix) account $userName" ); |
+ or ( $x = 255, warn "Error locking (unix) account $userName" ); |
419 |
} |
} |
420 |
+ system("/usr/sbin/cpu", "usermod", "-L", $userName) == 0 |
+ system("/usr/sbin/cpu", "usermod", "-L", $userName) == 0 |
421 |
+ or ( $x = 255, warn "Error locking (ldap) account $userName" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Error locking (ldap) account $userName" ); |
422 |
system("/usr/bin/smbpasswd", "-d", $userName) == 0 |
system("/usr/bin/smbpasswd", "-d", $userName) == 0 |
423 |
- or die "Error running /usr/bin/smbpasswd command to lock account $userName"; |
- or die "Error running /usr/bin/smbpasswd command to lock account $userName"; |
424 |
+ or ( $x = 255, warn "Error locking (smb) account $userName" ); |
+ or ( $x = 255, warn "Error locking (smb) account $userName" ); |
473 |
} |
} |
474 |
+ |
+ |
475 |
+ system("/usr/sbin/cpu", "usermod", '-s', "$new_shell", "-G", "$groups", $userName) == 0 |
+ system("/usr/sbin/cpu", "usermod", '-s', "$new_shell", "-G", "$groups", $userName) == 0 |
476 |
+ or ( $x = 255, warn "Failed to modify shell of (ldap) account $userName.\n" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to modify shell of (ldap) account $userName.\n" ); |
477 |
} |
} |
478 |
|
|
479 |
#------------------------------------------------------------ |
#------------------------------------------------------------ |
495 |
} |
} |
496 |
+ |
+ |
497 |
+ system("/usr/sbin/cpu", "usermod", "-c", "$first $last", "-G", "$groups", $userName) == 0 |
+ system("/usr/sbin/cpu", "usermod", "-c", "$first $last", "-G", "$groups", $userName) == 0 |
498 |
+ or ( $x = 255, warn "Failed to modify comment of (ldap) account $userName.\n" ); |
+ or ( $x = $ldapauth ne 'enabled ? $x : 255, warn "Failed to modify comment of (ldap) account $userName.\n" ); |
499 |
} |
} |
500 |
} |
} |
501 |
|
|