steffen: server/perl-kolab/Kolab Kolab.pm,1.7,1.8
cvs at intevation.de
cvs at intevation.de
Tue Aug 10 00:00:43 CEST 2004
Author: steffen
Update of /kolabrepository/server/perl-kolab/Kolab
In directory doto:/tmp/cvs-serv26677/perl-kolab/Kolab
Modified Files:
Kolab.pm
Log Message:
issue error when kolabconf cant build a configuration
Index: Kolab.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab/Kolab.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Kolab.pm 11 Jul 2004 16:12:07 -0000 1.7
+++ Kolab.pm 9 Aug 2004 22:00:40 -0000 1.8
@@ -27,7 +27,7 @@
use Net::LDAP;
use Kolab::Util;
#use Kolab::LDAP;
-use vars qw(%config %haschanged);
+use vars qw(%config %haschanged $reloadOk);
require Exporter;
@@ -36,6 +36,7 @@
our %EXPORT_TAGS = (
'all' => [ qw(
%config
+ $reloadOk
&reloadConfig
&reload
&log
@@ -66,6 +67,8 @@
my $tempval;
my $ldap;
+ my $error = 0;
+
# `log_level' specifies what severity of messages we want to see in the logs.
# Possible values are:
# 0 - Silent
@@ -77,8 +80,9 @@
# Determine the root of the kolab installation, and read `kolab.globals'
if (!($tempval = (getpwnam('kolab'))[7])) {
$config{'log_level'} = KOLAB_WARN;
- &log('C', 'Unable to determine the kolab root directory', KOLAB_ERROR);
+ &log('C', 'Unable to determine the kolab root directory', KOLAB_ERROR);
# exit(1);
+ $error = 1;
} else {
%config = readConfig(%config, "$tempval/etc/kolab/kolab.globals");
$config{'prefix'} = $tempval;
@@ -94,38 +98,46 @@
if (!($config{'kolab_uid'} = (getpwnam('kolab'))[2])) {
&log('C', "Unable to determine the uid of user `kolab'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
if (!($config{'kolab_gid'} = (getgrnam('kolab'))[2])) {
&log('C', "Unable to determine the gid of user `kolab'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
if (!($config{'kolab_n_uid'} = (getpwnam('kolab-n'))[2])) {
&log('C', "Unable to determine the uid of user `kolab-n'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
if (!($config{'kolab_n_gid'} = (getgrnam('kolab-n'))[2])) {
&log('C', "Unable to determine the gid of user `kolab-n'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
if (!($config{'kolab_r_uid'} = (getpwnam('kolab-r'))[2])) {
&log('C', "Unable to determine the uid of user `kolab-r'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
if (!($config{'kolab_r_gid'} = (getgrnam('kolab-r'))[2])) {
&log('C', "Unable to determine the gid of user `kolab-r'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
# Make sure the critical variables we need were defined in kolab.conf
if (!exists $config{'bind_dn'} || !exists $config{'bind_pw'} || !exists $config{'ldap_uri'} || !exists $config{'base_dn'}) {
&log('C', "One or more required configuration variables (`bind_dn', `bind_pw', `ldap_uri' and/or `base_dn') are missing in `kolab.conf'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
# Retrieve the LDAP values of the main kolab object to complete our config hash
if (!($tempval = URI->new($config{'ldap_uri'}))) {
&log('C', "Unable to parse ldap_uri `" . $config{'ldap_uri'} . "'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
} else {
$config{'ldap_ip'} = $tempval->host;
$config{'ldap_port'} = $tempval->port;
@@ -143,12 +155,14 @@
if (!($ldap = Net::LDAP->new($config{'ldap_uri'}, verify => 'none' ))) {
&log('C', "Unable to connect to LDAP server `" . $config{'ldap_ip'} . ":" . $config{'ldap_port'} . "'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
$mesg = $ldap->bind($config{'bind_dn'}, password => $config{'bind_pw'}) if $ldap;
if ($ldap && $mesg->code) {
&log('C', "Unable to bind to DN `" . $config{'bind_dn'} . "'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
#$ldap = Kolab::LDAP::create(
@@ -180,6 +194,7 @@
} else {
&log('C', "Unable to find kolab object `" . $config{'kolab_dn'} . "'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
}
} else {
&log('C', "Unable to read configuration data from LDAP", KOLAB_WARN);
@@ -252,6 +267,7 @@
if (!($tempval = URI->new($config{'user_ldap_uri'}))) {
&log('C', "Unable to parse user_ldap_uri `" . $config{'user_ldap_uri'} . "'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
} else {
$config{'user_ldap_ip'} = $tempval->host;
$config{'user_ldap_port'} = $tempval->port;
@@ -293,6 +309,7 @@
if (!($tempval = URI->new($config{'sf_ldap_uri'}))) {
&log('C', "Unable to parse sf_ldap_uri `" . $config{'sf_ldap_uri'} . "'", KOLAB_ERROR);
# exit(1);
+ $error = 1;
} else {
$config{'sf_ldap_ip'} = $tempval->host;
$config{'sf_ldap_port'} = $tempval->port;
@@ -334,6 +351,7 @@
}
&log('C', 'Finished reloading configuration');
+ $reloadOk = !$error;
}
sub reload
More information about the commits
mailing list