Code

Trashed DNS::Resolver in favor of inet_ntoa.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Feb 2008 14:22:24 +0000 (14:22 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Feb 2008 14:22:24 +0000 (14:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9109 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/server/events/siTriggered.pm

index 2a0ca7fe7bb395d632444e36ab51323989be6c57..297b91f1d6bb7d1d02e8d200dae7ef7a13e5de72 100644 (file)
@@ -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);