Sfoglia il codice sorgente

Ticket 47893 - should use Sys::Hostname instead Net::Domain

Bug Description: hostfqdn function does not always return the correct fqdn.
                 Sometimes it incorrectly adds ".com" when it should not.

Fix Description: Use Sys::Hostname/hostname() which does return the correct
                 fqdn.

https://fedorahosted.org/389/ticket/47893

Reviewed by: rmeggins(Thanks!)
Mark Reynolds 11 anni fa
parent
commit
f5a0f6ac89

+ 2 - 2
ldap/admin/src/scripts/DSCreate.pm.in

@@ -48,7 +48,7 @@ use DSUtil;
 use Inf;
 use FileConn;
 
-use Net::Domain qw(hostfqdn);
+use Sys::Hostname;
 # tempfiles
 use File::Temp qw(tempfile tempdir);
 use File::Path;
@@ -820,7 +820,7 @@ sub setDefaults {
     }
 
     if (!$inf->{General}->{FullMachineName}) {
-        $inf->{General}->{FullMachineName} = hostfqdn;
+        $inf->{General}->{FullMachineName} = hostname();
     }
 
     if (!$inf->{General}->{SuiteSpotUserID}) {

+ 3 - 3
ldap/admin/src/scripts/DSDialogs.pm

@@ -40,7 +40,7 @@ package DSDialogs;
 
 use strict;
 
-use Net::Domain qw(hostname hostfqdn);
+use Sys::Hostname;
 use DialogManager;
 use Setup;
 use Dialog;
@@ -86,7 +86,7 @@ my $dsserverid = new Dialog (
         if (!defined($serverid)) {
             $serverid = $self->{manager}->{inf}->{General}->{FullMachineName};
             if (!defined($serverid)) {
-                $serverid = hostfqdn;
+                $serverid = hostname();
             }
             # strip out the leftmost domain component
             $serverid =~ s/\..*$//;
@@ -124,7 +124,7 @@ my $dssuffix = new Dialog (
         if (!defined($suffix)) {
             $suffix = $self->{manager}->{inf}->{General}->{FullMachineName};
             if (!defined($suffix)) {
-                $suffix = hostfqdn;
+                $suffix = hostname();
             }
             $suffix =~ s/^[^\.]*\.//; # just the domain part
             # convert fqdn to dc= domain components

+ 1 - 1
ldap/admin/src/scripts/Migration.pm.in

@@ -55,7 +55,7 @@ use Exporter ();
 @EXPORT_OK = qw();
 
 # hostname
-use Net::Domain qw(hostfqdn);
+use Sys::Hostname;
 
 # load perldap
 use Mozilla::LDAP::Conn;

+ 1 - 1
ldap/admin/src/scripts/Setup.pm.in

@@ -53,7 +53,7 @@ use Exporter ();
 @EXPORT_OK = qw($SILENT $EXPRESS $TYPICAL $CUSTOM);
 
 # hostname
-use Net::Domain qw(hostfqdn);
+use Sys::Hostname; # hostname()
 
 # load perldap
 use Mozilla::LDAP::Conn;

+ 2 - 2
ldap/admin/src/scripts/SetupDialogs.pm.in

@@ -43,7 +43,7 @@ use strict;
 use DialogManager;
 use Setup;
 use Dialog;
-use Net::Domain qw(hostfqdn);
+use Sys::Hostname;
 use DSUtil;
 
 my $welcome = new DialogYesNo (
@@ -112,7 +112,7 @@ my $hostdlg = new Dialog (
     sub {
         my $self = shift;
         return $self->{manager}->{inf}->{General}->{FullMachineName} ||
-            hostfqdn;
+            hostname();
     },
     sub {
         my $self = shift;