[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun May 29 02:12:02 MDT 2011


The branch, master has been updated
       via  edfa62f s3: Use cli_connect_nb in do_message_op
       via  8a3199e s3: Use cli_connect_nb in smbtorture open_nbt_connection
      from  797316a s3: Use cli_connect_nb in net_rpc_check

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


- Log -----------------------------------------------------------------
commit edfa62f2a0f42440d7a17d519c281f28d623a602
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 29 00:59:12 2011 +0200

    s3: Use cli_connect_nb in do_message_op
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Sun May 29 10:11:54 CEST 2011 on sn-devel-104

commit 8a3199e00de3e138d36b99043703938482192ed7
Author: Volker Lendecke <vl at samba.org>
Date:   Sat May 28 23:34:26 2011 +0200

    s3: Use cli_connect_nb in smbtorture open_nbt_connection

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

Summary of changes:
 source3/client/client.c   |   36 +++---------------------------------
 source3/torture/torture.c |   38 ++------------------------------------
 2 files changed, 5 insertions(+), 69 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/client.c b/source3/client/client.c
index 45494ef..7cffddb 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -5037,46 +5037,16 @@ static int do_tar_op(const char *base_directory)
 
 static int do_message_op(struct user_auth_info *a_info)
 {
-	struct sockaddr_storage ss;
-	struct nmb_name called, calling;
-	fstring server_name;
-	char name_type_hex[10];
-	int msg_port;
 	NTSTATUS status;
 
-	make_nmb_name(&calling, calling_name, 0x0);
-	make_nmb_name(&called , desthost, name_type);
-
-	strlcpy(server_name, desthost,sizeof(server_name));
-	snprintf(name_type_hex, sizeof(name_type_hex), "#%X", name_type);
-	strlcat(server_name, name_type_hex,sizeof(server_name));
-
-        zero_sockaddr(&ss);
-	if (have_ip)
-		ss = dest_ss;
-
-	/* we can only do messages over port 139 (to windows clients at least) */
-
-	msg_port = port ? port : 139;
-
-	if (!(cli=cli_initialise())) {
-		d_printf("Connection to %s failed\n", desthost);
-		return 1;
-	}
-	cli_set_port(cli, msg_port);
-
-	status = cli_connect(cli, server_name, &ss);
+	status = cli_connect_nb(desthost, have_ip ? &dest_ss : NULL,
+				port ? port : 139, name_type,
+				calling_name, Undefined, &cli);
 	if (!NT_STATUS_IS_OK(status)) {
 		d_printf("Connection to %s failed. Error %s\n", desthost, nt_errstr(status));
 		return 1;
 	}
 
-	if (!cli_session_request(cli, &calling, &called)) {
-		d_printf("session request failed\n");
-		cli_shutdown(cli);
-		return 1;
-	}
-
 	send_message(get_cmdline_auth_info_username(a_info));
 	cli_shutdown(cli);
 
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 64ba543..ae34077 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -178,24 +178,11 @@ static bool force_cli_encryption(struct cli_state *c,
 
 static struct cli_state *open_nbt_connection(void)
 {
-	struct nmb_name called, calling;
-	struct sockaddr_storage ss;
 	struct cli_state *c;
 	NTSTATUS status;
 
-	make_nmb_name(&calling, myname, 0x0);
-	make_nmb_name(&called , host, 0x20);
-
-        zero_sockaddr(&ss);
-
-	if (!(c = cli_initialise_ex(signing_state))) {
-		printf("Failed initialize cli_struct to connect with %s\n", host);
-		return NULL;
-	}
-
-	c->port = port_to_use;
-
-	status = cli_connect(c, host, &ss);
+	status = cli_connect_nb(host, NULL, port_to_use, 0x20, myname,
+				signing_state, &c);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("Failed to connect with %s. Error %s\n", host, nt_errstr(status) );
 		return NULL;
@@ -207,27 +194,6 @@ static struct cli_state *open_nbt_connection(void)
 	if (use_oplocks) c->use_oplocks = True;
 	if (use_level_II_oplocks) c->use_level_II_oplocks = True;
 
-	if (!cli_session_request(c, &calling, &called)) {
-		/*
-		 * Well, that failed, try *SMBSERVER ...
-		 * However, we must reconnect as well ...
-		 */
-		status = cli_connect(c, host, &ss);
-		if (!NT_STATUS_IS_OK(status)) {
-			printf("Failed to connect with %s. Error %s\n", host, nt_errstr(status) );
-			return NULL;
-		}
-
-		make_nmb_name(&called, "*SMBSERVER", 0x20);
-		if (!cli_session_request(c, &calling, &called)) {
-			printf("%s rejected the session\n",host);
-			printf("We tried with a called name of %s & %s\n",
-				host, "*SMBSERVER");
-			cli_shutdown(c);
-			return NULL;
-		}
-	}
-
 	return c;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list