summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-13 14:33:31 +0200
committerStefan Metzmacher <metze@samba.org>2011-09-15 10:25:17 +0200
commit3f00cce9b3502c8ec9b3f7fcf5b2024c10550f82 (patch)
treea0ea277fecceb874d1a77b459ccb0a833945b8d9
parent4f7be46d99b68040c3b42f3a4662fccd777012a3 (diff)
downloadsamba-3f00cce9b3502c8ec9b3f7fcf5b2024c10550f82.tar.gz
samba-3f00cce9b3502c8ec9b3f7fcf5b2024c10550f82.tar.bz2
samba-3f00cce9b3502c8ec9b3f7fcf5b2024c10550f82.zip
s3:libsmb: pass max_protocol to cli_negprot()
metze
-rw-r--r--source3/auth/auth_server.c2
-rw-r--r--source3/libsmb/cliconnect.c11
-rw-r--r--source3/libsmb/clidfs.c4
-rw-r--r--source3/libsmb/libsmb_server.c2
-rw-r--r--source3/libsmb/passchange.c4
-rw-r--r--source3/libsmb/proto.h5
-rw-r--r--source3/nmbd/nmbd_synclists.c2
-rw-r--r--source3/torture/locktest.c2
-rw-r--r--source3/torture/masktest.c4
-rw-r--r--source3/torture/torture.c6
-rw-r--r--source3/utils/net_rpc.c2
-rw-r--r--source3/utils/net_time.c2
-rw-r--r--source3/winbindd/winbindd_cm.c2
13 files changed, 22 insertions, 26 deletions
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c
index 04b46737a2..1df085321a 100644
--- a/source3/auth/auth_server.c
+++ b/source3/auth/auth_server.c
@@ -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);
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 6fa724f7b7..23518ea1b8 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -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);
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 68a6724d24..b066b8bd12 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -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",
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 005f2cdf8e..0af9798d2b 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -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);
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index e5c336f882..58997e4c82 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -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 "
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 4992d95c96..88035ffa6b 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -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,
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index a5fd356692..7a256a35ef 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -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;
diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c
index da3b9a7cdf..e7d3df2ce7 100644
--- a/source3/torture/locktest.c
+++ b/source3/torture/locktest.c
@@ -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)));
diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c
index 6a4bb6e1d1..eaac0d8edc 100644
--- a/source3/torture/masktest.c
+++ b/source3/torture/masktest.c
@@ -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)));
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 1de7e79732..3eb6fec294 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -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));
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 9ed4ead2f2..fe41e77148 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -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)
diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c
index c8d08085ae..88520c4818 100644
--- a/source3/utils/net_time.c
+++ b/source3/utils/net_time.c
@@ -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));
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index b631ab69a9..33c4deed08 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -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)));