/[smeserver]/rpms/e-smith-base+ldap/sme7/e-smith-base+ldap-4.19.1-merge_users_and_people.patch
ViewVC logotype

Contents of /rpms/e-smith-base+ldap/sme7/e-smith-base+ldap-4.19.1-merge_users_and_people.patch

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


Revision 1.2 - (show annotations) (download)
Tue Oct 7 19:21:54 2008 UTC (15 years, 7 months ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
New streams

1 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/createlinks mezzanine_patched_e-smith-base+ldap-4.19.1/createlinks
2 --- e-smith-base+ldap-4.19.1/createlinks 2008-06-06 13:37:45.000000000 +0200
3 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/createlinks 2008-06-06 13:37:28.000000000 +0200
4 @@ -209,6 +209,7 @@
5 /etc/ldap.conf
6 /etc/ldap.secret
7 /etc/cpu.conf
8 + /etc/cpu-machine.conf
9 /etc/security/pam_abl.conf
10 ))
11 {
12 @@ -258,6 +259,7 @@
13 /var/log/cron
14 /var/log/spooler
15 /var/log/maillog
16 + /var/log/slapd
17 ))
18 {
19 safe_touch "root/etc/e-smith/events/logrotate/logfiles2timestamp/$_";
20 @@ -423,6 +425,7 @@
21 $event = "user-create";
22
23 event_link("user-create-unix", $event, "04");
24 +event_link("update-domain-group-maps", $event, "10");
25 event_link("count-active-user-accounts", $event, "25");
26 event_link("user-group-modify", $event, "85");
27
28 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-create-unix mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-create-unix
29 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-create-unix 2008-06-06 13:37:45.000000000 +0200
30 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-create-unix 2008-06-05 13:53:32.000000000 +0200
31 @@ -83,6 +83,7 @@
32 "-u", $uid,
33 "-g", $gid,
34 "-c", $description,
35 + "-E", $description,
36 "-d",
37 "/home/e-smith",
38 "-s",
39 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-modify-unix mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-modify-unix
40 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-modify-unix 2008-06-06 13:37:45.000000000 +0200
41 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-modify-unix 2008-06-05 13:53:32.000000000 +0200
42 @@ -64,7 +64,7 @@
43 my $groupDesc = $properties{'Description'}
44 if (defined $properties{'Description'});
45
46 - system("/usr/sbin/cpu", "usermod", "-c", "$groupDesc", "$groupName") == 0
47 + system("/usr/sbin/cpu", "usermod", "-c", "$groupDesc", "-E", "$groupDesc", "$groupName") == 0
48 or die "Failed to modify group description for $groupName.\n";
49
50 my ($name, $passwd, $gid, $members) = getgrnam ($groupName);
51 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/ldap-update mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/ldap-update
52 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/ldap-update 2008-06-06 13:37:45.000000000 +0200
53 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/ldap-update 2008-06-05 13:53:32.000000000 +0200
54 @@ -100,79 +100,73 @@
55 my $key = $acct->key;
56 my $type = $acct->prop('type');
57 next unless ($type eq 'user' || $type eq 'group');
58 - my @attrs = ();
59 + my @usr_attrs = ();
60 + my @grp_attrs = ();
61 + my $name = '';
62 if ($type eq 'user')
63 {
64 - my $name = $acct->prop('FirstName') . " " . $acct->prop('LastName');
65 + # retrieve informations of the user from the db
66 + # which can override default ones (like Phone, Company etc...)
67 + $name = $acct->prop('FirstName') . " " . $acct->prop('LastName');
68 utf8::upgrade($name);
69 my $first = $acct->prop('FirstName') || '';
70 utf8::upgrade($first);
71 my $last = $acct->prop('LastName') || '';
72 utf8::upgrade($last);
73 - my $phone = $acct->prop('Phone') || '';
74 - my $company = $acct->prop('Company') || '';
75 + $phone = $acct->prop('Phone') || '';
76 + $company = $acct->prop('Company') || '';
77 utf8::upgrade($company);
78 - my $dept = $acct->prop('Dept') || '';
79 + $dept = $acct->prop('Dept') || '';
80 utf8::upgrade($dept);
81 - my $city = $acct->prop('City') || '';
82 + $city = $acct->prop('City') || '';
83 utf8::upgrade($city);
84 - my $street = $acct->prop('Street') || '';
85 + $street = $acct->prop('Street') || '';
86 utf8::upgrade($street);
87 my $freebusy = $acct->prop('FreeBusy') ||
88 'https://'.$hostname.'.'.$domain.'/horde/kronolith/fb.php?u='.$key.'@'.$domain;
89 utf8::upgrade($freebusy);
90 - push @attrs, (objectClass => ['person',
91 - 'organizationalPerson',
92 - 'inetOrgPerson']);
93 - push @attrs, (uid => $key);
94 -
95 - push @attrs, (cn => $name) unless ($name =~ /^\s*$/);
96 - push @attrs, (givenName => $first) unless $first =~ /^\s*$/;
97 - push @attrs, (sn => $last) unless $last =~ /^\s*$/;
98 - push @attrs, (mail => "$key\@$domain");
99 - push @attrs, (telephoneNumber => $phone) unless $phone =~ /^\s*$/;
100 - push @attrs, (o => $company) unless $company =~ /^\s*$/;
101 - push @attrs, (ou => $dept) unless $dept =~ /^\s*$/;
102 - push @attrs, (l => $city) unless $city =~ /^\s*$/;
103 - push @attrs, (street => $street) unless $street =~ /^\s*$/;
104 - push @attrs, (calFBURL => $freebusy) unless $freebusy =~ /^\s*$/;
105 +
106 + # Some attributes are only valide for user account
107 + push @usr_attrs, (calFBURL => $freebusy) unless $freebusy =~ /^\s*$/;
108 + push @usr_attrs, (givenName => $first) unless $first =~ /^\s*$/;
109 + push @usr_attrs, (sn => $last) unless $last =~ /^\s*$/;
110 }
111 elsif ($type eq 'group')
112 - {
113 - push @attrs, (objectClass => ['person',
114 - 'organizationalPerson',
115 - 'inetOrgPerson',
116 - 'calEntry']);
117 - push @attrs, (uid => $key);
118 -
119 + {
120 my $key = $acct->key;
121 - my $desc = $acct->prop('Description') || '';
122 - utf8::upgrade($desc);
123 - push @attrs, (cn => $desc) unless $desc =~ /^\s*$/;
124 - push @attrs, (sn => $desc) unless $desc =~ /^\s*$/;
125 - push @attrs, (mail => "$key\@$domain");
126 - push @attrs, (telephoneNumber => $phone) unless $phone =~ /^\s*$/;
127 - push @attrs, (o => $company) unless $company =~ /^\s*$/;
128 - push @attrs, (ou => $dept) unless $dept =~ /^\s*$/;
129 - push @attrs, (l => $city) unless $city =~ /^\s*$/;
130 - push @attrs, (street => $street) unless $street =~ /^\s*$/;
131 - }
132 - my $dn = "uid=$key,ou=People,$base";
133 - if (($event eq 'user-create') || ($event eq 'group-create'))
134 - {
135 - my $result = $ldap->add ($dn, attr => \@attrs);
136
137 - $result->code &&
138 - warn "failed to add entry for $dn: ", $result->error ;
139 - }
140 - else
141 - {
142 - my %attrs = @attrs;
143 - my $result = $ldap->modify ($dn, replace => \%attrs);
144 + $name = $acct->prop('Description') || '';
145 + # sn Attribute is mandatory for objectClass inetOrgPerson
146 + push @usr_attrs, (sn => $name) unless $name =~ /^\s*$/;
147 + utf8::upgrade($name);
148
149 - $result->code &&
150 - warn "failed to modify entry for $dn: ", $result->error ;
151 }
152 +
153 + # In any case, update common attributes
154 + push @usr_attrs, (displayName => $name) unless ($name =~ /^\s*$/);
155 + push @usr_attrs, (mail => "$key\@$domain");
156 + push @usr_attrs, (telephoneNumber => $phone) unless $phone =~ /^\s*$/;
157 + push @usr_attrs, (o => $company) unless $company =~ /^\s*$/;
158 + push @usr_attrs, (ou => $dept) unless $dept =~ /^\s*$/;
159 + push @usr_attrs, (l => $city) unless $city =~ /^\s*$/;
160 + push @usr_attrs, (street => $street) unless $street =~ /^\s*$/;
161 + push @usr_attrs, (gecos => $name) unless ($name =~ /^\s*$/);
162 + push @grp_attrs, (displayName => $name) unless ($name =~ /^\s*$/);
163 +
164 + # Update user entry (or dummy user for group accounts)
165 + my %usr_attrs = @usr_attrs;
166 + my $result = $ldap->modify ("uid=$key,ou=Users,$base", replace => \%usr_attrs);
167 +
168 + $result->code &&
169 + warn "failed to modify user entry for uid=$key,ou=Users,$base: ", $result->error ;
170 +
171 + # Update Group entry (or personnal group for user accounts)
172 + my %grp_attrs = @grp_attrs;
173 + $result = $ldap->modify ("cn=$key,ou=Groups,$base", replace => \%grp_attrs);
174 +
175 + $result->code &&
176 + warn "failed to modify group entry for cn=$key,ou=Groups,$base: ", $result->error ;
177 +
178 }
179 $ldap->unbind;
180
181 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-create-unix mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-create-unix
182 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-create-unix 2008-06-06 13:37:45.000000000 +0200
183 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-create-unix 2008-06-05 13:53:32.000000000 +0200
184 @@ -77,6 +77,8 @@
185 "-u", $uid,
186 "-g", $uid,
187 "-c", "$first $last",
188 + "-f", "$first",
189 + "-E", "$last",
190 "-d", "/home/e-smith/files/users/$userName",
191 "-G", "shared",
192 "-m",
193 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-modify-unix mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-modify-unix
194 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-modify-unix 2008-06-06 13:37:45.000000000 +0200
195 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-modify-unix 2008-06-05 13:53:32.000000000 +0200
196 @@ -55,17 +55,16 @@
197 # to be removed from all it's supplementary groups. Thus, to be able to call
198 # cpu usermod properly we need to know user supplementary groups.
199
200 - my $cmd = "/usr/bin/id -G -n '$member'";
201 + my $cmd = "/usr/bin/id -G -n '$userName'";
202 my $groups = `$cmd 2>/dev/null`;
203 if ($? != 0)
204 {
205 - die "Failed to get supplementary group list for $member.\n";
206 + die "Failed to get supplementary group list for $userName.\n";
207 }
208 chomp ($groups);
209
210 my @groupList = split (/\s+/, $groups);
211 - @groupList = grep (!/^$member$/, @groupList);
212 - push @groupList, $groupName;
213 + @groupList = grep (!/^$userName$/, @groupList);
214
215 $groups = join (',', sort (@groupList));
216
217 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/etc/cpu.conf/all mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/etc/cpu.conf/all
218 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/etc/cpu.conf/all 2008-06-06 13:37:45.000000000 +0200
219 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/etc/cpu.conf/all 2008-06-05 13:53:32.000000000 +0200
220 @@ -10,17 +10,24 @@
221 # Can also use LDAP_URI = ldaps://localhost:389 for TLS support
222 BIND_DN = "cn=root,{ esmith::util::ldapBase ($DomainName); }"
223 BIND_PASS = { esmith::util::LdapPassword (); }
224 -USER_BASE = ou=Users,{ esmith::util::ldapBase ($DomainName); }
225 -# replace account with inetOrgPerson if you want first or last name
226 +{
227 +if ($ACCOUNT eq 'machine'){
228 + $OUT .= "USER_BASE = ou=Computers," . esmith::util::ldapBase ($DomainName) . "\n";
229 + $OUT .= "USER_OBJECT_CLASS = posixAccount,shadowAccount,account";
230 +}
231 +else{
232 + $OUT .= "USER_BASE = ou=Users," . esmith::util::ldapBase ($DomainName) . "\n";
233 + $OUT .= "USER_OBJECT_CLASS = posixAccount,shadowAccount,calEntry,inetOrgPerson";
234 +}
235 +}
236 GROUP_BASE = ou=Groups,{ esmith::util::ldapBase ($DomainName); }
237 -USER_OBJECT_CLASS = account,posixAccount,shadowAccount,top
238 GROUP_OBJECT_CLASS = posixGroup,top
239 USER_FILTER = (objectClass=posixAccount)
240 GROUP_FILTER = (objectClass=posixGroup)
241 USER_CN_STRING = uid
242 GROUP_CN_STRING = cn
243 SKEL_DIR = /etc/skel
244 -DEFAULT_SHELL = /bin/bash
245 +DEFAULT_SHELL = /usr/bin/rssh
246 HOME_DIRECTORY = /home
247 MAX_UIDNUMBER = 10000
248 MIN_UIDNUMBER = 100
249 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups
250 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups 2008-06-06 13:37:45.000000000 +0200
251 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups 2008-06-05 13:53:32.000000000 +0200
252 @@ -23,11 +23,6 @@
253 {
254 $OUT .= utf8("memberUid: $_\n");
255 }
256 - if ($name eq 'nobody'){
257 - foreach(@machines){
258 - $OUT .= utf8("memberUid: $_\n");
259 - }
260 - }
261 $OUT .= utf8("description: Local Unix group\n");
262 $OUT .= utf8("displayName: $dname\n");
263 $OUT .= utf8("sambaGroupType: 2\n");
264 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50people mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50people
265 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50people 2008-06-06 13:37:45.000000000 +0200
266 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50people 1970-01-01 01:00:00.000000000 +0100
267 @@ -1,60 +0,0 @@
268 -{
269 - @peoples = ($a->users, $a->groups);
270 -
271 - foreach my $people (@peoples)
272 - {
273 - my $key = $people->key;
274 - my $type = $people->prop('type');
275 -
276 - if ($type eq 'user')
277 - {
278 - my $first = $people->prop('FirstName') || '';
279 - my $last = $people->prop('LastName') || '';
280 - my $name = "$first $last";
281 - my $phone = $people->prop('Phone') || '';
282 - my $company = $people->prop('Company') || '';
283 - my $dept = $people->prop('Dept') || '';
284 - my $city = $people->prop('City') || '';
285 - my $street = $people->prop('Street') || '';
286 -
287 - $OUT .= utf8("dn: uid=$key,ou=People,$ldapBase\n");
288 - $OUT .= utf8("objectClass: person\n");
289 - $OUT .= utf8("objectClass: organizationalPerson\n");
290 - $OUT .= utf8("objectClass: inetOrgPerson\n");
291 - $OUT .= utf8("uid: $key\n");
292 - $OUT .= utf8("cn: $name\n");
293 - $OUT .= utf8("givenName: $first\n");
294 - $OUT .= utf8("sn: $last\n");
295 - $OUT .= utf8("mail: $key\@$DomainName\n");
296 - $OUT .= utf8("telephoneNumber: $phone\n");
297 - $OUT .= utf8("o: $company\n");
298 - $OUT .= utf8("ou: $dept\n");
299 - $OUT .= utf8("l: $city\n");
300 - $OUT .= utf8("street: $street\n\n");
301 - }
302 - elsif ($type eq 'group')
303 - {
304 - my $desc = $people->prop('Description') || '';
305 - my $phone = $ldap{defaultPhoneNumber} || '';
306 - my $company = $ldap{defaultCompany} || '';
307 - my $dept = $ldap{defaultDepartment} || '';
308 - my $city = $ldap{defaultCity} || '';
309 - my $street = $ldap{defaultStreet} || '';
310 -
311 - $OUT .= utf8("dn: uid=$key,ou=People,$ldapBase\n");
312 - $OUT .= utf8("objectClass: person\n");
313 - $OUT .= utf8("objectClass: organizationalPerson\n");
314 - $OUT .= utf8("objectClass: inetOrgPerson\n");
315 - $OUT .= utf8("uid: $key\n");
316 - $OUT .= utf8("cn: $desc\n");
317 - $OUT .= utf8("sn: $desc\n");
318 - $OUT .= utf8("mail: $key\@$DomainName\n");
319 - $OUT .= utf8("telephoneNumber: $phone\n");
320 - $OUT .= utf8("o: $company\n");
321 - $OUT .= utf8("ou: $dept\n");
322 - $OUT .= utf8("l: $city\n");
323 - $OUT .= utf8("street: $street\n\n");
324 - }
325 - }
326 -}
327 -
328 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users
329 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users 2008-06-06 13:37:45.000000000 +0200
330 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users 2008-06-06 13:11:08.000000000 +0200
331 @@ -3,33 +3,131 @@
332 my $shadow_info = parse_file("/etc/shadow", @users);
333 my $smbpasswd_info = parse_file("/etc/smbpasswd", @users);
334
335 +
336 + my $l = $c->get('ldap');
337 + my $phone = $l->prop('defaultTelephoneNumber') || '';
338 + my $company = $l->prop('defaultCompany') || '';
339 + my $dept = $l->prop('defaultDepartment') || '';
340 + my $city = $l->prop('defaultCity') || '';
341 + my $street = $l->prop('defaultStreet') || '';
342 +
343 + my $hostname = $c->get('SystemName')
344 + || die("Couldn't determine system name");
345 + $hostname = $hostname->value;
346 +
347 + my $domain = $c->get('DomainName')
348 + || die("Couldn't determine domain name");
349 + $domain = $domain->value;
350 +
351 +
352 foreach my $user (@users)
353 {
354 # Skip users in db but not in /etc/passwd.
355 - next unless ($passwd_info->{$user});
356 -
357 - my ($name, undef, $uid, $gid, $comment, $home, $shell)
358 + next unless ($passwd_info->{$user});
359 + # Retrieve info from passwd
360 + my ($name, undef, $uid, $gid, $comment, $home, $shell)
361 = @{$passwd_info->{$user}};
362 - my (undef, $passwd, $lastchange, $min, $max, $warning, $inactive,
363 + # And from shadow
364 + my (undef, $passwd, $lastchange, $min, $max, $warning, $inactive,
365 $expire, $flag) = @{$shadow_info->{$user}};
366
367 - # Import the sambaSID of the user
368 - my $sambaSID = `/usr/bin/net sam show $user -s /etc/samba/smb-pre-ldap.conf 2> /dev/null`;
369 - $sambaSID =~ s/(.*)\\$user is a (.*) with SID (.+)/$3/;
370 - chomp($sambaSID);
371 -
372 - # Import smb passwords (NT and LM) from smbpasswd
373 - my (undef, undef, $sambaLMPassword, $sambaNTPassword, $sambaAcctFlags, undef)
374 - = @{$smbpasswd_info->{$user}} if ($sambaSID ne '');
375 -
376 - $OUT .= utf8("dn: uid=$user,ou=Users,$ldapBase\n");
377 - $OUT .= utf8("objectClass: account\n");
378 - $OUT .= utf8("objectClass: posixAccount\n");
379 - $OUT .= utf8("objectClass: shadowAccount\n");
380 - $OUT .= utf8("objectClass: sambaSamAccount\n") if ($sambaSID ne '');
381 - $OUT .= utf8("objectClass: top\n");
382 + $OUT .= utf8("dn: uid=$user,ou=Users,$ldapBase\n");
383 + $OUT .= utf8("objectClass: posixAccount\n");
384 + $OUT .= utf8("objectClass: shadowAccount\n");
385 +
386 + my $type = '';
387 + my $acct = $a->get($user) || '';
388 + $type = $acct->prop('type') if ($acct ne '');
389 +
390 + # If the account is a user
391 + if (($type eq 'user') || ($user eq 'admin')){
392 + my $rid = 1000 + $uid * 2;
393 + my $grid = 1000 + $gid * 2 + 1;
394 + my $sambaSID = $local_sid . "-$rid";
395 + my $groupSID = ($user eq 'admin') ?
396 + "$local_sid-512" :
397 + "$local_sid-$grid";
398 + # Import smb passwords (NT and LM) from smbpasswd
399 + my (undef, undef, $sambaLMPassword, $sambaNTPassword, $sambaAcctFlags, undef)
400 + = @{$smbpasswd_info->{$user}} if ($sambaSID ne '');
401 +
402 + $name = $acct->prop('FirstName') . " " . $acct->prop('LastName');
403 + utf8::upgrade($name);
404 + my $first = $acct->prop('FirstName') || '';
405 + utf8::upgrade($first);
406 + my $last = $acct->prop('LastName') || '';
407 + utf8::upgrade($last);
408 + my $phone = $acct->prop('Phone') || '';
409 + my $company = $acct->prop('Company') || '';
410 + utf8::upgrade($company);
411 + my $dept = $acct->prop('Dept') || '';
412 + utf8::upgrade($dept);
413 + my $city = $acct->prop('City') || '';
414 + utf8::upgrade($city);
415 + my $street = $acct->prop('Street') || '';
416 + utf8::upgrade($street);
417 + my $freebusy = $acct->prop('FreeBusy') ||
418 + 'https://'.$hostname.'.'.$domain.'/horde/kronolith/fb.php?u='.$user.'@'.$domain;
419 + utf8::upgrade($freebusy);
420 +
421 +
422 + # Write the person informations in the ldif
423 + $OUT .= utf8("objectClass: sambaSamAccount\n") if ($sambaSID ne '');
424 + $OUT .= utf8("objectClass: calEntry\n");
425 + $OUT .= utf8("objectClass: inetOrgPerson\n");
426 + $OUT .= utf8("uid: $user\n");
427 + $OUT .= utf8("sn: $last\n");
428 + $OUT .= utf8("displayName: " . ($comment || "no comment") . "\n");
429 + $OUT .= utf8("givenName: $first\n");
430 + $OUT .= utf8("mail: $user\@$domain\n");
431 + #foreach my $alias (@alias){
432 + # my $acc = $a->get($alias)->prop('Account') || '';
433 + # if ($acc eq $user){
434 + # $OUT .= utf8("mail: $alias\@$domain\n");
435 + # }
436 + #}
437 + $OUT .= utf8("telephoneNumber: $phone\n") unless $phone =~ /^\s*$/;
438 + $OUT .= utf8("o: $company\n") unless $company =~ /^\s*$/;
439 + $OUT .= utf8("ou: $dept\n") unless $dept =~ /^\s*$/;
440 + $OUT .= utf8("l: $city\n") unless $city =~ /^\s*$/;
441 + $OUT .= utf8("street: $street\n") unless $street =~ /^\s*$/;
442 + $OUT .= utf8("calFBURL: $freebusy\n") unless $freebusy =~ /^\s*$/;
443 +
444 + # Write samba informations
445 + $OUT .= utf8("sambaSID: $sambaSID\n") if ($sambaSID ne '');
446 + $OUT .= utf8("sambaPrimaryGroupSID: $groupSID\n") if ($groupSID ne '');
447 + $OUT .= utf8("sambaLMPassword: $sambaLMPassword\n") if $sambaLMPassword;
448 + $OUT .= utf8("sambaNTPassword: $sambaNTPassword\n") if $sambaNTPassword;
449 + $OUT .= utf8("sambaPwdLastSet: ".int(time / (24 * 3600))."\n") if ($sambaLMPassword && $sambaNTPassword);
450 + $OUT .= utf8("sambaAcctFlags: $sambaAcctFlags\n") if $sambaAcctFlags;
451 +
452 + }
453 + # This handle dummy users for groups
454 + elsif($type eq 'group'){
455 + $OUT .= utf8("objectClass: inetOrgPerson\n");
456 + $OUT .= utf8("uid: $name\n");
457 + $OUT .= utf8("sn: $name\n");
458 + $OUT .= utf8("displayName: " . ($comment || "no comment") . "\n");
459 + $OUT .= utf8("mail: $user\@$domain\n");
460 + #foreach my $alias (@alias){
461 + # my $acc = $a->get($alias)->prop('Account') || '';
462 + # if ($acc eq $user){
463 + # $OUT .= utf8("mail: $alias\@$domain\n");
464 + # }
465 + #}
466 + $OUT .= utf8("telephoneNumber: $phone\n") unless $phone =~ /^\s*$/;
467 + $OUT .= utf8("o: $company\n") unless $company =~ /^\s*$/;
468 + $OUT .= utf8("ou: $dept\n") unless $dept =~ /^\s*$/;
469 + $OUT .= utf8("l: $city\n") unless $city =~ /^\s*$/;
470 + $OUT .= utf8("street: $street\n") unless $street =~ /^\s*$/;
471 + }
472 + # Else means, system account like root, www etc...
473 + else{
474 + $OUT .= utf8("objectClass: account\n");
475 + $OUT .= utf8("uid: $name\n");
476 + }
477 + # Some others attributes valid for all accounts
478 $OUT .= utf8("cn: $name\n");
479 - $OUT .= utf8("uid: $name\n");
480 $OUT .= utf8("gecos: " . ($comment || "no comment") . "\n");
481 $OUT .= utf8("uidNumber: $uid\n");
482 $OUT .= utf8("gidNumber: $gid\n");
483 @@ -42,11 +140,6 @@
484 $OUT .= utf8("shadowWarning: " . ($warning || "7") . "\n");
485 $OUT .= utf8("shadowInactive: " . ($inactive || "-1") . "\n");
486 $OUT .= utf8("shadowExpire: " . ($expire || "-1") . "\n");
487 - $OUT .= utf8("sambaSID: $sambaSID\n") if ($sambaSID ne '');
488 - $OUT .= utf8("sambaLMPassword: $sambaLMPassword\n") if $sambaLMPassword;
489 - $OUT .= utf8("sambaNTPassword: $sambaNTPassword\n") if $sambaNTPassword;
490 - $OUT .= utf8("sambaPwdLastSet: 1207907915\n") if ($sambaLMPassword && $sambaNTPassword); # sambaPwdLastSet needs to be not null
491 - $OUT .= utf8("sambaAcctFlags: $sambaAcctFlags\n") if $sambaAcctFlags;
492 $OUT .= utf8("shadowFlag: " . ($flag || "-1") . "\n\n");
493 }
494 }
495 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin
496 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin 2008-06-06 13:37:45.000000000 +0200
497 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin 2008-06-05 13:53:32.000000000 +0200
498 @@ -25,7 +25,7 @@
499 return $t;
500 }
501 # Basic entries to init.
502 - @ous = ("Groups", "People", "Users", "Computers"); # ous for Organizational Units.
503 + @ous = ("Groups", "Users", "Computers"); # ous for Organizational Units.
504 @users = ("root", "ntp", "www", "admin", "public");
505 @groups = ("shared", "slocate", "nobody", @users);
506 @machines = ();
507 @@ -56,6 +56,10 @@
508 foreach ($a->get_all_by_prop('type'=>'machine')){
509 @machines = (@machines,$_->key);
510 }
511 + #And read alias
512 + #foreach ($a->get_all_by_prop('type'=>'pseudonym')){
513 + # @alias = (@alias,$_->key);
514 + #}
515
516 # Parse a file with fields separated by ':' (ie /etc/{group,passwd,shadow}).
517 sub parse_file
518 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu.conf mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu.conf
519 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu.conf 2008-06-06 13:37:45.000000000 +0200
520 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu.conf 2008-06-05 13:53:32.000000000 +0200
521 @@ -1 +1,2 @@
522 PERMS=0600
523 +MORE_DATA={ ACCOUNT => "user" }
524 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu-machine.conf mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu-machine.conf
525 --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu-machine.conf 1970-01-01 01:00:00.000000000 +0100
526 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu-machine.conf 2008-06-05 13:53:32.000000000 +0200
527 @@ -0,0 +1,4 @@
528 +PERMS=0600
529 +TEMPLATE_PATH="/etc/cpu.conf"
530 +OUTPUT_FILENAME="/etc/cpu-machine.conf"
531 +MORE_DATA={ ACCOUNT => "machine" }

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