summaryrefslogtreecommitdiffstats
path: root/lib/uid_wrapper
Commit message (Collapse)AuthorAgeFilesLines
* uwrap: Bump version to 1.1.0.Andreas Schneider2015-01-281-1/+1
| | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Jan 28 19:44:39 CET 2015 on sn-devel-104
* uwrap: Make sure we leave if the id is NULL.Andreas Schneider2015-01-281-0/+1
| | | | | | | CID #97616 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Support scenario where threads fork or creates threads.Robin Hack2015-01-281-221/+177
| | | | | | | | | | | | | | | | | When fork() is called here there is no need to disable uwrap as a whole. This change disables only uwrap for the thread which called fork(). uwrap catches calls of pthread_create() and pthread_exit() functions from libpthread library now. Pair-Programmed-With: Andreas Schneider <asn@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Robin Hack <hack.robin@gmail.com> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Prepare for overload of libpthread functions.Robin Hack2015-01-281-19/+140
| | | | | | | | | uwrap_bind_symbol are now renamed to uwrap_bind_symbol_libc and simlilar uwrap_bind_symbol_libpthread are introduced. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Introduce UWRAP_LOCK_ALL and UWRAP_UNLOCK_ALL macrosRobin Hack2015-01-281-8/+14
| | | | | | | | | Introduce UWRAP_LOCK_ALL and UWRAP_UNLOCK_ALL which make locking easier. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Rewrite uwrap_libc_fns struct to pass strict aliasing rules.Robin Hack2015-01-281-59/+116
| | | | | | | | | | Also rename struct uwrap_libc_fns fns to uwrap_libc_symbols and uwrap_load_lib_function to uwrap_bind_symbol (same for _uwrap_load_... variant. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Fix wrong data types in syscalls switch.Robin Hack2015-01-281-12/+12
| | | | | | Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Add support for getresuid() and getresgid() glibc/syscall.Robin Hack2015-01-282-0/+111
| | | | | | Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Extend support for (set|get)groups libc functions and syscalls.Robin Hack2015-01-281-11/+82
| | | | | | Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Extend support for syscalls called from threads or main process.Robin Hack2015-01-281-0/+36
| | | | | | | | | We need to distinguish if the syscall is called from main process or from a thread. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Small uwrap_init optimalization.Robin Hack2015-01-281-2/+2
| | | | | | | | Don't call libc_getuid/getgid function twice. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Add support for running with address sanitizer.Andreas Schneider2015-01-282-0/+27
| | | | | | | | The address sanitzer will complain about our hack with variable function attributes. This disables the checking of it. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Reflect changes of uid/gid in threads to main process.Robin Hack2015-01-281-7/+50
| | | | | | | | | | | | When thread changes uid/gid this change must be reflected to main process. Syscalls changes only uid/gid of thread. Call of libc functions changes also uid/gid of main process. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Small optimalization of uwrap_init().Robin Hack2015-01-281-1/+2
| | | | | | | | Don't call getenv("UID_WRAPPER") on start of uwrap_init(). Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Optimalization of uid_wrapper_enabled() function.Robin Hack2015-01-282-4/+42
| | | | | | | | | | | | | | | Check only bool variable inside uwrap structure instead of calling whole uid_init(). In the best case only one mutex lock is need when check. NOTES: * This patch uses __atomic_load gcc builtin function. * uid_init() were moved outside uid_wrapper_enabled() function. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uid_wrapper: Fix race condition - uwrap_init.Robin Hack2015-01-281-5/+2
| | | | | | | | | Patch moves uwrap_id_mutex before if (uwrap.initialised) statement which can be passed by concurrent threads. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Fix race condition - glibc lookups.Robin Hack2015-01-281-3/+14
| | | | | | | | | Patch adds libc_symbol_binding_mutex which guards global table of libc functions and their lookup. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Add library constructor and move pthread_atfork inside.Robin Hack2015-01-282-9/+39
| | | | | | | | | Library constructor is used for pthread_atfork call. Moved here because pthread_atfork is cumulative and should be called only once. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Use UWRAP_LOCK/UNLOCK macros instead of pthread_mutex_lock/unlock calls.Robin Hack2015-01-281-31/+40
| | | | | | | | | New macros UWRAP_LOCK/UNLOCK has been created and all calls to pthread_mutex_lock/unlock has been replaced by these macros. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* uwrap: Fix the handle loop for older gcc versions.Andreas Schneider2015-01-281-1/+4
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* lib: uid_wrapper: Fix setgroups and syscall detection on a system without ↵Jeremy Allison2014-10-061-0/+7
| | | | | | | | | | | native uid_wrapper library. Originally from youzhong@gmail.com. https://bugzilla.samba.org/show_bug.cgi?id=10851 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* uwrap: Support dropping all supplemetary groups with setgroups()Jakub Hrozek2014-07-311-2/+12
| | | | | | | | | | Dropping all supplementary groups is a common practice when changing UIDs. This patch adds support for dropping all supplementary groups when setgroups is called with size=0. Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* uwrap: Add logging if uwrap is enabled correctly.Andreas Schneider2014-07-311-0/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* uwrap: Log error if we are out of memory.Andreas Schneider2014-07-311-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* uwrap: Add a better logging function.Andreas Schneider2014-07-311-8/+67
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* uwrap: Check for HAVE_FUNCTION_ATTRIBUTE_FORMAT.Andreas Schneider2014-07-312-0/+19
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* uwrap: Fall back to RTLD_NEXT if we can't find libc.Andreas Schneider2014-07-311-4/+4
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* uwrap: Add mutex in uwrap_destructor().Andreas Schneider2014-07-311-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* uwrap: Fix memory leak on error.Andreas Schneider2014-07-311-0/+1
| | | | | | | Found by Coverity. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib: Change uid_wrapper to preloadable version.Andreas Schneider2014-04-174-269/+1121
| | | | | | | This imports version 1.0.1 of uid_wrapper. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* build: Remove autoconf build systemAndrew Bartlett2013-05-281-19/+0
| | | | | | | | | | | We are now confident that that waf build system meets enough of our needs that we will work to improve it, rather than maintain two build systems. Andrew Bartlett Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* build: Remove special case for the build farmAndrew Bartlett2012-08-211-1/+1
| | | | | | | | | | | Except in the formatting of the selftest output, this removes the special case of the build farm, so that an autobuild, a manual make test and the build farm are more similar. Andrew Bartlett Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Aug 21 06:39:04 CEST 2012 on sn-devel-104
* Replace all uses of setXX[ug]id() and setgroups with samba_setXX[ug]id() calls.Jeremy Allison2012-06-283-29/+30
| | | | | | Will allow thread-specific credentials to be added by modifying the central definitions. Deliberately left the setXX[ug]id() call in popt as this is not used in Samba.
* Add missing setresgid() wrapper.Jeremy Allison2012-06-281-0/+1
|
* Include uid_wrapper correctly.Andreas Schneider2011-10-272-3/+6
|
* uid_wrapper: Add uwrap_setresgid().Andreas Schneider2011-10-272-0/+24
|
* uid_wrapper: Fix build on UNIX platforms.Andreas Schneider2011-10-271-0/+10
|
* uid_wrapper: Handle euid and egid 0.Andreas Schneider2011-10-271-7/+29
|
* uid_wrapper: Make sure we have initialized the wrapper.Andreas Schneider2011-10-271-0/+2
|
* uid_wrapper: Fix prototypes.Andreas Schneider2011-10-271-2/+2
|
* uid_wrapper: Add uwrap_setresuid().Andreas Schneider2011-10-072-0/+17
| | | | | Autobuild-User: Andreas Schneider <asn@cryptomilk.org> Autobuild-Date: Fri Oct 7 12:04:05 CEST 2011 on sn-devel-104
* uid_wrapper: Add uwrap_setregid().Andreas Schneider2011-10-072-0/+17
|
* uid_wrapper: Add uwrap_setreuid().Andreas Schneider2011-10-072-0/+17
|
* s3: Use the uid_wrapperVolker Lendecke2011-10-061-0/+3
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org>
* uid_wrapper: We have talloc_array_length, no need for an explicit lengthVolker Lendecke2011-10-061-9/+9
| | | | Signed-off-by: Andreas Schneider <asn@samba.org>
* uid-wrapper: handle uwrap_enabled() as a macroAndrew Tridgell2011-02-181-0/+2
| | | | | | | some s3 code defines uwrap_enabled() as a macro. Detect this, and don't redeclare the functions Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* s4-waf: Only enable various wrappers if they're actually used.Jelmer Vernooij2010-11-121-1/+2
| | | | | Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Fri Nov 12 14:33:34 UTC 2010 on sn-devel-104
* s4: Remove the old perl/m4/make/mk-based build system.Jelmer Vernooij2010-10-311-9/+0
| | | | | | | | The new waf-based build system now has all the same functionality, and the old build system has been broken for quite some time. Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sun Oct 31 02:01:44 UTC 2010 on sn-devel-104
* s4: Rename UID_WRAPPER to uid_wrapper.Jelmer Vernooij2010-10-232-5/+6
| | | | Only link to uid_wrapper when it is enabled.
* wrapper: make socket_wrapper, uid_wrapper and nss_wrapper private libsAndrew Tridgell2010-10-211-4/+5
| | | | | | this prevents double instantiation Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>