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 ) ) +