emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lib-src/pop.c,v


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/lib-src/pop.c,v
Date: Mon, 19 Nov 2007 11:09:11 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Jan Djärv <jhd>        07/11/19 11:09:11

Index: pop.c
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/pop.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- pop.c       18 Nov 2007 17:24:27 -0000      1.42
+++ pop.c       19 Nov 2007 11:09:11 -0000      1.43
@@ -1022,6 +1022,7 @@
   char found_port = 0;
   char *service;
   int sock;
+  char *realhost;
 #ifdef KERBEROS
 #ifdef KERBEROS5
   krb5_error_code rem;
@@ -1037,7 +1038,6 @@
   CREDENTIALS cred;
   Key_schedule schedule;
   int rem;
-  char *realhost;
 #endif /* KERBEROS5 */
 #endif /* KERBEROS */
 
@@ -1107,7 +1107,7 @@
 #ifdef HAVE_GETADDRINFO
   memset (&hints, 0, sizeof(hints));
   hints.ai_socktype = SOCK_STREAM;
-  hints.ai_flags = AI_ADDRCONFIG;
+  hints.ai_flags = AI_ADDRCONFIG | AI_CANONNAME;
   hints.ai_family = AF_INET;
   do
     {
@@ -1136,6 +1136,11 @@
           it = it->ai_next;
         }
       connect_ok = it != NULL;
+      if (connect_ok)
+        {
+          realhost = alloca (strlen (it->ai_canonname) + 1);
+          strcpy (realhost, it->ai_canonname);
+        }
       freeaddrinfo (res);
     }
 #else /* !HAVE_GETADDRINFO */
@@ -1159,6 +1164,12 @@
       hostent->h_addr_list++;
     }
   connect_ok = *hostent->h_addr_list != NULL;
+  if (! connect_ok)
+    {
+      realhost = alloca (strlen (hostent->h_name) + 1);
+      strcpy (realhost, hostent->h_name);
+    }
+
 #endif /* !HAVE_GETADDRINFO */
 
 #define CONNECT_ERROR "Could not connect to POP server: "
@@ -1175,9 +1186,6 @@
 
 #ifdef KERBEROS
 
-  realhost = alloca (strlen (hostent->h_name) + 1);
-  strcpy (realhost, hostent->h_name);
-
 #define KRB_ERROR "Kerberos error connecting to POP server: "
   if (! (flags & POP_NO_KERBEROS))
     {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]