diff --git a/Makefile b/Makefile index 022731d8b..4c1335582 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,8 @@ # USE_TPROXY : enable transparent proxy. Automatic. # USE_LINUX_TPROXY : enable full transparent proxy (need kernel patch). # USE_LINUX_SPLICE : enable kernel 2.6 splicing (broken on old kernels) +# USE_LIBCRYPT : enable crypted passwords using -lcrypt +# USE_CRYPT_H : set it if your system requires including crypt.h # # Options can be forced by specifying "USE_xxx=1" or can be disabled by using # "USE_xxx=" (empty string). @@ -208,6 +210,8 @@ ifeq ($(TARGET),solaris) TARGET_CFLAGS = -fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT TARGET_LDFLAGS = -lnsl -lsocket USE_TPROXY = implicit + USE_LIBCRYPT = implicit + USE_CRYPT_H = implicit else ifeq ($(TARGET),freebsd) # This is for FreeBSD @@ -336,6 +340,11 @@ BUILD_OPTIONS += $(call ignore_implicit,USE_LIBCRYPT) OPTIONS_LDFLAGS += -lcrypt endif +ifneq ($(USE_CRYPT_H),) +OPTIONS_CFLAGS += -DNEED_CRYPT_H +BUILD_OPTIONS += $(call ignore_implicit,USE_CRYPT_H) +endif + ifneq ($(USE_POLL),) OPTIONS_CFLAGS += -DENABLE_POLL OPTIONS_OBJS += src/ev_poll.o diff --git a/src/auth.c b/src/auth.c index 93af8d68c..8ae485864 100644 --- a/src/auth.c +++ b/src/auth.c @@ -10,7 +10,15 @@ * */ -#define _XOPEN_SOURCE 500 +#ifdef CONFIG_HAP_CRYPT +/* This is to have crypt() defined on Linux */ +#define _GNU_SOURCE + +#ifdef NEED_CRYPT_H +/* some platforms such as Solaris need this */ +#include +#endif +#endif /* CONFIG_HAP_CRYPT */ #include #include