lib/util: rename USE_LINUX_THREAD_CREDENTIALS to HAVE_LINUX_THREAD_CREDENTIALS
authorRalph Boehme <slow@samba.org>
Thu, 28 Jun 2018 12:28:34 +0000 (14:28 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 24 Jul 2018 15:38:28 +0000 (17:38 +0200)
The define reflects the results of a feature test, not a configure
option.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/util/setid.c
source3/lib/util_sec.c
source3/modules/vfs_aio_pthread.c
source3/wscript
tests/summary.c

index 88195d8..eb75110 100644 (file)
@@ -56,7 +56,7 @@ int samba_setgroups(size_t setlen, const gid_t *gidset);
 
 #endif
 
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(HAVE_UNISTD_H)
 #include <unistd.h>
 #endif
@@ -80,7 +80,7 @@ int samba_setgroups(size_t setlen, const gid_t *gidset);
 /* All the setXX[ug]id functions and setgroups Samba uses. */
 int samba_setresuid(uid_t ruid, uid_t euid, uid_t suid)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(USE_LINUX_32BIT_SYSCALLS)
        return syscall(SYS_setresuid32, ruid, euid, suid);
 #else
@@ -96,7 +96,7 @@ int samba_setresuid(uid_t ruid, uid_t euid, uid_t suid)
 
 int samba_setresgid(gid_t rgid, gid_t egid, gid_t sgid)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(USE_LINUX_32BIT_SYSCALLS)
        return syscall(SYS_setresgid32, rgid, egid, sgid);
 #else
@@ -112,7 +112,7 @@ int samba_setresgid(gid_t rgid, gid_t egid, gid_t sgid)
 
 int samba_setreuid(uid_t ruid, uid_t euid)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(USE_LINUX_32BIT_SYSCALLS)
        return syscall(SYS_setreuid32, ruid, euid);
 #else
@@ -128,7 +128,7 @@ int samba_setreuid(uid_t ruid, uid_t euid)
 
 int samba_setregid(gid_t rgid, gid_t egid)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(USE_LINUX_32BIT_SYSCALLS)
        return syscall(SYS_setregid32, rgid, egid);
 #else
@@ -144,7 +144,7 @@ int samba_setregid(gid_t rgid, gid_t egid)
 
 int samba_seteuid(uid_t euid)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(USE_LINUX_32BIT_SYSCALLS)
        /* seteuid is not a separate system call. */
        return syscall(SYS_setresuid32, -1, euid, -1);
@@ -162,7 +162,7 @@ int samba_seteuid(uid_t euid)
 
 int samba_setegid(gid_t egid)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(USE_LINUX_32BIT_SYSCALLS)
        /* setegid is not a separate system call. */
        return syscall(SYS_setresgid32, -1, egid, -1);
@@ -180,7 +180,7 @@ int samba_setegid(gid_t egid)
 
 int samba_setuid(uid_t uid)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(USE_LINUX_32BIT_SYSCALLS)
        return syscall(SYS_setuid32, uid);
 #else
@@ -196,7 +196,7 @@ int samba_setuid(uid_t uid)
 
 int samba_setgid(gid_t gid)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(USE_LINUX_32BIT_SYSCALLS)
        return syscall(SYS_setgid32, gid);
 #else
@@ -215,7 +215,7 @@ int samba_setuidx(int flags, uid_t uid)
 #if defined(HAVE_SETUIDX)
        return setuidx(flags, uid);
 #else
-       /* USE_LINUX_THREAD_CREDENTIALS doesn't have this. */
+       /* HAVE_LINUX_THREAD_CREDENTIALS doesn't have this. */
        errno = ENOSYS;
        return -1;
 #endif
@@ -226,7 +226,7 @@ int samba_setgidx(int flags, gid_t gid)
 #if defined(HAVE_SETGIDX)
        return setgidx(flags, gid);
 #else
-       /* USE_LINUX_THREAD_CREDENTIALS doesn't have this. */
+       /* HAVE_LINUX_THREAD_CREDENTIALS doesn't have this. */
        errno = ENOSYS;
        return -1;
 #endif
@@ -234,7 +234,7 @@ int samba_setgidx(int flags, gid_t gid)
 
 int samba_setgroups(size_t setlen, const gid_t *gidset)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
 #if defined(USE_LINUX_32BIT_SYSCALLS)
        return syscall(SYS_setgroups32, setlen, gidset);
 #else
index 760f8b0..a6817f6 100644 (file)
@@ -165,7 +165,7 @@ static void assert_gid(gid_t rgid, gid_t egid)
 ****************************************************************************/
 void gain_root_privilege(void)
 {      
-#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(USE_SETRESUID) || defined(HAVE_LINUX_THREAD_CREDENTIALS)
        samba_setresuid(0,0,0);
 #endif
     
@@ -195,7 +195,7 @@ void gain_root_privilege(void)
 ****************************************************************************/
 void gain_root_group_privilege(void)
 {
-#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(USE_SETRESUID) || defined(HAVE_LINUX_THREAD_CREDENTIALS)
        samba_setresgid(0,0,0);
 #endif
 
@@ -232,7 +232,7 @@ void gain_root_group_privilege(void)
 ****************************************************************************/
 void set_effective_uid(uid_t uid)
 {
-#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(USE_SETRESUID) || defined(HAVE_LINUX_THREAD_CREDENTIALS)
         /* Set the effective as well as the real uid. */
        if (samba_setresuid(uid,uid,-1) == -1) {
                if (errno == EAGAIN) {
@@ -264,7 +264,7 @@ void set_effective_uid(uid_t uid)
 ****************************************************************************/
 void set_effective_gid(gid_t gid)
 {
-#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(USE_SETRESUID) || defined(HAVE_LINUX_THREAD_CREDENTIALS)
        samba_setresgid(-1,gid,-1);
 #endif
 
@@ -303,7 +303,7 @@ void save_re_uid(void)
 
 void restore_re_uid_fromroot(void)
 {
-#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(USE_SETRESUID) || defined(HAVE_LINUX_THREAD_CREDENTIALS)
        samba_setresuid(saved_ruid, saved_euid, -1);
 #elif USE_SETREUID
        samba_setreuid(saved_ruid, -1);
@@ -342,7 +342,7 @@ void save_re_gid(void)
 ****************************************************************************/
 void restore_re_gid(void)
 {
-#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(USE_SETRESUID) || defined(HAVE_LINUX_THREAD_CREDENTIALS)
        samba_setresgid(saved_rgid, saved_egid, -1);
 #elif USE_SETREUID
        samba_setregid(saved_rgid, -1);
@@ -370,7 +370,7 @@ int set_re_uid(void)
 {
        uid_t uid = geteuid();
 
-#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(USE_SETRESUID) || defined(HAVE_LINUX_THREAD_CREDENTIALS)
        samba_setresuid(uid, uid, -1);
 #endif
 
@@ -409,7 +409,7 @@ void become_user_permanently(uid_t uid, gid_t gid)
        gain_root_privilege();
        gain_root_group_privilege();
 
-#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(USE_SETRESUID) || defined(HAVE_LINUX_THREAD_CREDENTIALS)
        samba_setresgid(gid,gid,gid);
        samba_setgid(gid);
        samba_setresuid(uid,uid,uid);
@@ -454,7 +454,7 @@ int set_thread_credentials(uid_t uid,
                        size_t setlen,
                        const gid_t *gidset)
 {
-#if defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_LINUX_THREAD_CREDENTIALS)
        /*
         * With Linux thread-specific credentials
         * we know we have setresuid/setresgid
@@ -501,7 +501,7 @@ static int have_syscall(void)
 {
        errno = 0;
 
-#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(USE_SETRESUID) || defined(HAVE_LINUX_THREAD_CREDENTIALS)
        samba_setresuid(-1,-1,-1);
 #endif
 
index a9e2b09..c1d1a7d 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/falloc.h>
 #endif
 
-#if defined(HAVE_OPENAT) && defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_OPENAT) && defined(HAVE_LINUX_THREAD_CREDENTIALS)
 
 /*
  * We must have openat() to do any thread-based
@@ -395,7 +395,7 @@ static int aio_pthread_open_fn(vfs_handle_struct *handle,
 #endif
 
 static struct vfs_fn_pointers vfs_aio_pthread_fns = {
-#if defined(HAVE_OPENAT) && defined(USE_LINUX_THREAD_CREDENTIALS)
+#if defined(HAVE_OPENAT) && defined(HAVE_LINUX_THREAD_CREDENTIALS)
        .open_fn = aio_pthread_open_fn,
 #endif
 };
index a14d76d..8409e77 100644 (file)
@@ -964,23 +964,23 @@ syscall(SYS_setgroups32, 0, NULL);
         if (conf.CONFIG_SET('USE_LINUX_32BIT_SYSCALLS')):
             seteuid = conf.CHECK_CODE('''
                                 #define AUTOCONF_TEST 1
-                                #define USE_LINUX_THREAD_CREDENTIALS 1
+                                #define HAVE_LINUX_THREAD_CREDENTIALS 1
                                 #define USE_LINUX_32BIT_SYSCALLS 1
                                 #include "../lib/util/setid.c"
                                 #include "./lib/util_sec.c"
                                 ''',
-                                'USE_LINUX_THREAD_CREDENTIALS',
+                                'HAVE_LINUX_THREAD_CREDENTIALS',
                                 addmain=False,
                                 execute=True,
                                 msg="Checking whether we can use Linux thread-specific credentials with 32-bit system calls")
         else:
             seteuid = conf.CHECK_CODE('''
                                 #define AUTOCONF_TEST 1
-                                #define USE_LINUX_THREAD_CREDENTIALS 1
+                                #define HAVE_LINUX_THREAD_CREDENTIALS 1
                                 #include "../lib/util/setid.c"
                                 #include "./lib/util_sec.c"
                                 ''',
-                                'USE_LINUX_THREAD_CREDENTIALS',
+                                'HAVE_LINUX_THREAD_CREDENTIALS',
                                 addmain=False,
                                 execute=True,
                                 msg="Checking whether we can use Linux thread-specific credentials")
index 0843ee2..87a64fd 100644 (file)
@@ -12,7 +12,7 @@ int main()
 #warning "WARNING: No automated network interface determination"
 #endif
 
-#if !(defined(USE_SETEUID) || defined(USE_SETREUID) || defined(USE_SETRESUID) || defined(USE_SETUIDX) || defined(USE_LINUX_THREAD_CREDENTIALS))
+#if !(defined(USE_SETEUID) || defined(USE_SETREUID) || defined(USE_SETRESUID) || defined(USE_SETUIDX) || defined(HAVE_LINUX_THREAD_CREDENTIALS))
 #error "ERROR: no seteuid method available"
 #endif