diff --git a/Makefile b/Makefile index cd8a49a..5664df5 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,13 @@ YACC?=yacc BIN=doas PREFIX?=/usr/local OBJECTS=doas.o env.o execvpe.o reallocarray.o y.tab.o -CFLAGS+=-DUSE_PAM -DDOAS_CONF=\"${PREFIX}/etc/doas.conf\" +CFLAGS+=-DUSE_PAM -DDOAS_CONF=\"${PREFIX}/etc/doas.conf\" LDFLAGS+=-lpam UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) LDFLAGS+=-lpam_misc OBJECTS+=strlcat.o strlcpy.o + CFLAGS+=-D_GNU_SOURCE endif ifeq ($(UNAME_S),FreeBSD) CFLAGS+=-DHAVE_LOGIN_CAP_H diff --git a/doas.c b/doas.c index f58b0f6..5baa8f6 100644 --- a/doas.c +++ b/doas.c @@ -433,7 +433,7 @@ main(int argc, char **argv) pam_handle_t *pamh = NULL; int pam_err; -#ifndef linux +/* #ifndef linux */ int temp_stdin; /* openpam_ttyconv checks if stdin is a terminal and @@ -450,7 +450,7 @@ main(int argc, char **argv) if (temp_stdin == -1) err(1, "dup"); close(STDIN_FILENO); -#else +/* #else */ /* force password prompt to display on stderr, not stdout */ int temp_stdout = dup(1); if (temp_stdout == -1) @@ -458,7 +458,7 @@ main(int argc, char **argv) close(1); if (dup2(2, 1) == -1) err(1, "dup2"); -#endif +/* #endif */ pam_err = pam_start("doas", myname, &pamc, &pamh); if (pam_err != PAM_SUCCESS) { @@ -510,17 +510,17 @@ main(int argc, char **argv) } pam_end(pamh, pam_err); -#ifndef linux +/* #ifndef linux */ /* Re-establish stdin */ if (dup2(temp_stdin, STDIN_FILENO) == -1) err(1, "dup2"); close(temp_stdin); -#else +/* #else */ /* Re-establish stdout */ close(1); if (dup2(temp_stdout, 1) == -1) err(1, "dup2"); -#endif +/* #endif */ #else #error No auth module! #endif diff --git a/env.c b/env.c index a2cd977..e463d37 100644 --- a/env.c +++ b/env.c @@ -20,9 +20,9 @@ #include #endif -#include #include #include +#include #include #include #include @@ -90,7 +90,7 @@ createenv(struct rule *rule) env->count = 0; if (rule->options & KEEPENV) { - extern const char **environ; + /* extern const char **environ; */ for (i = 0; environ[i] != NULL; i++) { struct envnode *node;