From b1ae418af40289ea4f40449a819df26ee3bdd399 Mon Sep 17 00:00:00 2001 From: Sunil Nimmagadda Date: Thu, 5 Nov 2020 12:33:09 +0530 Subject: [PATCH] Fallback definition for HOST_NAME_MAX. On some platforms(NetBSD) where HOST_NAME_MAX is not defined, provide a fallback definition to _POSIX_HOST_NAME_MAX. --- pam.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pam.c b/pam.c index c5a3001..ccebd0f 100644 --- 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))) -- 2.39.2