From 2bbd403f39eb5bc6025014fe1514751dd5872207 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 9 Oct 2014 09:16:33 +0200 Subject: [PATCH] nwrap: Use DNS_NAME_MAX cause it is not available on BSD. Also HOST_NAME_MAX is only for the value returned by gethostname(). It is normally limited to 64 chars on Linux. Signed-off-by: Andreas Schneider Reviewed-by: Stefan Metzmacher --- lib/nss_wrapper/nss_wrapper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/nss_wrapper/nss_wrapper.c b/lib/nss_wrapper/nss_wrapper.c index 931aaa5989b..c066e47f51d 100644 --- a/lib/nss_wrapper/nss_wrapper.c +++ b/lib/nss_wrapper/nss_wrapper.c @@ -49,7 +49,6 @@ #include #include #include -#include /* * Defining _POSIX_PTHREAD_SEMANTICS before including pwd.h and grp.h gives us @@ -122,6 +121,10 @@ typedef nss_status_t NSS_STATUS; #define __location__ __FILE__ ":" __LINESTR__ #endif +#ifndef DNS_NAME_MAX +#define DNS_NAME_MAX 255 +#endif + /* GCC have printf type attribute check. */ #ifdef HAVE_ATTRIBUTE_PRINTF_FORMAT #define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b))) @@ -2352,7 +2355,7 @@ static void nwrap_files_endgrent(struct nwrap_backend *b) static struct hostent *nwrap_files_gethostbyname(const char *name, int af) { struct hostent *he; - char canon_name[HOST_NAME_MAX] = { 0 }; + char canon_name[DNS_NAME_MAX] = { 0 }; size_t name_len; int i; -- 2.11.4.GIT