/[smeserver]/rpms/e-smith-ldap/sme8/e-smith-ldap-5.2.0-ldif_template.patch
ViewVC logotype

Annotation of /rpms/e-smith-ldap/sme8/e-smith-ldap-5.2.0-ldif_template.patch

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


Revision 1.1 - (hide annotations) (download)
Sun Sep 26 23:02:50 2010 UTC (14 years, 2 months ago) by slords
Branch: MAIN
CVS Tags: e-smith-ldap-5_2_0-49_el5_sme, e-smith-ldap-5_2_0-76_el5_sme, e-smith-ldap-5_2_0-71_el5_sme, e-smith-ldap-5_2_0-39_el5_sme, e-smith-ldap-5_2_0-77_el5_sme, e-smith-ldap-5_2_0-50_el5_sme, e-smith-ldap-5_2_0-78_el5_sme, e-smith-ldap-5_2_0-61_el5_sme, e-smith-ldap-5_2_0-66_el5_sme, e-smith-ldap-5_2_0-70_el5_sme, e-smith-ldap-5_2_0-79_el5_sme, e-smith-ldap-5_2_0-81_el5_sme, e-smith-ldap-5_2_0-59_el5_sme, e-smith-ldap-5_2_0-45_el5_sme, e-smith-ldap-5_2_0-75_el5_sme, e-smith-ldap-5_2_0-46_el5_sme, e-smith-ldap-5_2_0-56_el5_sme, e-smith-ldap-5_2_0-55_el5_sme, e-smith-ldap-5_2_0-57_el5_sme, e-smith-ldap-5_2_0-73_el5_sme, e-smith-ldap-5_2_0-69_el5_sme, e-smith-ldap-5_2_0-48_el5_sme, e-smith-ldap-5_2_0-44_el5_sme, e-smith-ldap-5_2_0-52_el5_sme, e-smith-ldap-5_2_0-51_el5_sme, e-smith-ldap-5_2_0-72_el5_sme, e-smith-ldap-5_2_0-65_el5_sme, e-smith-ldap-5_2_0-54_el5_sme, e-smith-ldap-5_2_0-53_el5_sme, e-smith-ldap-5_2_0-43_el5_sme, e-smith-ldap-5_2_0-47_el5_sme, e-smith-ldap-5_2_0-40_el5_sme, e-smith-ldap-5_2_0-80_el5_sme, e-smith-ldap-5_2_0-74_el5_sme, e-smith-ldap-5_2_0-41_el5_sme, e-smith-ldap-5_2_0-63_el5_sme, e-smith-ldap-5_2_0-60_el5_sme, e-smith-ldap-5_2_0-62_el5_sme, e-smith-ldap-5_2_0-42_el5_sme, e-smith-ldap-5_2_0-38_el5_sme, e-smith-ldap-5_2_0-68_el5_sme, e-smith-ldap-5_2_0-67_el5_sme, e-smith-ldap-5_2_0-64_el5_sme, HEAD
* Sun Sep 26 2010 Shad L. Lords <slords@mail.com> 5.2.0-38.sme
- Update ldif template to match stored data [SME: 6240]

1 slords 1.1 diff -up e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update.ldif_template e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update
2     --- e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update.ldif_template 2010-09-26 15:33:01.000000000 -0600
3     +++ e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update 2010-09-26 16:16:41.000000000 -0600
4     @@ -266,6 +266,7 @@ foreach my $acct (@accounts)
5     }
6     }
7     endpwent();
8     +endgrent();
9    
10     #------------------------------------------------------------
11     # Update LDAP database entry.
12     @@ -355,7 +356,7 @@ foreach my $dn (keys %$updates)
13     {
14     # Don't overwrite objectClass (just remove person if existing)
15     %seen = ( person => 1 );
16     - @{$updates->{$dn}->{objectClass}} = grep { ! $seen{$_} ++ } (@{$updates->{$dn}->{objectClass}}, @objectClass );
17     + @{$updates->{$dn}->{objectClass}} = grep { ! $seen{$_}++ } (@{$updates->{$dn}->{objectClass}}, @objectClass );
18    
19     $result = $ldap->modify( $dn, replace => $updates->{$dn});
20     $result->code && warn "failed to modify entry $dn: ", $result->error;
21     diff -up e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/10organisation.ldif_template e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/10organisation
22     --- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/10organisation.ldif_template 2010-09-26 15:33:01.000000000 -0600
23     +++ e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/10organisation 2010-09-26 16:34:45.000000000 -0600
24     @@ -1,26 +1,26 @@
25     {
26     my ($dc,undef) = split (/\./, $DomainName);
27     - my $o = $ldap{defaultCompany};
28     + my $o = $ldap{defaultCompany} || $DomainName;
29    
30     $OUT .= "dn: $ldapBase\n";
31     - $OUT .= "objectClass: organization\n";
32     - $OUT .= "objectClass: top\n";
33     $OUT .= "dc: $dc\n";
34     $OUT .= "o: $o\n";
35     - $OUT .= "objectClass: dcObject\n";
36     + $OUT .= "objectClass: top\n";
37     + $OUT .= "objectClass: organization\n";
38     + $OUT .= "objectClass: dcObject\n\n";
39    
40     - $OUT .= "\n";
41     $OUT .= "dn: ou=Users,$ldapBase\n";
42     + $OUT .= "ou: Users\n";
43     $OUT .= "objectClass: top\n";
44     - $OUT .= "objectClass: organizationalUnit\n";
45     - $OUT .= "ou: Users\n\n";
46     + $OUT .= "objectClass: organizationalUnit\n\n";
47     +
48     $OUT .= "dn: ou=Groups,$ldapBase\n";
49     + $OUT .= "ou: Groups\n";
50     $OUT .= "objectClass: top\n";
51     - $OUT .= "objectClass: organizationalUnit\n";
52     - $OUT .= "ou: Groups\n\n";
53     + $OUT .= "objectClass: organizationalUnit\n\n";
54     +
55     $OUT .= "dn: ou=Computers,$ldapBase\n";
56     + $OUT .= "ou: Computers\n";
57     $OUT .= "objectClass: top\n";
58     - $OUT .= "objectClass: organizationalUnit\n";
59     - $OUT .= "ou: Computers\n\n";
60     + $OUT .= "objectClass: organizationalUnit\n\n";
61     }
62     -
63     diff -up e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50computers.ldif_template e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50computers
64     --- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50computers.ldif_template 2010-09-26 16:58:19.000000000 -0600
65     +++ e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50computers 2010-09-26 16:50:52.000000000 -0600
66     @@ -0,0 +1,40 @@
67     +{
68     + foreach my $comp ($a->get_all_by_prop(type => 'machine'))
69     + {
70     + my $key = $comp->key;
71     +
72     + if (exists $users->{$key})
73     + {
74     + $OUT .= "dn: uid=$key,ou=Computers,$ldapBase\n";
75     + $OUT .= "objectClass: posixAccount\n";
76     + $OUT .= "objectClass: shadowAccount\n";
77     + $OUT .= "objectClass: account\n";
78     + $OUT .= "objectClass: sambaSamAccount\n" if exists $users->{$key}->{sambaSID};
79     + foreach my $attr ( keys %{$users->{$key}} )
80     + {
81     + $OUT .= utf8("$attr: ".$users->{$key}->{$attr})."\n" if $users->{$key}->{$attr};
82     + }
83     + $OUT .= "\n";
84     + }
85     +
86     + if (exists $groups->{$key})
87     + {
88     + $OUT .= "dn: cn=$key,ou=Groups,$ldapBase\n";
89     + $OUT .= "objectClass: posixGroup\n";
90     + $OUT .= "objectClass: sambaGroupMapping\n" if exists $groups->{$key}->{sambaSID};
91     + foreach my $attr ( keys %{$groups->{$key}} )
92     + {
93     + if (ref($groups->{$key}->{$attr}) eq 'ARRAY')
94     + {
95     + my %seen = ();
96     + $OUT .= utf8("$attr: $_\n") foreach (grep { ! $seen{$_}++ } @{$groups->{$key}->{$attr}});
97     + }
98     + else
99     + {
100     + $OUT .= utf8("$attr: ".$groups->{$key}->{$attr})."\n" if $groups->{$key}->{$attr};
101     + }
102     + }
103     + $OUT .= "\n";
104     + }
105     + }
106     +}
107     diff -up e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups.ldif_template e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups
108     --- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups.ldif_template 2010-09-26 15:33:01.000000000 -0600
109     +++ e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups 2010-09-26 16:50:55.000000000 -0600
110     @@ -1,27 +1,42 @@
111     {
112     - foreach ($a->groups)
113     + foreach my $grp ($a->groups)
114     {
115     - my $key = $_->key;
116     - my $desc = $_->prop('Description') || '';
117     - my $gid = $_->prop('Gid');
118     - my @members = split( /,/, ($_->prop('Members') || '') );
119     - my $smbsid = $smbsid{$key} || '';
120     + my $key = $grp->key;
121    
122     - $OUT .= "\n";
123     - $OUT .= "dn: cn=$key,ou=Groups,$ldapBase\n";
124     - $OUT .= "objectClass: posixGroup\n";
125     - $OUT .= "objectClass: mailboxRelatedObject\n";
126     - $OUT .= "objectClass: sambaGroupMapping\n";
127     - $OUT .= "gidNumber: $gid\n";
128     - $OUT .= "cn: $key\n";
129     - $OUT .= "description: $desc\n";
130     - $OUT .= "displayName: $desc\n";
131     - $OUT .= "mail: $key\@$DomainName\n";
132     - foreach my $member (@members){
133     - $OUT .= "memberUid: $member\n";
134     - }
135     - $OUT .= "sambaGroupType: 2\n";
136     - $OUT .= "sambaSID: $smbsid\n";
137     + if (exists $users->{$key})
138     + {
139     + $OUT .= "dn: uid=$key,ou=Users,$ldapBase\n";
140     + $OUT .= "objectClass: posixAccount\n";
141     + $OUT .= "objectClass: shadowAccount\n";
142     + $OUT .= "objectClass: account\n";
143     + $OUT .= "objectClass: sambaSamAccount\n" if exists $users->{$key}->{sambaSID};
144     + foreach my $attr ( keys %{$users->{$key}} )
145     + {
146     + $OUT .= utf8("$attr: ".$users->{$key}->{$attr})."\n" if $users->{$key}->{$attr};
147     + }
148     + $OUT .= "\n";
149     + }
150     +
151     + if (exists $groups->{$key})
152     + {
153     + $OUT .= "dn: cn=$key,ou=Groups,$ldapBase\n";
154     + $OUT .= "objectClass: posixGroup\n";
155     + $OUT .= "objectClass: mailboxRelatedObject\n";
156     + $OUT .= "objectClass: sambaGroupMapping\n" if exists $groups->{$key}->{sambaSID};
157     + foreach my $attr ( keys %{$groups->{$key}} )
158     + {
159     + if (ref($groups->{$key}->{$attr}) eq 'ARRAY')
160     + {
161     + my %seen = ();
162     + $OUT .= utf8("$attr: $_\n") foreach grep { ! $seen{$_}++ } @{$groups->{$key}->{$attr}};
163     + }
164     + else
165     + {
166     + $OUT .= utf8("$attr: ".$groups->{$key}->{$attr})."\n" if $groups->{$key}->{$attr};
167     + }
168     + }
169     + $OUT .= "mail: $key\@$DomainName\n";
170     + $OUT .= "\n";
171     + }
172     }
173     }
174     -
175     diff -up e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50ibays.ldif_template e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50ibays
176     --- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50ibays.ldif_template 2010-09-26 16:58:44.000000000 -0600
177     +++ e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50ibays 2010-09-26 16:50:57.000000000 -0600
178     @@ -0,0 +1,40 @@
179     +{
180     + foreach my $ibay ($a->ibays)
181     + {
182     + my $key = $ibay->key;
183     +
184     + if (exists $users->{$key})
185     + {
186     + $OUT .= "dn: uid=$key,ou=Users,$ldapBase\n";
187     + $OUT .= "objectClass: posixAccount\n";
188     + $OUT .= "objectClass: shadowAccount\n";
189     + $OUT .= "objectClass: account\n";
190     + $OUT .= "objectClass: sambaSamAccount\n" if exists $users->{$key}->{sambaSID};
191     + foreach my $attr ( keys %{$users->{$key}} )
192     + {
193     + $OUT .= utf8("$attr: ".$users->{$key}->{$attr})."\n" if $users->{$key}->{$attr};
194     + }
195     + $OUT .= "\n";
196     + }
197     +
198     + if (exists $groups->{$key})
199     + {
200     + $OUT .= "dn: cn=$key,ou=Groups,$ldapBase\n";
201     + $OUT .= "objectClass: posixGroup\n";
202     + $OUT .= "objectClass: sambaGroupMapping\n" if exists $groups->{$key}->{sambaSID};
203     + foreach my $attr ( keys %{$groups->{$key}} )
204     + {
205     + if (ref($groups->{$key}->{$attr}) eq 'ARRAY')
206     + {
207     + my %seen = ();
208     + $OUT .= utf8("$attr: $_\n") foreach grep { ! $seen{$_}++ } @{$groups->{$key}->{$attr}};
209     + }
210     + else
211     + {
212     + $OUT .= utf8("$attr: ".$groups->{$key}->{$attr})."\n" if $groups->{$key}->{$attr};
213     + }
214     + }
215     + $OUT .= "\n";
216     + }
217     + }
218     +}
219     diff -up e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users.ldif_template e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users
220     --- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users.ldif_template 2010-09-26 15:33:01.000000000 -0600
221     +++ e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users 2010-09-26 16:50:58.000000000 -0600
222     @@ -2,56 +2,42 @@
223     my @users = $a->users;
224     push (@users,$a->get('admin'));
225     foreach my $user (@users)
226     - {
227     + {
228     my $key = $user->key;
229     - my $first = $user->prop('FirstName') || '';
230     - my $last = $user->prop('LastName') || '';
231     - my $name = "$first $last";
232     - my $phone = $user->prop('Phone');
233     - my $company = $user->prop('Company');
234     - my $dept = $user->prop('Dept');
235     - my $city = $user->prop('City');
236     - my $street = $user->prop('Street');
237     - my $uid = $uid{$key};
238     - my $gid = $gid{$key};
239     - my $password = $passwd{$key};
240     - my $home = $home{$key};
241     - my $shell = $shell{$key};
242    
243     - my $lmpass = $lmpass{$key} || '';
244     - my $ntpass = $ntpass{$key} || '';
245     - my $smbflag = $smbflag{$key} || '';
246     - my $smblct = $smblct{$key} || '';
247     - my $smbsid = $smbsid{$key} || '';
248     - my $smbpgsid = $smbpgsid{$key} || '';
249     -
250     -
251     - $OUT .= "\n";
252     - $OUT .= utf8("dn: uid=$key,ou=Users,$ldapBase\n");
253     - $OUT .= utf8("objectClass: inetOrgPerson\n");
254     - $OUT .= utf8("objectClass: posixAccount\n");
255     - $OUT .= utf8("objectClass: sambaSamAccount\n");
256     - $OUT .= utf8("uid: $key\n");
257     - $OUT .= utf8("cn: $name\n") if $name;
258     - $OUT .= utf8("givenName: $first\n") if $first;
259     - $OUT .= utf8("sn: $last\n") if $last;
260     - $OUT .= utf8("mail: $key\@$DomainName\n");
261     - $OUT .= utf8("telephoneNumber: $phone\n") if $phone;
262     - $OUT .= utf8("o: $company\n") if $company;
263     - $OUT .= utf8("ou: $dept\n") if $dept;
264     - $OUT .= utf8("l: $city\n") if $city;
265     - $OUT .= utf8("street: $street\n") if $street;
266     - $OUT .= utf8("userPassword: $password\n") if $password;
267     - $OUT .= utf8("uidNumber: $uid\n") if $uid;
268     - $OUT .= utf8("gidNumber: $gid\n") if $gid;
269     - $OUT .= utf8("homeDirectory: $home\n") if $home;
270     - $OUT .= utf8("loginShell: $shell\n") if $shell;
271     - $OUT .= utf8("sambaLMPassword: $lmpass\n") if $lmpass;
272     - $OUT .= utf8("sambaNTPassword: $ntpass\n") if $ntpass;
273     - $OUT .= utf8("sambaAcctFlags: $smbflag\n") if $smbflag;
274     - $OUT .= utf8("sambaPwdLastSet: $smblct\n") if $smblct;
275     - $OUT .= utf8("sambaSID: $smbsid\n") if $smbsid;
276     - $OUT .= utf8("sambaPrimaryGroupSID: $smbpgsid\n") if $smbpgsid;
277     + if (exists $users->{$key})
278     + {
279     + $OUT .= "dn: uid=$key,ou=Users,$ldapBase\n";
280     + $OUT .= "objectClass: inetOrgPerson\n";
281     + $OUT .= "objectClass: posixAccount\n";
282     + $OUT .= "objectClass: shadowAccount\n";
283     + $OUT .= "objectClass: sambaSamAccount\n" if exists $users->{$key}->{sambaSID};
284     + foreach my $attr ( keys %{$users->{$key}} )
285     + {
286     + $OUT .= utf8("$attr: ".$users->{$key}->{$attr})."\n" if $users->{$key}->{$attr};
287     + }
288     + $OUT .= utf8("mail: $key\@$DomainName\n");
289     + $OUT .= "\n";
290     + }
291    
292     + if (exists $groups->{$key})
293     + {
294     + $OUT .= "dn: cn=$key,ou=Groups,$ldapBase\n";
295     + $OUT .= "objectClass: posixGroup\n";
296     + $OUT .= "objectClass: sambaGroupMapping\n" if exists $groups->{$key}->{sambaSID};
297     + foreach my $attr ( keys %{$groups->{$key}} )
298     + {
299     + if (ref($groups->{$key}->{$attr}) eq 'ARRAY')
300     + {
301     + my %seen = ();
302     + $OUT .= utf8("$attr: $_\n") foreach grep { ! $seen{$_}++ } @{$groups->{$key}->{$attr}};
303     + }
304     + else
305     + {
306     + $OUT .= utf8("$attr: ".$groups->{$key}->{$attr})."\n" if $groups->{$key}->{$attr};
307     + }
308     + }
309     + $OUT .= "\n";
310     + }
311     }
312     }
313     diff -up e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin.ldif_template e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin
314     --- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin.ldif_template 2010-09-26 15:33:01.000000000 -0600
315     +++ e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin 2010-09-26 16:51:00.000000000 -0600
316     @@ -1,9 +1,13 @@
317     {
318     use esmith::AccountsDB;
319     use esmith::util;
320     + use Date::Parse;
321    
322     + my $schema = '/etc/openldap/schema/samba.schema';
323     + my $schema = '/usr/share/doc/samba-3.0.33/LDAP/samba.schema';
324     $a = esmith::AccountsDB->open_ro;
325     $ldapBase = esmith::util::ldapBase ($DomainName);
326     +
327     sub utf8
328     {
329     my $t = shift;
330     @@ -11,51 +15,76 @@
331     return $t;
332     }
333    
334     - %passwd = ();
335     - %uid = ();
336     - %gid = ();
337     - %home = ();
338     - %shell = ();
339     - while(my ($key,$pwd,$uid,$gid,
340     - undef,undef,undef,
341     - $dir,$shell) = getpwent()) {
342     -
343     - $passwd{$key} = "{CRYPT}$pwd";
344     - $uid{$key} = $uid;
345     - $gid{$key} = $gid;
346     - $home{$key} = $dir;
347     - $shell{$key} = $shell;
348     + $users = ();
349     + while(my ($key,$pwd,$uid,$gid,undef,undef,$gecos,$dir,$shell) = getpwent())
350     + {
351     + # skip non sme users
352     + my $account = $a->get($key) || next;
353     +
354     + $users->{$key}->{uid} = $key;
355     + $users->{$key}->{userPassword} = ($pwd =~ m/^\{/) ? $pwd : "\{CRYPT\}$pwd";
356     + $users->{$key}->{uidNumber} = $uid;
357     + $users->{$key}->{gidNumber} = $gid;
358     + $users->{$key}->{gecos} = $gecos;
359     + $users->{$key}->{cn} = $gecos;
360     + $users->{$key}->{homeDirectory} = $dir;
361     + $users->{$key}->{loginShell} = $shell;
362     + if (($account->prop('type') || 'unknown') eq 'user')
363     + {
364     + $users->{$key}->{givenName} = $account->prop('FirstName');
365     + $users->{$key}->{sn} = $account->prop('LastName');
366     + $users->{$key}->{telephoneNumber} = $account->prop('Phone');
367     + $users->{$key}->{o} = $account->prop('Company');
368     + $users->{$key}->{ou} = $account->prop('Department');
369     + $users->{$key}->{l} = $account->prop('City');
370     + $users->{$key}->{street} = $account->prop('Street');
371     + }
372     }
373     endpwent();
374    
375     - %lmpass = ();
376     - %ntpass = ();
377     - %smbflag = ();
378     - %smblct = ();
379     - %smbsid = ();
380     - %smbpgsid = ();
381     -
382     - foreach my $line (`/usr/bin/pdbedit -Lw`){
383     - my ($key,undef,$lmpass,$ntpass,$smbflag,$smblct) = split(/:/,$line);
384     - $lmpass{$key} = $lmpass;
385     - $ntpass{$key} = $ntpass;
386     - $smbflag{$key} = $smbflag;
387     - $smblct =~ s/LCT\-//;
388     - $smblct{$key} = hex($smblct);
389     - foreach my $info (`/usr/bin/pdbedit -v $key`){
390     - $smbsid{$key} = $1 if ($info =~ m/User SID:\s+(S-.*)/);
391     - $smbpgsid{$key} = $1 if ($info =~ m/Primary Group SID:\s+(S-.*)/);
392     + if ( -f "$schema" and -x '/usr/bin/pdbedit' )
393     + {
394     + foreach my $line (`/usr/bin/pdbedit -Lw 2> /dev/null`)
395     + {
396     + my ($key,undef,$lmpass,$ntpass) = split(/:/,$line);
397     + next unless exists $users->{$key};
398     + $users->{$key}->{sambaLMPassword} = $lmpass;
399     + $users->{$key}->{sambaNTPassword} = $ntpass;
400     +
401     + foreach my $info (`/usr/bin/pdbedit -v '$key' 2> /dev/null`){
402     + $users->{$key}->{sambaSID} = $1 if $info =~ m{User SID:\s+(S-.*)$};
403     + $users->{$key}->{displayName} = $1 if $info =~ m{Full Name:\s+(.*)$};
404     + $users->{$key}->{sambaPrimaryGroupSID} = $1 if $info =~ m{Primary Group SID:\s+(S-.*)$};
405     + $users->{$key}->{sambaAcctFlags} = $1 if $info =~ m{Account Flags:\s+(.*)$};
406     + $users->{$key}->{sambaPwdLastSet} = str2time($1) if $info =~ m{Password last set:\s+(.*)$};
407     + }
408     }
409     - }
410     + }
411    
412     - foreach (`/usr/bin/net groupmap list`){
413     + $groups = ();
414     + while(my ($key,$pwd,$gid,$members) = getgrent())
415     + {
416     + # skip non sme groups
417     + $a->get($key) || next;
418     +
419     + $groups->{$key}->{cn} = $key;
420     + $groups->{$key}->{userPassword} = ($pwd =~ m/^\{/) ? $pwd : "\{CRYPT\}$pwd";
421     + $groups->{$key}->{gidNumber} = $gid;
422     + $groups->{$key}->{description} = $users->{$key}->{cn} if exists $users->{$key}->{cn};
423     + $groups->{$key}->{memberUid} = [ split /\s+/, $members ];
424     + }
425     + endgrent();
426     +
427     + foreach (`/usr/bin/net groupmap list 2> /dev/null`){
428     chomp;
429     - next unless (/^(.*?) \((S-.*-\d+)\) -> (.*)$/);
430     - my ($desc, $smbsid, $key) = ($1, $2, $3);
431     - # We only want group sid
432     - my $account = $a->get($key) || next;
433     - next unless ($account->prop('type') eq 'group');
434     - $smbsid{$key} = $smbsid;
435     + next if m{\(S-1-5-32-\d+\)};
436     + if (/^(.*) \((S-.*-\d+)\) -> (.*)$/)
437     + {
438     + next unless exists $groups->{$3};
439     + $groups->{$3}->{displayName} = $1;
440     + $groups->{$3}->{sambaSID} = $2;
441     + $groups->{$3}->{sambaGroupType} = '2';
442     + }
443     }
444    
445     $OUT = "";

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