]> git.armaanb.net Git - opendoas.git/commitdiff
move HOST_NAME_MAX to the top and add it to shadow.c
authorDuncan Overbruck <mail@duncano.de>
Thu, 12 Nov 2020 13:11:05 +0000 (14:11 +0100)
committerDuncan Overbruck <mail@duncano.de>
Thu, 12 Nov 2020 13:11:05 +0000 (14:11 +0100)
pam.c
shadow.c

diff --git a/pam.c b/pam.c
index ccebd0fe98105499e81555bd5d15b3335cec3258..1fc608223d2ca25710fcd808075193f47e710565 100644 (file)
--- a/pam.c
+++ b/pam.c
 
 #include "includes.h"
 
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
+#endif
+
 #define PAM_SERVICE_NAME "doas"
 
 static pam_handle_t *pamh = NULL;
@@ -271,9 +275,6 @@ 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)))
index 71c71c697dd644017a7d77bc8541f029c49038f2..64cc1f740d0172172072b3bf90b0befe7cdf12e0 100644 (file)
--- a/shadow.c
+++ b/shadow.c
 
 #include "openbsd.h"
 
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
+#endif
+
 void
 shadowauth(const char *myname, int persist)
 {