s3:libsmb: pass max_protocol to cli_negprot()
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Sep 2011 12:33:31 +0000 (14:33 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 15 Sep 2011 08:25:17 +0000 (10:25 +0200)
metze

13 files changed:
source3/auth/auth_server.c
source3/libsmb/cliconnect.c
source3/libsmb/clidfs.c
source3/libsmb/libsmb_server.c
source3/libsmb/passchange.c
source3/libsmb/proto.h
source3/nmbd/nmbd_synclists.c
source3/torture/locktest.c
source3/torture/masktest.c
source3/torture/torture.c
source3/utils/net_rpc.c
source3/utils/net_time.c
source3/winbindd/winbindd_cm.c

index 04b46737a2a391eb2ac617250acd8853aa8cc520..1df085321ab08343113159eae40d098f2bdd7b0d 100644 (file)
@@ -106,7 +106,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
 
        DEBUG(3,("got session\n"));
 
-       status = cli_negprot(cli);
+       status = cli_negprot(cli, PROTOCOL_NT1);
 
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(mutex);
index 6fa724f7b77b2014529867ffeda31c6481401d54..23518ea1b80632666f0abb690fbe2f2554c48954 100644 (file)
@@ -2545,7 +2545,8 @@ static void cli_negprot_done(struct tevent_req *subreq);
 
 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
                                    struct event_context *ev,
-                                   struct cli_state *cli)
+                                   struct cli_state *cli,
+                                   enum protocol_types max_protocol)
 {
        struct tevent_req *req, *subreq;
        struct cli_negprot_state *state;
@@ -2558,7 +2559,7 @@ struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
        state->cli = cli;
-       state->max_protocol = cli->protocol;
+       state->max_protocol = max_protocol;
 
        /* setup the protocol strings */
        for (numprots=0; numprots < ARRAY_SIZE(prots); numprots++) {
@@ -2765,7 +2766,7 @@ NTSTATUS cli_negprot_recv(struct tevent_req *req)
        return tevent_req_simple_recv_ntstatus(req);
 }
 
-NTSTATUS cli_negprot(struct cli_state *cli)
+NTSTATUS cli_negprot(struct cli_state *cli, enum protocol_types max_protocol)
 {
        TALLOC_CTX *frame = talloc_stackframe();
        struct event_context *ev;
@@ -2786,7 +2787,7 @@ NTSTATUS cli_negprot(struct cli_state *cli)
                goto fail;
        }
 
-       req = cli_negprot_send(frame, ev, cli);
+       req = cli_negprot_send(frame, ev, cli, max_protocol);
        if (req == NULL) {
                status = NT_STATUS_NO_MEMORY;
                goto fail;
@@ -2942,7 +2943,7 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli,
                return nt_status;
        }
 
-       nt_status = cli_negprot(cli);
+       nt_status = cli_negprot(cli, PROTOCOL_NT1);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(1, ("failed negprot: %s\n", nt_errstr(nt_status)));
                cli_shutdown(cli);
index 68a6724d24244cff47da4fcba4f013ef4b3a6282..b066b8bd1203a16e5a2d34893483576e42ebd05f 100644 (file)
@@ -144,11 +144,9 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
        if (max_protocol == 0) {
                max_protocol = PROTOCOL_NT1;
        }
-       c->protocol = max_protocol;
-
        DEBUG(4,(" session request ok\n"));
 
-       status = cli_negprot(c);
+       status = cli_negprot(c, max_protocol);
 
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("protocol negotiation failed: %s\n",
index 005f2cdf8e8599d3741ec82894260b100a83c49a..0af9798d2be6a793a27cbf4642f9b52349c438ce 100644 (file)
@@ -439,7 +439,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 
        cli_set_timeout(c, smbc_getTimeout(context));
 
-       status = cli_negprot(c);
+       status = cli_negprot(c, PROTOCOL_NT1);
 
        if (!NT_STATUS_IS_OK(status)) {
                cli_shutdown(c);
index e5c336f8828e2dd9209ae9e6448ae545b4f82e70..58997e4c821666f69108aefde3be19f9480213ce 100644 (file)
@@ -66,9 +66,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
                return result;
        }
 
-       cli->protocol = PROTOCOL_NT1;
-
-       result = cli_negprot(cli);
+       result = cli_negprot(cli, PROTOCOL_NT1);
 
        if (!NT_STATUS_IS_OK(result)) {
                if (asprintf(err_str, "machine %s rejected the negotiate "
index 4992d95c96815e26150e218e694f26e1acc2aa46..88035ffa6bec9acad58a628f518143172db12ae1 100644 (file)
@@ -67,10 +67,11 @@ struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
                                  struct cli_state *cli);
 NTSTATUS cli_tdis_recv(struct tevent_req *req);
 NTSTATUS cli_tdis(struct cli_state *cli);
-NTSTATUS cli_negprot(struct cli_state *cli);
+NTSTATUS cli_negprot(struct cli_state *cli, enum protocol_types max_protocol);
 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
                                    struct event_context *ev,
-                                   struct cli_state *cli);
+                                   struct cli_state *cli,
+                                   enum protocol_types max_protocol);
 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,
index a5fd35669276526108f7ed3f267808002a0f07ef..7a256a35efe516d5f469b280be5ee08c55db19d2 100644 (file)
@@ -88,7 +88,7 @@ static void sync_child(char *name, int nm_type,
                return;
        }
 
-       status = cli_negprot(cli);
+       status = cli_negprot(cli, PROTOCOL_NT1);
        if (!NT_STATUS_IS_OK(status)) {
                cli_shutdown(cli);
                return;
index da3b9a7cdf8f131ea65217a01202227c1241e519..e7d3df2ce7467a4ad63d986146c3fd2aa341c8cb 100644 (file)
@@ -198,7 +198,7 @@ static struct cli_state *connect_one(char *share, int snum)
                return NULL;
        }
 
-       status = cli_negprot(c);
+       status = cli_negprot(c, PROTOCOL_NT1);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("protocol negotiation failed: %s\n",
                          nt_errstr(status)));
index 6a4bb6e1d1e925bb8c4087da5d162ec8e4590e15..eaac0d8edccc4e688a89597665d64468c4b11dba 100644 (file)
@@ -187,9 +187,7 @@ static struct cli_state *connect_one(char *share)
                return NULL;
        }
 
-       c->protocol = max_protocol;
-
-       status = cli_negprot(c);
+       status = cli_negprot(c, max_protocol);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("protocol negotiation failed: %s\n",
                          nt_errstr(status)));
index 1de7e79732cf2c054fcc568d2b7c54e7a4490fcb..3eb6fec29482660b32614dfcb09a8108ac6ece4a 100644 (file)
@@ -3037,7 +3037,7 @@ static bool run_negprot_nowait(int dummy)
        for (i=0;i<50000;i++) {
                struct tevent_req *req;
 
-               req = cli_negprot_send(ev, ev, cli);
+               req = cli_negprot_send(ev, ev, cli, PROTOCOL_NT1);
                if (req == NULL) {
                        TALLOC_FREE(ev);
                        return false;
@@ -6289,7 +6289,7 @@ static bool run_error_map_extract(int dummy) {
        }
        disable_spnego = false;
 
-       status = cli_negprot(c_nt);
+       status = cli_negprot(c_nt, PROTOCOL_NT1);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("%s rejected the NT-error negprot (%s)\n", host,
@@ -6316,7 +6316,7 @@ static bool run_error_map_extract(int dummy) {
        disable_spnego = false;
        force_dos_errors = false;
 
-       status = cli_negprot(c_dos);
+       status = cli_negprot(c_dos, PROTOCOL_NT1);
        if (!NT_STATUS_IS_OK(status)) {
                printf("%s rejected the DOS-error negprot (%s)\n", host,
                       nt_errstr(status));
index 9ed4ead2f2f159190952407628f8885c6b844267..fe41e77148e19e07f07b1ca3462f59c28076e744 100644 (file)
@@ -7096,7 +7096,7 @@ bool net_rpc_check(struct net_context *c, unsigned flags)
        if (!NT_STATUS_IS_OK(status)) {
                return false;
        }
-       status = cli_negprot(cli);
+       status = cli_negprot(cli, PROTOCOL_NT1);
        if (!NT_STATUS_IS_OK(status))
                goto done;
        if (cli_state_protocol(cli) < PROTOCOL_NT1)
index c8d08085ae2217c04236ffb90b74b1bb0c248e25..88520c48189a04f7fd11ca566d5a12a32c948a3a 100644 (file)
@@ -40,7 +40,7 @@ static time_t cli_servertime(const char *host,
                goto done;
        }
 
-       status = cli_negprot(cli);
+       status = cli_negprot(cli, PROTOCOL_NT1);
        if (!NT_STATUS_IS_OK(status)) {
                fprintf(stderr, _("Protocol negotiation failed: %s\n"),
                        nt_errstr(status));
index b631ab69a9ece58cd3e3ac0dc4e2db067e4d5e10..33c4deed08acd882efb9d545717cbdbb1906ae51 100644 (file)
@@ -821,7 +821,7 @@ static NTSTATUS cm_prepare_connection(const struct winbindd_domain *domain,
 
        cli_set_timeout(*cli, 10000); /* 10 seconds */
 
-       result = cli_negprot(*cli);
+       result = cli_negprot(*cli, PROTOCOL_NT1);
 
        if (!NT_STATUS_IS_OK(result)) {
                DEBUG(1, ("cli_negprot failed: %s\n", nt_errstr(result)));