[SCM] Samba Shared Repository - branch v4-1-test updated
Karolin Seeger
kseeger at samba.org
Wed May 6 14:33:04 MDT 2015
The branch, v4-1-test has been updated
via a9ca30c s3: nmbd: Don't set work_changed = True inside update_server_ttl().
via 91e7c41 s3: nmbd: Ensure we only set work_changed = true if we modify the record.
via bbde543 vfs: kernel_flock and named streams
via 050f831 s3: smbd: Incorrect file size returned in the response of "FILE_SUPERSEDE Create"
via c850922 s4: rpc: Refactor dcesrv_alter() function into setup and send steps.
from f8ef498 Add DCERPC flag to call unbind hooks without destroying the connection itself upon termination of a connection with outstanding pending calls.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-1-test
- Log -----------------------------------------------------------------
commit a9ca30cfc9e5a94783b3c6226a74b3350278cf0d
Author: Jeremy Allison <jra at samba.org>
Date: Fri May 1 09:56:59 2015 -0700
s3: nmbd: Don't set work_changed = True inside update_server_ttl().
This is taken care of inside expire_servers() when it calls
remove_server_from_workgroup().
Ensure the only functions in nmbd_serverlistdb.c that
set subnet->work_changed are:
remove_all_servers()
add_server_to_workgroup()
remove_server_from_workgroup()
Fix inspired by a change from Volker.
https://bugzilla.samba.org/show_bug.cgi?id=11254
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit c3c820a661c092de31d56c16c8cd1ec57999d2f7)
Autobuild-User(v4-1-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-1-test): Wed May 6 22:32:36 CEST 2015 on sn-devel-104
commit 91e7c4160aed768251271ca261df961dd745d2a6
Author: Jeremy Allison <jra at samba.org>
Date: Thu Apr 30 12:05:17 2015 -0700
s3: nmbd: Ensure we only set work_changed = true if we modify the record.
https://bugzilla.samba.org/show_bug.cgi?id=11254
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit db6572ef80e20b0e577b9e9fb5d233f8bdd20713)
commit bbde543f5b0171b5fe100fd362cd1799a4fda123
Author: Ralph Boehme <slow at samba.org>
Date: Wed Apr 29 16:53:04 2015 +0200
vfs: kernel_flock and named streams
Streams implementing VFS modules may implement streams in a way that the
fsp will have the basefile open in the fsp fd, so lacking a distinct fd
for the stream, kernel_flock will apply on the basefile which is
wrong. The actual check is deffered to the VFS module implementing the
kernel_flock call.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11243
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit d748652e5b1c1c0238a2b86cdf14d7f6de7ce9b2)
commit 050f8312404a77e6afea4b628a05d7047bcaf226
Author: Jeremy Allison <jra at samba.org>
Date: Tue Apr 28 14:22:42 2015 -0700
s3: smbd: Incorrect file size returned in the response of "FILE_SUPERSEDE Create"
https://bugzilla.samba.org/show_bug.cgi?id=11240
Signed-off-by: Kenny Dinh <kdinh at peaxy.net>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Böhme <rb at sernet.de>
(cherry picked from commit d68383e9638254d1b6805b3d3ea3e5e897908374)
commit c8509227db612c9fa4c2b01d9c6f539357752ac2
Author: Jeremy Allison <jra at samba.org>
Date: Fri Apr 24 13:19:30 2015 -0700
s4: rpc: Refactor dcesrv_alter() function into setup and send steps.
Fixes bug:
https://bugzilla.samba.org/show_bug.cgi?id=11236
Based on code from Julien Kerihuel <j.kerihuel at openchange.org>
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Apr 25 02:43:22 CEST 2015 on sn-devel-104
(cherry picked from commit 49030649db3dfec5a9bc03e5dde4255a14499f16)
-----------------------------------------------------------------------
Summary of changes:
source3/modules/vfs_default.c | 8 ++-
source3/modules/vfs_gpfs.c | 10 ++++
source3/nmbd/nmbd_incomingdgrams.c | 22 +++++--
source3/nmbd/nmbd_serverlistdb.c | 5 --
source3/smbd/open.c | 9 +++
source4/rpc_server/dcerpc_server.c | 114 ++++++++++++++++++++-----------------
6 files changed, 104 insertions(+), 64 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 23c1cc2..618e460 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1870,8 +1870,6 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t
ftruncate extend but ext2 can. */
result = ftruncate(fsp->fh->fd, len);
- if (result == 0)
- goto done;
/* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
extend a file with ftruncate. Provide alternate implementation
@@ -1885,6 +1883,12 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+
+ /* We need to update the files_struct after successful ftruncate */
+ if (result == 0) {
+ goto done;
+ }
+
pst = &fsp->fsp_name->st;
#ifdef S_ISFIFO
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index f9eb7e8..2efac19 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -66,6 +66,16 @@ static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
return 0;
}
+ /*
+ * A named stream fsp will have the basefile open in the fsp
+ * fd, so lacking a distinct fd for the stream we have to skip
+ * kernel_flock and set_gpfs_sharemode for stream.
+ */
+ if (!is_ntfs_default_stream_smb_fname(fsp->fsp_name)) {
+ DEBUG(2,("%s: kernel_flock on stream\n", fsp_str_dbg(fsp)));
+ return 0;
+ }
+
START_PROFILE(syscall_kernel_flock);
kernel_flock(fsp->fh->fd, share_mode, access_mask);
diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c
index 153a86d..2dc684e 100644
--- a/source3/nmbd/nmbd_incomingdgrams.c
+++ b/source3/nmbd/nmbd_incomingdgrams.c
@@ -336,12 +336,25 @@ a local master browser for workgroup %s and we think we are master. Forcing elec
ttl, comment);
} else {
/* Update the record. */
- servrec->serv.type = servertype|SV_TYPE_LOCAL_LIST_ONLY;
+ if (servrec->serv.type !=
+ (servertype|SV_TYPE_LOCAL_LIST_ONLY)) {
+ servrec->serv.type =
+ servertype|SV_TYPE_LOCAL_LIST_ONLY;
+ subrec->work_changed = true;
+ }
+ if (!strequal(servrec->serv.comment,comment)) {
+ strlcpy(servrec->serv.comment,
+ comment,
+ sizeof(servrec->serv.comment));
+ subrec->work_changed = true;
+ }
update_server_ttl(servrec, ttl);
- strlcpy(servrec->serv.comment,comment,sizeof(servrec->serv.comment));
}
-
- set_workgroup_local_master_browser_name( work, server_name );
+
+ if (!strequal(work->local_master_browser_name, server_name)) {
+ set_workgroup_local_master_browser_name( work, server_name );
+ subrec->work_changed = true;
+ }
} else {
/*
* This server is announcing it is going down. Remove it from the
@@ -353,7 +366,6 @@ a local master browser for workgroup %s and we think we are master. Forcing elec
}
}
- subrec->work_changed = True;
done:
END_PROFILE(local_master_announce);
diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c
index 05ca6e9..9bc4a20 100644
--- a/source3/nmbd/nmbd_serverlistdb.c
+++ b/source3/nmbd/nmbd_serverlistdb.c
@@ -133,8 +133,6 @@ workgroup %s. This is a bug.\n", name, work->work_group));
DEBUG(3,("create_server_on_workgroup: Created server entry %s of type %x (%s) on \
workgroup %s.\n", name,servertype,comment, work->work_group));
- work->subnet->work_changed = True;
-
return(servrec);
}
@@ -151,8 +149,6 @@ void update_server_ttl(struct server_record *servrec, int ttl)
servrec->death_time = PERMANENT_TTL;
else
servrec->death_time = (ttl != PERMANENT_TTL) ? time(NULL)+(ttl*3) : PERMANENT_TTL;
-
- servrec->subnet->work_changed = True;
}
/*******************************************************************
@@ -172,7 +168,6 @@ void expire_servers(struct work_record *work, time_t t)
if ((servrec->death_time != PERMANENT_TTL) && ((t == -1) || (servrec->death_time < t))) {
DEBUG(3,("expire_old_servers: Removing timed out server %s\n",servrec->serv.name));
remove_server_from_workgroup(work, servrec);
- work->subnet->work_changed = True;
}
}
}
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 4fcdff8..f50db2f 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2737,6 +2737,15 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
if (fsp->fh->fd != -1 && lp_kernel_share_modes(SNUM(conn))) {
int ret_flock;
+ /*
+ * Beware: streams implementing VFS modules may
+ * implement streams in a way that fsp will have the
+ * basefile open in the fsp fd, so lacking a distinct
+ * fd for the stream kernel_flock will apply on the
+ * basefile which is wrong. The actual check is
+ * deffered to the VFS module implementing the
+ * kernel_flock call.
+ */
ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access, access_mask);
if(ret_flock == -1 ){
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c
index 8c0a101..04ba5f8 100644
--- a/source4/rpc_server/dcerpc_server.c
+++ b/source4/rpc_server/dcerpc_server.c
@@ -795,66 +795,31 @@ static NTSTATUS dcesrv_alter_new_context(struct dcesrv_call_state *call, uint32_
return NT_STATUS_OK;
}
-
-/*
- handle a alter context request
-*/
-static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call)
+/* setup and send an alter_resp */
+static NTSTATUS dcesrv_alter_resp(struct dcesrv_call_state *call,
+ uint32_t result,
+ uint32_t reason)
{
struct ncacn_packet pkt;
- struct data_blob_list_item *rep;
- NTSTATUS status;
- uint32_t result=0, reason=0;
- uint32_t context_id;
uint32_t extra_flags = 0;
+ struct data_blob_list_item *rep = NULL;
+ NTSTATUS status;
- /* handle any authentication that is being requested */
- if (!dcesrv_auth_alter(call)) {
- /* TODO: work out the right reject code */
- result = DCERPC_BIND_PROVIDER_REJECT;
- reason = DCERPC_BIND_REASON_ASYNTAX;
- }
-
- context_id = call->pkt.u.alter.ctx_list[0].context_id;
-
- /* see if they are asking for a new interface */
- if (result == 0) {
- call->context = dcesrv_find_context(call->conn, context_id);
- if (!call->context) {
- status = dcesrv_alter_new_context(call, context_id);
- if (!NT_STATUS_IS_OK(status)) {
- result = DCERPC_BIND_PROVIDER_REJECT;
- reason = DCERPC_BIND_REASON_ASYNTAX;
- }
- }
- }
-
- if (result == 0 &&
- call->pkt.u.alter.assoc_group_id != 0 &&
- lpcfg_parm_bool(call->conn->dce_ctx->lp_ctx, NULL, "dcesrv","assoc group checking", true) &&
- call->pkt.u.alter.assoc_group_id != call->context->assoc_group->id) {
- DEBUG(0,(__location__ ": Failed attempt to use new assoc_group in alter context (0x%08x 0x%08x)\n",
- call->context->assoc_group->id, call->pkt.u.alter.assoc_group_id));
- /* TODO: can they ask for a new association group? */
- result = DCERPC_BIND_PROVIDER_REJECT;
- reason = DCERPC_BIND_REASON_ASYNTAX;
- }
-
- if ((call->pkt.pfc_flags & DCERPC_PFC_FLAG_CONC_MPX)) {
- if (call->context->conn->state_flags & DCESRV_CALL_STATE_FLAG_MULTIPLEXED) {
- extra_flags |= DCERPC_PFC_FLAG_CONC_MPX;
- }
- }
-
- if (call->state_flags & DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL) {
- call->context->conn->state_flags |= DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL;
- }
-
- /* setup a alter_resp */
dcesrv_init_hdr(&pkt, lpcfg_rpc_big_endian(call->conn->dce_ctx->lp_ctx));
pkt.auth_length = 0;
pkt.call_id = call->pkt.call_id;
pkt.ptype = DCERPC_PKT_ALTER_RESP;
+ if (result == 0) {
+ if ((call->pkt.pfc_flags & DCERPC_PFC_FLAG_CONC_MPX) &&
+ call->context->conn->state_flags &
+ DCESRV_CALL_STATE_FLAG_MULTIPLEXED) {
+ extra_flags |= DCERPC_PFC_FLAG_CONC_MPX;
+ }
+ if (call->state_flags & DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL) {
+ call->context->conn->state_flags |=
+ DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL;
+ }
+ }
pkt.pfc_flags = DCERPC_PFC_FLAG_FIRST | DCERPC_PFC_FLAG_LAST | extra_flags;
pkt.u.alter_resp.max_xmit_frag = 0x2000;
pkt.u.alter_resp.max_recv_frag = 0x2000;
@@ -910,6 +875,51 @@ static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call)
}
/*
+ handle a alter context request
+*/
+static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call)
+{
+ NTSTATUS status;
+ uint32_t context_id;
+
+ /* handle any authentication that is being requested */
+ if (!dcesrv_auth_alter(call)) {
+ /* TODO: work out the right reject code */
+ return dcesrv_alter_resp(call,
+ DCERPC_BIND_PROVIDER_REJECT,
+ DCERPC_BIND_REASON_ASYNTAX);
+ }
+
+ context_id = call->pkt.u.alter.ctx_list[0].context_id;
+
+ /* see if they are asking for a new interface */
+ call->context = dcesrv_find_context(call->conn, context_id);
+ if (!call->context) {
+ status = dcesrv_alter_new_context(call, context_id);
+ if (!NT_STATUS_IS_OK(status)) {
+ return dcesrv_alter_resp(call,
+ DCERPC_BIND_PROVIDER_REJECT,
+ DCERPC_BIND_REASON_ASYNTAX);
+ }
+ }
+
+ if (call->pkt.u.alter.assoc_group_id != 0 &&
+ lpcfg_parm_bool(call->conn->dce_ctx->lp_ctx, NULL, "dcesrv","assoc group checking", true) &&
+ call->pkt.u.alter.assoc_group_id != call->context->assoc_group->id) {
+ DEBUG(0,(__location__ ": Failed attempt to use new assoc_group in alter context (0x%08x 0x%08x)\n",
+ call->context->assoc_group->id, call->pkt.u.alter.assoc_group_id));
+ /* TODO: can they ask for a new association group? */
+ return dcesrv_alter_resp(call,
+ DCERPC_BIND_PROVIDER_REJECT,
+ DCERPC_BIND_REASON_ASYNTAX);
+ }
+
+ return dcesrv_alter_resp(call,
+ 0,
+ 0);
+}
+
+/*
possibly save the call for inspection with ndrdump
*/
static void dcesrv_save_call(struct dcesrv_call_state *call, const char *why)
--
Samba Shared Repository
More information about the samba-cvs
mailing list