From 5227eb531cddc795d60a54d6591e0b0466be104a Mon Sep 17 00:00:00 2001 From: janw Date: Mon, 25 Feb 2008 14:22:24 +0000 Subject: [PATCH] Trashed DNS::Resolver in favor of inet_ntoa. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9109 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/server/events/siTriggered.pm | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) 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); -- 2.30.2