/[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.1 - (show annotations) (download)
Tue Nov 2 19:49:11 2010 UTC (14 years ago) by slords
Branch: MAIN
CVS Tags: e-smith-ibays-2_2_0-4_el5_sme
* Tue Nov 2 2010 Shad L. Lords <slords@mail.com> 2.2.0-4.sme
- Always use cpu, do unix if ldap{Auth} is disabled [SME: 6326]

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

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