From: janw Date: Mon, 25 Feb 2008 13:34:25 +0000 (+0000) Subject: Added more checks. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=df4a9d7c19056ee8975ea22f3106300279e85509;p=gosa.git Added more checks. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9105 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/server/events/siTriggered.pm b/gosa-si/server/events/siTriggered.pm index 4cc8fdc25..6d80ba944 100644 --- a/gosa-si/server/events/siTriggered.pm +++ b/gosa-si/server/events/siTriggered.pm @@ -162,7 +162,12 @@ sub detected_hardware { my $resolver=Net::DNS::Resolver->new; my $ipaddress= $1 if $address =~ /^([0-9\.]*?):.*$/; my $dnsresult= $resolver->search($ipaddress); - my $dnsname= (defined($dnsresult))?$dnsresult->{answer}[0]->{ptrdname}:$ipaddress; + my $dnsname= ( + defined($dnsresult) && + defined($dnsresult->{answer} && + defined($dnsresult->{answer}[0] && + defined($dnsresult->{answer}[0]->{ptrdname} + )?$dnsresult->{answer}[0]->{ptrdname}:$ipaddress; my $cn = (($dnsname =~ /^(\d){1,3}\.(\d){1,3}\.(\d){1,3}\.(\d){1,3}/) ? $dnsname : sprintf "%s", $dnsname =~ /([^\.]+)\.?/); my $dn = "cn=$cn,ou=incoming,$ldap_base"; &main::daemon_log("INFO: Creating entry for $dn",5);