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