[PATCH] fix smb signing in connect_to_service() for non-ipc$ shares in net

Günther Deschner gd at samba.org
Tue Nov 22 23:49:23 UTC 2016


Hi,

smb signing fails for non-ipc$ shares in the 'net' helper call. Noticed
while working on new core printer driver migration utility.

Please review and push,
Guenther
-- 
Günther Deschner                    GPG-ID: 8EE11688
Red Hat                         gdeschner at redhat.com
Samba Team                              gd at samba.org
-------------- next part --------------
From 08b7d88a8dc23e3d6f33ee2841b803391faefb60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Fri, 18 Nov 2016 18:17:52 +0100
Subject: [PATCH] s3-net: use SMB_SIGNING_DEFAULT in connect_to_service()

For non IPC$ connections we get NT_STATUS_REVISION_MISMATCH otherwise when using
the connection.

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
---
 source3/utils/net_util.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index de929ff..cc65457 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -106,6 +106,7 @@ NTSTATUS connect_to_service(struct net_context *c,
 {
 	NTSTATUS nt_status;
 	int flags = 0;
+	enum smb_signing_setting signing_setting = SMB_SIGNING_DEFAULT;
 
 	c->opt_password = net_prompt_pass(c, c->opt_user_name);
 
@@ -121,12 +122,16 @@ NTSTATUS connect_to_service(struct net_context *c,
 		flags |= CLI_FULL_CONNECTION_USE_CCACHE;
 	}
 
+	if (strequal(service_type, "IPC")) {
+		signing_setting = SMB_SIGNING_IPC_DEFAULT;
+	}
+
 	nt_status = cli_full_connection(cli_ctx, NULL, server_name,
 					server_ss, c->opt_port,
 					service_name, service_type,
 					c->opt_user_name, c->opt_workgroup,
 					c->opt_password, flags,
-					SMB_SIGNING_IPC_DEFAULT);
+					signing_setting);
 	if (!NT_STATUS_IS_OK(nt_status)) {
 		d_fprintf(stderr, _("Could not connect to server %s\n"),
 			  server_name);
-- 
2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 201 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20161123/bf79015d/signature.sig>


More information about the samba-technical mailing list