From 764b5e56108362a53acf8f435203dd1e56ecd2ce Mon Sep 17 00:00:00 2001 From: Luk Claes Date: Sun, 20 May 2012 17:54:29 +0200 Subject: s3:libsmb: get rid of cli_negprot Signed-off-by: Luk Claes Signed-off-by: Stefan Metzmacher --- source3/libsmb/cliconnect.c | 24 ++---------------------- source3/libsmb/clidfs.c | 3 ++- source3/libsmb/libsmb_server.c | 3 ++- source3/libsmb/passchange.c | 4 +++- source3/libsmb/proto.h | 6 ------ source3/nmbd/nmbd_synclists.c | 4 +++- source3/torture/locktest.c | 4 +++- source3/torture/masktest.c | 3 ++- source3/torture/torture.c | 9 ++++++--- source3/utils/net_rpc.c | 5 +++-- source3/utils/net_time.c | 3 ++- source3/winbindd/winbindd_cm.c | 3 ++- 12 files changed, 30 insertions(+), 41 deletions(-) diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index a9ac383964..491b7039f9 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -2606,27 +2606,6 @@ fail: return status; } -struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx, - struct event_context *ev, - struct cli_state *cli, - enum protocol_types max_protocol) -{ - return smbXcli_negprot_send(mem_ctx, ev, - cli->conn, cli->timeout, - PROTOCOL_CORE, max_protocol); -} - -NTSTATUS cli_negprot_recv(struct tevent_req *req) -{ - return smbXcli_negprot_recv(req); -} - -NTSTATUS cli_negprot(struct cli_state *cli, enum protocol_types max_protocol) -{ - return smbXcli_negprot(cli->conn, cli->timeout, - PROTOCOL_CORE, max_protocol); -} - static NTSTATUS cli_connect_sock(const char *host, int name_type, const struct sockaddr_storage *pss, const char *myname, uint16_t port, @@ -2768,7 +2747,8 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli, return nt_status; } - nt_status = cli_negprot(cli, PROTOCOL_NT1); + nt_status = smbXcli_negprot(cli->conn, cli->timeout, PROTOCOL_CORE, + 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 ff89dcc505..8aae42bb86 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -147,7 +147,8 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, } DEBUG(4,(" session request ok\n")); - status = cli_negprot(c, max_protocol); + status = smbXcli_negprot(c->conn, c->timeout, PROTOCOL_CORE, + 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 ccbb6f1aa5..c7ec142ffc 100644 --- a/source3/libsmb/libsmb_server.c +++ b/source3/libsmb/libsmb_server.c @@ -442,7 +442,8 @@ SMBC_server_internal(TALLOC_CTX *ctx, cli_set_timeout(c, smbc_getTimeout(context)); - status = cli_negprot(c, PROTOCOL_NT1); + status = smbXcli_negprot(c->conn, c->timeout, PROTOCOL_CORE, + PROTOCOL_NT1); if (!NT_STATUS_IS_OK(status)) { cli_shutdown(c); diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c index ea6d9d5edb..393383336b 100644 --- a/source3/libsmb/passchange.c +++ b/source3/libsmb/passchange.c @@ -24,6 +24,7 @@ #include "libsmb/libsmb.h" #include "libsmb/clirap.h" #include "libsmb/nmblib.h" +#include "../libcli/smb/smbXcli_base.h" /************************************************************* Change a password on a remote machine using IPC calls. @@ -66,7 +67,8 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam return result; } - result = cli_negprot(cli, PROTOCOL_NT1); + result = smbXcli_negprot(cli->conn, cli->timeout, PROTOCOL_CORE, + 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 a584a63763..3f25958825 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -72,12 +72,6 @@ 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, enum protocol_types max_protocol); -struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx, - struct event_context *ev, - 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, int signing_state, int flags, struct cli_state **pcli); diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c index 20ece6915a..d10b580a01 100644 --- a/source3/nmbd/nmbd_synclists.c +++ b/source3/nmbd/nmbd_synclists.c @@ -32,6 +32,7 @@ #include "libsmb/libsmb.h" #include "libsmb/clirap.h" #include "smbprofile.h" +#include "../libcli/smb/smbXcli_base.h" struct sync_record { struct sync_record *next, *prev; @@ -88,7 +89,8 @@ static void sync_child(char *name, int nm_type, return; } - status = cli_negprot(cli, PROTOCOL_NT1); + status = smbXcli_negprot(cli->conn, cli->timeout, PROTOCOL_CORE, + 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 288ce8fe54..04928f20ac 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -22,6 +22,7 @@ #include "system/filesys.h" #include "locking/proto.h" #include "libsmb/nmblib.h" +#include "../libcli/smb/smbXcli_base.h" static fstring password[2]; static fstring username[2]; @@ -198,7 +199,8 @@ static struct cli_state *connect_one(char *share, int snum) return NULL; } - status = cli_negprot(c, PROTOCOL_NT1); + status = smbXcli_negprot(c->conn, c->timeout, PROTOCOL_CORE, + 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 6669949635..74f33a5cdd 100644 --- a/source3/torture/masktest.c +++ b/source3/torture/masktest.c @@ -188,7 +188,8 @@ static struct cli_state *connect_one(char *share) return NULL; } - status = cli_negprot(c, max_protocol); + status = smbXcli_negprot(c->conn, c->timeout, PROTOCOL_CORE, + 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 b49a7a73e2..1f463f6672 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -3053,7 +3053,8 @@ static bool run_negprot_nowait(int dummy) for (i=0;i<50000;i++) { struct tevent_req *req; - req = cli_negprot_send(ev, ev, cli, PROTOCOL_NT1); + req = smbXcli_negprot_send(ev, ev, cli->conn, cli->timeout, + PROTOCOL_CORE, PROTOCOL_NT1); if (req == NULL) { TALLOC_FREE(ev); return false; @@ -6307,7 +6308,8 @@ static bool run_error_map_extract(int dummy) { } disable_spnego = false; - status = cli_negprot(c_nt, PROTOCOL_NT1); + status = smbXcli_negprot(c_nt->conn, c_nt->timeout, PROTOCOL_CORE, + PROTOCOL_NT1); if (!NT_STATUS_IS_OK(status)) { printf("%s rejected the NT-error negprot (%s)\n", host, @@ -6334,7 +6336,8 @@ static bool run_error_map_extract(int dummy) { disable_spnego = false; force_dos_errors = false; - status = cli_negprot(c_dos, PROTOCOL_NT1); + status = smbXcli_negprot(c_dos->conn, c_dos->timeout, PROTOCOL_CORE, + 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 daae7f449e..49b405f75f 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -43,7 +43,7 @@ #include "libsmb/clirap.h" #include "nsswitch/libwbclient/wbclient.h" #include "passdb.h" -#include "libcli/smb/smbXcli_base.h" +#include "../libcli/smb/smbXcli_base.h" static int net_mode_share; static NTSTATUS sync_files(struct copy_clistate *cp_clistate, const char *mask); @@ -7105,7 +7105,8 @@ bool net_rpc_check(struct net_context *c, unsigned flags) if (!NT_STATUS_IS_OK(status)) { return false; } - status = cli_negprot(cli, PROTOCOL_NT1); + status = smbXcli_negprot(cli->conn, cli->timeout, PROTOCOL_CORE, + PROTOCOL_NT1); if (!NT_STATUS_IS_OK(status)) goto done; if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_NT1) diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c index 979d29cf91..847b4fe445 100644 --- a/source3/utils/net_time.c +++ b/source3/utils/net_time.c @@ -41,7 +41,8 @@ static time_t cli_servertime(const char *host, goto done; } - status = cli_negprot(cli, PROTOCOL_NT1); + status = smbXcli_negprot(cli->conn, cli->timeout, PROTOCOL_CORE, + 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 d4af23783d..44ca77bc6c 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -827,7 +827,8 @@ static NTSTATUS cm_prepare_connection(const struct winbindd_domain *domain, cli_set_timeout(*cli, 10000); /* 10 seconds */ - result = cli_negprot(*cli, PROTOCOL_SMB2_02); + result = smbXcli_negprot((*cli)->conn, (*cli)->timeout, PROTOCOL_CORE, + PROTOCOL_SMB2_02); if (!NT_STATUS_IS_OK(result)) { DEBUG(1, ("cli_negprot failed: %s\n", nt_errstr(result))); -- cgit