From: janw Date: Mon, 25 Feb 2008 14:22:24 +0000 (+0000) Subject: Trashed DNS::Resolver in favor of inet_ntoa. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5227eb531cddc795d60a54d6591e0b0466be104a;p=gosa.git Trashed DNS::Resolver in favor of inet_ntoa. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9109 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/server/events/siTriggered.pm b/gosa-si/server/events/siTriggered.pm index 2a0ca7fe7..297b91f1d 100644 --- a/gosa-si/server/events/siTriggered.pm +++ b/gosa-si/server/events/siTriggered.pm @@ -161,13 +161,7 @@ sub detected_hardware { &main::daemon_log("INFO: Need to create a new LDAP Entry for client $address", 6); my $resolver=Net::DNS::Resolver->new; my $ipaddress= $1 if $address =~ /^([0-9\.]*?):.*$/; - my $dnsresult= $resolver->search($ipaddress); - my $dnsname= ( - defined($dnsresult) && - defined($dnsresult->{answer}) && - defined($dnsresult->{answer}[0]) && - defined($dnsresult->{answer}[0]->{ptrdname}) - )?$dnsresult->{answer}[0]->{ptrdname}:$ipaddress; + my $dnsname= gethostbyaddr(inet_aton($ipaddress), AF_INET) || $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);