From 665593d6acd8bc9b0c78515050cb7dd107c3867d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 20 Sep 2011 06:57:37 +0200 Subject: s3:libsmb: add cli_tree_connect() for a generic tree connect metze --- source3/libsmb/cliconnect.c | 15 +++++++++++++++ source3/libsmb/proto.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'source3') diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 39710525dd..58fb2e8e03 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -2520,6 +2520,21 @@ NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share, return status; } +NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share, + const char *dev, const char *pass, int passlen) +{ + cli->share = talloc_strdup(cli, share); + if (!cli->share) { + return NT_STATUS_NO_MEMORY; + } + + if (cli_state_protocol(cli) >= PROTOCOL_SMB2_02) { + return smb2cli_tcon(cli, share); + } + + return cli_tcon_andx(cli, share, dev, pass, passlen); +} + /**************************************************************************** Send a tree disconnect. ****************************************************************************/ diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index 991deadfa5..e03d721ef2 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -64,6 +64,8 @@ struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx, NTSTATUS cli_tcon_andx_recv(struct tevent_req *req); NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share, const char *dev, const char *pass, int passlen); +NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share, + const char *dev, const char *pass, int passlen); struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli); -- cgit