50 lines
1.4 KiB
Diff
50 lines
1.4 KiB
Diff
diff --git a/configure.in b/configure.in
|
|
index b9692c8..28364c3 100644
|
|
--- a/configure.in
|
|
+++ b/configure.in
|
|
@@ -13,6 +13,7 @@ AC_CHECK_PROG([YACC], [bison -y], [bison -y], [:])
|
|
AC_PATH_PROG([NSCD], [nscd], [/usr/sbin/nscd],
|
|
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
|
|
AC_ARG_VAR([NSCD], [Path to nscd])
|
|
+AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
LT_INIT([disable-static])
|
|
|
|
@@ -115,7 +116,7 @@ AC_TYPE_MODE_T
|
|
AC_TYPE_OFF_T
|
|
AC_TYPE_SIZE_T
|
|
|
|
-AC_CHECK_FUNCS_ONCE([__secure_getenv])
|
|
+AC_CHECK_FUNCS([__secure_getenv secure_getenv])
|
|
|
|
# Modify CFLAGS after all tests are run (some of them could fail because
|
|
# of the -Werror).
|
|
diff --git a/lib/config.c b/lib/config.c
|
|
index 1b30f97..29e7120 100644
|
|
--- a/lib/config.c
|
|
+++ b/lib/config.c
|
|
@@ -40,8 +40,12 @@
|
|
* from the libuser configuration.
|
|
*/
|
|
|
|
-#ifdef HAVE___SECURE_GETENV
|
|
-#define getenv(string) __secure_getenv(string)
|
|
+#if defined(HAVE_SECURE_GETENV)
|
|
+# define safe_getenv(string) secure_getenv(string)
|
|
+#elif defined(HAVE___SECURE_GETENV)
|
|
+# define safe_getenv(string) __secure_getenv(string)
|
|
+#else
|
|
+# error Neither secure_getenv not __secure_getenv are available
|
|
#endif
|
|
|
|
struct config_config {
|
|
@@ -266,7 +270,7 @@ lu_cfg_init(struct lu_context *context, struct lu_error **error)
|
|
if ((getuid() == geteuid()) && (getgid() == getegid())) {
|
|
const char *t;
|
|
|
|
- t = getenv("LIBUSER_CONF");
|
|
+ t = safe_getenv("LIBUSER_CONF");
|
|
if (t != NULL)
|
|
filename = t;
|
|
}
|