[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-3832-g02836d4
Michael Adam
obnox at samba.org
Tue Aug 26 14:14:29 GMT 2008
The branch, v3-3-test has been updated
via 02836d45bc15d546f765f4f95c84d9b3ac5d4b57 (commit)
via de628055ff81ffd2f2ee3b8a4949a69c4c512570 (commit)
via 1cd01dbd7aa98c5bf60a3dac77ee07e342f7f06b (commit)
via 898f1d86b048bf457468b2af8191f4e86d72e438 (commit)
via 6b1291bdd4f8145c73684a679f895d0958df4e66 (commit)
via 2cd7bedcb7d5d9c218dae2cc08b1131d844b738b (commit)
via 44fcdd73b059b83f0dca86237881d76c95649714 (commit)
from eb8ea124be88d8173cd62891e7c9227c24f0080d (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit 02836d45bc15d546f765f4f95c84d9b3ac5d4b57
Author: Michael Adam <obnox at samba.org>
Date: Tue Aug 26 16:09:50 2008 +0200
run make idl after idl change "Handle arbitrary new PAC types"
Michael
(cherry picked from commit 5de253ba1308f470a47f9e5f83c6eccd17e95c26)
commit de628055ff81ffd2f2ee3b8a4949a69c4c512570
Author: Andrew Tridgell <tridge at samba.org>
Date: Sun Aug 24 14:00:58 2008 +1000
Handle arbitrary new PAC types
When MS introduces a new PAC type, we should just ignore it, not
generate a parse error. New PAC info structures are supposed to be
backwards compatible with old ones
(cherry picked from commit 2971b926c835412b02c93ad1e30f1471bc0a3612)
commit 1cd01dbd7aa98c5bf60a3dac77ee07e342f7f06b
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"
(cherry picked from commit 737f664604b28f230be63bfc2f3d516fd9eb1c63)
commit 898f1d86b048bf457468b2af8191f4e86d72e438
Author: Andrew Tridgell <tridge at samba.org>
Date: Sun Aug 24 13:58:05 2008 +1000
become root for AIO operations
We need to become root for AIO read and write to allow the AIO thread
to send a completion signal to the parent process when the IO
completes
(cherry picked from commit c548e5c69f9d8bc85a654f4d29d64c735a5e780b)
commit 6b1291bdd4f8145c73684a679f895d0958df4e66
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.
(cherry picked from commit 56c5a6f024875bb79b0104beb36f6b0ec1e1e9f9)
commit 2cd7bedcb7d5d9c218dae2cc08b1131d844b738b
Author: Andrew Tridgell <tridge at samba.org>
Date: Sun Aug 24 13:53:19 2008 +1000
fixed an errno handling bug that could lead to an infinite loop
(cherry picked from commit 5ccdc58ce91ee40ca7171dd040191291aeb7fe02)
commit 44fcdd73b059b83f0dca86237881d76c95649714
Author: Andrew Tridgell <tridge at samba.org>
Date: Sat Aug 23 11:36:27 2008 +1000
fixed tsmsm_sendfile(). The logic was totally broken.
(cherry picked from commit 794e48b809036871287df8416a2c669b7e26f216)
-----------------------------------------------------------------------
Summary of changes:
source/configure.in | 24 +++++++++++++-----------
source/librpc/gen_ndr/krb5pac.h | 2 +-
source/librpc/gen_ndr/ndr_krb5pac.c | 20 +++++---------------
source/librpc/idl/krb5pac.idl | 2 +-
source/modules/vfs_tsmsm.c | 15 +++++++++------
source/smbd/aio.c | 8 +++++++-
source/smbd/reply.c | 5 +++--
7 files changed, 39 insertions(+), 37 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/configure.in b/source/configure.in
index 5508d9b..9436fed 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -2627,30 +2627,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/librpc/gen_ndr/krb5pac.h b/source/librpc/gen_ndr/krb5pac.h
index 2d799ea..b3b29e5 100644
--- a/source/librpc/gen_ndr/krb5pac.h
+++ b/source/librpc/gen_ndr/krb5pac.h
@@ -76,7 +76,7 @@ union PAC_INFO {
struct PAC_SIGNATURE_DATA srv_cksum;/* [case(PAC_TYPE_SRV_CHECKSUM)] */
struct PAC_SIGNATURE_DATA kdc_cksum;/* [case(PAC_TYPE_KDC_CHECKSUM)] */
struct PAC_LOGON_NAME logon_name;/* [case(PAC_TYPE_LOGON_NAME)] */
- struct DATA_BLOB_REM unknown;/* [subcontext(0),case(PAC_TYPE_UNKNOWN_12)] */
+ struct DATA_BLOB_REM unknown;/* [subcontext(0),default] */
}/* [gensize,nodiscriminant,public] */;
struct PAC_BUFFER {
diff --git a/source/librpc/gen_ndr/ndr_krb5pac.c b/source/librpc/gen_ndr/ndr_krb5pac.c
index 70d63ae..6e06f90 100644
--- a/source/librpc/gen_ndr/ndr_krb5pac.c
+++ b/source/librpc/gen_ndr/ndr_krb5pac.c
@@ -319,7 +319,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_PAC_INFO(struct ndr_push *ndr, int ndr_flags
NDR_CHECK(ndr_push_PAC_LOGON_NAME(ndr, NDR_SCALARS, &r->logon_name));
break; }
- case PAC_TYPE_UNKNOWN_12: {
+ default: {
{
struct ndr_push *_ndr_unknown;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_unknown, 0, -1));
@@ -328,8 +328,6 @@ _PUBLIC_ enum ndr_err_code ndr_push_PAC_INFO(struct ndr_push *ndr, int ndr_flags
}
break; }
- default:
- return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
}
if (ndr_flags & NDR_BUFFERS) {
@@ -348,11 +346,9 @@ _PUBLIC_ enum ndr_err_code ndr_push_PAC_INFO(struct ndr_push *ndr, int ndr_flags
case PAC_TYPE_LOGON_NAME:
break;
- case PAC_TYPE_UNKNOWN_12:
+ default:
break;
- default:
- return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
}
return NDR_ERR_SUCCESS;
@@ -380,7 +376,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_PAC_INFO(struct ndr_pull *ndr, int ndr_flags
NDR_CHECK(ndr_pull_PAC_LOGON_NAME(ndr, NDR_SCALARS, &r->logon_name));
break; }
- case PAC_TYPE_UNKNOWN_12: {
+ default: {
{
struct ndr_pull *_ndr_unknown;
NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_unknown, 0, -1));
@@ -389,8 +385,6 @@ _PUBLIC_ enum ndr_err_code ndr_pull_PAC_INFO(struct ndr_pull *ndr, int ndr_flags
}
break; }
- default:
- return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
}
if (ndr_flags & NDR_BUFFERS) {
@@ -408,11 +402,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_PAC_INFO(struct ndr_pull *ndr, int ndr_flags
case PAC_TYPE_LOGON_NAME:
break;
- case PAC_TYPE_UNKNOWN_12:
+ default:
break;
- default:
- return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
}
return NDR_ERR_SUCCESS;
@@ -440,12 +432,10 @@ _PUBLIC_ void ndr_print_PAC_INFO(struct ndr_print *ndr, const char *name, const
ndr_print_PAC_LOGON_NAME(ndr, "logon_name", &r->logon_name);
break;
- case PAC_TYPE_UNKNOWN_12:
+ default:
ndr_print_DATA_BLOB_REM(ndr, "unknown", &r->unknown);
break;
- default:
- ndr_print_bad_level(ndr, name, level);
}
}
diff --git a/source/librpc/idl/krb5pac.idl b/source/librpc/idl/krb5pac.idl
index 7c2f72d..c039502 100644
--- a/source/librpc/idl/krb5pac.idl
+++ b/source/librpc/idl/krb5pac.idl
@@ -70,7 +70,7 @@ interface krb5pac
[case(PAC_TYPE_SRV_CHECKSUM)] PAC_SIGNATURE_DATA srv_cksum;
[case(PAC_TYPE_KDC_CHECKSUM)] PAC_SIGNATURE_DATA kdc_cksum;
[case(PAC_TYPE_LOGON_NAME)] PAC_LOGON_NAME logon_name;
- [case(PAC_TYPE_UNKNOWN_12)] [subcontext(0)] DATA_BLOB_REM unknown;
+ [default] [subcontext(0)] DATA_BLOB_REM unknown;
/* [case(PAC_TYPE_UNKNOWN_12)] PAC_UNKNOWN_12 unknown; */
} PAC_INFO;
diff --git a/source/modules/vfs_tsmsm.c b/source/modules/vfs_tsmsm.c
index 4a732bc..ee958b1 100644
--- a/source/modules/vfs_tsmsm.c
+++ b/source/modules/vfs_tsmsm.c
@@ -200,9 +200,9 @@ static bool tsmsm_is_offline(struct vfs_handle_struct *handle,
goto done;
}
- lerrno = 0;
-
do {
+ lerrno = 0;
+
ret = dm_get_dmattr(*dmsession_id, dmhandle, dmhandle_len,
DM_NO_TOKEN, &dmname, buflen, buf, &rlen);
if (ret == -1 && errno == EINVAL) {
@@ -279,10 +279,13 @@ static ssize_t tsmsm_aio_return(struct vfs_handle_struct *handle, struct files_s
static ssize_t tsmsm_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, const DATA_BLOB *hdr,
SMB_OFF_T offset, size_t n)
{
- bool file_online = tsmsm_aio_force(handle, fsp);
+ bool file_offline = tsmsm_aio_force(handle, fsp);
- if(!file_online)
- return ENOSYS;
+ if (file_offline) {
+ DEBUG(10,("tsmsm_sendfile on offline file - rejecting\n"));
+ errno = ENOSYS;
+ return -1;
+ }
return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, hdr, offset, n);
}
@@ -333,7 +336,7 @@ static int tsmsm_set_offline(struct vfs_handle_struct *handle,
if (tsmd->hsmscript == NULL) {
/* no script enabled */
- DEBUG(1, ("tsmsm_set_offline: No tsmsm:hsmscript configured\n"));
+ DEBUG(1, ("tsmsm_set_offline: No 'tsmsm:hsm script' configured\n"));
return 0;
}
diff --git a/source/smbd/aio.c b/source/smbd/aio.c
index 2889e3c..7427536 100644
--- a/source/smbd/aio.c
+++ b/source/smbd/aio.c
@@ -268,12 +268,15 @@ bool schedule_aio_read_and_X(connection_struct *conn,
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
+ become_root();
if (SMB_VFS_AIO_READ(fsp,a) == -1) {
DEBUG(0,("schedule_aio_read_and_X: aio_read failed. "
"Error %s\n", strerror(errno) ));
delete_aio_ex(aio_ex);
+ unbecome_root();
return False;
}
+ unbecome_root();
DEBUG(10,("schedule_aio_read_and_X: scheduled aio_read for file %s, "
"offset %.0f, len = %u (mid = %u)\n",
@@ -366,13 +369,16 @@ bool schedule_aio_write_and_X(connection_struct *conn,
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
+ become_root();
if (SMB_VFS_AIO_WRITE(fsp,a) == -1) {
DEBUG(3,("schedule_aio_wrote_and_X: aio_write failed. "
"Error %s\n", strerror(errno) ));
delete_aio_ex(aio_ex);
+ unbecome_root();
return False;
}
-
+ unbecome_root();
+
release_level_2_oplocks_on_change(fsp);
if (!write_through && !lp_syncalways(SNUM(fsp->conn))
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index b3d691f..06aa835 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -3198,8 +3198,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