summaryrefslogtreecommitdiff
path: root/app/xauth/gethost.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-03-08 09:35:08 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-03-08 09:35:08 +0000
commit2eff261421c331bc8f4a1037dc2822f03e098939 (patch)
tree4d35ab84abe48f13b95b643c6effcc02731839a1 /app/xauth/gethost.c
parentfbdb956451732145f5a0036d26f396473d2c91b3 (diff)
Update to xauth 1.0.3 + fixes from git head. Partially addresses system/6097.
Diffstat (limited to 'app/xauth/gethost.c')
-rw-r--r--app/xauth/gethost.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/app/xauth/gethost.c b/app/xauth/gethost.c
index 4fd9d775e..3bfdb39b6 100644
--- a/app/xauth/gethost.c
+++ b/app/xauth/gethost.c
@@ -61,13 +61,9 @@ in this Software without prior written authorization from The Open Group.
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#ifdef SYSV
-#ifdef i386
-#if !defined(SCO325) && !defined(sun)
+#ifdef HAVE_NET_ERRNO_H
#include <net/errno.h>
-#endif /* !SCO325 && !sun */
-#endif /* i386 */
-#endif /* SYSV */
+#endif /* HAVE_NET_ERRNO_H */
#endif /* !STREAMSCONN */
#endif /* !WIN32 */
#include <errno.h>
@@ -92,15 +88,6 @@ static volatile Bool nameserver_timedout = False;
* be found. Stolen from xhost.
*/
-/* defined by autoconf AC_TYPE_SIGNAL, need to define for Imake */
-#ifndef RETSIGTYPE
-# ifdef SIGNALRETURNSINT
-# define RETSIGTYPE int
-# else
-# define RETSIGTYPE void
-# endif
-#endif
-
static jmp_buf env;
static RETSIGTYPE
nameserver_lost(int sig)
@@ -115,8 +102,7 @@ nameserver_lost(int sig)
#endif
char *
-get_hostname (auth)
- Xauth *auth;
+get_hostname (Xauth *auth)
{
static struct hostent *hp;
int af;
@@ -309,6 +295,8 @@ struct addrlist *get_address_info (
hints.ai_protocol = 0;
if (getaddrinfo(host,NULL,&hints,&firstai) !=0) return NULL;
for (ai = firstai; ai != NULL; ai = ai->ai_next) {
+ struct addrlist *duplicate;
+
if (ai->ai_family == AF_INET) {
struct sockaddr_in *sin = (struct sockaddr_in *)ai->ai_addr;
src = &(sin->sin_addr);
@@ -321,7 +309,14 @@ struct addrlist *get_address_info (
family = FamilyInternet6;
}
- if (len > 0 && src != NULL) {
+ for(duplicate = retval; duplicate != NULL; duplicate = duplicate->next) {
+ if(duplicate->family == family && duplicate->len == len &&
+ memcmp(duplicate->address, src, len) == 0) {
+ break;
+ }
+ }
+
+ if (len > 0 && src != NULL && duplicate == NULL) {
struct addrlist *newrv = malloc (sizeof(struct addrlist));
if (newrv) {
newrv->address = malloc (len);