diff options
author | Ken Raeburn <raeburn@mit.edu> | 2005-05-18 01:01:23 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2005-05-18 01:01:23 +0000 |
commit | f2f53802ee47d3e805953b27a933da8ebb7b20eb (patch) | |
tree | 5d91e8dcd1ddaaffe887c82ad5b1830ae1f47dfd | |
parent | 6c2ed716538c24fca22578f39b16eb4da499ddb1 (diff) | |
download | krb5-f2f53802ee47d3e805953b27a933da8ebb7b20eb.tar.gz krb5-f2f53802ee47d3e805953b27a933da8ebb7b20eb.tar.xz krb5-f2f53802ee47d3e805953b27a933da8ebb7b20eb.zip |
* fake-addrinfo.c (fai_add_hosts_by_name): Pass null pointer instead of telnet
as service name.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17218 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/util/support/ChangeLog | 5 | ||||
-rw-r--r-- | src/util/support/fake-addrinfo.c | 33 |
2 files changed, 36 insertions, 2 deletions
diff --git a/src/util/support/ChangeLog b/src/util/support/ChangeLog index b0370a8df..fa6147e92 100644 --- a/src/util/support/ChangeLog +++ b/src/util/support/ChangeLog @@ -1,3 +1,8 @@ +2005-05-17 Ken Raeburn <raeburn@mit.edu> + + * fake-addrinfo.c (fai_add_hosts_by_name): Pass null pointer + instead of telnet as service name. + 2005-03-20 Alexandra Ellwood <lxs@mit.edu> * threads.c (thread_termination): Free array of pointers diff --git a/src/util/support/fake-addrinfo.c b/src/util/support/fake-addrinfo.c index 74197e645..b07bb022a 100644 --- a/src/util/support/fake-addrinfo.c +++ b/src/util/support/fake-addrinfo.c @@ -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 @@ -663,7 +663,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; |