/[smecontribs]/rpms/smeserver-kronolith/contribs8/smeserver-kronolith_remove_calFBURL.patch
ViewVC logotype

Contents of /rpms/smeserver-kronolith/contribs8/smeserver-kronolith_remove_calFBURL.patch

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


Revision 1.1 - (show annotations) (download)
Thu Jul 8 15:01:07 2010 UTC (13 years, 10 months ago) by slords
Branch: MAIN
CVS Tags: smeserver-kronolith-2_2-13_el5_sme, smeserver-kronolith-2_2-14_el5_sme, HEAD
Import for sme8

1 diff -Nur -x '*.orig' -x '*.rej' smeserver-kronolith-2.2/root/etc/e-smith/events/actions/ldap-delete-fburl mezzanine_patched_smeserver-kronolith-2.2/root/etc/e-smith/events/actions/ldap-delete-fburl
2 --- smeserver-kronolith-2.2/root/etc/e-smith/events/actions/ldap-delete-fburl 1969-12-31 18:00:00.000000000 -0600
3 +++ mezzanine_patched_smeserver-kronolith-2.2/root/etc/e-smith/events/actions/ldap-delete-fburl 2010-05-12 21:14:01.000000000 -0500
4 @@ -0,0 +1,114 @@
5 +#!/usr/bin/perl -w
6 +
7 +#----------------------------------------------------------------------
8 +# copyright (C) 1999, 2000 e-smith, inc.
9 +#
10 +# This program is free software; you can redistribute it and/or modify
11 +# it under the terms of the GNU General Public License as published by
12 +# the Free Software Foundation; either version 2 of the License, or
13 +# (at your option) any later version.
14 +#
15 +# This program is distributed in the hope that it will be useful,
16 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
17 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 +# GNU General Public License for more details.
19 +#
20 +# You should have received a copy of the GNU General Public License
21 +# along with this program; if not, write to the Free Software
22 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 +#
24 +# Technical support for this program is available from e-smith, inc.
25 +# For details, please visit our web site at www.e-smith.com or
26 +# call us on 1 888 ESMITH 1 (US/Canada toll free) or +1 613 564 8000
27 +#----------------------------------------------------------------------
28 +
29 +package esmith;
30 +
31 +use strict;
32 +use Errno;
33 +use esmith::ConfigDB;
34 +use esmith::AccountsDB;
35 +use esmith::util;
36 +use Net::LDAP;
37 +
38 +my $c = esmith::ConfigDB->open_ro;
39 +my $a = esmith::AccountsDB->open_ro;
40 +
41 +my $l = $c->get('ldap');
42 +my $status = $l->prop('status') || "disabled";
43 +unless ($status eq "enabled" )
44 +{
45 + warn "Not running action script $0, LDAP service not enabled!\n";
46 + exit(0);
47 +}
48 +
49 +my $hostname = $c->get('SystemName')
50 + || die("Couldn't determine system name");
51 + $hostname = $hostname->value;
52 +
53 +my $domain = $c->get('DomainName')
54 + || die("Couldn't determine domain name");
55 + $domain = $domain->value;
56 +
57 +my @accounts;
58 +my $account;
59 +my $event = shift || die "Event name must be specified";
60 +if ($event eq 'ldap-update')
61 +{
62 + @accounts = ($a->users);
63 +}
64 +else
65 +{
66 + my $userName = shift;
67 + die "Username argument missing." unless defined ($userName);
68 +
69 + $account = $a->get($userName);
70 + die "Account $userName not found.\n" unless defined $account;
71 + my $type = $account->prop('type') || "unknown";
72 +
73 + die "Account $userName is not a user or group account; " .
74 + "update LDAP entry failed.\n"
75 + unless ($type eq 'user');
76 + @accounts = ($account);
77 +}
78 +
79 +#------------------------------------------------------------
80 +# Update LDAP directory entry. First read LDAP password
81 +#------------------------------------------------------------
82 +my $pw = esmith::util::LdapPassword();
83 +
84 +#------------------------------------------------------------
85 +# Update LDAP database entry.
86 +#------------------------------------------------------------
87 +my $base = esmith::util::ldapBase ($domain);
88 +
89 +my $ldap = Net::LDAP->new('localhost')
90 + or die "$@";
91 +
92 +$ldap->bind(
93 + dn => "cn=root,$base",
94 + password => $pw
95 +);
96 +
97 +foreach my $acct (@accounts)
98 +{
99 + my $key = $acct->key;
100 + my $type = $acct->prop('type');
101 + next unless ($type eq 'user');
102 + my @attrs = ();
103 +
104 +
105 + my $dn = "uid=$key,ou=Users,$base";
106 + my %attrs = @attrs;
107 +
108 + $ldap->modify ($dn, delete => ['calFBURL']);
109 + my $result = $ldap->modify ($dn, delete => \%attrs);
110 +
111 + $result->code &&
112 + warn "failed to delete entry for $dn: ", $result->error ;
113 +
114 +}
115 +$ldap->unbind;
116 +
117 +exit (0);
118 +

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