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

Annotation 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.5 - (hide annotations) (download)
Thu Nov 4 15:50:00 2010 UTC (14 years ago) by vip-ire
Branch: MAIN
CVS Tags: e-smith-ibays-2_2_0-8_el5_sme
Changes since 1.4: +14 -13 lines
* Thu Nov 4 2010 Daniel Berteaud <daniel@firewall-services.com> 2.2.0-8.sme
- Create ibay accounts as system accounts in LDAP [SME: 6326]

1 vip-ire 1.5 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 slords 1.1 @@ -25,6 +25,7 @@
5    
6     event=$1
7     ibay=$2
8     +
9     if [ -z "$ibay" ]
10     then
11     echo ibayName argument missing
12 slords 1.2 @@ -32,12 +33,17 @@
13 slords 1.1 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 slords 1.2 + /usr/sbin/userdel "$ibay" || x=1
23     /usr/sbin/cpu userdel "$ibay"
24     /usr/sbin/cpu -C/etc/cpu-system.conf groupdel "$ibay"
25     else
26 slords 1.1 - exec /usr/sbin/userdel "$ibay"
27 slords 1.2 + /usr/sbin/cpu userdel "$ibay" || x=1
28     + /usr/sbin/cpu -C/etc/cpu-system.conf groupdel "$ibay" || x=1
29 slords 1.1 fi
30     +
31     +exit $x
32 vip-ire 1.5 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 slords 1.1 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 vip-ire 1.5 @@ -55,41 +56,14 @@
44 slords 1.1
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 vip-ire 1.5 @@ -108,16 +82,42 @@
88 slords 1.1 "-s",
89     "/bin/false",
90     "$ibayName"
91     - ) == 0 or die "Failed to create account $ibayName.\n";
92 slords 1.4 + ) == 0 or ( $x = 255, warn "Failed to create (unix) account $ibayName.\n" );
93 slords 1.1 }
94    
95     + system(
96     + "/usr/sbin/cpu", "-C/etc/cpu-system.conf", "groupadd",
97     + "-g",
98     + $ibay->prop("Gid"),
99     + $ibayName
100 slords 1.3 + ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $ibayName.\n" );
101 slords 1.1 +
102     + system(
103     + "/usr/sbin/cpu", "useradd",
104 vip-ire 1.5 + "-C/etc/cpu-system.conf",
105 slords 1.1 + "-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 slords 1.3 + ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) account $ibayName.\n" );
120 slords 1.1 +
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 vip-ire 1.5 @@ -125,16 +125,14 @@
133 slords 1.1 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 slords 1.3 + or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Error locking (ldap) account $ibayName" );
151 slords 1.1 }
152     elsif ($event eq 'ibay-modify')
153     {
154 vip-ire 1.5 @@ -142,19 +140,16 @@
155 slords 1.1 # 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 slords 1.3 + or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify (ldap) account $ibayName.\n" );
176 slords 1.1 }
177    
178     #------------------------------------------------------------
179 vip-ire 1.5 @@ -166,7 +161,7 @@
180 slords 1.1 #--------------------------------------------------
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 vip-ire 1.5 @@ -237,3 +232,5 @@
189 slords 1.1 }
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