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

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

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


Revision 1.1 - (hide annotations) (download)
Fri Sep 24 16:50:54 2010 UTC (14 years, 1 month ago) by vip-ire
Branch: MAIN
CVS Tags: e-smith-ldap-5_2_0-31_el5_sme, 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-37_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-36_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-35_el5_sme, e-smith-ldap-5_2_0-72_el5_sme, e-smith-ldap-5_2_0-34_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-30_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
* Fri Sep 24 2010 Daniel Berteaud <daniel@firewall-services.com> 5.2.0-30.sme
- Add sambaSamAccount attributes in LDAP [SME: 6232]

1 vip-ire 1.1 diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update mezzanine_patched_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 2010-09-24 18:47:32.000000000 +0200
3     +++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update 2010-09-24 16:15:45.000000000 +0200
4     @@ -97,6 +97,41 @@
5     }
6     endpwent();
7    
8     +# Now parse samba info
9     +# We want to copy all this into LDAP
10     +# so it'll be easier to switch to real LDAP auth later
11     +my %lmpass;
12     +my %ntpass;
13     +my %smbflag;
14     +my %smblct;
15     +my %smbsid;
16     +my %smbpgsid;
17     +
18     +# First, parse users data
19     +foreach my $line (`/usr/bin/pdbedit -Lw`){
20     + my ($key,undef,$lmpass,$ntpass,$smbflag,$smblct) = split(/:/,$line);
21     + $lmpass{$key} = $lmpass;
22     + $ntpass{$key} = $ntpass;
23     + $smbflag{$key} = $smbflag;
24     + $smblct =~ s/LCT\-//;
25     + $smblct{$key} = hex($smblct);
26     + foreach my $info (`/usr/bin/pdbedit -v $key`){
27     + $smbsid{$key} = $1 if ($info =~ m/User SID:\s+(S-.*)/);
28     + $smbpgsid{$key} = $1 if ($info =~ m/Primary Group SID:\s+(S-.*)/);
29     + }
30     +}
31     +
32     +# Now, parse groupmaps data
33     +foreach (`/usr/bin/net groupmap list`){
34     + chomp;
35     + next unless (/^(.*?) \((S-.*-\d+)\) -> (.*)$/);
36     + my ($desc, $smbsid, $key) = ($1, $2, $3);
37     + # We only want group sid
38     + my $account = $a->get($key) || next;
39     + next unless ($account->prop('type') eq 'group');
40     + $smbsid{$key} = $smbsid;
41     +}
42     +
43     #------------------------------------------------------------
44     # Update LDAP database entry.
45     #------------------------------------------------------------
46     @@ -146,8 +181,14 @@
47     my $gid = $gid{$key} || '';
48     my $home = $home{$key} || '';
49     my $shell = $shell{$key} || '';
50     + my $lmpass = $lmpass{$key} || '';
51     + my $ntpass = $ntpass{$key} || '';
52     + my $smbflag = $smbflag{$key} || '';
53     + my $smblct = $smblct{$key} || '';
54     + my $smbsid = $smbsid{$key} || '';
55     + my $smbpgsid = $smbpgsid{$key} || '';
56    
57     - push @attrs, (objectClass => ['inetOrgPerson', 'posixAccount']);
58     + push @attrs, (objectClass => ['inetOrgPerson', 'posixAccount', 'sambaSamAccount']);
59     push @attrs, (uid => $key);
60    
61     push @attrs, (cn => $name) unless ($name =~ /^\s*$/);
62     @@ -164,6 +205,12 @@
63     push @attrs, (gidNumber => $gid) unless $gid =~ /^\s*$/;
64     push @attrs, (homeDirectory => $home) unless $home =~ /^\s*$/;
65     push @attrs, (loginShell => $shell) unless $shell =~ /^\s*$/;
66     + push @attrs, (sambaLMPassword => $lmpass) unless $lmpass =~ /^\s*$/;
67     + push @attrs, (sambaNTPassword => $ntpass) unless $ntpass =~ /^\s*$/;
68     + push @attrs, (sambaAcctFlags => $smbflag) unless $smbflag =~ /^\s*$/;
69     + push @attrs, (sambaPwdLastSet => $smblct) unless $smblct =~ /^\s*$/;
70     + push @attrs, (sambaSID => $smbsid) unless $smbsid =~ /^\s*$/;
71     + push @attrs, (sambaPrimaryGroupSID => $smbpgsid) unless $smbpgsid =~ /^\s*$/;
72     }
73     elsif ($type eq 'group')
74     {
75     @@ -173,14 +220,19 @@
76     utf8::upgrade($desc);
77     my @members = split(/,/,($acct->prop('Members') || ''));
78     my $gid = $acct->prop('Gid');
79     + my $smbsid = $smbsid{$key};
80    
81     - push @attrs, (objectClass => ['posixGroup','mailboxRelatedObject']);
82     + push @attrs, (objectClass => ['posixGroup','mailboxRelatedObject','sambaGroupMapping']);
83     push @attrs, (cn => $key);
84     push @attrs, (mail => "$key\@$domain");
85     push @attrs, (gidNumber => $gid);
86     push @attrs, (description => $desc) unless $desc =~ /^\s*$/;
87     push @attrs, (memberUid => \@members)
88     unless ((scalar @members == 0) && ($event eq 'group-create'));
89     + # Samba requires the displayName attribute
90     + push @attrs, (displayName => $desc) unless $desc =~ /^\s*$/;
91     + push @attrs, (sambaGroupType => '2');
92     + push @attrs, (sambaSID => $smbsid);
93     }
94     if (($event eq 'user-create') || ($event eq 'group-create'))
95     {
96     diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups
97     --- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups 2010-09-24 18:47:32.000000000 +0200
98     +++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups 2010-09-24 18:43:40.000000000 +0200
99     @@ -5,18 +5,23 @@
100     my $desc = $_->prop('Description') || '';
101     my $gid = $_->prop('Gid');
102     my @members = split( /,/, ($_->prop('Members') || '') );
103     + my $smbsid = $smbsid{$key} || '';
104    
105     $OUT .= "\n";
106     $OUT .= "dn: cn=$key,ou=Groups,$ldapBase\n";
107     $OUT .= "objectClass: posixGroup\n";
108     $OUT .= "objectClass: mailboxRelatedObject\n";
109     + $OUT .= "objectClass: sambaGroupMapping\n";
110     $OUT .= "gidNumber: $gid\n";
111     $OUT .= "cn: $key\n";
112     $OUT .= "description: $desc\n";
113     + $OUT .= "displayName: $desc\n";
114     $OUT .= "mail: $key\@$DomainName\n";
115     foreach my $member (@members){
116     $OUT .= "memberUid: $member\n";
117     }
118     + $OUT .= "sambaGroupType: 2\n";
119     + $OUT .= "sambaSID: $smbsid\n";
120     }
121     }
122    
123     diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users
124     --- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users 2010-09-24 18:47:32.000000000 +0200
125     +++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users 2010-09-24 16:15:45.000000000 +0200
126     @@ -18,10 +18,19 @@
127     my $home = $home{$key};
128     my $shell = $shell{$key};
129    
130     + my $lmpass = $lmpass{$key} || '';
131     + my $ntpass = $ntpass{$key} || '';
132     + my $smbflag = $smbflag{$key} || '';
133     + my $smblct = $smblct{$key} || '';
134     + my $smbsid = $smbsid{$key} || '';
135     + my $smbpgsid = $smbpgsid{$key} || '';
136     +
137     +
138     $OUT .= "\n";
139     $OUT .= utf8("dn: uid=$key,ou=Users,$ldapBase\n");
140     $OUT .= utf8("objectClass: inetOrgPerson\n");
141     $OUT .= utf8("objectClass: posixAccount\n");
142     + $OUT .= utf8("objectClass: sambaSamAccount\n");
143     $OUT .= utf8("uid: $key\n");
144     $OUT .= utf8("cn: $name\n") if $name;
145     $OUT .= utf8("givenName: $first\n") if $first;
146     @@ -37,5 +46,12 @@
147     $OUT .= utf8("gidNumber: $gid\n") if $gid;
148     $OUT .= utf8("homeDirectory: $home\n") if $home;
149     $OUT .= utf8("loginShell: $shell\n") if $shell;
150     + $OUT .= utf8("sambaLMPassword: $lmpass\n") if $lmpass;
151     + $OUT .= utf8("sambaNTPassword: $ntpass\n") if $ntpass;
152     + $OUT .= utf8("sambaAcctFlags: $smbflag\n") if $smbflag;
153     + $OUT .= utf8("sambaPwdLastSet: $smblct\n") if $smblct;
154     + $OUT .= utf8("sambaSID: $smbsid\n") if $smbsid;
155     + $OUT .= utf8("sambaPrimaryGroupSID: $smbpgsid\n") if $smbpgsid;
156     +
157     }
158     }
159     diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin
160     --- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin 2010-09-24 18:47:32.000000000 +0200
161     +++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin 2010-09-24 16:15:45.000000000 +0200
162     @@ -28,5 +28,35 @@
163     }
164     endpwent();
165    
166     + %lmpass = ();
167     + %ntpass = ();
168     + %smbflag = ();
169     + %smblct = ();
170     + %smbsid = ();
171     + %smbpgsid = ();
172     +
173     + foreach my $line (`/usr/bin/pdbedit -Lw`){
174     + my ($key,undef,$lmpass,$ntpass,$smbflag,$smblct) = split(/:/,$line);
175     + $lmpass{$key} = $lmpass;
176     + $ntpass{$key} = $ntpass;
177     + $smbflag{$key} = $smbflag;
178     + $smblct =~ s/LCT\-//;
179     + $smblct{$key} = hex($smblct);
180     + foreach my $info (`/usr/bin/pdbedit -v $key`){
181     + $smbsid{$key} = $1 if ($info =~ m/User SID:\s+(S-.*)/);
182     + $smbpgsid{$key} = $1 if ($info =~ m/Primary Group SID:\s+(S-.*)/);
183     + }
184     + }
185     +
186     + foreach (`/usr/bin/net groupmap list`){
187     + chomp;
188     + next unless (/^(.*?) \((S-.*-\d+)\) -> (.*)$/);
189     + my ($desc, $smbsid, $key) = ($1, $2, $3);
190     + # We only want group sid
191     + my $account = $a->get($key) || next;
192     + next unless ($account->prop('type') eq 'group');
193     + $smbsid{$key} = $smbsid;
194     + }
195     +
196     $OUT = "";
197     }

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