diff options
author | Ken Raeburn <raeburn@mit.edu> | 2004-07-04 08:48:21 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2004-07-04 08:48:21 +0000 |
commit | 0f603f72496ff9ba52a1b6af75b8c8c4a45e67df (patch) | |
tree | 35220247b39d760db85aaea769db0e1b62511d89 /src/lib/krb5/os | |
parent | 5b89ed274b839787d15679964644559a3b8ace47 (diff) | |
download | krb5-0f603f72496ff9ba52a1b6af75b8c8c4a45e67df.tar.gz krb5-0f603f72496ff9ba52a1b6af75b8c8c4a45e67df.tar.xz krb5-0f603f72496ff9ba52a1b6af75b8c8c4a45e67df.zip |
* dnssrv.c (krb5int_make_srv_query_realm) [HAVE_RES_NSEARCH]: Use res_nsearch
instead of res_search.
* hst_realm.c (krb5_try_realm_txt_rr) [HAVE_RES_NSEARCH]: Likewise.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16541 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/os')
-rw-r--r-- | src/lib/krb5/os/ChangeLog | 7 | ||||
-rw-r--r-- | src/lib/krb5/os/dnssrv.c | 28 | ||||
-rw-r--r-- | src/lib/krb5/os/hst_realm.c | 28 |
3 files changed, 63 insertions, 0 deletions
diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index fcba1f33c..4efd66d12 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,10 @@ +2004-07-04 Ken Raeburn <raeburn@mit.edu> + + * dnssrv.c (krb5int_make_srv_query_realm) [HAVE_RES_NSEARCH]: Use + res_nsearch instead of res_search. + * hst_realm.c (krb5_try_realm_txt_rr) [HAVE_RES_NSEARCH]: + Likewise. + 2004-07-02 Ken Raeburn <raeburn@mit.edu> * an_to_ln.c: Include string.h. diff --git a/src/lib/krb5/os/dnssrv.c b/src/lib/krb5/os/dnssrv.c index 1c1586a8a..400217975 100644 --- a/src/lib/krb5/os/dnssrv.c +++ b/src/lib/krb5/os/dnssrv.c @@ -128,7 +128,35 @@ krb5int_make_srv_query_realm(const krb5_data *realm, fprintf (stderr, "sending DNS SRV query for %s\n", host); #endif +#ifdef HAVE_RES_NSEARCH + { + res_state statp; + /* Weird... the man pages I've been looking at (Solaris 9) say + we pass a res_state object (which is a pointer) into + various routines, but they don't say much of anything about + what it should point to initially or how it should be + allocated. + + They also give no indication what the return value of + res_ninit is. */ + typedef union { + struct sockaddr_storage ss; + INT64_TYPE i64; + double d; + } aligned_thing; + aligned_thing statp_buf[(sizeof(*statp) + sizeof(aligned_thing) - 1) / sizeof(aligned_thing)]; + int n; + + statp = (res_state) &statp_buf; + memset(&statp_buf, 0, sizeof(statp_buf)); + n = res_ninit(statp); + /* ignore n? */ + size = res_nsearch(statp, host, C_IN, T_SRV, + answer.bytes, sizeof(answer.bytes)); + } +#else size = res_search(host, C_IN, T_SRV, answer.bytes, sizeof(answer.bytes)); +#endif if ((size < hdrsize) || (size > sizeof(answer.bytes))) goto out; diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c index a72fb846c..bdf7e8d09 100644 --- a/src/lib/krb5/os/hst_realm.c +++ b/src/lib/krb5/os/hst_realm.c @@ -143,7 +143,35 @@ krb5_try_realm_txt_rr(const char *prefix, const char *name, char **realm) if ((h > host) && (h[-1] != '.') && ((h - host + 1) < sizeof(host))) strcpy (h, "."); } +#ifdef HAVE_RES_NSEARCH + { + res_state statp; + /* Weird... the man pages I've been looking at (Solaris 9) say + we pass a res_state object (which is a pointer) into + various routines, but they don't say much of anything about + what it should point to initially or how it should be + allocated. + + They also give no indication what the return value of + res_ninit is. */ + typedef union { + struct sockaddr_storage ss; + INT64_TYPE i64; + double d; + } aligned_thing; + aligned_thing statp_buf[(sizeof(*statp) + sizeof(aligned_thing) - 1) / sizeof(aligned_thing)]; + int n; + + statp = (res_state) &statp_buf; + memset(&statp_buf, 0, sizeof(statp_buf)); + n = res_ninit(statp); + /* ignore n? */ + size = res_nsearch(statp, host, C_IN, T_TXT, + answer.bytes, sizeof(answer.bytes)); + } +#else size = res_search(host, C_IN, T_TXT, answer.bytes, sizeof(answer.bytes)); +#endif if ((size < sizeof(HEADER)) || (size > sizeof(answer.bytes))) return KRB5_ERR_HOST_REALM_UNKNOWN; |