steffen: server/kolabd/kolabd kolab_smtpdpolicy,1.6,1.6.2.1
cvs at intevation.de
cvs at intevation.de
Fri Sep 16 14:37:53 CEST 2005
Author: steffen
Update of /kolabrepository/server/kolabd/kolabd
In directory doto:/tmp/cvs-serv2704/kolabd
Modified Files:
Tag: kolab_2_0_branch
kolab_smtpdpolicy
Log Message:
new conf file for policy daemon. Fixes Issue832 for kolab 2.0
Index: kolab_smtpdpolicy
===================================================================
RCS file: /kolabrepository/server/kolabd/kolabd/Attic/kolab_smtpdpolicy,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -d -r1.6 -r1.6.2.1
--- kolab_smtpdpolicy 21 Feb 2005 13:25:28 -0000 1.6
+++ kolab_smtpdpolicy 16 Sep 2005 12:37:51 -0000 1.6.2.1
@@ -26,6 +26,9 @@
use Net::LDAP::Entry;
use Net::hostent;
use Socket;
+use Kolab::Util;
+
+my %conf;
#
# Usage: kolab_smtpd_policy.pl [-v]
@@ -121,13 +124,13 @@
}
sub ldap_connect {
- my $ldapuri = URI->new($conf_ldapuri) || fatal_exit("error: could not parse given uri");
- $ldap = Net::LDAP->new($conf_ldapuri) || fatal_exit("could not connect ldap server");
+ my $ldapuri = URI->new($conf_ldapuri) || fatal_exit("error: could not parse given uri $conf_ldapuri");
+ $ldap = Net::LDAP->new($conf_ldapuri) || fatal_exit("could not connect to ldap server $conf_ldapuri: $@");
if ($ldap) {
if( $conf_binddn ) {
- $ldap->bind( $conf_binddn, password => $conf_bindpw ) || fatal_exit( "could not bind as $conf_binddn" );
+ $ldap->bind( $conf_binddn, password => $conf_bindpw ) || fatal_exit( "could not bind as $conf_binddn: $@" );
} else {
- $ldap->bind || fatal_exit("could not bind");
+ $ldap->bind || fatal_exit("could not bind: $@");
}
} else {
fatal_exit( "Could not contact LDAP server" );
@@ -302,9 +305,21 @@
openlog $0, $syslog_options, $syslog_facility;
#
-# We don't need getopt() for now.
+# Read options from config-file
#
$conf_allowunauth = 0;
+%conf = readConfig( %conf, "@l_prefix@/etc/kolab/kolab_smtpdpolicy.conf" );
+$conf_ldapuri = $conf{'ldap_uri'};
+$conf_basedn = $conf{'basedn'};
+$conf_bindn = $conf{'binddn'};
+$conf_bindpw = $conf{'bindpw'};
+$conf_domain = $conf{'domain'};
+$conf_allowunauth = 1 if( $conf{'allow_unauth'} );
+ at conf_permithosts = split /\s*,\s*/, $conf{'permithosts'};
+
+#
+# Allow user to override on commandline
+#
while ($option = shift(@ARGV)) {
if ($option eq "-v") {
$verbose = 1;
@@ -321,6 +336,7 @@
} elsif ($option eq '-allow-unauth') {
$conf_allowunauth = 1;
} elsif ($option eq '-permithosts') {
+ @conf_permithosts = ();
for my $h (split /\s*,\s*/, shift(@ARGV)) {
push @conf_permithosts, $h;
}
More information about the commits
mailing list