s3-lib: Get the real initial uid for selftest
authorAndreas Schneider <asn@samba.org>
Fri, 30 Oct 2015 13:31:33 +0000 (14:31 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 5 Nov 2015 08:23:15 +0000 (09:23 +0100)
We need this that if we connect as the user who started smbd, we are
able to perform privileged operation like creating a user.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/lib/util_sec.c

index 9ccd04e24adf99f00aedf208cf94b80780f37c80..760f8b06906e7990852a721112658be2a055ee36 100644 (file)
@@ -60,8 +60,22 @@ void sec_init(void)
        static int initialized;
 
        if (!initialized) {
+
+#ifndef AUTOCONF_TEST
+               if (uid_wrapper_enabled()) {
+                       setenv("UID_WRAPPER_MYUID", "1", 1);
+               }
+#endif
+
                initial_uid = geteuid();
                initial_gid = getegid();
+
+#ifndef AUTOCONF_TEST
+               if (uid_wrapper_enabled()) {
+                       unsetenv("UID_WRAPPER_MYUID");
+               }
+#endif
+
                initialized = 1;
        }
 }