20 |
+if [ "$ldapauth" != "enabled" ] |
+if [ "$ldapauth" != "enabled" ] |
21 |
then |
then |
22 |
+ /usr/sbin/userdel "$ibay" || x=1 |
+ /usr/sbin/userdel "$ibay" || x=1 |
23 |
/usr/sbin/cpu userdel "$ibay" |
/usr/sbin/cpu -C/etc/cpu-system.conf userdel "$ibay" |
24 |
/usr/sbin/cpu -C/etc/cpu-system.conf groupdel "$ibay" |
/usr/sbin/cpu -C/etc/cpu-system.conf groupdel "$ibay" |
25 |
else |
else |
26 |
- exec /usr/sbin/userdel "$ibay" |
- exec /usr/sbin/userdel "$ibay" |
84 |
|
|
85 |
system( |
system( |
86 |
"/usr/sbin/useradd", |
"/usr/sbin/useradd", |
87 |
@@ -108,16 +82,42 @@ |
@@ -108,16 +82,41 @@ |
88 |
"-s", |
"-s", |
89 |
"/bin/false", |
"/bin/false", |
90 |
"$ibayName" |
"$ibayName" |
100 |
+ ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $ibayName.\n" ); |
+ ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $ibayName.\n" ); |
101 |
+ |
+ |
102 |
+ system( |
+ system( |
103 |
+ "/usr/sbin/cpu", "useradd", |
+ "/usr/sbin/cpu", "-C/etc/cpu-system.conf", "useradd", |
|
+ "-C/etc/cpu-system.conf", |
|
104 |
+ "-u", |
+ "-u", |
105 |
+ $ibay->prop("Uid"), |
+ $ibay->prop("Uid"), |
106 |
+ "-g", |
+ "-g", |
128 |
|
|
129 |
processTemplate( { |
processTemplate( { |
130 |
TEMPLATE_PATH=>"/home/e-smith/files/ibays/html/index.html", |
TEMPLATE_PATH=>"/home/e-smith/files/ibays/html/index.html", |
131 |
@@ -125,16 +125,14 @@ |
@@ -125,16 +124,14 @@ |
132 |
MORE_DATA=>{IBAY_NAME=>$ibayName}, |
MORE_DATA=>{IBAY_NAME=>$ibayName}, |
133 |
} ); |
} ); |
134 |
|
|
145 |
+ or ( $x = 255, warn "Error locking (unix) account $ibayName" ); |
+ or ( $x = 255, warn "Error locking (unix) account $ibayName" ); |
146 |
} |
} |
147 |
+ |
+ |
148 |
+ system("/usr/sbin/cpu", "usermod", "-L", $ibayName) == 0 |
+ system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-L", $ibayName) == 0 |
149 |
+ or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Error locking (ldap) account $ibayName" ); |
+ or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Error locking (ldap) account $ibayName" ); |
150 |
} |
} |
151 |
elsif ($event eq 'ibay-modify') |
elsif ($event eq 'ibay-modify') |
152 |
{ |
{ |
153 |
@@ -142,19 +140,16 @@ |
@@ -142,19 +139,16 @@ |
154 |
# Modify ibay description in /etc/passwd using "usermod" |
# Modify ibay description in /etc/passwd using "usermod" |
155 |
#------------------------------------------------------------ |
#------------------------------------------------------------ |
156 |
|
|
169 |
+ or ( $x = 255, warn "Failed to modify (unix) account $ibayName.\n" ); |
+ or ( $x = 255, warn "Failed to modify (unix) account $ibayName.\n" ); |
170 |
} |
} |
171 |
|
|
172 |
+ system("/usr/sbin/cpu", "usermod", "-c", $ibay->prop("Name"), |
+ system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-c", $ibay->prop("Name"), |
173 |
+ "-G", "shared," . $ibay->prop("Group"), "$ibayName") == 0 |
+ "-G", "shared," . $ibay->prop("Group"), "$ibayName") == 0 |
174 |
+ or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify (ldap) account $ibayName.\n" ); |
+ or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify (ldap) account $ibayName.\n" ); |
175 |
} |
} |
176 |
|
|
177 |
#------------------------------------------------------------ |
#------------------------------------------------------------ |
178 |
@@ -166,7 +161,7 @@ |
@@ -166,7 +160,7 @@ |
179 |
#-------------------------------------------------- |
#-------------------------------------------------- |
180 |
|
|
181 |
chdir "/home/e-smith/files/ibays/$ibayName" |
chdir "/home/e-smith/files/ibays/$ibayName" |
184 |
|
|
185 |
mkdir '.AppleDesktop' unless (-d '.AppleDesktop'); |
mkdir '.AppleDesktop' unless (-d '.AppleDesktop'); |
186 |
|
|
187 |
@@ -237,3 +232,5 @@ |
@@ -237,3 +231,5 @@ |
188 |
} |
} |
189 |
|
|
190 |
find(\&process, glob("* .AppleDesktop")); |
find(\&process, glob("* .AppleDesktop")); |