summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Parent <math.parent@gmail.com>2009-01-17 17:05:50 (GMT)
committerMathieu Parent <math.parent@gmail.com>2009-01-17 17:05:50 (GMT)
commitbc6bc0095dc086d7a6fb0324ae2bfe2683086aea (patch)
treee8858fee08bf38fae5bfda52ee83254fc77ce0ce
parent4e5c5162f733402e18b7cce74d997d797c393a03 (diff)
downloadperl-Kolab-bc6bc0095dc086d7a6fb0324ae2bfe2683086aea.tar.gz
in sub createObject: describe why mailboxes are also
created on others servers (mentioned in kolab/issue3253)
-rw-r--r--ChangeLog7
-rw-r--r--lib/Kolab/LDAP.pm122
2 files changed, 69 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 63eae95..4cdff9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
+2009-01-17 Mathieu Parent <math.parent@gmail.com>
+
+ * lib/Kolab/LDAP.pm: in sub createObject: describe why mailboxes are also
+ created on others servers (mentioned in kolab/issue3253)
+
2008-12-30 Mathieu Parent <math.parent@gmail.com>
- * lib/Kolab/Conf.pm.pm: slapd.replicas.template and slapd.access.template
+ * lib/Kolab/Conf.pm: slapd.replicas.template and slapd.access.template
can be absent (kolab/issue3321)
2008-11-26 Mathieu Parent <math.parent@gmail.com>
diff --git a/lib/Kolab/LDAP.pm b/lib/Kolab/LDAP.pm
index 5d87b0b..7c196c8 100644
--- a/lib/Kolab/LDAP.pm
+++ b/lib/Kolab/LDAP.pm
@@ -456,32 +456,36 @@ sub createObject
my $islocal = 1;
my $del = $object->get_value($Kolab::config{$p . '_field_deleted'}, asref => 1);
if( ref($del) eq 'ARRAY' && @$del > 0 ) {
- Kolab::log('L', "Kolab::LDAP::createObject() skipping object ".lc($object->get_value($objuidfield))
- ." because it is deleted", KOLAB_DEBUG);
- return;
+ Kolab::log('L', "Kolab::LDAP::createObject() skipping object ".lc($object->get_value($objuidfield))
+ ." because it is deleted", KOLAB_DEBUG);
+ return;
}
if( ($kolabhomeserver && $kolabhomeserver ne lc($Kolab::config{'fqdnhostname'}))
- || $kolabimapserver && $kolabimapserver ne lc(hostfqdn()) ) {
- if( $p eq 'sf' ) {
- # Dont create shared folders on other hosts than it's kolabhomeserver
- Kolab::log('L', "Kolab::LDAP::createObject() skipping shared folder for other server $kolabhomeserver", KOLAB_DEBUG);
- return;
- }
- Kolab::log('L', "Kolab::LDAP::createObject() for other server $kolabhomeserver. TODO: Create referral or something, for now we just create ", KOLAB_DEBUG);
- $islocal = 0;
+ || $kolabimapserver && $kolabimapserver ne lc(hostfqdn()) ) {
+ # We are not on the home server
+ if( $p eq 'sf' ) {
+ # Dont create shared folders on other hosts than it's kolabhomeserver
+ Kolab::log('L', "Kolab::LDAP::createObject() skipping shared folder for other server $kolabhomeserver", KOLAB_DEBUG);
+ return;
+ }
+ Kolab::log('L', "Kolab::LDAP::createObject() for other server than $kolabhomeserver. TODO: Create referral or something, for now we just create an empty INBOX", KOLAB_DEBUG);
+ # We create INBOX on other servers also, to allow access to shared/published
+ # folders on those servers because some IMAP clients abort the connection
+ # to an IMAP server if they cannot access the INBOX.
+ $islocal = 0;
}
# Intermediate multidomain support:
# We accept domain encoded in CN...
if( $p eq 'sf' && index( $uid, '@' ) < 0 ) {
- # We have to create shared folders
- # with names shared.<fldrname>@<domain>
- my @dcs = split(/,/,$object->dn());
- my @dn;
- while( pop( @dcs ) =~ /dc=(.*)/ ) {
- push(@dn, $1);
- }
- if( $#dn > 0 ) { $uid .= '@'.join('.',reverse(@dn)); }
+ # We have to create shared folders
+ # with names shared.<fldrname>@<domain>
+ my @dcs = split(/,/,$object->dn());
+ my @dn;
+ while( pop( @dcs ) =~ /dc=(.*)/ ) {
+ push(@dn, $1);
+ }
+ if( $#dn > 0 ) { $uid .= '@'.join('.',reverse(@dn)); }
}
if (!$uid) {
Kolab::log('L', "Kolab::LDAP::createObject() called with null id attribute `$objuidfield', returning", KOLAB_DEBUG);
@@ -501,7 +505,7 @@ sub createObject
Kolab::log('L', "Object `$uid' already exists as `$olduid'; refusing to create", KOLAB_WARN);
} else {
Kolab::log('L', "Object `$uid' already exists, skipping", KOLAB_DEBUG);
- }
+ }
# Nothing changed; nothing to do
} else {
# No official records - check the graveyard
@@ -513,40 +517,40 @@ sub createObject
# We have a object that we have no previous record of, so create everything
if ($sync) { $newuid_db{$guid} = $uid; } else { uidcacheStore($guid, $uid); }
Kolab::Cyrus::createMailbox($cyrus, $uid, ($p eq 'sf' ? 1 : 0));
- if( $p eq 'sf' ){
- my $foldertype = lc($object->get_value('kolabfoldertype'));
+ if( $p eq 'sf' ){
+ my $foldertype = lc($object->get_value('kolabfoldertype'));
- if ( $foldertype ne '' ){
- Kolab::Cyrus::setFolderType($cyrus,$uid,1,$foldertype);
- }
- }
- if( $p ne 'sf' && !$islocal ) {
- # Hide user mailboxes on other servers
- Kolab::Cyrus::setACL($cyrus,$uid,0, ["$uid rswipcda"]);
- } elsif( $p ne 'sf' ) {
- # Deal with group and resource accounts
- my $edn = Net::LDAP::Util::ldap_explode_dn($object->dn(), casefold=>'lower' );
- my $gcn = $edn->[1]->{'cn'};
- if( $gcn && ($gcn eq 'groups' || $gcn eq 'resources') ) {
- # We need to give the calendar user access to the
- # group's/resource's Calendar folder.
- # TODO: Don't hardcode user and folder name
- Kolab::log('L', "Detected group or resource account, creating calendar folder", KOLAB_ERROR );
- my $domain;
- my $user;
- if ($uid =~ /(.*)\@(.*)/) {
- $user = $1;
- $domain = $2;
- } else {
- $user = $uid;
- $domain = $Kolab::config{'postfix-mydomain'};
- }
- my $folder = $user . '/Calendar@' . $domain;
- Kolab::Cyrus::createMailbox($cyrus, $folder, 0);
- Kolab::Cyrus::setFolderType($cyrus, $folder, 0, 'event.default');
- Kolab::Cyrus::setACL($cyrus, $folder, 0, ["$uid all", 'calendar@' . $domain .' all']);
- }
- }
+ if ( $foldertype ne '' ){
+ Kolab::Cyrus::setFolderType($cyrus,$uid,1,$foldertype);
+ }
+ }
+ if( $p ne 'sf' && !$islocal ) {
+ # Hide user mailboxes on other servers
+ Kolab::Cyrus::setACL($cyrus,$uid,0, ["$uid rswipcda"]);
+ } elsif( $p ne 'sf' ) {
+ # Deal with group and resource accounts
+ my $edn = Net::LDAP::Util::ldap_explode_dn($object->dn(), casefold=>'lower' );
+ my $gcn = $edn->[1]->{'cn'};
+ if( $gcn && ($gcn eq 'groups' || $gcn eq 'resources') ) {
+ # We need to give the calendar user access to the
+ # group's/resource's Calendar folder.
+ # TODO: Don't hardcode user and folder name
+ Kolab::log('L', "Detected group or resource account, creating calendar folder", KOLAB_ERROR );
+ my $domain;
+ my $user;
+ if ($uid =~ /(.*)\@(.*)/) {
+ $user = $1;
+ $domain = $2;
+ } else {
+ $user = $uid;
+ $domain = $Kolab::config{'postfix-mydomain'};
+ }
+ my $folder = $user . '/Calendar@' . $domain;
+ Kolab::Cyrus::createMailbox($cyrus, $folder, 0);
+ Kolab::Cyrus::setFolderType($cyrus, $folder, 0, 'event.default');
+ Kolab::Cyrus::setACL($cyrus, $folder, 0, ["$uid all", 'calendar@' . $domain .' all']);
+ }
+ }
}
}
@@ -559,12 +563,12 @@ sub createObject
defined($quota) or ($quota = 0);
my $oldquota = quotaFetch($guid);
if( $quota != $oldquota ) {
- Kolab::Cyrus::setQuota($cyrus, $uid, $quota*1024, ($p eq 'sf' ? 1 : 0));
- if( $quota == 0 ) {
- quotaDelete{$guid};
- } else {
- quotaStore($guid, $quota);
- }
+ Kolab::Cyrus::setQuota($cyrus, $uid, $quota*1024, ($p eq 'sf' ? 1 : 0));
+ if( $quota == 0 ) {
+ quotaDelete{$guid};
+ } else {
+ quotaStore($guid, $quota);
+ }
}
Kolab::log('L', "createObject() done", KOLAB_DEBUG );
}