From 7cb08171ce5e4ce73a37d2f57f466fda0fd3669b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Oct 2011 12:00:53 +0200 Subject: [PATCH] Include uid_wrapper correctly. --- lib/replace/system/passwd.h | 11 +++++++++++ lib/uid_wrapper/uid_wrapper.c | 4 ++-- lib/uid_wrapper/uid_wrapper.h | 5 ++++- lib/util/unix_privs.c | 9 --------- lib/util/util.c | 10 +--------- source3/lib/system.c | 1 - source3/lib/util_sec.c | 2 +- source3/rpc_server/rpc_handles.c | 1 + source3/rpc_server/srv_access_check.c | 1 + source3/smbd/sec_ctx.c | 2 +- source4/ntvfs/posix/pvfs_acl.c | 10 +--------- source4/ntvfs/unixuid/vfs_unixuid.c | 10 ---------- 12 files changed, 23 insertions(+), 43 deletions(-) diff --git a/lib/replace/system/passwd.h b/lib/replace/system/passwd.h index aaea9c8344e..f630012f000 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 c43dbc14368..898d1afbb9c 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 +#include "replace.h" #include "system/passwd.h" +#include #else /* _SAMBA_BUILD_ */ diff --git a/lib/uid_wrapper/uid_wrapper.h b/lib/uid_wrapper/uid_wrapper.h index 7cb97af8dfb..680e5445833 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 9aa9a459189..baa54fd5584 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 133bd0dfb0b..c7c37bc8152 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 diff --git a/source3/lib/system.c b/source3/lib/system.c index 45fe77e3445..85988417a65 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -25,7 +25,6 @@ #include "system/capability.h" #include "system/passwd.h" #include "system/filesys.h" -#include "lib/uid_wrapper/uid_wrapper.h" #ifdef HAVE_SYS_PRCTL_H #include diff --git a/source3/lib/util_sec.c b/source3/lib/util_sec.c index 0e2eee44af8..60ea214d262 100644 --- a/source3/lib/util_sec.c +++ b/source3/lib/util_sec.c @@ -19,7 +19,7 @@ #ifndef AUTOCONF_TEST #include "includes.h" -#include "lib/uid_wrapper/uid_wrapper.h" +#include "system/passwd.h" /* uid_wrapper */ #else /* we are running this code in autoconf test mode to see which type of setuid function works */ diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 87145ca848f..d547f18dc1e 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "system/passwd.h" /* uid_wrapper */ #include "../librpc/gen_ndr/ndr_lsa.h" #include "../librpc/gen_ndr/ndr_samr.h" #include "auth.h" diff --git a/source3/rpc_server/srv_access_check.c b/source3/rpc_server/srv_access_check.c index 4e74b0443a7..f667d7b23d0 100644 --- a/source3/rpc_server/srv_access_check.c +++ b/source3/rpc_server/srv_access_check.c @@ -28,6 +28,7 @@ */ #include "includes.h" +#include "system/passwd.h" /* uid_wrapper */ #include "rpc_server/srv_access_check.h" #include "../libcli/security/security.h" #include "passdb/machine_sid.h" diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c index 446810d535c..99592815e3f 100644 --- a/source3/smbd/sec_ctx.c +++ b/source3/smbd/sec_ctx.c @@ -18,12 +18,12 @@ */ #include "includes.h" +#include "system/passwd.h" #include "smbd/smbd.h" #include "smbd/globals.h" #include "libcli/security/security_token.h" #include "auth.h" #include "smbprofile.h" -#include "lib/uid_wrapper/uid_wrapper.h" extern struct current_user current_user; diff --git a/source4/ntvfs/posix/pvfs_acl.c b/source4/ntvfs/posix/pvfs_acl.c index 8157d862ec2..b253b8ab2d4 100644 --- a/source4/ntvfs/posix/pvfs_acl.c +++ b/source4/ntvfs/posix/pvfs_acl.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "system/passwd.h" #include "auth/auth.h" #include "vfs_posix.h" #include "librpc/gen_ndr/xattr.h" @@ -28,15 +29,6 @@ #include "../lib/util/unix_privs.h" #include "lib/util/samba_modules.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 - /* the list of currently registered ACL backends */ static struct pvfs_acl_backend { const struct pvfs_acl_ops *ops; diff --git a/source4/ntvfs/unixuid/vfs_unixuid.c b/source4/ntvfs/unixuid/vfs_unixuid.c index 0221b4391c1..7e7fd443d54 100644 --- a/source4/ntvfs/unixuid/vfs_unixuid.c +++ b/source4/ntvfs/unixuid/vfs_unixuid.c @@ -29,16 +29,6 @@ #define TEVENT_DEPRECATED #include -#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 - - NTSTATUS ntvfs_unixuid_init(void); struct unixuid_private { -- 2.34.1