summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/replace/system/passwd.h11
-rw-r--r--lib/uid_wrapper/uid_wrapper.c4
-rw-r--r--lib/uid_wrapper/uid_wrapper.h5
-rw-r--r--lib/util/unix_privs.c9
-rw-r--r--lib/util/util.c10
5 files changed, 18 insertions, 21 deletions
diff --git a/lib/replace/system/passwd.h b/lib/replace/system/passwd.h
index aaea9c8344..f630012f00 100644
--- a/lib/replace/system/passwd.h
+++ b/lib/replace/system/passwd.h
@@ -109,4 +109,15 @@ char *rep_getpass(const char *prompt);
#endif /* NSS_WRAPPER_DISABLE */
#endif /* NSS_WRAPPER */
+#ifdef UID_WRAPPER
+# ifndef UID_WRAPPER_DISABLE
+# ifndef UID_WRAPPER_NOT_REPLACE
+# define UID_WRAPPER_REPLACE
+# endif /* UID_WRAPPER_NOT_REPLACE */
+# include "../uid_wrapper/uid_wrapper.h"
+# endif /* UID_WRAPPER_DISABLE */
+#else /* UID_WRAPPER */
+# define uwrap_enabled() 0
+#endif /* UID_WRAPPER */
+
#endif
diff --git a/lib/uid_wrapper/uid_wrapper.c b/lib/uid_wrapper/uid_wrapper.c
index c43dbc1436..898d1afbb9 100644
--- a/lib/uid_wrapper/uid_wrapper.c
+++ b/lib/uid_wrapper/uid_wrapper.c
@@ -19,9 +19,9 @@
#ifdef _SAMBA_BUILD_
#define UID_WRAPPER_NOT_REPLACE
-#include "../replace/replace.h"
-#include <talloc.h>
+#include "replace.h"
#include "system/passwd.h"
+#include <talloc.h>
#else /* _SAMBA_BUILD_ */
diff --git a/lib/uid_wrapper/uid_wrapper.h b/lib/uid_wrapper/uid_wrapper.h
index 7cb97af8df..680e544583 100644
--- a/lib/uid_wrapper/uid_wrapper.h
+++ b/lib/uid_wrapper/uid_wrapper.h
@@ -33,6 +33,8 @@ int uwrap_getgroups(int size, gid_t *list);
uid_t uwrap_getuid(void);
gid_t uwrap_getgid(void);
+#ifdef UID_WRAPPER_REPLACE
+
#ifdef seteuid
#undef seteuid
#endif
@@ -93,5 +95,6 @@ gid_t uwrap_getgid(void);
#endif
#define getgid uwrap_getgid
-#endif
+#endif /* UID_WRAPPER_REPLACE */
+#endif /* uwrap_enabled */
#endif /* __UID_WRAPPER_H__ */
diff --git a/lib/util/unix_privs.c b/lib/util/unix_privs.c
index 9aa9a45918..baa54fd558 100644
--- a/lib/util/unix_privs.c
+++ b/lib/util/unix_privs.c
@@ -23,15 +23,6 @@
#include "system/passwd.h"
#include "../lib/util/unix_privs.h"
-#if defined(UID_WRAPPER)
-#if !defined(UID_WRAPPER_REPLACE) && !defined(UID_WRAPPER_NOT_REPLACE)
-#define UID_WRAPPER_REPLACE
-#include "../uid_wrapper/uid_wrapper.h"
-#endif
-#else
-#define uwrap_enabled() 0
-#endif
-
/**
* @file
* @brief Gaining/losing root privileges
diff --git a/lib/util/util.c b/lib/util/util.c
index 133bd0dfb0..c7c37bc815 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -27,6 +27,7 @@
#include "system/filesys.h"
#include "system/locale.h"
#include "system/shmem.h"
+#include "system/passwd.h"
#undef malloc
#undef strcasecmp
@@ -34,15 +35,6 @@
#undef strdup
#undef realloc
-#if defined(UID_WRAPPER)
-#if !defined(UID_WRAPPER_REPLACE) && !defined(UID_WRAPPER_NOT_REPLACE)
-#define UID_WRAPPER_REPLACE
-#include "../uid_wrapper/uid_wrapper.h"
-#endif
-#else
-#define uwrap_enabled() 0
-#endif
-
/**
* @file
* @brief Misc utility functions