1 |
diff -up e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-delete.enable-cpu e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-delete |
2 |
--- e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-delete.enable-cpu 2005-07-28 12:42:07.000000000 -0600 |
3 |
+++ e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-delete 2010-11-01 10:24:44.000000000 -0600 |
4 |
@@ -31,5 +31,13 @@ then |
5 |
exit 1 |
6 |
fi |
7 |
|
8 |
+ldapauth=$(/sbin/e-smith/config getprop ldap Authentication || echo disabled) |
9 |
+ |
10 |
/bin/rm -rf /home/e-smith/files/ibays/$ibay |
11 |
-exec /usr/sbin/userdel "$ibay" |
12 |
+if [ "$ldapauth" == "enabled" ] |
13 |
+then |
14 |
+ /usr/sbin/cpu -C/etc/cpu-system.conf userdel "$ibay" |
15 |
+ /usr/sbin/cpu -C/etc/cpu-system.conf groupdel "$ibay" |
16 |
+else |
17 |
+ exec /usr/sbin/userdel "$ibay" |
18 |
+fi |
19 |
diff -up e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-modify.enable-cpu e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-modify |
20 |
--- e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-modify.enable-cpu 2006-03-15 19:58:10.000000000 -0700 |
21 |
+++ e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-modify 2010-11-01 10:22:27.000000000 -0600 |
22 |
@@ -26,7 +26,12 @@ use File::Find; |
23 |
use esmith::util; |
24 |
use esmith::templates; |
25 |
use esmith::AccountsDB; |
26 |
+use esmith::ConfigDB; |
27 |
|
28 |
+my $conf = esmith::ConfigDB->open_ro |
29 |
+ or die "Could not open Config DB"; |
30 |
+ |
31 |
+my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled'; |
32 |
|
33 |
$ENV{'PATH'} = "/bin"; |
34 |
|
35 |
@@ -50,31 +55,61 @@ if ($event eq 'ibay-create') |
36 |
|
37 |
# Create the ibay's unique group first |
38 |
|
39 |
- system( |
40 |
- "/usr/sbin/groupadd", |
41 |
- "-g", |
42 |
- $ibay->prop("Gid"), |
43 |
- $ibayName |
44 |
- ) == 0 or die "Failed to create group $ibayName.\n"; |
45 |
- |
46 |
- system( |
47 |
- "/usr/sbin/useradd", |
48 |
- "-u", |
49 |
- $ibay->prop("Uid"), |
50 |
- "-g", |
51 |
- $ibay->prop("Gid"), |
52 |
- "-c", |
53 |
- $ibay->prop("Name"), |
54 |
- "-d", |
55 |
- "/home/e-smith/files/ibays/$ibayName/files", |
56 |
- "-G", |
57 |
- "shared," |
58 |
- . $ibay->prop("Group"), |
59 |
- "-M", |
60 |
- "-s", |
61 |
- "/bin/false", |
62 |
- "$ibayName" |
63 |
- ) == 0 or die "Failed to create account $ibayName.\n"; |
64 |
+ if ($ldapauth eq 'enabled') |
65 |
+ { |
66 |
+ system( |
67 |
+ "/usr/sbin/cpu", "-C/etc/cpu-system.conf", "groupadd", |
68 |
+ "-g", |
69 |
+ $ibay->prop("Gid"), |
70 |
+ $ibayName |
71 |
+ ) == 0 or die "Failed to create group $ibayName.\n"; |
72 |
+ |
73 |
+ system( |
74 |
+ "/usr/sbin/cpu", "useradd", |
75 |
+ "-u", |
76 |
+ $ibay->prop("Uid"), |
77 |
+ "-g", |
78 |
+ $ibay->prop("Gid"), |
79 |
+ "-c", |
80 |
+ $ibay->prop("Name"), |
81 |
+ "-d", |
82 |
+ "/home/e-smith/files/ibays/$ibayName/files", |
83 |
+ "-G", |
84 |
+ "shared," |
85 |
+ . $ibay->prop("Group"), |
86 |
+ "-s", |
87 |
+ "/bin/false", |
88 |
+ "$ibayName" |
89 |
+ ) == 0 or die "Failed to create account $ibayName.\n"; |
90 |
+ } |
91 |
+ else |
92 |
+ { |
93 |
+ system( |
94 |
+ "/usr/sbin/groupadd", |
95 |
+ "-g", |
96 |
+ $ibay->prop("Gid"), |
97 |
+ $ibayName |
98 |
+ ) == 0 or die "Failed to create group $ibayName.\n"; |
99 |
+ |
100 |
+ system( |
101 |
+ "/usr/sbin/useradd", |
102 |
+ "-u", |
103 |
+ $ibay->prop("Uid"), |
104 |
+ "-g", |
105 |
+ $ibay->prop("Gid"), |
106 |
+ "-c", |
107 |
+ $ibay->prop("Name"), |
108 |
+ "-d", |
109 |
+ "/home/e-smith/files/ibays/$ibayName/files", |
110 |
+ "-G", |
111 |
+ "shared," |
112 |
+ . $ibay->prop("Group"), |
113 |
+ "-M", |
114 |
+ "-s", |
115 |
+ "/bin/false", |
116 |
+ "$ibayName" |
117 |
+ ) == 0 or die "Failed to create account $ibayName.\n"; |
118 |
+ } |
119 |
|
120 |
#------------------------------------------------------------ |
121 |
# Create the ibay files and set the password. |
122 |
@@ -90,8 +125,16 @@ if ($event eq 'ibay-create') |
123 |
MORE_DATA=>{IBAY_NAME=>$ibayName}, |
124 |
} ); |
125 |
|
126 |
- system("/usr/bin/passwd", "-l", $ibayName) == 0 |
127 |
- or die "Error running /usr/bin/passwd command to lock account $ibayName"; |
128 |
+ if ($ldapauth eq 'enabled') |
129 |
+ { |
130 |
+ system("/usr/sbin/cpu", "usermod", "-L", $ibayName) == 0 |
131 |
+ or die "Error running /usr/sbin/cpu usermod -L command to lock account $ibayName"; |
132 |
+ } |
133 |
+ else |
134 |
+ { |
135 |
+ system("/usr/bin/passwd", "-l", $ibayName) == 0 |
136 |
+ or die "Error running /usr/bin/passwd command to lock account $ibayName"; |
137 |
+ } |
138 |
} |
139 |
elsif ($event eq 'ibay-modify') |
140 |
{ |
141 |
@@ -99,9 +142,18 @@ elsif ($event eq 'ibay-modify') |
142 |
# Modify ibay description in /etc/passwd using "usermod" |
143 |
#------------------------------------------------------------ |
144 |
|
145 |
- system("/usr/sbin/usermod", "-c", $ibay->prop("Name"), |
146 |
- "-G", "shared," . $ibay->prop("Group"), "$ibayName") == 0 |
147 |
- or die "Failed to modify account $ibayName.\n"; |
148 |
+ if ($ldapauth eq 'enabled') |
149 |
+ { |
150 |
+ system("/usr/sbin/cpu", "usermod", "-c", $ibay->prop("Name"), |
151 |
+ "-G", "shared," . $ibay->prop("Group"), "$ibayName") == 0 |
152 |
+ or die "Failed to modify account $ibayName.\n"; |
153 |
+ } |
154 |
+ else |
155 |
+ { |
156 |
+ system("/usr/sbin/usermod", "-c", $ibay->prop("Name"), |
157 |
+ "-G", "shared," . $ibay->prop("Group"), "$ibayName") == 0 |
158 |
+ or die "Failed to modify account $ibayName.\n"; |
159 |
+ } |
160 |
|
161 |
} |
162 |
|