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