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 |
|
|
} |