/[smeserver]/rpms/e-smith-ibays/sme8/e-smith-ibays-2.2.0-better-ldap.patch
ViewVC logotype

Contents of /rpms/e-smith-ibays/sme8/e-smith-ibays-2.2.0-better-ldap.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download)
Thu Nov 4 15:59:37 2010 UTC (13 years, 6 months ago) by slords
Branch: MAIN
CVS Tags: e-smith-ibays-2_2_0-13_el5_sme, e-smith-ibays-2_2_0-10_el5_sme, e-smith-ibays-2_2_0-15_el5_sme, e-smith-ibays-2_2_0-11_el5_sme, e-smith-ibays-2_2_0-14_el5_sme, e-smith-ibays-2_2_0-9_el5_sme, e-smith-ibays-2_2_0-16_el5_sme, HEAD
Changes since 1.5: +9 -10 lines
* Thu Nov 4 2010 Shad L. Lords <slords@mail.com> 2.2.0-9.sme
- All ibay account commands as system accounts in LDAP [SME: 6326]

1 diff -Nur -x '*.orig' -x '*.rej' e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-delete mezzanine_patched_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 2010-11-04 16:43:36.000000000 +0100
3 +++ mezzanine_patched_e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-delete 2010-11-04 16:42:13.000000000 +0100
4 @@ -25,6 +25,7 @@
5
6 event=$1
7 ibay=$2
8 +
9 if [ -z "$ibay" ]
10 then
11 echo ibayName argument missing
12 @@ -32,12 +33,17 @@
13 fi
14
15 ldapauth=$(/sbin/e-smith/config getprop ldap Authentication || echo disabled)
16 +x=0 # exit value
17
18 /bin/rm -rf /home/e-smith/files/ibays/$ibay
19 -if [ "$ldapauth" == "enabled" ]
20 +if [ "$ldapauth" != "enabled" ]
21 then
22 + /usr/sbin/userdel "$ibay" || x=1
23 /usr/sbin/cpu -C/etc/cpu-system.conf userdel "$ibay"
24 /usr/sbin/cpu -C/etc/cpu-system.conf groupdel "$ibay"
25 else
26 - exec /usr/sbin/userdel "$ibay"
27 + /usr/sbin/cpu userdel "$ibay" || x=1
28 + /usr/sbin/cpu -C/etc/cpu-system.conf groupdel "$ibay" || x=1
29 fi
30 +
31 +exit $x
32 diff -Nur -x '*.orig' -x '*.rej' e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-modify mezzanine_patched_e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-modify
33 --- e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-modify 2010-11-04 16:43:36.000000000 +0100
34 +++ mezzanine_patched_e-smith-ibays-2.2.0/root/etc/e-smith/events/actions/ibay-modify 2010-11-04 16:43:26.000000000 +0100
35 @@ -32,6 +32,7 @@
36 or die "Could not open Config DB";
37
38 my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';
39 +my $x = 0; # exit value
40
41 $ENV{'PATH'} = "/bin";
42
43 @@ -55,41 +56,14 @@
44
45 # Create the ibay's unique group first
46
47 - if ($ldapauth eq 'enabled')
48 - {
49 - system(
50 - "/usr/sbin/cpu", "-C/etc/cpu-system.conf", "groupadd",
51 - "-g",
52 - $ibay->prop("Gid"),
53 - $ibayName
54 - ) == 0 or die "Failed to create group $ibayName.\n";
55 -
56 - system(
57 - "/usr/sbin/cpu", "useradd",
58 - "-u",
59 - $ibay->prop("Uid"),
60 - "-g",
61 - $ibay->prop("Gid"),
62 - "-c",
63 - $ibay->prop("Name"),
64 - "-d",
65 - "/home/e-smith/files/ibays/$ibayName/files",
66 - "-G",
67 - "shared,"
68 - . $ibay->prop("Group"),
69 - "-s",
70 - "/bin/false",
71 - "$ibayName"
72 - ) == 0 or die "Failed to create account $ibayName.\n";
73 - }
74 - else
75 + if ($ldapauth ne 'enabled')
76 {
77 system(
78 "/usr/sbin/groupadd",
79 "-g",
80 $ibay->prop("Gid"),
81 $ibayName
82 - ) == 0 or die "Failed to create group $ibayName.\n";
83 + ) == 0 or ( $x = 255, warn "Failed to create (unix) group $ibayName.\n" );
84
85 system(
86 "/usr/sbin/useradd",
87 @@ -108,16 +82,41 @@
88 "-s",
89 "/bin/false",
90 "$ibayName"
91 - ) == 0 or die "Failed to create account $ibayName.\n";
92 + ) == 0 or ( $x = 255, warn "Failed to create (unix) account $ibayName.\n" );
93 }
94
95 + system(
96 + "/usr/sbin/cpu", "-C/etc/cpu-system.conf", "groupadd",
97 + "-g",
98 + $ibay->prop("Gid"),
99 + $ibayName
100 + ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $ibayName.\n" );
101 +
102 + system(
103 + "/usr/sbin/cpu", "-C/etc/cpu-system.conf", "useradd",
104 + "-u",
105 + $ibay->prop("Uid"),
106 + "-g",
107 + $ibay->prop("Gid"),
108 + "-c",
109 + $ibay->prop("Name"),
110 + "-d",
111 + "/home/e-smith/files/ibays/$ibayName/files",
112 + "-G",
113 + "shared,"
114 + . $ibay->prop("Group"),
115 + "-s",
116 + "/bin/false",
117 + "$ibayName"
118 + ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) account $ibayName.\n" );
119 +
120 #------------------------------------------------------------
121 # Create the ibay files and set the password.
122 #------------------------------------------------------------
123
124 system("/bin/cp", "-Rp", "/etc/e-smith/skel/ibay",
125 "/home/e-smith/files/ibays/$ibayName") == 0
126 - or die "Error copying ibay skeletal files";
127 + or ( $x = 255, warn "Error copying ibay skeletal files" );
128
129 processTemplate( {
130 TEMPLATE_PATH=>"/home/e-smith/files/ibays/html/index.html",
131 @@ -125,16 +124,14 @@
132 MORE_DATA=>{IBAY_NAME=>$ibayName},
133 } );
134
135 - if ($ldapauth eq 'enabled')
136 - {
137 - system("/usr/sbin/cpu", "usermod", "-L", $ibayName) == 0
138 - or die "Error running /usr/sbin/cpu usermod -L command to lock account $ibayName";
139 - }
140 - else
141 + if ($ldapauth ne 'enabled')
142 {
143 system("/usr/bin/passwd", "-l", $ibayName) == 0
144 - or die "Error running /usr/bin/passwd command to lock account $ibayName";
145 + or ( $x = 255, warn "Error locking (unix) account $ibayName" );
146 }
147 +
148 + 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" );
150 }
151 elsif ($event eq 'ibay-modify')
152 {
153 @@ -142,19 +139,16 @@
154 # Modify ibay description in /etc/passwd using "usermod"
155 #------------------------------------------------------------
156
157 - if ($ldapauth eq 'enabled')
158 - {
159 - system("/usr/sbin/cpu", "usermod", "-c", $ibay->prop("Name"),
160 - "-G", "shared," . $ibay->prop("Group"), "$ibayName") == 0
161 - or die "Failed to modify account $ibayName.\n";
162 - }
163 - else
164 + if ($ldapauth ne 'enabled')
165 {
166 system("/usr/sbin/usermod", "-c", $ibay->prop("Name"),
167 "-G", "shared," . $ibay->prop("Group"), "$ibayName") == 0
168 - or die "Failed to modify account $ibayName.\n";
169 + or ( $x = 255, warn "Failed to modify (unix) account $ibayName.\n" );
170 }
171
172 + system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-c", $ibay->prop("Name"),
173 + "-G", "shared," . $ibay->prop("Group"), "$ibayName") == 0
174 + or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify (ldap) account $ibayName.\n" );
175 }
176
177 #------------------------------------------------------------
178 @@ -166,7 +160,7 @@
179 #--------------------------------------------------
180
181 chdir "/home/e-smith/files/ibays/$ibayName"
182 - or die "Could not chdir to /home/e-smith/files/ibays/$ibayName";
183 + or ( $x = 255, warn "Could not chdir to /home/e-smith/files/ibays/$ibayName" );
184
185 mkdir '.AppleDesktop' unless (-d '.AppleDesktop');
186
187 @@ -237,3 +231,5 @@
188 }
189
190 find(\&process, glob("* .AppleDesktop"));
191 +
192 +exit ($x);

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed