+2007-11-19 Jan Dj\e,Ad\e(Brv <jan.h.d@swipnet.se>
+
+ * pop.c (socket_connection): Move realhost out of #ifdefs.
+ Set realhost both for HAVE_GETADDRINFO and !HAVE_GETADDRINFO.
+
2007-11-18 Jan Dj\e,Ad\e(Brv <jan.h.d@swipnet.se>
* pop.c (socket_connection): Use getaddrinfo if available.
char found_port = 0;
char *service;
int sock;
+ char *realhost;
#ifdef KERBEROS
#ifdef KERBEROS5
krb5_error_code rem;
CREDENTIALS cred;
Key_schedule schedule;
int rem;
- char *realhost;
#endif /* KERBEROS5 */
#endif /* KERBEROS */
#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
{
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 */
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: "
#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))
{