nwrap: Use DNS_NAME_MAX cause it is not available on BSD.
authorAndreas Schneider <asn@samba.org>
Thu, 9 Oct 2014 07:16:33 +0000 (09:16 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 9 Oct 2014 10:24:03 +0000 (12:24 +0200)
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 <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/nss_wrapper/nss_wrapper.c

index 931aaa5989bd8694c91ee3bf612377cb2f65b01d..c066e47f51d464fe864ff880699e398717386916 100644 (file)
@@ -49,7 +49,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <ctype.h>
-#include <limits.h>
 
 /*
  * 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;