diff options
| author | Jan Djärv | 2007-11-19 11:09:20 +0000 |
|---|---|---|
| committer | Jan Djärv | 2007-11-19 11:09:20 +0000 |
| commit | ee15f3125e20e9b0fe246690e8b9b7a72d382d86 (patch) | |
| tree | 49f1f5c49b43d57ef872915f7ca04452801b1168 /lib-src | |
| parent | 004a00f4ae0d64a86265c0fa6d6d52f0fa3d9434 (diff) | |
| download | emacs-ee15f3125e20e9b0fe246690e8b9b7a72d382d86.tar.gz emacs-ee15f3125e20e9b0fe246690e8b9b7a72d382d86.zip | |
(socket_connection): Move realhost out of #ifdefs.
Set realhost both for HAVE_GETADDRINFO and !HAVE_GETADDRINFO.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 5 | ||||
| -rw-r--r-- | lib-src/pop.c | 18 |
2 files changed, 18 insertions, 5 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 9a88a606449..a4d67b80eed 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-11-19 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * pop.c (socket_connection): Move realhost out of #ifdefs. | ||
| 4 | Set realhost both for HAVE_GETADDRINFO and !HAVE_GETADDRINFO. | ||
| 5 | |||
| 1 | 2007-11-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 6 | 2007-11-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 7 | ||
| 3 | * pop.c (socket_connection): Use getaddrinfo if available. | 8 | * pop.c (socket_connection): Use getaddrinfo if available. |
diff --git a/lib-src/pop.c b/lib-src/pop.c index df9e41f6457..ea057713234 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c | |||
| @@ -1022,6 +1022,7 @@ socket_connection (host, flags) | |||
| 1022 | char found_port = 0; | 1022 | char found_port = 0; |
| 1023 | char *service; | 1023 | char *service; |
| 1024 | int sock; | 1024 | int sock; |
| 1025 | char *realhost; | ||
| 1025 | #ifdef KERBEROS | 1026 | #ifdef KERBEROS |
| 1026 | #ifdef KERBEROS5 | 1027 | #ifdef KERBEROS5 |
| 1027 | krb5_error_code rem; | 1028 | krb5_error_code rem; |
| @@ -1037,7 +1038,6 @@ socket_connection (host, flags) | |||
| 1037 | CREDENTIALS cred; | 1038 | CREDENTIALS cred; |
| 1038 | Key_schedule schedule; | 1039 | Key_schedule schedule; |
| 1039 | int rem; | 1040 | int rem; |
| 1040 | char *realhost; | ||
| 1041 | #endif /* KERBEROS5 */ | 1041 | #endif /* KERBEROS5 */ |
| 1042 | #endif /* KERBEROS */ | 1042 | #endif /* KERBEROS */ |
| 1043 | 1043 | ||
| @@ -1107,7 +1107,7 @@ socket_connection (host, flags) | |||
| 1107 | #ifdef HAVE_GETADDRINFO | 1107 | #ifdef HAVE_GETADDRINFO |
| 1108 | memset (&hints, 0, sizeof(hints)); | 1108 | memset (&hints, 0, sizeof(hints)); |
| 1109 | hints.ai_socktype = SOCK_STREAM; | 1109 | hints.ai_socktype = SOCK_STREAM; |
| 1110 | hints.ai_flags = AI_ADDRCONFIG; | 1110 | hints.ai_flags = AI_ADDRCONFIG | AI_CANONNAME; |
| 1111 | hints.ai_family = AF_INET; | 1111 | hints.ai_family = AF_INET; |
| 1112 | do | 1112 | do |
| 1113 | { | 1113 | { |
| @@ -1136,6 +1136,11 @@ socket_connection (host, flags) | |||
| 1136 | it = it->ai_next; | 1136 | it = it->ai_next; |
| 1137 | } | 1137 | } |
| 1138 | connect_ok = it != NULL; | 1138 | connect_ok = it != NULL; |
| 1139 | if (connect_ok) | ||
| 1140 | { | ||
| 1141 | realhost = alloca (strlen (it->ai_canonname) + 1); | ||
| 1142 | strcpy (realhost, it->ai_canonname); | ||
| 1143 | } | ||
| 1139 | freeaddrinfo (res); | 1144 | freeaddrinfo (res); |
| 1140 | } | 1145 | } |
| 1141 | #else /* !HAVE_GETADDRINFO */ | 1146 | #else /* !HAVE_GETADDRINFO */ |
| @@ -1159,6 +1164,12 @@ socket_connection (host, flags) | |||
| 1159 | hostent->h_addr_list++; | 1164 | hostent->h_addr_list++; |
| 1160 | } | 1165 | } |
| 1161 | connect_ok = *hostent->h_addr_list != NULL; | 1166 | connect_ok = *hostent->h_addr_list != NULL; |
| 1167 | if (! connect_ok) | ||
| 1168 | { | ||
| 1169 | realhost = alloca (strlen (hostent->h_name) + 1); | ||
| 1170 | strcpy (realhost, hostent->h_name); | ||
| 1171 | } | ||
| 1172 | |||
| 1162 | #endif /* !HAVE_GETADDRINFO */ | 1173 | #endif /* !HAVE_GETADDRINFO */ |
| 1163 | 1174 | ||
| 1164 | #define CONNECT_ERROR "Could not connect to POP server: " | 1175 | #define CONNECT_ERROR "Could not connect to POP server: " |
| @@ -1175,9 +1186,6 @@ socket_connection (host, flags) | |||
| 1175 | 1186 | ||
| 1176 | #ifdef KERBEROS | 1187 | #ifdef KERBEROS |
| 1177 | 1188 | ||
| 1178 | realhost = alloca (strlen (hostent->h_name) + 1); | ||
| 1179 | strcpy (realhost, hostent->h_name); | ||
| 1180 | |||
| 1181 | #define KRB_ERROR "Kerberos error connecting to POP server: " | 1189 | #define KRB_ERROR "Kerberos error connecting to POP server: " |
| 1182 | if (! (flags & POP_NO_KERBEROS)) | 1190 | if (! (flags & POP_NO_KERBEROS)) |
| 1183 | { | 1191 | { |