[SCM] Samba Shared Repository - branch v4-8-test updated

Karolin Seeger kseeger at samba.org
Thu Apr 19 14:17:02 UTC 2018


The branch, v4-8-test has been updated
       via  c45c96e smbclient: Handle ENUM_DIR in "notify" command
       via  61470f6 libsmb: Handle IO_TIMEOUT in cli_smb2_notify properly
       via  daf2c88 libsmb: Handle long-running smb2cli_notify
       via  a25ec76 rpc_server: Init local_server_* in make_internal_rpc_pipe_socketpair
       via  9f3ab35 libads: Fix the build --without-ads
      from  7e01028 torture: Test compound request request counters

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-8-test


- Log -----------------------------------------------------------------
commit c45c96e94ed052bb1bb8d27a1eadcd611ab7af4a
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Oct 30 16:15:03 2017 +0100

    smbclient: Handle ENUM_DIR in "notify" command
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13382
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Apr  5 04:05:52 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 1452677ef0044815df0702de5424d4711e18144b)
    
    Autobuild-User(v4-8-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-8-test): Thu Apr 19 16:16:41 CEST 2018 on sn-devel-144

commit 61470f63f8c053f393070f6052f77fb0a9d7a4cc
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Oct 30 14:36:46 2017 +0100

    libsmb: Handle IO_TIMEOUT in cli_smb2_notify properly
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13382
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit abfe482828e8c1dc233d67657a4d11a91a731f70)

commit daf2c88a3fcc4b619da131c95595584bca80c345
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Oct 30 14:34:12 2017 +0100

    libsmb: Handle long-running smb2cli_notify
    
    This likely runs into a timeout. Properly cancel the smb2 request,
    allowing the higher-level caller to re-issue this request on an existing
    handle.
    
    I did not see a proper way to achieve this with tevent_req_set_endtime or
    something like that.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13382
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 91c0f497816bb88d8935a8a79c146c08379ecf53)

commit a25ec76b6118c722378548655c1862db9e1bca42
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 11 10:42:21 2018 +0200

    rpc_server: Init local_server_* in make_internal_rpc_pipe_socketpair
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13370
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Wed Apr 11 15:19:19 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 212815969f4a706bc8395e2f6dbf225318ff2ad7)

commit 9f3ab35a6243361de946a37f9b99af40b288d7cf
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 3 07:07:24 2018 +0100

    libads: Fix the build --without-ads
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>
    
    Autobuild-User(master): David Disseldorp <ddiss at samba.org>
    Autobuild-Date(master): Tue Feb  6 02:47:44 CET 2018 on sn-devel-144
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13273
    
    (cherry picked from commit 859698d29b547217356851094ed8188236e717b6)

-----------------------------------------------------------------------

Summary of changes:
 libcli/smb/smb2cli_notify.c       | 54 ++++++++++++++++++++++++++++++++-------
 source3/client/client.c           |  9 +++++--
 source3/libads/kerberos_keytab.c  |  4 +++
 source3/libsmb/cli_smb2_fnum.c    |  9 +++++++
 source3/rpc_server/rpc_ncacn_np.c | 31 ++++++++++++++++------
 source3/rpc_server/rpc_ncacn_np.h | 18 +++++++------
 source3/rpc_server/srv_pipe_hnd.c | 18 +++++++------
 7 files changed, 108 insertions(+), 35 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb2cli_notify.c b/libcli/smb/smb2cli_notify.c
index 0a23cf9..34329ba 100644
--- a/libcli/smb/smb2cli_notify.c
+++ b/libcli/smb/smb2cli_notify.c
@@ -30,9 +30,12 @@ struct smb2cli_notify_state {
 	struct iovec *recv_iov;
 	uint8_t *data;
 	uint32_t data_length;
+
+	struct tevent_req *subreq;
 };
 
 static void smb2cli_notify_done(struct tevent_req *subreq);
+static void smb2cli_notify_timedout(struct tevent_req *subreq);
 
 struct tevent_req *smb2cli_notify_send(TALLOC_CTX *mem_ctx,
 				       struct tevent_context *ev,
@@ -64,21 +67,50 @@ struct tevent_req *smb2cli_notify_send(TALLOC_CTX *mem_ctx,
 	SIVAL(fixed, 24, completion_filter);
 	SIVAL(fixed, 28, 0); 	/* reserved */
 
-	subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_NOTIFY,
-				  0, 0, /* flags */
-				  timeout_msec,
-				  tcon,
-				  session,
-				  state->fixed, sizeof(state->fixed),
-				  NULL, 0, /* dyn* */
-				  0); /* max_dyn_len */
+	state->subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_NOTIFY,
+					 0, 0, /* flags */
+					 0,	/* timeout_msec */
+					 tcon,
+					 session,
+					 state->fixed, sizeof(state->fixed),
+					 NULL, 0, /* dyn* */
+					 0); /* max_dyn_len */
+	if (tevent_req_nomem(state->subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(state->subreq, smb2cli_notify_done, req);
+
+	subreq = tevent_wakeup_send(state, ev,
+				    timeval_current_ofs_msec(timeout_msec));
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, smb2cli_notify_done, req);
+	tevent_req_set_callback(subreq, smb2cli_notify_timedout, req);
+
 	return req;
 }
 
+static void smb2cli_notify_timedout(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct smb2cli_notify_state *state = tevent_req_data(
+		req, struct smb2cli_notify_state);
+	bool ok;
+
+	ok = tevent_wakeup_recv(subreq);
+	if (!ok) {
+		tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
+		return;
+	}
+
+	ok = tevent_req_cancel(state->subreq);
+	if (!ok) {
+		tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
+		return;
+	}
+}
+
 static void smb2cli_notify_done(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(
@@ -98,6 +130,10 @@ static void smb2cli_notify_done(struct tevent_req *subreq)
 	status = smb2cli_req_recv(subreq, state, &iov,
 				  expected, ARRAY_SIZE(expected));
 	TALLOC_FREE(subreq);
+
+	if (NT_STATUS_EQUAL(status, NT_STATUS_CANCELLED)) {
+		status = NT_STATUS_IO_TIMEOUT;
+	}
 	if (tevent_req_nterror(req, status)) {
 		return;
 	}
diff --git a/source3/client/client.c b/source3/client/client.c
index ad10a53..2c1c760 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4561,12 +4561,17 @@ static int cmd_notify(void)
 	}
 
 	while (1) {
-		uint32_t i, num_changes;
-		struct notify_change *changes;
+		uint32_t i;
+		uint32_t num_changes = 0;
+		struct notify_change *changes = NULL;
 
 		status = cli_notify(cli, fnum, 1000, FILE_NOTIFY_CHANGE_ALL,
 				    true,
 				    talloc_tos(), &num_changes, &changes);
+		if (NT_STATUS_EQUAL(status, STATUS_NOTIFY_ENUM_DIR)) {
+			printf("NOTIFY_ENUM_DIR\n");
+			status = NT_STATUS_OK;
+		}
 		if (!NT_STATUS_IS_OK(status)) {
 			d_printf("notify returned %s\n",
 				 nt_errstr(status));
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
index ffd100c..37ac7ba 100644
--- a/source3/libads/kerberos_keytab.c
+++ b/source3/libads/kerberos_keytab.c
@@ -640,7 +640,11 @@ int ads_keytab_list(const char *keytab_name)
 	}
 
 	if (keytab_name == NULL) {
+#ifdef HAVE_ADS
 		ret = ads_keytab_open(context, &keytab);
+#else
+		ret = ENOENT;
+#endif
 	} else {
 		ret = smb_krb5_kt_open(context, keytab_name, False, &keytab);
 	}
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 2d87b58..c397b29 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -4192,6 +4192,15 @@ NTSTATUS cli_smb2_notify(struct cli_state *cli, uint16_t fnum,
 				completion_filter, recursive,
 				frame, &base, &len);
 
+	if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+		len = 0;
+		status = NT_STATUS_OK;
+	}
+
+	if (!NT_STATUS_IS_OK(status)) {
+		goto fail;
+	}
+
 	ofs = 0;
 
 	while (len - ofs >= 12) {
diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c
index 0728f54..d7e7785 100644
--- a/source3/rpc_server/rpc_ncacn_np.c
+++ b/source3/rpc_server/rpc_ncacn_np.c
@@ -69,14 +69,16 @@ fail:
 	return NULL;
 }
 
-NTSTATUS make_internal_rpc_pipe_socketpair(TALLOC_CTX *mem_ctx,
-					   struct tevent_context *ev_ctx,
-					   struct messaging_context *msg_ctx,
-					   const char *pipe_name,
-					   const struct ndr_syntax_id *syntax,
-					   const struct tsocket_address *remote_address,
-					   const struct auth_session_info *session_info,
-					   struct npa_state **pnpa)
+NTSTATUS make_internal_rpc_pipe_socketpair(
+	TALLOC_CTX *mem_ctx,
+	struct tevent_context *ev_ctx,
+	struct messaging_context *msg_ctx,
+	const char *pipe_name,
+	const struct ndr_syntax_id *syntax,
+	const struct tsocket_address *remote_address,
+	const struct tsocket_address *local_address,
+	const struct auth_session_info *session_info,
+	struct npa_state **pnpa)
 {
 	TALLOC_CTX *tmp_ctx = talloc_stackframe();
 	struct named_pipe_client *npc;
@@ -136,6 +138,19 @@ NTSTATUS make_internal_rpc_pipe_socketpair(TALLOC_CTX *mem_ctx,
 		goto out;
 	}
 
+	npc->local_server_addr = tsocket_address_copy(local_address, npc);
+	if (npc->local_server_addr == NULL) {
+		status = NT_STATUS_NO_MEMORY;
+		goto out;
+	}
+
+	npc->local_server_name = tsocket_address_inet_addr_string(
+		npc->local_server_addr, npc);
+	if (npc->local_server_name == NULL) {
+		status = NT_STATUS_NO_MEMORY;
+		goto out;
+	}
+
 	npc->session_info = copy_session_info(npc, session_info);
 	if (npc->session_info == NULL) {
 		status = NT_STATUS_NO_MEMORY;
diff --git a/source3/rpc_server/rpc_ncacn_np.h b/source3/rpc_server/rpc_ncacn_np.h
index 03bbd3f..9ba5864 100644
--- a/source3/rpc_server/rpc_ncacn_np.h
+++ b/source3/rpc_server/rpc_ncacn_np.h
@@ -44,14 +44,16 @@ NTSTATUS make_external_rpc_pipe(TALLOC_CTX *mem_ctx,
 				const struct auth_session_info *session_info,
 				struct npa_state **pnpa);
 
-NTSTATUS make_internal_rpc_pipe_socketpair(TALLOC_CTX *mem_ctx,
-					   struct tevent_context *ev_ctx,
-					   struct messaging_context *msg_ctx,
-					   const char *pipe_name,
-					   const struct ndr_syntax_id *syntax,
-					   const struct tsocket_address *remote_address,
-					   const struct auth_session_info *session_info,
-					   struct npa_state **pnpa);
+NTSTATUS make_internal_rpc_pipe_socketpair(
+	TALLOC_CTX *mem_ctx,
+	struct tevent_context *ev_ctx,
+	struct messaging_context *msg_ctx,
+	const char *pipe_name,
+	const struct ndr_syntax_id *syntax,
+	const struct tsocket_address *remote_address,
+	const struct tsocket_address *local_address,
+	const struct auth_session_info *session_info,
+	struct npa_state **pnpa);
 
 struct np_proxy_state {
 	uint16_t file_type;
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index f9b7855..baa4ce9 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -106,14 +106,16 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
 			return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 		}
 
-		status = make_internal_rpc_pipe_socketpair(handle,
-							   ev_ctx,
-							   msg_ctx,
-							   name,
-							   &syntax,
-							   remote_client_address,
-							   session_info,
-							   &npa);
+		status = make_internal_rpc_pipe_socketpair(
+			handle,
+			ev_ctx,
+			msg_ctx,
+			name,
+			&syntax,
+			remote_client_address,
+			local_server_address,
+			session_info,
+			&npa);
 		if (!NT_STATUS_IS_OK(status)) {
 			talloc_free(handle);
 			return status;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list