r516: On GNU/Linux distributions which allow to use both 2.4 and 2.6 kernels
authorAlexander Bokovoy <ab@samba.org>
Thu, 6 May 2004 14:38:31 +0000 (14:38 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:51:26 +0000 (10:51 -0500)
there is SYS_utimes syscall defined at compile time in glibc-kernheaders but
it is available on 2.6 kernels only. Therefore, we can't rely on syscall at
compile time but have to check that behaviour during program execution. An easy
workaround is to have replacement for utimes() implemented within our wrapper and
do not rely on syscall at all. Thus, if REPLACE_UTIME is defined already (by packager),
skip these syscall shortcuts.

source/smbwrapper/realcalls.h
source/utils/ntlm_auth.c

index 6c230dba05606825482a4ccbf981e611395e8fac..bad89d598c15f40e2f22480df3d7d1b2a164f6fa 100644 (file)
 #define real_rmdir(fn)                 (syscall(SYS_rmdir, (fn)))
 #define real_mkdir(fn, mode)           (syscall(SYS_mkdir, (fn), (mode)))
 
+/*
+ * On GNU/Linux distributions which allow to use both 2.4 and 2.6 kernels
+ * there is SYS_utimes syscall defined at compile time in glibc-kernheaders but 
+ * it is available on 2.6 kernels only. Therefore, we can't rely on syscall at 
+ * compile time but have to check that behaviour during program execution. An easy 
+ * workaround is to have replacement for utimes() implemented within our wrapper and 
+ * do not rely on syscall at all. Thus, if REPLACE_UTIME is defined already (by packager), 
+ * skip these syscall shortcuts.
+ */
+#ifndef REPLACE_UTIME
 #ifdef SYS_utime
 #define real_utime(fn, buf)            (syscall(SYS_utime, (fn), (buf)))
 #else
 #define REPLACE_UTIME 1
 #endif
+#endif
 
+#ifndef REPLACE_UTIMES
 #ifdef SYS_utimes
 #define real_utimes(fn, buf)           (syscall(SYS_utimes, (fn), (buf)))
 #else
 #define REPLACE_UTIMES 1
 #endif
+#endif
index f2fb7dcaaf3000b92a10dd6f72d35c9bb6dfa0d4..686fd6256be97a193b2e4a4353f3a25ddbc0cb58 100644 (file)
@@ -1624,6 +1624,12 @@ static void squid_stream(enum stdio_helper_mode stdio_mode, stdio_helper_functio
        /* initialize FDescs */
        x_setbuf(x_stdout, NULL);
        x_setbuf(x_stderr, NULL);
+       {
+               struct passwd *pass = getpwuid(getuid());
+               if (initgroups (pass->pw_name, pass->pw_gid)) {
+                       DEBUG(0,("Unable to initgroups. Error was %s\n", strerror(errno) ));
+               }
+       }
        while(1) {
                manage_squid_request(stdio_mode, fn);
        }