From: Ken Raeburn Date: Fri, 12 Apr 2002 05:59:34 +0000 (+0000) Subject: * locate_kdc.c (add_addrinfo_to_list) [TEST]: Print out socket type before X-Git-Tag: krb5-1.3-alpha1~773 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d378c230edc4c24ff95bea6da9e900f0c14d1b73;p=krb5.git * locate_kdc.c (add_addrinfo_to_list) [TEST]: Print out socket type before returning. (add_host_to_list): Don't need to initialize err. Supply getaddrinfo hint to select datagram addresses only. Delete AIX bug workaround code. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14387 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 38f0f16f7..6a5cb19ed 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,11 @@ +2002-04-12 Ken Raeburn + + * locate_kdc.c (add_addrinfo_to_list) [TEST]: Print out socket + type before returning. + (add_host_to_list): Don't need to initialize err. Supply + getaddrinfo hint to select datagram addresses only. Delete AIX + bug workaround code. + 2002-04-10 Danilo Almeida * locate_kdc.c (translate_ai_error), hst_realm.c diff --git a/src/lib/krb5/os/locate_kdc.c b/src/lib/krb5/os/locate_kdc.c index 0395b7e99..cc6d9c567 100644 --- a/src/lib/krb5/os/locate_kdc.c +++ b/src/lib/krb5/os/locate_kdc.c @@ -249,7 +249,27 @@ static int translate_ai_error (int err) static int add_addrinfo_to_list (struct addrlist *lp, struct addrinfo *a) { - return add_sockaddr_to_list (lp, a->ai_addr, a->ai_addrlen); + int r; + r = add_sockaddr_to_list (lp, a->ai_addr, a->ai_addrlen); +#ifdef TEST + switch (a->ai_socktype) { + case SOCK_DGRAM: + fprintf(stderr, "\tdgram\n"); + break; + case SOCK_STREAM: + fprintf(stderr, "\tstream\n"); + break; + case SOCK_RAW: + fprintf(stderr, "\traw\n"); + break; + case 0: + break; + default: + fprintf(stderr, "\tsocket type %d\n", a->ai_socktype); + break; + } +#endif + return r; } static void set_port_num (struct sockaddr *addr, int num) @@ -270,28 +290,20 @@ static int add_host_to_list (struct addrlist *lp, const char *hostname, int port, int secport) { - struct addrinfo *addrs, *a; - /* Must set err to 0 for the case we return err without ever - setting it -- !HAVE_GETADDRINFO and !hp */ - int err = 0; + struct addrinfo *addrs, *a, hint; + int err; #ifdef TEST fprintf (stderr, "adding hostname %s, ports %d,%d\n", hostname, ntohs (port), ntohs (secport)); #endif - err = getaddrinfo (hostname, NULL, NULL, &addrs); + memset(&hint, 0, sizeof(hint)); + hint.ai_socktype = SOCK_DGRAM; + err = getaddrinfo (hostname, NULL, &hint, &addrs); if (err) return translate_ai_error (err); for (a = addrs; a; a = a->ai_next) { - /* AIX 4.3.3 libc is broken. */ - if (a->ai_addr->sa_family == 0) - a->ai_addr->sa_family = a->ai_family; -#ifdef HAVE_SA_LEN - if (a->ai_addr->sa_len == 0) - a->ai_addr->sa_len = a->ai_addrlen; -#endif - set_port_num (a->ai_addr, port); err = add_addrinfo_to_list (lp, a); if (err)