From: Alexandra Ellwood Date: Wed, 1 Jun 2005 19:24:32 +0000 (+0000) Subject: pullup to trunk X-Git-Tag: krb5-1.4.3-beta1~55 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=48750c7ec6a2f37aafdf61d4c256bcf2cb102d8c;p=krb5.git pullup to trunk ticket: 3083 version_fixed: 1.4.2 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@17225 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 7ecb536b7..73aa7922b 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,8 @@ +2005-05-17 Ken Raeburn + + * fake-addrinfo.c (fai_add_hosts_by_name): Pass null pointer + instead of telnet as service name. + 2005-03-25 Ken Raeburn * k5-platform.h: Expand on init/fini comments some more. diff --git a/src/include/fake-addrinfo.h b/src/include/fake-addrinfo.h index 9ed8d406e..a0e58b77a 100644 --- a/src/include/fake-addrinfo.h +++ b/src/include/fake-addrinfo.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002,2003,2004 by the Massachusetts Institute of Technology, + * Copyright (C) 2001,2002,2003,2004,2005 by the Massachusetts Institute of Technology, * Cambridge, MA, USA. All Rights Reserved. * * This software is being provided to you, the LICENSEE, by the @@ -756,7 +756,36 @@ static inline int fai_add_hosts_by_name (const char *name, we never have to look up an IPv6 address if we are always asked for IPv4 only, but let's deal with that later, if we have to. */ - aierr = system_getaddrinfo(name, "telnet", &myhints, &ai); + /* Try NULL for the service for now. + + It would be nice to use the requested service name, and not + have to patch things up, but then we'd be doing multiple + queries for the same host when we get different services. + We were using "telnet" for a little more confidence that + getaddrinfo would heed the hints to only give us stream + socket types (with no socket type and null service name, we + might get stream *and* dgram *and* raw, for each address, + or only raw). The RFC 3493 description of ai_socktype + sometimes associates it with the specified service, + sometimes not. + + But on Mac OS X (10.3, 10.4) they've "extended" getaddrinfo + to make SRV RR queries. (Please, somebody, show me + something in the specs that actually supports this? RFC + 3493 says nothing about it, but it does say getaddrinfo is + the new way to look up hostnames. RFC 2782 says SRV + records should *not* be used unless the application + protocol spec says to do so. The Telnet spec does not say + to do it.) And then they complain when our code + "unexpectedly" seems to use this "extension" in cases where + they don't want it to be used. + + Fortunately, it appears that if we specify ai_socktype as + SOCK_STREAM and use a null service name, we only get one + copy of each address on all the platforms I've tried, + although it may not have ai_socktype filled in properly. + So, we'll fudge it with that for now. */ + aierr = system_getaddrinfo(name, NULL, &myhints, &ai); if (aierr) { krb5int_unlock_fac(); return aierr;