summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b0bcbe8)
raw | patch | inline | side by side (parent: b0bcbe8)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 26 Feb 2008 17:29:37 +0000 (17:29 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 26 Feb 2008 17:29:37 +0000 (17:29 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9138 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-server | patch | blob | history |
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 5f3c468acbd0bfb6cd72a8578088c490c518e011..aac8b3c994bbdd8c3162011c7b84b33a5cf5957d 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
use GOSA::DBsqlite;
use GOSA::GosaSupportDaemon;
use POE qw(Component::Server::TCP);
+use Net::LDAP;
+use Net::LDAP::Util qw(:escape);
my $modules_path = "/usr/lib/gosa-si/modules";
use lib "/usr/lib/gosa-si/modules";
my ($pid_file, $procid, $pid, $log_file);
my ($arp_activ, $arp_fifo);
my ($xml);
+my ($ldap_uri, $ldap_base, $ldap_admin_dn, $ldap_admin_password);
# variables declared in config file are always set to 'our'
our (%cfg_defaults, $log_file, $pid_file,
"known-servers" => [\$known_server_file_name, '/var/lib/gosa-si/servers.db'],
"login-users" => [\$login_users_file_name, '/var/lib/gosa-si/users.db'],
"fai-server" => [\$fai_server_file_name, '/var/lib/gosa-si/fai.db'],
- "gosa-unit-tag" => [\$gosa_unit_tag, ""],
+ "ldap-uri" => [\$ldap_uri, ""],
+ "ldap-base" => [\$ldap_base, ""],
+ "ldap-admin-dn" => [\$ldap_admin_dn, ""],
+ "ldap-admin-password" => [\$ldap_admin_password, ""],
+ "gosa-unit-tag" => [\$gosa_unit_tag, ""],
},
"GOsaPackages" => {
"ip" => [\$gosa_ip, "0.0.0.0"],
}
+sub get_ldap_handle {
+ my $mesg;
+
+ # Get an ldap handle, if we don't have one
+ if( ! defined $ldap_handle ){
+ $ldap_handle = Net::LDAP->new( $ldap_uri );
+ }
+ # Still not defined?
+ if( ! defined $ldap_handle ) {
+ daemon_log( "ch $$: Net::LDAP constructor failed: $!\n" );
+ return 0;
+ }
+
+ # Bind to ldap server - eventually authenticate
+ if( defined $ldap_admin_dn ) {
+ if( defined $ldap_admin_password ) {
+ $mesg = $ldap_handle->bind( $ldap_admin_dn, password => $ldap_admin_password );
+ } else {
+ $mesg = $ldap_handle->bind( $ldap_admin_dn );#
+ }
+ }
+ else {
+ $mesg = $ldap_handle->bind();
+ }
+
+ if( 0 != $mesg->code ) {
+ undef( $ldap_handle ) if( 81 == $mesg->code );
+ daemon_log( "ch $$: LDAP bind: error ("
+ . $mesg->code . ') - ' . $mesg->error . "\n" );
+ return 0;
+ }
+ #HIER IST EIN FEHLER.....
+ return 1;
+}
+
+
sub create_fai_server_db {
#####################################################################
}
-
#==== MAIN = main ==============================================================
# parse commandline options
Getopt::Long::Configure( "bundling" );