diff -Nur -x '*.orig' -x '*.rej' smeserver-kronolith-2.2/createlinks mezzanine_patched_smeserver-kronolith-2.2/createlinks --- smeserver-kronolith-2.2/createlinks 2008-04-07 23:29:44.000000000 -0500 +++ mezzanine_patched_smeserver-kronolith-2.2/createlinks 2010-04-18 20:36:35.000000000 -0500 @@ -28,3 +28,19 @@ qw(post-upgrade)); } +#-------------------------------------------------- +# action for user-create event +#-------------------------------------------------- + +$event = "user-create"; + +event_link("ldap-add-fburl", $event, "30"); + +#-------------------------------------------------- +# action for ldaup-update event +#-------------------------------------------------- + +$event = "ldap-update"; + +event_link("ldap-add-fburl", $event, "85"); + diff -Nur -x '*.orig' -x '*.rej' smeserver-kronolith-2.2/root/etc/e-smith/events/actions/ldap-add-fburl mezzanine_patched_smeserver-kronolith-2.2/root/etc/e-smith/events/actions/ldap-add-fburl --- smeserver-kronolith-2.2/root/etc/e-smith/events/actions/ldap-add-fburl 1969-12-31 18:00:00.000000000 -0600 +++ mezzanine_patched_smeserver-kronolith-2.2/root/etc/e-smith/events/actions/ldap-add-fburl 2010-04-18 20:27:53.000000000 -0500 @@ -0,0 +1,117 @@ +#!/usr/bin/perl -w + +#---------------------------------------------------------------------- +# copyright (C) 1999, 2000 e-smith, inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Technical support for this program is available from e-smith, inc. +# For details, please visit our web site at www.e-smith.com or +# call us on 1 888 ESMITH 1 (US/Canada toll free) or +1 613 564 8000 +#---------------------------------------------------------------------- + +package esmith; + +use strict; +use Errno; +use esmith::ConfigDB; +use esmith::AccountsDB; +use esmith::util; +use Net::LDAP; + +my $c = esmith::ConfigDB->open_ro; +my $a = esmith::AccountsDB->open_ro; + +my $l = $c->get('ldap'); +my $status = $l->prop('status') || "disabled"; +unless ($status eq "enabled" ) +{ + warn "Not running action script $0, LDAP service not enabled!\n"; + exit(0); +} + +my $hostname = $c->get('SystemName') + || die("Couldn't determine system name"); + $hostname = $hostname->value; + +my $domain = $c->get('DomainName') + || die("Couldn't determine domain name"); + $domain = $domain->value; + +my @accounts; +my $account; +my $event = shift || die "Event name must be specified"; +if ($event eq 'ldap-update') +{ + @accounts = ($a->users); +} +else +{ + my $userName = shift; + die "Username argument missing." unless defined ($userName); + + $account = $a->get($userName); + die "Account $userName not found.\n" unless defined $account; + my $type = $account->prop('type') || "unknown"; + + die "Account $userName is not a user or group account; " . + "update LDAP entry failed.\n" + unless ($type eq 'user'); + @accounts = ($account); +} + +#------------------------------------------------------------ +# Update LDAP directory entry. First read LDAP password +#------------------------------------------------------------ +my $pw = esmith::util::LdapPassword(); + +#------------------------------------------------------------ +# Update LDAP database entry. +#------------------------------------------------------------ +my $base = esmith::util::ldapBase ($domain); + +my $ldap = Net::LDAP->new('localhost') + or die "$@"; + +$ldap->bind( + dn => "cn=root,$base", + password => $pw +); + +foreach my $acct (@accounts) +{ + my $key = $acct->key; + my $type = $acct->prop('type'); + next unless ($type eq 'user'); + my @attrs = (); + + my $fb = 'https://'.$hostname.'.'.$domain.'/horde/kronolith/fb.php?u='.$key.'@'.$domain; + utf8::upgrade($fb); + push @attrs, (calFBURL => $fb) unless $fb =~ /^\s*$/; + + my $dn = "uid=$key,ou=Users,$base"; + my %attrs = @attrs; + + $ldap->modify ($dn, add => {objectClass => 'calEntry'}); + my $result = $ldap->modify ($dn, replace => \%attrs); + + $result->code && + warn "failed to modify entry for $dn: ", $result->error ; + +} +$ldap->unbind; + +exit (0); + diff -Nur -x '*.orig' -x '*.rej' smeserver-kronolith-2.2/root/etc/e-smith/templates/etc/openldap/slapd.conf/12kronolithschema mezzanine_patched_smeserver-kronolith-2.2/root/etc/e-smith/templates/etc/openldap/slapd.conf/12kronolithschema --- smeserver-kronolith-2.2/root/etc/e-smith/templates/etc/openldap/slapd.conf/12kronolithschema 1969-12-31 18:00:00.000000000 -0600 +++ mezzanine_patched_smeserver-kronolith-2.2/root/etc/e-smith/templates/etc/openldap/slapd.conf/12kronolithschema 2010-04-18 21:06:42.000000000 -0500 @@ -0,0 +1,3 @@ +include /etc/openldap/schema/rfc2739.schema +include /etc/openldap/schema/horde.schema + diff -Nur -x '*.orig' -x '*.rej' smeserver-kronolith-2.2/root/etc/openldap/schema/rfc2739.schema mezzanine_patched_smeserver-kronolith-2.2/root/etc/openldap/schema/rfc2739.schema --- smeserver-kronolith-2.2/root/etc/openldap/schema/rfc2739.schema 1969-12-31 18:00:00.000000000 -0600 +++ mezzanine_patched_smeserver-kronolith-2.2/root/etc/openldap/schema/rfc2739.schema 2010-04-18 21:07:53.000000000 -0500 @@ -0,0 +1,98 @@ +# +# http://www.faqs.org/rfcs/rfc2739.html +# +# From the RFC: +# The calCalURI contains the URI to a snapshot of the user's entire +# default calendar. The calFBURL contains the URI to the user's default +# busy time data. The calCAPURI represents contains a URI that can be +# used to communicate with the user's calendar. The calCalAdrURI +# contains a URI that points to the location to which event requests +# should be sent for that user. +# +# The calOtherCalURIs is a multi-valued property containing URIs to +# snapshots of other calendars that the user may have. The +# calOtherFBURLs is a multi-valued property containing URIs to other +# free/busy data that the user may have. The calOtherCAPURIs attribute +# is a multi-valued property containing URIs to other calendars that +# the user may have. The calOtherCalAdrURIs attribute is a multi-valued +# property containing URIs to other locations that a user may want +# event requests sent to. +# +# There is no predetermined order to the values in either multi-valued +# property. + +# EQUALITY caseIgnoreIA5Match + +attribute (1.2.840.113556.1.4.478 + NAME 'calCalURI' + DESC 'Snapshot of users entire default calendar' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 + ) + +attribute (1.2.840.113556.1.4.479 + NAME 'calFBURL' + DESC 'URI of the uses free and busy information' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 + ) + +attribute (1.2.840.113556.1.4.480 + NAME 'calCAPURI' + DESC 'URI used to communicate with the users calendar' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 + ) + +attribute (1.2.840.113556.1.4.481 + NAME 'calCalAdrURI' + DESC 'URI to which event requests should be sent for the user' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 + ) + +attribute (1.2.840.113556.1.4.482 + NAME 'calOtherCalURIs' + DESC 'URIs to non-default calendars belonging to the user' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 + ) + +attribute (1.2.840.113556.1.4.483 + NAME 'calOtherFBURLs' + DESC 'URIs to non-default free and busy information files' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 + ) + +attribute (1.2.840.113556.1.4.484 + NAME 'calOtherCAPURIs' + DESC 'URIs for communicating with non-default calendars' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 + ) + +attribute (1.2.840.113556.1.4.485 + NAME 'calOtherCalAdrURIs' + DESC 'Destinations for event requests to non-default calendars' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 + ) + +objectclass (1.2.840.113556.1.5.87 + NAME 'calEntry' + DESC 'Calendering and Free Busy information' + SUP top AUXILIARY + MAY (calCalURI $ calFBURL $ calCAPURI $ calCalAdrURI $ + calOtherCalURIs $ calOtherFBURLs $ calOtherCAPURIs $ + calOtherCalAdrURIs + ) + )