From 0457569ebe89df3c33c3ccd329e2ad45681d39ab Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sat, 8 Jan 2000 08:02:46 +0000 Subject: [PATCH] (match_local_auth): handle ai_canonname being set in any of the addresses returnedby getaddrinfo. glibc apparently returns the reverse lookup of every address in ai_canonname. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7759 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/kx/common.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/appl/kx/common.c b/appl/kx/common.c index 28b5d90c1..df82772a8 100644 --- a/appl/kx/common.c +++ b/appl/kx/common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -564,6 +564,7 @@ match_local_auth (Xauth* auth, struct addrinfo *ai, int disp_nr) { int auth_disp; char *tmp_disp; + struct addrinfo *a; tmp_disp = strndup (auth->number, auth->number_length); if (tmp_disp == NULL) @@ -572,13 +573,15 @@ match_local_auth (Xauth* auth, struct addrinfo *ai, int disp_nr) free (tmp_disp); if (auth_disp != disp_nr) return 1; - if ((auth->family == FamilyLocal - || auth->family == FamilyWild) - && ai->ai_canonname != NULL - && strncmp (auth->address, - ai->ai_canonname, - auth->address_length) == 0) + for (a = ai; a != NULL; a = a->ai_next) { + if ((auth->family == FamilyLocal + || auth->family == FamilyWild) + && a->ai_canonname != NULL + && strncmp (auth->address, + a->ai_canonname, + auth->address_length) == 0) return 0; + } return 1; }