Robin Hack [Fri, 26 Sep 2014 14:17:18 +0000 (16:17 +0200)]
tests: Added two new tests aimed to setgid() and getgid() functions.
New tests:
* test_sync_setgid - test if call of setgid() in thread changes gid
of main process
* test_sync_setgid_syscall - test setgid() syscall
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Robin Hack [Fri, 26 Sep 2014 13:25:09 +0000 (15:25 +0200)]
tests: Small phtread_attr cleanup.
This change should make valgrind happy.
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Robin Hack [Fri, 26 Sep 2014 12:31:39 +0000 (14:31 +0200)]
tests: Get rid of malloc calls in test_glibc_thread_support.c.
Thread structures are allocated on stack now.
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Robin Hack [Fri, 26 Sep 2014 12:00:27 +0000 (14:00 +0200)]
uwrap: Optimalization of uid_wrapper_enabled() function.
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>
Robin Hack [Fri, 26 Sep 2014 11:26:17 +0000 (13:26 +0200)]
uid_wrapper: Fix race condition - uwrap_init.
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>
Robin Hack [Fri, 26 Sep 2014 11:05:43 +0000 (13:05 +0200)]
uwrap: Fix race condition - glibc lookups.
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>
Robin Hack [Fri, 26 Sep 2014 10:33:21 +0000 (12:33 +0200)]
uwrap: Add library constructor and move pthread_atfork inside.
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>
Robin Hack [Fri, 26 Sep 2014 10:08:58 +0000 (12:08 +0200)]
uwrap: Use UWRAP_LOCK/UNLOCK macros instead of pthread_mutex_lock/unlock calls.
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>
Andreas Schneider [Wed, 1 Oct 2014 15:17:43 +0000 (17:17 +0200)]
uwrap: Fix the handle loop for older gcc versions.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Sat, 23 Aug 2014 22:52:26 +0000 (00:52 +0200)]
TESTS: SYS_gettimeofday behaves differently on OS X
SYS_gettimeofday returns the number of seconds on OS X and doesn't set
the tz parameter.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Sat, 23 Aug 2014 22:50:18 +0000 (00:50 +0200)]
TESTS: add -DOSX if building on OS X
We need some OS X specific branch in the tests.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Sat, 23 Aug 2014 22:54:18 +0000 (00:54 +0200)]
testsuite: Fix comparison
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Marcin Juszkiewicz [Mon, 4 Aug 2014 09:56:50 +0000 (11:56 +0200)]
tests: Remove test with legacy "access" system call.
AArch64 architecture does not implement legacy system calls and as a
result SYS_access is not defined (as it got replaced with "accessat"
syscall).
Signed-off-by: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Wed, 30 Jul 2014 12:48:04 +0000 (14:48 +0200)]
Bump version to 1.0.2.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Tue, 29 Jul 2014 17:20:07 +0000 (19:20 +0200)]
uwrap: Support dropping all supplemetary groups with setgroups()
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>
tests: Fix test for dopping supplementary groups.
Signed-off-by: Andreas Schneider <asn@samba.org>
Andreas Schneider [Thu, 10 Jul 2014 15:09:50 +0000 (17:09 +0200)]
doc: Add a manpage for uid_wrapper.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Fri, 30 May 2014 13:52:19 +0000 (15:52 +0200)]
uwrap: Add logging if uwrap is enabled correctly.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Fri, 30 May 2014 13:52:00 +0000 (15:52 +0200)]
uwrap: Log error if we are out of memory.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Fri, 30 May 2014 13:44:39 +0000 (15:44 +0200)]
uwrap: Add a better logging function.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Fri, 30 May 2014 13:59:17 +0000 (15:59 +0200)]
cmake: Check for HAVE_FUNCTION_ATTRIBUTE_FORMAT.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Tue, 29 Apr 2014 13:11:40 +0000 (15:11 +0200)]
uwrap: Fall back to RTLD_NEXT if we can't find libc.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Fri, 9 May 2014 15:10:57 +0000 (17:10 +0200)]
uwrap: Add mutex in uwrap_destructor().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Wed, 28 May 2014 14:13:22 +0000 (16:13 +0200)]
cmake: Fix a typo in uid_wrapper-config.cmake.in.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Michael Adam [Tue, 27 May 2014 21:23:58 +0000 (23:23 +0200)]
Add README.install - instructions for building and installing.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Andreas Schneider [Fri, 25 Apr 2014 12:00:39 +0000 (14:00 +0200)]
cmake: Fix policy check.
Andreas Schneider [Wed, 16 Apr 2014 13:47:34 +0000 (15:47 +0200)]
cmake: Install cmake config into the correct directory.
Andreas Schneider [Wed, 9 Apr 2014 10:00:25 +0000 (12:00 +0200)]
cmake: Use 2.8.13 as version to check.
Andreas Schneider [Tue, 8 Apr 2014 07:24:42 +0000 (09:24 +0200)]
uwrap: Fix memory leak on error.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Andreas Schneider [Tue, 8 Apr 2014 07:24:21 +0000 (09:24 +0200)]
cmake: Only set policy in cmake 3.0.
Signed-off-by: Andreas Schneider <asn@samba.org>
Andreas Schneider [Mon, 7 Apr 2014 10:17:16 +0000 (12:17 +0200)]
cmake: Fix configure warning with cmake 3.0.
Signed-off-by: Andreas Schneider <asn@samba.org>
Andreas Schneider [Mon, 7 Apr 2014 10:17:01 +0000 (12:17 +0200)]
cmake: Create the compile command database by default.
Signed-off-by: Andreas Schneider <asn@samba.org>
Andreas Schneider [Tue, 4 Feb 2014 11:39:33 +0000 (12:39 +0100)]
Bump version to 1.0.1.
Andreas Schneider [Tue, 4 Feb 2014 11:37:30 +0000 (12:37 +0100)]
cmake: Add uid_wrapper-config.cmake.
Andreas Schneider [Tue, 4 Feb 2014 11:35:11 +0000 (12:35 +0100)]
cmake: Use UID_WRAPPER_LOCATION.
Andreas Schneider [Tue, 4 Feb 2014 11:32:49 +0000 (12:32 +0100)]
cmake: Add --libs output for pkg-config.
Andreas Schneider [Tue, 4 Feb 2014 11:38:11 +0000 (12:38 +0100)]
cpack: Don't package the obj directory.
Andreas Schneider [Mon, 3 Feb 2014 21:16:15 +0000 (22:16 +0100)]
tests: Use bool in the prototype too.
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Andreas Schneider [Sun, 2 Feb 2014 07:54:27 +0000 (08:54 +0100)]
tests: Use a bool for the test_uwrap_enabled test.
Reviewed-by: Jeremy Allison <jra@samba.org>
Andreas Schneider [Sat, 1 Feb 2014 13:32:03 +0000 (14:32 +0100)]
src: Use a bool for uid_wrapper_enabled().
Reviewed-by: Jeremy Allison <jra@samba.org>
Andreas Schneider [Thu, 30 Jan 2014 17:15:14 +0000 (18:15 +0100)]
Add ChangeLog.
Andreas Schneider [Fri, 24 Jan 2014 09:47:09 +0000 (10:47 +0100)]
Add TODO
Andreas Schneider [Mon, 20 Jan 2014 11:43:21 +0000 (12:43 +0100)]
cmake: Add cmake version file.
Andreas Schneider [Mon, 20 Jan 2014 11:43:08 +0000 (12:43 +0100)]
cmake: Add a pkg-config file.
Andreas Schneider [Sun, 19 Jan 2014 19:23:01 +0000 (20:23 +0100)]
Update README.
Andreas Schneider [Fri, 17 Jan 2014 14:30:32 +0000 (15:30 +0100)]
uwrap: Rename uwrap_enabled() to uid_wrapper_enabled().
Andreas Schneider [Tue, 7 Jan 2014 12:31:58 +0000 (13:31 +0100)]
uwrap: Rename the variable to get myuid from geteuid().
Andreas Schneider [Tue, 7 Jan 2014 12:30:06 +0000 (13:30 +0100)]
uwrap: Make uwrap_enabled public so we can use it.
Andreas Schneider [Fri, 20 Dec 2013 12:18:46 +0000 (13:18 +0100)]
tests: Fix some memory leaks.
Andreas Schneider [Fri, 20 Dec 2013 12:18:34 +0000 (13:18 +0100)]
cmake: Add valgrind suppression file.
Andreas Schneider [Fri, 20 Dec 2013 12:03:04 +0000 (13:03 +0100)]
uwrap: Pass bool values to uwrap_new_id().
Andreas Schneider [Fri, 20 Dec 2013 12:02:37 +0000 (13:02 +0100)]
uwrap: Fix a memory leak when we reuse an allocated id.
Andreas Schneider [Fri, 20 Dec 2013 12:02:03 +0000 (13:02 +0100)]
uwrap: Add a destructor to free resources.
Andreas Schneider [Fri, 20 Dec 2013 12:01:27 +0000 (13:01 +0100)]
cmake: Add check for HAVE_DESTRUCTOR_ATTRIBUTE.
Andreas Schneider [Fri, 20 Dec 2013 11:54:14 +0000 (12:54 +0100)]
uwrap: Use realloc for setgroups().
Andreas Schneider [Fri, 20 Dec 2013 10:09:15 +0000 (11:09 +0100)]
uwrap: Fix loading the system libraries.
Thanks metze!
Andreas Schneider [Thu, 19 Dec 2013 08:52:22 +0000 (09:52 +0100)]
tests: Add test_uwrap_disabled.
Andreas Schneider [Thu, 19 Dec 2013 08:52:05 +0000 (09:52 +0100)]
testsuite: Add missing include.
Andreas Schneider [Thu, 19 Dec 2013 07:46:45 +0000 (08:46 +0100)]
cmake: Fix HAVE_SETRESUID and HAVE_SETRESGID.
Andreas Schneider [Wed, 18 Dec 2013 16:23:31 +0000 (17:23 +0100)]
tests: Add test_uwrap_syscall_setgroups().
Andreas Schneider [Wed, 18 Dec 2013 16:11:14 +0000 (17:11 +0100)]
tests: Add test_uwrap_setresuid().
Andreas Schneider [Wed, 18 Dec 2013 16:09:15 +0000 (17:09 +0100)]
tests: Add test_uwrap_setreuid().
Andreas Schneider [Wed, 18 Dec 2013 16:06:46 +0000 (17:06 +0100)]
tests: Add test_uwrap_setresgid().
Andreas Schneider [Wed, 18 Dec 2013 15:59:54 +0000 (16:59 +0100)]
tests: Add test_uwrap_setregid().
Andreas Schneider [Wed, 18 Dec 2013 15:53:17 +0000 (16:53 +0100)]
tests: The tests should always be executed with uid_wrapper.
Andreas Schneider [Wed, 18 Dec 2013 16:05:57 +0000 (17:05 +0100)]
nwrap: Fix prototype of libc_setresuid().
Andreas Schneider [Wed, 18 Dec 2013 16:02:08 +0000 (17:02 +0100)]
cmake: Fix defines for setres(u|g)id.
Andreas Schneider [Tue, 17 Dec 2013 12:39:42 +0000 (13:39 +0100)]
uwrap: Remove obsolete uwrap_libc_fn().
Andreas Schneider [Tue, 17 Dec 2013 12:38:30 +0000 (13:38 +0100)]
uwrap: Load libc_syscall correctly.
Andreas Schneider [Tue, 17 Dec 2013 12:36:15 +0000 (13:36 +0100)]
uwrap: Add libc_getgroups().
Andreas Schneider [Tue, 17 Dec 2013 12:35:21 +0000 (13:35 +0100)]
uwrap: Add libc_getgroups().
Andreas Schneider [Tue, 17 Dec 2013 12:33:57 +0000 (13:33 +0100)]
uwrap: Add libc_getegid().
Andreas Schneider [Tue, 17 Dec 2013 12:31:28 +0000 (13:31 +0100)]
uwrap: Add libc_setregid().
Andreas Schneider [Tue, 17 Dec 2013 12:28:37 +0000 (13:28 +0100)]
uwrap: Add libc_setregid().
Andreas Schneider [Tue, 17 Dec 2013 12:27:12 +0000 (13:27 +0100)]
uwrap: Add libc_setgeid().
Andreas Schneider [Tue, 17 Dec 2013 12:26:04 +0000 (13:26 +0100)]
uwarp: Add libc_getgid().
Andreas Schneider [Tue, 17 Dec 2013 12:24:59 +0000 (13:24 +0100)]
uwrap: Add libc_setgid().
Andreas Schneider [Tue, 17 Dec 2013 12:20:02 +0000 (13:20 +0100)]
uwrap: Add libc_geteuid().
Andreas Schneider [Tue, 17 Dec 2013 12:10:08 +0000 (13:10 +0100)]
uwrap: Add libc_setresuid().
Andreas Schneider [Tue, 17 Dec 2013 12:08:16 +0000 (13:08 +0100)]
uwrap: Add libc_setreuid().
Andreas Schneider [Tue, 17 Dec 2013 12:06:49 +0000 (13:06 +0100)]
uwrap: Add libc_seteuid().
Andreas Schneider [Tue, 17 Dec 2013 12:05:34 +0000 (13:05 +0100)]
uwrap: Add libc_getuid().
Andreas Schneider [Tue, 17 Dec 2013 12:03:40 +0000 (13:03 +0100)]
uwrap: Add libc_setuid().
Andreas Schneider [Tue, 17 Dec 2013 11:59:49 +0000 (12:59 +0100)]
uwrap: Add uwrap_load_lib_function().
Andreas Schneider [Tue, 17 Dec 2013 11:57:29 +0000 (12:57 +0100)]
uwrap: Add uwrap_load_lib_handle().
Andreas Schneider [Wed, 4 Dec 2013 17:07:54 +0000 (18:07 +0100)]
tests: Add a test for getgroups().
Andreas Schneider [Wed, 4 Dec 2013 16:58:44 +0000 (17:58 +0100)]
tests: Add a test for setgroups().
Andreas Schneider [Wed, 4 Dec 2013 16:44:53 +0000 (17:44 +0100)]
tests: Add a test for setgid().
Andreas Schneider [Wed, 4 Dec 2013 16:38:52 +0000 (17:38 +0100)]
cmake: Set _FORTIFY_SOURCE only for optimized builds.
Andreas Schneider [Wed, 4 Dec 2013 16:08:19 +0000 (17:08 +0100)]
tests: Use SYS_gettimeofday for testing.
SYS_stat is a bad idea cause you need to know kernel internals.
Andreas Schneider [Wed, 20 Nov 2013 15:27:25 +0000 (16:27 +0100)]
tests: Fix testsuite on Solaris.
Andreas Schneider [Wed, 20 Nov 2013 15:24:22 +0000 (16:24 +0100)]
uwrap: Fix build on Solaris.
Andreas Schneider [Wed, 20 Nov 2013 15:07:48 +0000 (16:07 +0100)]
cmake: Fix dashboard drop location.
Andreas Schneider [Fri, 15 Nov 2013 09:23:27 +0000 (10:23 +0100)]
cmake: Detect OSX.
Andreas Schneider [Fri, 15 Nov 2013 09:21:20 +0000 (10:21 +0100)]
config: Add missing define for APPLE.
Andreas Schneider [Fri, 15 Nov 2013 09:19:06 +0000 (10:19 +0100)]
uwrap: Move pthread_atfork() to correct position.
Andreas Schneider [Fri, 15 Nov 2013 09:07:14 +0000 (10:07 +0100)]
uwarp: Load libc functions on OSX.
Andreas Schneider [Fri, 15 Nov 2013 08:47:32 +0000 (09:47 +0100)]
cmake: Add environment variables for OSX.
Andreas Schneider [Fri, 15 Nov 2013 08:44:19 +0000 (09:44 +0100)]
cmake: Build getuids only on Linux.
Andreas Schneider [Fri, 15 Nov 2013 08:43:06 +0000 (09:43 +0100)]
uwrap: Fix build on OSX.
Andreas Schneider [Fri, 15 Nov 2013 08:41:41 +0000 (09:41 +0100)]
cmake: Add check for syscall prototype.