s3: Use cli_connect_nb in smbtorture open_nbt_connection
authorVolker Lendecke <vl@samba.org>
Sat, 28 May 2011 21:34:26 +0000 (23:34 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 28 May 2011 21:04:02 +0000 (23:04 +0200)
source3/torture/torture.c

index 64ba5431d6a8b81d51e4c91e5dbf372968732378..ae34077cbe0df4bb546ec9c7d3fdc8569c099339 100644 (file)
@@ -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;
 }