From c957d4b15f9cbfb3cb6962e9863ed888b40fd606 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 9 Apr 2007 20:58:13 +0000 Subject: [PATCH] EAI_NODATA deprecated, not always defined Brian Kantor reports (on the kerberos@mit list today) that krb5-1.6 doesn't build on FreeBSD 6.1 because they've done away with EAI_NODATA, which was removed from the getaddrinfo API in RFC 3943. This patch conditionalizes two tests for EAI_NODATA on the macro being defined, and also adds handling for EAI_OVERFLOW, a new error code added in RFC 3943. ticket: new tags: pullup target_version: 1.6.1 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19410 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/hst_realm.c | 6 +++++- src/lib/krb5/os/locate_kdc.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c index e66016441..7e24b8d6d 100644 --- a/src/lib/krb5/os/hst_realm.c +++ b/src/lib/krb5/os/hst_realm.c @@ -302,12 +302,16 @@ krb5int_translate_gai_error (int num) return EAFNOSUPPORT; case EAI_MEMORY: return ENOMEM; -#if EAI_NODATA != EAI_NONAME +#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME case EAI_NODATA: return KRB5_EAI_NODATA; #endif case EAI_NONAME: return KRB5_EAI_NONAME; +#if defined(EAI_OVERFLOW) + case EAI_OVERFLOW: + return EINVAL; /* XXX */ +#endif case EAI_SERVICE: return KRB5_EAI_SERVICE; case EAI_SOCKTYPE: diff --git a/src/lib/krb5/os/locate_kdc.c b/src/lib/krb5/os/locate_kdc.c index a59fc63b3..566213d35 100644 --- a/src/lib/krb5/os/locate_kdc.c +++ b/src/lib/krb5/os/locate_kdc.c @@ -157,13 +157,18 @@ static int translate_ai_error (int err) #ifdef EAI_ADDRFAMILY case EAI_ADDRFAMILY: #endif -#if EAI_NODATA != EAI_NONAME +#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME case EAI_NODATA: #endif case EAI_NONAME: /* Name not known or no address data, but no error. Do nothing more. */ return 0; +#ifdef EAI_OVERFLOW + case EAI_OVERFLOW: + /* An argument buffer overflowed. */ + return EINVAL; /* XXX */ +#endif #ifdef EAI_SYSTEM case EAI_SYSTEM: /* System error, obviously. */ -- 2.26.2