1 |
diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-delete mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-delete |
2 |
--- e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-delete 2010-02-03 08:40:40.000000000 +0100 |
3 |
+++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-delete 2010-02-03 08:39:45.000000000 +0100 |
4 |
@@ -57,7 +57,13 @@ |
5 |
password => $pw |
6 |
); |
7 |
|
8 |
-my @search_args = ( base => "ou=Users,$base", filter => "uid=$name" ); |
9 |
+my @search_args = (); |
10 |
+if ($event eq 'user-delete'){ |
11 |
+ @search_args = ( base => "ou=Users,$base", filter => "uid=$name" ); |
12 |
+} |
13 |
+elsif($event eq 'group-delete'){ |
14 |
+ @search_args = ( base => "ou=Groups,$base", filter => "cn=$name" ); |
15 |
+} |
16 |
my $mesg = $ldap->search(@search_args); |
17 |
|
18 |
$mesg->code && die "Failed ldap search: ", $mesg->error; |
19 |
@@ -69,18 +75,6 @@ |
20 |
|
21 |
$ldap->delete($mesg->entry(0)); |
22 |
|
23 |
-if ($event eq 'group-delete'){ |
24 |
- @search_args = ( base => "ou=Groups,$base", filter => "cn=$name" ); |
25 |
- $mesg = $ldap->search(@search_args); |
26 |
- $mesg->code && die "Failed ldap search: ", $mesg->error; |
27 |
- if ($mesg->count > 1) |
28 |
- { |
29 |
- die("LDAP search for $name returned $mesg->count - 1 expected\n"); |
30 |
- } |
31 |
- |
32 |
- $ldap->delete($mesg->entry(0)); |
33 |
-} |
34 |
- |
35 |
$ldap->unbind; |
36 |
|
37 |
exit (0); |
38 |
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 |
39 |
--- e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update 2010-02-03 08:40:40.000000000 +0100 |
40 |
+++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update 2010-02-03 08:40:36.000000000 +0100 |
41 |
@@ -106,9 +106,10 @@ |
42 |
my $type = $acct->prop('type'); |
43 |
next unless ($type eq 'user' || $type eq 'group'); |
44 |
my @attrs = (); |
45 |
- my @groupAttrs = (); |
46 |
+ my $dn = $base; |
47 |
if (($type eq 'user') || ($key eq 'admin')) |
48 |
{ |
49 |
+ $dn = "uid=$key,ou=Users,$base"; |
50 |
my $name = $acct->prop('FirstName') . " " . $acct->prop('LastName'); |
51 |
utf8::upgrade($name); |
52 |
my $first = $acct->prop('FirstName') || ''; |
53 |
@@ -142,57 +143,34 @@ |
54 |
} |
55 |
elsif ($type eq 'group') |
56 |
{ |
57 |
- push @attrs, (objectClass => 'inetOrgPerson'); |
58 |
- push @attrs, (uid => $key); |
59 |
- push @attrs, (sn => $key); |
60 |
- |
61 |
+ $dn = "cn=$key,ou=Groups,$base"; |
62 |
my $key = $acct->key; |
63 |
- my $desc = $acct->prop('Description') || ''; |
64 |
- my @members = split(/,/,($acct->prop('Members') || '')); |
65 |
- my $gid = $acct->prop('Gid'); |
66 |
- |
67 |
+ my $desc = $acct->prop('Description') || ''; |
68 |
utf8::upgrade($desc); |
69 |
- push @attrs, (cn => $desc) unless $desc =~ /^\s*$/; |
70 |
- push @attrs, (mail => "$key\@$domain"); |
71 |
- push @attrs, (telephoneNumber => $phone) unless $phone =~ /^\s*$/; |
72 |
- push @attrs, (o => $company) unless $company =~ /^\s*$/; |
73 |
- push @attrs, (ou => $dept) unless $dept =~ /^\s*$/; |
74 |
- push @attrs, (l => $city) unless $city =~ /^\s*$/; |
75 |
- push @attrs, (street => $street) unless $street =~ /^\s*$/; |
76 |
+ my @members = split(/,/,($acct->prop('Members') || '')); |
77 |
+ my $gid = $acct->prop('Gid'); |
78 |
|
79 |
- push @groupAttrs, (objectClass => 'posixGroup'); |
80 |
- push @groupAttrs, (cn => $key); |
81 |
- push @groupAttrs, (gidNumber => $gid); |
82 |
- push @groupAttrs, (description => $desc) unless $desc =~ /^\s*$/; |
83 |
- push @groupAttrs, (memberUid => \@members); |
84 |
+ push @attrs, (objectClass => ['posixGroup','mailboxRelatedObject']); |
85 |
+ push @attrs, (cn => $key); |
86 |
+ push @attrs, (mail => "$key\@$domain"); |
87 |
+ push @attrs, (gidNumber => $gid); |
88 |
+ push @attrs, (description => $desc) unless $desc =~ /^\s*$/; |
89 |
+ push @attrs, (memberUid => \@members); |
90 |
} |
91 |
- my $dn = "uid=$key,ou=Users,$base"; |
92 |
- my $groupDn = "cn=$key,ou=Groups,$base"; |
93 |
if (($event eq 'user-create') || ($event eq 'group-create')) |
94 |
{ |
95 |
my $result = $ldap->add ($dn, attr => \@attrs); |
96 |
|
97 |
$result->code && |
98 |
warn "failed to add entry for $dn: ", $result->error ; |
99 |
- |
100 |
- $result = $ldap->add ($groupDn, attr => \@groupAttrs); |
101 |
- |
102 |
- $result->code && |
103 |
- warn "failed to add entry for $groupDn: ", $result->error ; |
104 |
} |
105 |
else |
106 |
{ |
107 |
my %attrs = @attrs; |
108 |
- my %groupAttrs = @groupAttrs; |
109 |
my $result = $ldap->modify ($dn, replace => \%attrs); |
110 |
|
111 |
$result->code && |
112 |
warn "failed to modify entry for $dn: ", $result->error ; |
113 |
- |
114 |
- $result = $ldap->modify ($groupDn, replace => \%groupAttrs); |
115 |
- |
116 |
- $result->code && |
117 |
- warn "failed to modify entry for $groupDn: ", $result->error ; |
118 |
} |
119 |
} |
120 |
$ldap->unbind; |
121 |
diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/etc/e-smith/templates/etc/openldap/slapd.conf/10schema mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/etc/openldap/slapd.conf/10schema |
122 |
--- e-smith-ldap-5.2.0/root/etc/e-smith/templates/etc/openldap/slapd.conf/10schema 2008-08-20 23:26:21.000000000 +0200 |
123 |
+++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/etc/openldap/slapd.conf/10schema 2010-02-03 08:39:45.000000000 +0100 |
124 |
@@ -5,3 +5,4 @@ |
125 |
include /etc/openldap/schema/nis.schema |
126 |
include /etc/openldap/schema/redhat/rfc822-MailMember.schema |
127 |
include /etc/openldap/schema/redhat/autofs.schema |
128 |
+include /etc/openldap/schema/mailRelatedObject.schema |
129 |
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 |
130 |
--- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups 2010-02-03 08:40:40.000000000 +0100 |
131 |
+++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups 2010-02-03 08:39:45.000000000 +0100 |
132 |
@@ -7,19 +7,13 @@ |
133 |
my @members = split( /,/, ($_->prop('Members') || '') ); |
134 |
|
135 |
$OUT .= "\n"; |
136 |
- $OUT .= "dn: uid=$key,ou=Users,$ldapBase\n"; |
137 |
- $OUT .= "objectClass: inetOrgPerson\n"; |
138 |
- $OUT .= "mail: $key\@$DomainName\n"; |
139 |
- $OUT .= utf8("cn: $desc\n") if $desc; |
140 |
- $OUT .= "uid: $key\n"; |
141 |
- $OUT .= "sn: $key\n"; |
142 |
- |
143 |
- $OUT .= "\n"; |
144 |
$OUT .= "dn: cn=$key,ou=Groups,$ldapBase\n"; |
145 |
$OUT .= "objectClass: posixGroup\n"; |
146 |
+ $OUT .= "objectClass: mailboxRelatedObject\n"; |
147 |
$OUT .= "gidNumber: $gid\n"; |
148 |
$OUT .= "cn: $key\n"; |
149 |
$OUT .= "description: $desc\n"; |
150 |
+ $OUT .= "mail: $key\@$DomainName\n"; |
151 |
foreach my $member (@members){ |
152 |
$OUT .= "memberUid: $member\n"; |
153 |
} |
154 |
diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/etc/openldap/schema/mailRelatedObject.schema mezzanine_patched_e-smith-ldap-5.2.0/root/etc/openldap/schema/mailRelatedObject.schema |
155 |
--- e-smith-ldap-5.2.0/root/etc/openldap/schema/mailRelatedObject.schema 1970-01-01 01:00:00.000000000 +0100 |
156 |
+++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/openldap/schema/mailRelatedObject.schema 2010-02-03 08:39:45.000000000 +0100 |
157 |
@@ -0,0 +1,6 @@ |
158 |
+objectClass ( 1.3.6.1.4.1.5427.1.389.6.9 |
159 |
+ NAME 'mailboxRelatedObject' |
160 |
+ DESC 'For pointing to an associated RFC822 (functional) mailbox from any entry' |
161 |
+ AUXILIARY |
162 |
+ MAY ( mail $ displayName ) ) |
163 |
+ |