[SCM] Samba Shared Repository - branch v3-2-test updated -
release-3-2-0pre2-2956-gdc04b5a
Jeremy Allison
jra at samba.org
Tue Aug 26 16:33:29 GMT 2008
The branch, v3-2-test has been updated
via dc04b5adf7569b3501cb95f86d01e00276b41c23 (commit)
via 319cea52d259e347061658cfbae56ab350b09671 (commit)
from ec178599d37d6633697650c54c3588afedea9b7e (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit dc04b5adf7569b3501cb95f86d01e00276b41c23
Author: Andrew Tridgell <tridge at samba.org>
Date: Tue Aug 26 14:06:42 2008 +1000
EINVAL is also a valid error return, meaning "this filesystem
cannot do sendfile for this file"
commit 319cea52d259e347061658cfbae56ab350b09671
Author: Andrew Tridgell <tridge at samba.org>
Date: Sun Aug 24 13:56:59 2008 +1000
Avoid a race condition in glibc between AIO and setresuid().
See this test: http://samba.org/~tridge/junkcode/aio_uid.c
The problem is that setresuid() tries to be clever about threads, and
tries to change the euid of any threads that are running. If a AIO read
or write completes while this is going on then the signal from the thread
where the IO completed is lost, as it gets -1/EPERM from rt_sigqueueinfo()
The simplest fix is to try to use setreuid() instead of setresuid(),
as setreuid() doesn't try to be clever. Unfortunately this also means
we must use become_root()/unbecome_root() in the aio code.
-----------------------------------------------------------------------
Summary of changes:
source/configure.in | 24 +++++++++++++-----------
source/smbd/reply.c | 5 +++--
2 files changed, 16 insertions(+), 13 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/configure.in b/source/configure.in
index 0012b17..0086be7 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -2603,30 +2603,32 @@ AC_CHECK_FUNCS(getpagesize)
################################################
# look for a method of setting the effective uid
seteuid=no;
+
if test $seteuid = no; then
-AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
+AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
AC_TRY_RUN([
#define AUTOCONF_TEST 1
-#define USE_SETRESUID 1
+#define USE_SETREUID 1
#include "confdefs.h"
#include "${srcdir-.}/lib/util_sec.c"],
- samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
-if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
- seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
+ samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
+if test x"$samba_cv_USE_SETREUID" = x"yes"; then
+ seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
fi
fi
-
+# we check for setresuid second as it conflicts with AIO on Linux.
+# see http://samba.org/~tridge/junkcode/aio_uid.c
if test $seteuid = no; then
-AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
+AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
AC_TRY_RUN([
#define AUTOCONF_TEST 1
-#define USE_SETREUID 1
+#define USE_SETRESUID 1
#include "confdefs.h"
#include "${srcdir-.}/lib/util_sec.c"],
- samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
-if test x"$samba_cv_USE_SETREUID" = x"yes"; then
- seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
+ samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
+if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
+ seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
fi
fi
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 88c8ae8..31844c5 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -3168,8 +3168,9 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
setup_readX_header((char *)headerbuf, smb_maxcnt);
if ((nread = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, &header, startpos, smb_maxcnt)) == -1) {
- /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */
- if (errno == ENOSYS) {
+ /* Returning ENOSYS or EINVAL means no data at all was sent.
+ Do this as a normal read. */
+ if (errno == ENOSYS || errno == EINVAL) {
goto normal_read;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list