[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Thu Sep 8 02:22:04 MDT 2011


The branch, master has been updated
       via  3e227d8 s3:libsmb: pass CLI_FULL_CONNECTION_* flags via cli_connect_nb()
       via  cdca1e0 s3:libsmb: pass CLI_FULL_CONNECTION_* flags to cli_state_create()
       via  2c741ef lib/replace: include <sys/uio.h> in "system/filesys.h" in order to have struct iovec
      from  de710ce Revert "Part 4 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set (Invalid argument)"

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3e227d8544a020d1aea24c38c9ca45a75d14c3f1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 7 20:35:51 2011 +0200

    s3:libsmb: pass CLI_FULL_CONNECTION_* flags via cli_connect_nb()
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Thu Sep  8 10:21:50 CEST 2011 on sn-devel-104

commit cdca1e0ac3c185856fbe2d061a30bfa8e71e4e1c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 7 21:10:24 2011 +0200

    s3:libsmb: pass CLI_FULL_CONNECTION_* flags to cli_state_create()
    
    metze

commit 2c741efc993186c1f814ba0aaaf89cf80f911196
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Sep 8 08:01:30 2011 +0200

    lib/replace: include <sys/uio.h> in "system/filesys.h" in order to have struct iovec
    
    This is needed on some platforms, e.g. NetBSD5.
    
    metze

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

Summary of changes:
 lib/replace/system/filesys.h   |    4 ++++
 source3/auth/auth_server.c     |    7 +++----
 source3/client/client.c        |    2 +-
 source3/libsmb/cliconnect.c    |    6 +++---
 source3/libsmb/clidfs.c        |   18 +++++++++++++-----
 source3/libsmb/clientgen.c     |   23 ++++++++++++++++++++++-
 source3/libsmb/libsmb_server.c |   29 +++++++++++++++--------------
 source3/libsmb/passchange.c    |    2 +-
 source3/libsmb/proto.h         |    5 +++--
 source3/nmbd/nmbd_synclists.c  |    2 +-
 source3/torture/locktest.c     |   16 ++++++++++------
 source3/torture/masktest.c     |    2 +-
 source3/torture/torture.c      |   25 ++++++++++++++-----------
 source3/utils/net_rpc.c        |    2 +-
 source3/utils/net_time.c       |    2 +-
 source3/web/diagnose.c         |    2 +-
 source3/winbindd/winbindd_cm.c |    7 ++++---
 17 files changed, 98 insertions(+), 56 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h
index 6cf2dd2..47ea4e4 100644
--- a/lib/replace/system/filesys.h
+++ b/lib/replace/system/filesys.h
@@ -100,6 +100,10 @@
 #include <sys/ioctl.h>
 #endif
 
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
 /*
  * Veritas File System.  Often in addition to native.
  * Quotas different.
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c
index 4582d98..1cc2524 100644
--- a/source3/auth/auth_server.c
+++ b/source3/auth/auth_server.c
@@ -43,6 +43,8 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
 	bool connected_ok = False;
 	struct named_mutex *mutex = NULL;
 	NTSTATUS status;
+	/* security = server just can't function with spnego */
+	int flags = CLI_FULL_CONNECTION_DONT_SPNEGO;
 
         pserver = talloc_strdup(mem_ctx, lp_passwordserver());
 	p = pserver;
@@ -85,7 +87,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
 		}
 
 		status = cli_connect_nb(desthost, &dest_ss, 0, 0x20,
-					lp_netbios_name(), Undefined, &cli);
+					lp_netbios_name(), Undefined, flags, &cli);
 		if (NT_STATUS_IS_OK(status)) {
 			DEBUG(3,("connected to password server %s\n",desthost));
 			connected_ok = True;
@@ -101,9 +103,6 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
 		return NULL;
 	}
 
-	/* security = server just can't function with spnego */
-	cli->use_spnego = False;
-
 	DEBUG(3,("got session\n"));
 
 	status = cli_negprot(cli);
diff --git a/source3/client/client.c b/source3/client/client.c
index 110614e..30f8b8b 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -5230,7 +5230,7 @@ static int do_message_op(struct user_auth_info *a_info)
 
 	status = cli_connect_nb(desthost, have_ip ? &dest_ss : NULL,
 				port ? port : 139, name_type,
-				lp_netbios_name(), Undefined, &cli);
+				lp_netbios_name(), Undefined, 0, &cli);
 	if (!NT_STATUS_IS_OK(status)) {
 		d_printf("Connection to %s failed. Error %s\n", desthost, nt_errstr(status));
 		return 1;
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index eaac463..58cf7a8 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2846,7 +2846,7 @@ fail:
 
 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
 			uint16_t port, int name_type, const char *myname,
-			int signing_state, struct cli_state **pcli)
+			int signing_state, int flags, struct cli_state **pcli)
 {
 	TALLOC_CTX *frame = talloc_stackframe();
 	struct cli_state *cli;
@@ -2875,7 +2875,7 @@ NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss
 		goto fail;
 	}
 
-	cli = cli_state_create(NULL, fd, desthost, NULL, signing_state);
+	cli = cli_state_create(NULL, fd, desthost, NULL, signing_state, flags);
 	if (cli == NULL) {
 		goto fail;
 	}
@@ -2904,7 +2904,7 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli,
 	struct cli_state *cli;
 
 	nt_status = cli_connect_nb(dest_host, dest_ss, port, 0x20, my_name,
-				   signing_state, &cli);
+				   signing_state, flags, &cli);
 	if (!NT_STATUS_IS_OK(nt_status)) {
 		DEBUG(10, ("cli_connect_nb failed: %s\n",
 			   nt_errstr(nt_status)));
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index a40ef89..68a6724 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -95,6 +95,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 	const char *username;
 	const char *password;
 	NTSTATUS status;
+	int flags = 0;
 
 	/* make a copy so we don't modify the global string 'service' */
 	servicename = talloc_strdup(ctx,share);
@@ -118,9 +119,20 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
+	if (get_cmdline_auth_info_use_kerberos(auth_info)) {
+		flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+	}
+	if (get_cmdline_auth_info_fallback_after_kerberos(auth_info)) {
+		flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
+	}
+	if (get_cmdline_auth_info_use_ccache(auth_info)) {
+		flags |= CLI_FULL_CONNECTION_USE_CCACHE;
+	}
+
 	status = cli_connect_nb(
 		server, NULL, port, name_type, NULL,
-		get_cmdline_auth_info_signing_state(auth_info), &c);
+		get_cmdline_auth_info_signing_state(auth_info),
+		flags, &c);
 
 	if (!NT_STATUS_IS_OK(status)) {
 		d_printf("Connection to %s failed (Error %s)\n",
@@ -133,10 +145,6 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 		max_protocol = PROTOCOL_NT1;
 	}
 	c->protocol = max_protocol;
-	c->use_kerberos = get_cmdline_auth_info_use_kerberos(auth_info);
-	c->fallback_after_kerberos =
-		get_cmdline_auth_info_fallback_after_kerberos(auth_info);
-	c->use_ccache = get_cmdline_auth_info_use_ccache(auth_info);
 
 	DEBUG(4,(" session request ok\n"));
 
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 4689c7a..20b64b6 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -165,7 +165,7 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
 				   int fd,
 				   const char *remote_name,
 				   const char *remote_realm,
-				   int signing_state)
+				   int signing_state, int flags)
 {
 	struct cli_state *cli = NULL;
 	bool allow_smb_signing = false;
@@ -204,6 +204,27 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
 	if (getenv("CLI_FORCE_DOSERR"))
 		cli->force_dos_errors = true;
 
+	if (flags & CLI_FULL_CONNECTION_DONT_SPNEGO) {
+		cli->use_spnego = false;
+	} else if (flags & CLI_FULL_CONNECTION_USE_KERBEROS) {
+		cli->use_kerberos = true;
+	}
+	if ((flags & CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS) &&
+	     cli->use_kerberos) {
+		cli->fallback_after_kerberos = true;
+	}
+
+	if (flags & CLI_FULL_CONNECTION_USE_CCACHE) {
+		cli->use_ccache = true;
+	}
+
+	if (flags & CLI_FULL_CONNECTION_OPLOCKS) {
+		cli->use_oplocks = true;
+	}
+	if (flags & CLI_FULL_CONNECTION_LEVEL_II_OPLOCKS) {
+		cli->use_level_II_oplocks = true;
+	}
+
 	if (lp_client_signing()) {
 		allow_smb_signing = true;
 	}
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 6446252..005f2cd 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -253,6 +253,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
         const char *username_used;
  	NTSTATUS status;
 	char *newserver, *newshare;
+	int flags = 0;
 
 	ZERO_STRUCT(c);
 	*in_cache = false;
@@ -401,13 +402,25 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 
 	status = NT_STATUS_UNSUCCESSFUL;
 
+	if (smbc_getOptionUseKerberos(context)) {
+		flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+	}
+
+	if (smbc_getOptionFallbackAfterKerberos(context)) {
+		flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
+	}
+
+	if (smbc_getOptionUseCCache(context)) {
+		flags |= CLI_FULL_CONNECTION_USE_CCACHE;
+	}
+
         if (share == NULL || *share == '\0' || is_ipc) {
 		/*
 		 * Try 139 first for IPC$
 		 */
 		status = cli_connect_nb(server_n, NULL, 139, 0x20,
 					smbc_getNetbiosName(context),
-					Undefined, &c);
+					Undefined, flags, &c);
 	}
 
 	if (!NT_STATUS_IS_OK(status)) {
@@ -416,7 +429,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 		 */
 		status = cli_connect_nb(server_n, NULL, 0, 0x20,
 					smbc_getNetbiosName(context),
-					Undefined, &c);
+					Undefined, flags, &c);
 	}
 
 	if (!NT_STATUS_IS_OK(status)) {
@@ -424,18 +437,6 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 		return NULL;
 	}
 
-        if (smbc_getOptionUseKerberos(context)) {
-		c->use_kerberos = True;
-	}
-
-        if (smbc_getOptionFallbackAfterKerberos(context)) {
-		c->fallback_after_kerberos = True;
-	}
-
-        if (smbc_getOptionUseCCache(context)) {
-		c->use_ccache = True;
-	}
-
 	cli_set_timeout(c, smbc_getTimeout(context));
 
 	status = cli_negprot(c);
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index bf2103d..e5c336f 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -56,7 +56,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
 	*err_str = NULL;
 
 	result = cli_connect_nb(remote_machine, NULL, 0, 0x20, NULL,
-				Undefined, &cli);
+				Undefined, 0, &cli);
 	if (!NT_STATUS_IS_OK(result)) {
 		if (asprintf(err_str, "Unable to connect to SMB server on "
 			 "machine %s. Error was : %s.\n",
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index f932924..83da457 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -74,7 +74,7 @@ struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_negprot_recv(struct tevent_req *req);
 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
 			uint16_t port, int name_type, const char *myname,
-			int signing_state, struct cli_state **pcli);
+			int signing_state, int flags, struct cli_state **pcli);
 NTSTATUS cli_start_connection(struct cli_state **output_cli,
 			      const char *my_name,
 			      const char *dest_host,
@@ -159,7 +159,8 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
 				   int fd,
 				   const char *remote_name,
 				   const char *remote_realm,
-				   int signing_state);
+				   int signing_state,
+				   int flags);
 bool cli_state_encryption_on(struct cli_state *cli);
 void cli_nt_pipes_close(struct cli_state *cli);
 void cli_shutdown(struct cli_state *cli);
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index 964975e..a5fd356 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -82,7 +82,7 @@ static void sync_child(char *name, int nm_type,
 	in_addr_to_sockaddr_storage(&ss, ip);
 
 	status = cli_connect_nb(name, &ss, 139, nm_type,
-				get_local_machine_name(), Undefined,
+				get_local_machine_name(), Undefined, 0,
 				&cli);
 	if (!NT_STATUS_IS_OK(status)) {
 		return;
diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c
index d6c544d..da3b9a7 100644
--- a/source3/torture/locktest.c
+++ b/source3/torture/locktest.c
@@ -169,6 +169,7 @@ static struct cli_state *connect_one(char *share, int snum)
 	fstring myname;
 	static int count;
 	NTSTATUS status;
+	int flags = 0;
 
 	fstrcpy(server,share+2);
 	share = strchr_m(server,'\\');
@@ -182,16 +183,21 @@ static struct cli_state *connect_one(char *share, int snum)
 
 	/* have to open a new connection */
 
-	status = cli_connect_nb(server_n, NULL, 0, 0x20, myname, Undefined,
-				&c);
+	if (use_kerberos) {
+		flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+	}
+	if (use_oplocks) {
+		flags |= CLI_FULL_CONNECTION_OPLOCKS;
+	}
+
+	status = cli_connect_nb(server_n, NULL, 0, 0x20, myname,
+				Undefined, flags, &c);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(0, ("Connection to %s failed. Error %s\n", server_n,
 			  nt_errstr(status)));
 		return NULL;
 	}
 
-	c->use_kerberos = use_kerberos;
-
 	status = cli_negprot(c);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(0, ("protocol negotiation failed: %s\n",
@@ -246,8 +252,6 @@ static struct cli_state *connect_one(char *share, int snum)
 
 	DEBUG(4,(" tconx ok\n"));
 
-	c->use_oplocks = use_oplocks;
-
 	return c;
 }
 
diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c
index 05f9c60..6a4bb6e 100644
--- a/source3/torture/masktest.c
+++ b/source3/torture/masktest.c
@@ -179,7 +179,7 @@ static struct cli_state *connect_one(char *share)
 
 	server_n = server;
 
-	status = cli_connect_nb(server, NULL, 0, 0x20, "masktest", Undefined,
+	status = cli_connect_nb(server, NULL, 0, 0x20, "masktest", Undefined, 0,
 				&c);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(0,("Connection to %s failed. Error %s\n", server_n,
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index f07026d..495875b 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -181,19 +181,28 @@ static struct cli_state *open_nbt_connection(void)
 {
 	struct cli_state *c;
 	NTSTATUS status;
+	int flags = 0;
+
+	if (use_oplocks) {
+		flags |= CLI_FULL_CONNECTION_OPLOCKS;
+	}
+
+	if (use_level_II_oplocks) {
+		flags |= CLI_FULL_CONNECTION_LEVEL_II_OPLOCKS;
+	}
+
+	if (use_kerberos) {
+		flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+	}
 
 	status = cli_connect_nb(host, NULL, port_to_use, 0x20, myname,
-				signing_state, &c);
+				signing_state, flags, &c);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("Failed to connect with %s. Error %s\n", host, nt_errstr(status) );
 		return NULL;
 	}
 
-	c->use_kerberos = use_kerberos;
-
 	cli_set_timeout(c, 120000); /* set a really long timeout (2 minutes) */
-	if (use_oplocks) c->use_oplocks = True;
-	if (use_level_II_oplocks) c->use_level_II_oplocks = True;
 
 	return c;
 }
@@ -3545,18 +3554,12 @@ static bool run_oplock2(int dummy)
 		return False;
 	}
 
-	cli1->use_oplocks = True;
-	cli1->use_level_II_oplocks = True;
-
 	if (!torture_open_connection(&cli2, 1)) {
 		use_level_II_oplocks = False;
 		use_oplocks = saved_use_oplocks;
 		return False;
 	}
 
-	cli2->use_oplocks = True;
-	cli2->use_level_II_oplocks = True;
-
 	cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
 	cli_sockopt(cli1, sockops);
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 04e6e68..9ed4ead 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -7092,7 +7092,7 @@ bool net_rpc_check(struct net_context *c, unsigned flags)
 		return false;
 
 	status = cli_connect_nb(server_name, &server_ss, 0, 0x20,
-				lp_netbios_name(), Undefined, &cli);
+				lp_netbios_name(), Undefined, 0, &cli);
 	if (!NT_STATUS_IS_OK(status)) {
 		return false;
 	}
diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c
index cc97412..6fc3f96 100644
--- a/source3/utils/net_time.c
+++ b/source3/utils/net_time.c
@@ -33,7 +33,7 @@ static time_t cli_servertime(const char *host,
 	NTSTATUS status;
 
 	status = cli_connect_nb(host, dest_ss, 0, 0x20, lp_netbios_name(),
-				Undefined, &cli);
+				Undefined, 0, &cli);
 	if (!NT_STATUS_IS_OK(status)) {
 		fprintf(stderr, _("Can't contact server %s. Error %s\n"),
 			host, nt_errstr(status));
diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c
index abb4d79..d840f23 100644
--- a/source3/web/diagnose.c
+++ b/source3/web/diagnose.c
@@ -71,7 +71,7 @@ bool smbd_running(void)
 	in_addr_to_sockaddr_storage(&ss, loopback_ip);
 
 	status = cli_connect_nb("localhost", &ss, 0, 0x20, lp_netbios_name(),
-				Undefined, &cli);
+				Undefined, 0, &cli);
 	if (!NT_STATUS_IS_OK(status)) {
 		return false;
 	}
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 09189aa..807ad40 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -787,6 +787,7 @@ static NTSTATUS cm_prepare_connection(const struct winbindd_domain *domain,
 	char *ipc_username = NULL;
 	char *ipc_domain = NULL;
 	char *ipc_password = NULL;
+	int flags = 0;
 
 	struct named_mutex *mutex;
 
@@ -806,9 +807,11 @@ static NTSTATUS cm_prepare_connection(const struct winbindd_domain *domain,
 		goto done;
 	}
 
+	flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+
 	*cli = cli_state_create(NULL, sockfd,
 				controller, domain->alt_name,
-				Undefined);
+				Undefined, flags);
 	if (*cli == NULL) {
 		DEBUG(1, ("Could not cli_initialize\n"));
 		result = NT_STATUS_NO_MEMORY;
@@ -817,8 +820,6 @@ static NTSTATUS cm_prepare_connection(const struct winbindd_domain *domain,
 
 	cli_set_timeout(*cli, 10000); /* 10 seconds */
 
-	(*cli)->use_kerberos = True;
-
 	result = cli_negprot(*cli);
 
 	if (!NT_STATUS_IS_OK(result)) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list