mathieu: server/perl-kolab/lib/Kolab Conf.pm,1.15,1.16
cvs at kolab.org
cvs at kolab.org
Sun Dec 13 19:27:11 CET 2009
- Previous message: mathieu: server/kolabd/kolabd/templates DB_CONFIG.slapd.template.in, 1.6, 1.7 access.template.in, 1.2, 1.3 amavisd.conf.template.in, 1.15, 1.16 canonical.template.in, 1.1, 1.2 clamd.conf.template.in, 1.6, 1.7 cyrus.conf.template.in, 1.8, 1.9 freebusy.conf.template.in, 1.21, 1.22 freshclam.conf.template.in, 1.3, 1.4 header_checks.template.in, 1.1, 1.2 httpd.conf.template.in, 1.30, 1.31 httpd.local.template.in, 1.4, 1.5 imapd.conf.template.in, 1.17, 1.18 imapd.group.template.in, 1.2, 1.3 kolab_smtpdpolicy.conf.template.in, 1.3, 1.4 ldap.conf.template.in, 1.2, 1.3 ldapdistlist.cf.template.in, 1.4, 1.5 ldaptransport.cf.template.in, 1.2, 1.3 ldapvirtual.cf.template.in, 1.2, 1.3 local.cf.template.in, 1.2, 1.3 main.cf.template.in, 1.25, 1.26 master.cf.template.in, 1.27, 1.28 php.ini.template.in, 1.10, 1.11 rc.conf.template.in, 1.6, 1.7 relocated.template.in, 1.1, 1.2 resmgr.conf.template.in, 1.36, 1.37 saslauthd.conf.template.in, 1.5, 1.6 session_vars.php.template.in, 1.6, 1.7 slapd.access.template.in, 1.2, 1.3 slapd.conf.templa te.in, 1.29, 1.30 slapd.replicas.template.in, 1.4, 1.5 transport.template.in, 1.8, 1.9 virtual.template.in, 1.8, 1.9
- Next message: mathieu: server release-notes.txt,1.476,1.477
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: mathieu
Update of /kolabrepository/server/perl-kolab/lib/Kolab
In directory doto:/tmp/cvs-serv27781/lib/Kolab
Modified Files:
Conf.pm
Log Message:
Correct indentation: tab -> 4 spaces
Index: Conf.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/lib/Kolab/Conf.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Conf.pm 13 Dec 2009 17:54:23 -0000 1.15
+++ Conf.pm 13 Dec 2009 18:27:08 -0000 1.16
@@ -69,13 +69,13 @@
my $gid = (getgrnam($group))[2];
Kolab::log('T', sprintf("Changing permissions of %s to 0%o", $file, $perm ), KOLAB_DEBUG );
if( chmod($perm, $file) != 1 ) {
- Kolab::log('T', "Unable to change permissions of `$file' to ".sprintf("0%o",$perm) . ": $!", KOLAB_ERROR);
- exit(1);
+ Kolab::log('T', "Unable to change permissions of `$file' to ".sprintf("0%o",$perm) . ": $!", KOLAB_ERROR);
+ exit(1);
}
Kolab::log('T', "Changing owner of $file to $owner:$group ($uid:$gid)", KOLAB_DEBUG );
if( chown($uid,$gid,$file) != 1 ) {
- Kolab::log('T', "Unable to change ownership of `$file' to $uid:$gid: $!", KOLAB_ERROR);
- exit(1);
+ Kolab::log('T', "Unable to change ownership of `$file' to $uid:$gid: $!", KOLAB_ERROR);
+ exit(1);
}
}
@@ -145,7 +145,7 @@
#Eat the meta data sections
if (/^KOLAB_META_START$/) {
my $found_end;
- while (!$found_end) {
+ while (!$found_end) {
$_ = <$template>;
$found_end = /^KOLAB_META_END$/;
}
@@ -304,13 +304,13 @@
$Kolab::config{'ldap_port'},
$Kolab::config{'bind_dn'},
$Kolab::config{'bind_pw'}
- );
+ );
my $mesg = $ldap->search(
base => 'k=kolab,'.$Kolab::config{'base_dn'},
scope => 'base',
filter => '(objectclass=*)'
- );
+ );
if ($mesg->code) {
Kolab::log('T', "Unable to locate Postfix $map map entries in LDAP", KOLAB_ERROR);
exit(1);
@@ -345,13 +345,13 @@
$Kolab::config{'ldap_port'},
$Kolab::config{'bind_dn'},
$Kolab::config{'bind_pw'}
- );
+ );
my $mesg = $ldap->search(
base => $Kolab::config{'base_dn'},
scope => 'sub',
filter => '(&(mail=*)(objectclass=kolabgroupofnames))'
- );
+ );
if ($mesg->code) {
Kolab::log('T', 'Unable to locate Cyrus groups in LDAP', KOLAB_ERROR);
exit(1);
@@ -362,20 +362,20 @@
if ($mesg->code <= 0) {
foreach $ldapobject ($mesg->entries) {
#my $group = $ldapobject->get_value('cn') . '@'.join('.',reverse(@dn)) . ":*:$count:";
- my $group = lc($ldapobject->get_value('mail')).":*:$count:";
+ my $group = lc($ldapobject->get_value('mail')).":*:$count:";
my $userlist = $ldapobject->get_value('member', asref => 1);
foreach (@$userlist) {
- my $uid = $_;
- my $umesg = $ldap->search( base => $uid,
- scope => 'base',
- filter => '(objectClass=*)' );
- if ( $umesg && $umesg->code() <= 0 && $umesg->count() == 1 ) {
- my $mail;
- ($mail = $umesg->entry(0)->get_value('mail')) or
- ($mail = $umesg->entry(0)->get_value('uid'));
- $group .= lc($mail).',';
- }
- }
+ my $uid = $_;
+ my $umesg = $ldap->search( base => $uid,
+ scope => 'base',
+ filter => '(objectClass=*)' );
+ if ( $umesg && $umesg->code() <= 0 && $umesg->count() == 1 ) {
+ my $mail;
+ ($mail = $umesg->entry(0)->get_value('mail')) or
+ ($mail = $umesg->entry(0)->get_value('uid'));
+ $group .= lc($mail).',';
+ }
+ }
$group =~ s/,$//;
$ret .= $group . "\n";
Kolab::log('T', "Adding cyrus group `$group'");
@@ -429,32 +429,32 @@
by * search stop
EOS
- my $str;
+ my $str;
my $domain;
my @domains;
if( ref($Kolab::config{'postfix-mydestination'}) eq 'ARRAY' ) {
- @domains = @{$Kolab::config{'postfix-mydestination'}};
+ @domains = @{$Kolab::config{'postfix-mydestination'}};
} else {
- @domains =( $Kolab::config{'postfix-mydestination'} );
+ @domains =( $Kolab::config{'postfix-mydestination'} );
}
($str = $dom_acl1) =~ s/\@{3}base_dn\@{3}/$Kolab::config{'base_dn'}/g;
$ret .= $str;
foreach $domain (@domains) {
- ($str = $dom_acl2) =~ s/\@{3}domain\@{3}/$domain/g;
- $str =~ s/\@{3}base_dn\@{3}/$Kolab::config{'base_dn'}/g;
- $ret .= $str;
+ ($str = $dom_acl2) =~ s/\@{3}domain\@{3}/$domain/g;
+ $str =~ s/\@{3}base_dn\@{3}/$Kolab::config{'base_dn'}/g;
+ $ret .= $str;
}
($str = $dom_acl3) =~ s/\@{3}base_dn\@{3}/$Kolab::config{'base_dn'}/g;
$ret .= $str;
foreach $domain (@domains) {
- ($str = $global_acl) =~ s/\@{3}domain\@{3}/$domain/g;
- $str =~ s/\@{3}base_dn\@{3}/$Kolab::config{'base_dn'}/g;
- $ret .= $str;
- Kolab::log('T', "Adding acl for domain '$str'");
+ ($str = $global_acl) =~ s/\@{3}domain\@{3}/$domain/g;
+ $str =~ s/\@{3}base_dn\@{3}/$Kolab::config{'base_dn'}/g;
+ $ret .= $str;
+ Kolab::log('T', "Adding acl for domain '$str'");
}
return $ret;
}
@@ -483,26 +483,26 @@
} else {
- if( $Kolab::config{'is_master'} eq "true" ) {
- # Master setup
- my @kh;
- if( ref $Kolab::config{'kolabhost'} eq 'ARRAY' ) {
- @kh = @{$Kolab::config{'kolabhost'}};
- } else {
- @kh = ( $Kolab::config{'kolabhost'} );
- }
- for my $h ( @kh ) {
- next if lc($h) eq lc($Kolab::config{'fqdnhostname'});
- $ret .= "replica uri=ldaps://$h\n"
- ." binddn=\"".$Kolab::config{'bind_dn'}."\"\n"
- ." bindmethod=simple credentials=".$Kolab::config{'bind_pw'}."\n\n";
- }
- } else {
- # Slave setup
- # Output an update dn statement instead
- $ret .= "updatedn ".$Kolab::config{'bind_dn'}."\n";
- $ret .= "updateref ".$Kolab::config{'ldap_master_uri'}."\n";
- }
+ if( $Kolab::config{'is_master'} eq "true" ) {
+ # Master setup
+ my @kh;
+ if( ref $Kolab::config{'kolabhost'} eq 'ARRAY' ) {
+ @kh = @{$Kolab::config{'kolabhost'}};
+ } else {
+ @kh = ( $Kolab::config{'kolabhost'} );
+ }
+ for my $h ( @kh ) {
+ next if lc($h) eq lc($Kolab::config{'fqdnhostname'});
+ $ret .= "replica uri=ldaps://$h\n"
+ ." binddn=\"".$Kolab::config{'bind_dn'}."\"\n"
+ ." bindmethod=simple credentials=".$Kolab::config{'bind_pw'}."\n\n";
+ }
+ } else {
+ # Slave setup
+ # Output an update dn statement instead
+ $ret .= "updatedn ".$Kolab::config{'bind_dn'}."\n";
+ $ret .= "updateref ".$Kolab::config{'ldap_master_uri'}."\n";
+ }
}
Kolab::log('T', 'Finished building LDAP replicas', KOLAB_DEBUG);
@@ -510,24 +510,24 @@
}
sub replaceMetaVar
-{
+{
my $var = shift;
while ($var =~ /\@{3}([^\s\@]+?)\@{3}/) {
- my $attr = $1;
- if ($Kolab::config{$attr}) {
- my $val = $Kolab::config{$attr};
- $var =~ s/\@{3}([^\s\@]+?)\@{3}/$val/;
- } else {
- Kolab::log('T', "No configuration variable corresponding to `$1' exists", KOLAB_WARN);
- }
+ my $attr = $1;
+ if ($Kolab::config{$attr}) {
+ my $val = $Kolab::config{$attr};
+ $var =~ s/\@{3}([^\s\@]+?)\@{3}/$val/;
+ } else {
+ Kolab::log('T', "No configuration variable corresponding to `$1' exists", KOLAB_WARN);
+ }
}
return $var;
}
sub loadMetaTemplates
-{
+{
my $templatedir = shift;
my ($tref, $pref, $oref, $cmdref, $ccharref) = @_;
@@ -537,59 +537,58 @@
closedir(DIR);
foreach my $template (@metatemplates) {
- my $runonchange = undef;
- my $commentchar = undef;
- #Open each file and check for the META
- if (open (TEMPLATE, "$templatedir/$template" )) {
- my $line = <TEMPLATE>;
- if ($line =~ /^KOLAB_META_START$/) {
- Kolab::log('T', 'Processing META template :'.$template, KOLAB_DEBUG );
- my ($found_end, $target, $permissions, $ownership);
- while (<TEMPLATE>) {
- $line = $_;
-
- if (!$found_end) {
- $found_end = $line =~ /^KOLAB_META_END$/;
- if (!$found_end && $line) {
- my ($key,$value) = split(/=/,$line);
- chomp($value);
- Kolab::log('T', 'META Key: '.$key.' Value: '.$value, KOLAB_DEBUG );
- if ($key =~ /^TARGET$/) {
- $target = replaceMetaVar($value);
- Kolab::log('T', 'META Target '.$target, KOLAB_DEBUG );
- } elsif ($key =~ /^PERMISSIONS$/) {
- $permissions = replaceMetaVar($value);
- Kolab::log('T', 'META Permissions '.$permissions, KOLAB_DEBUG );
- } elsif ($key =~ /^OWNERSHIP$/) {
- $ownership = replaceMetaVar($value);
- Kolab::log('T', 'META Ownership '.$ownership, KOLAB_DEBUG );
- } elsif ($key =~ /^RUNONCHANGE$/) {
- $runonchange = replaceMetaVar($value);
- Kolab::log('T', 'META Cmd to execute '.$runonchange, KOLAB_DEBUG );
- } elsif ($key =~ /^COMMENT_CHAR$/) {
- $commentchar = replaceMetaVar($value);
- Kolab::log('T', 'META CommentChar to use: '.$commentchar, KOLAB_DEBUG );
- } else {
- Kolab::log('T', 'incorrect META key "'.$key.'" in: '.$template, KOLAB_WARN );
- }
- }
- }
- }
- if ($found_end && $target && $permissions && $ownership) {
- Kolab::log('T', 'All mandatory fields populated in '.$template, KOLAB_DEBUG );
- $$tref{$templatedir . "/" . $template} = $target;
- $$oref{$target} = $ownership;
- $permissions = oct($permissions);
- $$pref{$target} = $permissions;
- my $runcmdtemplate = $templatedir."/".$template;
- $$cmdref{$runcmdtemplate} = $runonchange if (defined $runonchange);
- $$ccharref{$target} = $commentchar if (defined $commentchar);
- }
-
- }
- } else {
- Kolab::log('T', 'Could not open template file: '. $template, KOLAB_WARN);
- }
+ my $runonchange = undef;
+ my $commentchar = undef;
+ #Open each file and check for the META
+ if (open (TEMPLATE, "$templatedir/$template" )) {
+ my $line = <TEMPLATE>;
+ if ($line =~ /^KOLAB_META_START$/) {
+ Kolab::log('T', 'Processing META template :'.$template, KOLAB_DEBUG );
+ my ($found_end, $target, $permissions, $ownership);
+ while (<TEMPLATE>) {
+ $line = $_;
+
+ if (!$found_end) {
+ $found_end = $line =~ /^KOLAB_META_END$/;
+ if (!$found_end && $line) {
+ my ($key,$value) = split(/=/,$line);
+ chomp($value);
+ Kolab::log('T', 'META Key: '.$key.' Value: '.$value, KOLAB_DEBUG );
+ if ($key =~ /^TARGET$/) {
+ $target = replaceMetaVar($value);
+ Kolab::log('T', 'META Target '.$target, KOLAB_DEBUG );
+ } elsif ($key =~ /^PERMISSIONS$/) {
+ $permissions = replaceMetaVar($value);
+ Kolab::log('T', 'META Permissions '.$permissions, KOLAB_DEBUG );
+ } elsif ($key =~ /^OWNERSHIP$/) {
+ $ownership = replaceMetaVar($value);
+ Kolab::log('T', 'META Ownership '.$ownership, KOLAB_DEBUG );
+ } elsif ($key =~ /^RUNONCHANGE$/) {
+ $runonchange = replaceMetaVar($value);
+ Kolab::log('T', 'META Cmd to execute '.$runonchange, KOLAB_DEBUG );
+ } elsif ($key =~ /^COMMENT_CHAR$/) {
+ $commentchar = replaceMetaVar($value);
+ Kolab::log('T', 'META CommentChar to use: '.$commentchar, KOLAB_DEBUG );
+ } else {
+ Kolab::log('T', 'incorrect META key "'.$key.'" in: '.$template, KOLAB_WARN );
+ }
+ }
+ }
+ }
+ if ($found_end && $target && $permissions && $ownership) {
+ Kolab::log('T', 'All mandatory fields populated in '.$template, KOLAB_DEBUG );
+ $$tref{$templatedir . "/" . $template} = $target;
+ $$oref{$target} = $ownership;
+ $permissions = oct($permissions);
+ $$pref{$target} = $permissions;
+ my $runcmdtemplate = $templatedir."/".$template;
+ $$cmdref{$runcmdtemplate} = $runonchange if (defined $runonchange);
+ $$ccharref{$target} = $commentchar if (defined $commentchar);
+ }
+ }
+ } else {
+ Kolab::log('T', 'Could not open template file: '. $template, KOLAB_WARN);
+ }
}
}
@@ -622,11 +621,10 @@
my %cmds = ();
foreach $key (keys %runonchange) {
- if (defined $confighaschanged{$key})
- {
- Kolab::log('T', 'Queueing RUNONCHANGE for '.$key, KOLAB_DEBUG );
- $cmds{$runonchange{$key}} = 1;
- }
+ if (defined $confighaschanged{$key}) {
+ Kolab::log('T', 'Queueing RUNONCHANGE for '.$key, KOLAB_DEBUG );
+ $cmds{$runonchange{$key}} = 1;
+ }
}
my $cmd;
foreach $cmd (keys %cmds) {
@@ -680,25 +678,25 @@
my $ok = 1;
foreach $key (keys %templates) {
- my $tpl = $templates{$key};
+ my $tpl = $templates{$key};
- if (-r $tpl) {
- my $st = stat($tpl);
- my $owner = getpwuid($st->uid).':'.getgrgid($st->gid);
- if( ( ($st->mode & 07777) != $permissions{$tpl}) ||
- ($owner ne $ownership{$tpl}) ) {
- my $str = 'File '.$tpl.' has the wrong persmissions/owner. Found '
- .sprintf("%lo", $st->mode&07777).' '.$owner.', expected '
- .sprintf("%lo",$permissions{$tpl}).' '.$ownership{$tpl};
- print( "$str\n" );
- Kolab::log('T', $str, KOLAB_ERROR );
- $ok = 0;
- }
- } else {
- my $str = "File $tpl does not exist";
- print "$str\n";
- Kolab::log('T', "$str", KOLAB_ERROR );
- }
+ if (-r $tpl) {
+ my $st = stat($tpl);
+ my $owner = getpwuid($st->uid).':'.getgrgid($st->gid);
+ if( ( ($st->mode & 07777) != $permissions{$tpl}) ||
+ ($owner ne $ownership{$tpl}) ) {
+ my $str = 'File '.$tpl.' has the wrong persmissions/owner. Found '
+ .sprintf("%lo", $st->mode&07777).' '.$owner.', expected '
+ .sprintf("%lo",$permissions{$tpl}).' '.$ownership{$tpl};
+ print( "$str\n" );
+ Kolab::log('T', $str, KOLAB_ERROR );
+ $ok = 0;
+ }
+ } else {
+ my $str = "File $tpl does not exist";
+ print "$str\n";
+ Kolab::log('T', "$str", KOLAB_ERROR );
+ }
}
return $ok;
}
- Previous message: mathieu: server/kolabd/kolabd/templates DB_CONFIG.slapd.template.in, 1.6, 1.7 access.template.in, 1.2, 1.3 amavisd.conf.template.in, 1.15, 1.16 canonical.template.in, 1.1, 1.2 clamd.conf.template.in, 1.6, 1.7 cyrus.conf.template.in, 1.8, 1.9 freebusy.conf.template.in, 1.21, 1.22 freshclam.conf.template.in, 1.3, 1.4 header_checks.template.in, 1.1, 1.2 httpd.conf.template.in, 1.30, 1.31 httpd.local.template.in, 1.4, 1.5 imapd.conf.template.in, 1.17, 1.18 imapd.group.template.in, 1.2, 1.3 kolab_smtpdpolicy.conf.template.in, 1.3, 1.4 ldap.conf.template.in, 1.2, 1.3 ldapdistlist.cf.template.in, 1.4, 1.5 ldaptransport.cf.template.in, 1.2, 1.3 ldapvirtual.cf.template.in, 1.2, 1.3 local.cf.template.in, 1.2, 1.3 main.cf.template.in, 1.25, 1.26 master.cf.template.in, 1.27, 1.28 php.ini.template.in, 1.10, 1.11 rc.conf.template.in, 1.6, 1.7 relocated.template.in, 1.1, 1.2 resmgr.conf.template.in, 1.36, 1.37 saslauthd.conf.template.in, 1.5, 1.6 session_vars.php.template.in, 1.6, 1.7 slapd.access.template.in, 1.2, 1.3 slapd.conf.templa te.in, 1.29, 1.30 slapd.replicas.template.in, 1.4, 1.5 transport.template.in, 1.8, 1.9 virtual.template.in, 1.8, 1.9
- Next message: mathieu: server release-notes.txt,1.476,1.477
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the commits
mailing list