]> git.armaanb.net Git - opendoas.git/commitdiff
Fallback definition for HOST_NAME_MAX.
authorSunil Nimmagadda <sunil@nimmagadda.net>
Thu, 5 Nov 2020 07:03:09 +0000 (12:33 +0530)
committerDuncan Overbruck <github@duncano.de>
Thu, 5 Nov 2020 14:23:08 +0000 (15:23 +0100)
On some platforms(NetBSD) where HOST_NAME_MAX is not defined,
provide a fallback definition to _POSIX_HOST_NAME_MAX.

pam.c

diff --git a/pam.c b/pam.c
index c5a3001509b59364281466cca310d56ce523b990..ccebd0fe98105499e81555bd5d15b3335cec3258 100644 (file)
--- a/pam.c
+++ b/pam.c
@@ -271,6 +271,9 @@ pamauth(const char *user, const char *myname, int interactive, int nopass, int p
                if (!interactive)
                        errx(1, "Authorization required");
 
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
+#endif
                /* doas style prompt for pam */
                char host[HOST_NAME_MAX + 1];
                if (gethostname(host, sizeof(host)))