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

Contents of /rpms/e-smith-ldap/sme8/e-smith-ldap-5.2.0-delete_extra_items.patch

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


Revision 1.1 - (show annotations) (download)
Sun Sep 26 15:12:30 2010 UTC (14 years, 1 month ago) by slords
Branch: MAIN
CVS Tags: 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-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-72_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-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
* Sun Sep 26 2010 Shad L. Lords <slords@mail.com> 5.2.0-37.sme
- Delete all ldap objects that we now create [SME: 6238]

1 diff -up e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-delete.delete_extra_items 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.delete_extra_items 2010-09-26 08:54:29.000000000 -0600
3 +++ e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-delete 2010-09-26 09:08:00.000000000 -0600
4 @@ -57,23 +57,60 @@ $ldap->bind(
5 password => $pw
6 );
7
8 -my @search_args = ();
9 -if ($event eq 'user-delete'){
10 - @search_args = ( base => "ou=Users,$base", filter => "uid=$name" );
11 +# Delete any user object with this name
12 +my $mesg = $ldap->search( base-> "uid=$name,ou=Users,$base", filter => '(ObjectClass=*)', scope => 'base' );
13 +if ($mesg->code && $mesg->code != 32)
14 +{
15 + warn "Failed ldap search uid=$name,ou=Users,$base: ", $mesg->error;
16 }
17 -elsif($event eq 'group-delete'){
18 - @search_args = ( base => "ou=Groups,$base", filter => "cn=$name" );
19 +else
20 +{
21 + $ldap->delete($mesg->entry(0));
22 }
23 -my $mesg = $ldap->search(@search_args);
24
25 -$mesg->code && die "Failed ldap search: ", $mesg->error;
26 +# Delete any computer object with this name
27 +my $mesg = $ldap->search( base-> "uid=$name,ou=Computers,$base", filter => '(ObjectClass=*)', scope => 'base' );
28 +if ($mesg->code && $mesg->code != 32)
29 +{
30 + warn "Failed ldap search uid=$name,ou=Computers,$base: ", $mesg->error;
31 +}
32 +else
33 +{
34 + $ldap->delete($mesg->entry(0));
35 +}
36
37 -if ($mesg->count > 1)
38 +# Delete any (old) user/computer object with this name
39 +my $mesg = $ldap->search( base-> "uid=$name,$base", filter => '(ObjectClass=*)', scope => 'base' );
40 +if ($mesg->code && $mesg->code != 32)
41 +{
42 + warn "Failed ldap search uid=$name,$base: ", $mesg->error;
43 +}
44 +else
45 {
46 - die("LDAP search for $name returned $mesg->count - 1 expected\n");
47 + $ldap->delete($mesg->entry(0));
48 }
49
50 -$ldap->delete($mesg->entry(0));
51 +# Delete any group object with this name
52 +my $mesg = $ldap->search( base-> "cn=$name,ou=Groups,$base", filter => '(ObjectClass=*)', scope => 'base' );
53 +if ($mesg->code && $mesg->code != 32)
54 +{
55 + warn "Failed ldap search cn=$name,ou=Groups,$base: ", $mesg->error;
56 +}
57 +else
58 +{
59 + $ldap->delete($mesg->entry(0));
60 +}
61 +
62 +# Delete any (old) group object with this name
63 +my $mesg = $ldap->search( base-> "cn=$name,$base", filter => '(ObjectClass=*)', scope => 'base' );
64 +if ($mesg->code && $mesg->code != 32)
65 +{
66 + warn "Failed ldap search cn=$name,$base: ", $mesg->error;
67 +}
68 +else
69 +{
70 + $ldap->delete($mesg->entry(0));
71 +}
72
73 $ldap->unbind;
74

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