From bfb97cf2f97d6236d1b423a15b6af1dcec83ca0b Mon Sep 17 00:00:00 2001 From: rettenbe Date: Wed, 26 Mar 2008 12:57:20 +0000 Subject: [PATCH] new jobs try to translate mac to real name and at it to targettag at job-queue git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9993 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/modules/GosaPackages.pm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index 7e50aef02..6e581101e 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -348,8 +348,28 @@ sub process_job_msg { ""; } - # check wether mac address is already known in known_daemons or known_clients - my $target = 'none'; + # if mac address is already known in ldap, set targettag to 'cn' + my $target; + my $ldap_handle = &main::get_ldap_handle($session_id); + if( not defined $ldap_handle ) { + &main::daemon_log("$session_id ERROR: cannot connect to ldap", 1); + $target = "none"; + + # try to fetch a 'real name' + } else { + my $mesg = $ldap_handle->search( + base => $main::ldap_base, + scope => 'sub', + attrs => ['cn'], + filter => "(macAddress=$macAddress)"); + if($mesg->code) { + &main::daemon_log($mesg->error, 1); + $target = "none"; + } else { + my $entry= $mesg->entry(0); + $target = $entry->get_value("cn"); + } + } if( $error == 0 ) { # add job to job queue -- 2.30.2