From ef2e26c91b80556af033d3335e55f5dfa6fff31d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Aug 2003 01:53:07 +0000 Subject: first public release of samba4 code (This used to be commit b0510b5428b3461aeb9bbe3cc95f62fc73e2b97f) --- source4/libcli/cliconnect.c | 207 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 source4/libcli/cliconnect.c (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c new file mode 100644 index 0000000000..da8a842dae --- /dev/null +++ b/source4/libcli/cliconnect.c @@ -0,0 +1,207 @@ +/* + Unix SMB/CIFS implementation. + client connect/disconnect routines + Copyright (C) Andrew Tridgell 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +/* + wrapper around cli_sock_connect() +*/ +BOOL cli_socket_connect(struct cli_state *cli, const char *server, struct in_addr *ip) +{ + struct cli_socket *sock; + + sock = cli_sock_init(); + if (!sock) return False; + + if (!cli_sock_connect_byname(sock, server, 0)) { + cli_sock_close(sock); + return False; + } + + cli->transport = cli_transport_init(sock); + if (!cli->transport) { + cli_sock_close(sock); + return False; + } + + return True; +} + +/* wrapper around cli_transport_connect() */ +BOOL cli_transport_establish(struct cli_state *cli, + struct nmb_name *calling, + struct nmb_name *called) +{ + return cli_transport_connect(cli->transport, calling, called); +} + +/* wrapper around smb_raw_negotiate() */ +BOOL cli_negprot(struct cli_state *cli) +{ + NTSTATUS status; + status = smb_raw_negotiate(cli->transport); + return NT_STATUS_IS_OK(status); +} + +/* wrapper around smb_raw_session_setup() */ +BOOL cli_session_setup(struct cli_state *cli, + const char *user, + const char *password, + const char *domain) +{ + union smb_sesssetup setup; + NTSTATUS status; + TALLOC_CTX *mem_ctx; + + cli->session = cli_session_init(cli->transport); + if (!cli->session) return False; + + mem_ctx = talloc_init("cli_session_setup"); + if (!mem_ctx) return False; + + setup.generic.level = RAW_SESSSETUP_GENERIC; + setup.generic.in.sesskey = cli->transport->negotiate.sesskey; + setup.generic.in.capabilities = CAP_UNICODE | CAP_STATUS32 | + CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | + CAP_W2K_SMBS | CAP_LARGE_READX | CAP_LARGE_WRITEX; + setup.generic.in.password = password; + setup.generic.in.user = user; + setup.generic.in.domain = domain; + + status = smb_raw_session_setup(cli->session, mem_ctx, &setup); + + cli->session->vuid = setup.generic.out.vuid; + + talloc_destroy(mem_ctx); + + return NT_STATUS_IS_OK(status); +} + +/* wrapper around smb_tree_connect() */ +BOOL cli_send_tconX(struct cli_state *cli, const char *sharename, const char *devtype, + const char *password) +{ + union smb_tcon tcon; + TALLOC_CTX *mem_ctx; + NTSTATUS status; + + cli->tree = cli_tree_init(cli->session); + if (!cli->tree) return False; + + cli->tree->reference_count++; + + /* setup a tree connect */ + tcon.generic.level = RAW_TCON_TCONX; + tcon.tconx.in.flags = 0; + tcon.tconx.in.password = data_blob(password, strlen(password)+1); + tcon.tconx.in.path = sharename; + tcon.tconx.in.device = devtype; + + mem_ctx = talloc_init("tcon"); + if (!mem_ctx) { + return False; + } + + status = smb_tree_connect(cli->tree, mem_ctx, &tcon); + + cli->tree->tid = tcon.tconx.out.cnum; + + talloc_destroy(mem_ctx); + + return NT_STATUS_IS_OK(status); +} + + +/* + easy way to get to a fully connected cli_state in one call +*/ +NTSTATUS cli_full_connection(struct cli_state **ret_cli, + const char *myname, + const char *host, + struct in_addr *ip, + const char *sharename, + const char *devtype, + const char *username, + const char *domain, + const char *password, + uint_t flags, + BOOL *retry) +{ + struct cli_tree *tree; + NTSTATUS status; + + *ret_cli = NULL; + + status = cli_tree_full_connection(&tree, myname, host, 0, sharename, devtype, + username, domain, password); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + (*ret_cli) = cli_state_init(); + + (*ret_cli)->tree = tree; + (*ret_cli)->session = tree->session; + (*ret_cli)->transport = tree->session->transport; + tree->reference_count++; + + return status; +} + + +/* + disconnect the tree +*/ +BOOL cli_tdis(struct cli_state *cli) +{ + NTSTATUS status; + status = smb_tree_disconnect(cli->tree); + return NT_STATUS_IS_OK(status); +} + +/**************************************************************************** + Initialise a client state structure. +****************************************************************************/ +struct cli_state *cli_state_init(void) +{ + struct cli_state *cli; + TALLOC_CTX *mem_ctx; + + mem_ctx = talloc_init("cli_state"); + if (!mem_ctx) return NULL; + + cli = talloc_zero(mem_ctx, sizeof(*cli)); + cli->mem_ctx = mem_ctx; + + return cli; +} + +/**************************************************************************** + Shutdown a client structure. +****************************************************************************/ +void cli_shutdown(struct cli_state *cli) +{ + if (!cli) return; + cli->tree->reference_count++; + cli_tree_close(cli->tree); + if (cli->mem_ctx) { + talloc_destroy(cli->mem_ctx); + } +} -- cgit From 75c0125fb71b0562e7bdd85c391764796b5f12f6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Aug 2003 16:04:21 +0000 Subject: - added SMBntrename test suite - allow username of form DOMAIN\username or DOMAIN/username - added ntrename to gentest (This used to be commit 2b464472c17b791eb5b117f89d5aaea2bf60f6ad) --- source4/libcli/cliconnect.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index da8a842dae..03112176d4 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -146,13 +146,24 @@ NTSTATUS cli_full_connection(struct cli_state **ret_cli, { struct cli_tree *tree; NTSTATUS status; + char *p; + TALLOC_CTX *mem_ctx; + + mem_ctx = talloc_init("cli_full_connection"); *ret_cli = NULL; + /* if the username is of the form DOMAIN\username then split out the domain */ + p = strpbrk(username, "\\/"); + if (p) { + domain = talloc_strndup(mem_ctx, username, PTR_DIFF(p, username)); + username = talloc_strdup(mem_ctx, p+1); + } + status = cli_tree_full_connection(&tree, myname, host, 0, sharename, devtype, username, domain, password); if (!NT_STATUS_IS_OK(status)) { - return status; + goto done; } (*ret_cli) = cli_state_init(); @@ -162,6 +173,8 @@ NTSTATUS cli_full_connection(struct cli_state **ret_cli, (*ret_cli)->transport = tree->session->transport; tree->reference_count++; +done: + talloc_destroy(mem_ctx); return status; } -- cgit From a59229614ebeb17f3e4db2edcb70b71f7bf31982 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Fri, 15 Aug 2003 21:37:42 +0000 Subject: don't dereference null pointer (This used to be commit ba5d1cde98f9146ffc889ac89ec79331e2bfae18) --- source4/libcli/cliconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 03112176d4..ea5f4e8a5d 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -211,7 +211,7 @@ struct cli_state *cli_state_init(void) ****************************************************************************/ void cli_shutdown(struct cli_state *cli) { - if (!cli) return; + if (!cli || !cli->tree) return; cli->tree->reference_count++; cli_tree_close(cli->tree); if (cli->mem_ctx) { -- cgit From 4809559c6450d0768a6b03681098286e3d5294da Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Fri, 15 Aug 2003 23:57:05 +0000 Subject: don't leak memory if cli->tree is NULL (This used to be commit b034c4b86e2faddf0928810a3e56c03d6aaef9f5) --- source4/libcli/cliconnect.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index ea5f4e8a5d..4fdffa6287 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -211,9 +211,11 @@ struct cli_state *cli_state_init(void) ****************************************************************************/ void cli_shutdown(struct cli_state *cli) { - if (!cli || !cli->tree) return; - cli->tree->reference_count++; - cli_tree_close(cli->tree); + if (!cli) return; + if (cli->tree) { + cli->tree->reference_count++; + cli_tree_close(cli->tree); + } if (cli->mem_ctx) { talloc_destroy(cli->mem_ctx); } -- cgit From 9a6388179b9c4e13238ed91aebaca9b15e02408f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 10 Feb 2004 11:33:35 +0000 Subject: Convert libcli routines to return NTSTATUS instead of BOOL. Again, the only users are smbclient and smbtorture. (This used to be commit 54cb508c78e5c1faa3ade46b46b165983c880d10) --- source4/libcli/cliconnect.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 4fdffa6287..e2d9665792 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -53,28 +53,26 @@ BOOL cli_transport_establish(struct cli_state *cli, } /* wrapper around smb_raw_negotiate() */ -BOOL cli_negprot(struct cli_state *cli) +NTSTATUS cli_negprot(struct cli_state *cli) { - NTSTATUS status; - status = smb_raw_negotiate(cli->transport); - return NT_STATUS_IS_OK(status); + return smb_raw_negotiate(cli->transport); } /* wrapper around smb_raw_session_setup() */ -BOOL cli_session_setup(struct cli_state *cli, - const char *user, - const char *password, - const char *domain) +NTSTATUS cli_session_setup(struct cli_state *cli, + const char *user, + const char *password, + const char *domain) { union smb_sesssetup setup; NTSTATUS status; TALLOC_CTX *mem_ctx; cli->session = cli_session_init(cli->transport); - if (!cli->session) return False; + if (!cli->session) return NT_STATUS_UNSUCCESSFUL; mem_ctx = talloc_init("cli_session_setup"); - if (!mem_ctx) return False; + if (!mem_ctx) return NT_STATUS_NO_MEMORY; setup.generic.level = RAW_SESSSETUP_GENERIC; setup.generic.in.sesskey = cli->transport->negotiate.sesskey; @@ -91,19 +89,19 @@ BOOL cli_session_setup(struct cli_state *cli, talloc_destroy(mem_ctx); - return NT_STATUS_IS_OK(status); + return status; } /* wrapper around smb_tree_connect() */ -BOOL cli_send_tconX(struct cli_state *cli, const char *sharename, const char *devtype, - const char *password) +NTSTATUS cli_send_tconX(struct cli_state *cli, const char *sharename, + const char *devtype, const char *password) { union smb_tcon tcon; TALLOC_CTX *mem_ctx; NTSTATUS status; cli->tree = cli_tree_init(cli->session); - if (!cli->tree) return False; + if (!cli->tree) return NT_STATUS_UNSUCCESSFUL; cli->tree->reference_count++; @@ -115,9 +113,8 @@ BOOL cli_send_tconX(struct cli_state *cli, const char *sharename, const char *de tcon.tconx.in.device = devtype; mem_ctx = talloc_init("tcon"); - if (!mem_ctx) { - return False; - } + if (!mem_ctx) + return NT_STATUS_NO_MEMORY; status = smb_tree_connect(cli->tree, mem_ctx, &tcon); @@ -125,7 +122,7 @@ BOOL cli_send_tconX(struct cli_state *cli, const char *sharename, const char *de talloc_destroy(mem_ctx); - return NT_STATUS_IS_OK(status); + return status; } @@ -182,11 +179,9 @@ done: /* disconnect the tree */ -BOOL cli_tdis(struct cli_state *cli) +NTSTATUS cli_tdis(struct cli_state *cli) { - NTSTATUS status; - status = smb_tree_disconnect(cli->tree); - return NT_STATUS_IS_OK(status); + return smb_tree_disconnect(cli->tree); } /**************************************************************************** -- cgit From efb010202f8c2edb35ab6fbbb57650140c21734a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 10 Jul 2004 10:24:58 +0000 Subject: r1429: enable spnego in smbclient too. metze (This used to be commit ae2e6b58629397d75a3e446ff0c50b594d029206) --- source4/libcli/cliconnect.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index e2d9665792..8b064f161e 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -76,12 +76,17 @@ NTSTATUS cli_session_setup(struct cli_state *cli, setup.generic.level = RAW_SESSSETUP_GENERIC; setup.generic.in.sesskey = cli->transport->negotiate.sesskey; - setup.generic.in.capabilities = CAP_UNICODE | CAP_STATUS32 | - CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | - CAP_W2K_SMBS | CAP_LARGE_READX | CAP_LARGE_WRITEX; - setup.generic.in.password = password; - setup.generic.in.user = user; - setup.generic.in.domain = domain; + setup.generic.in.capabilities = cli->transport->negotiate.capabilities; + if (!user || !user[0]) { + setup.generic.in.password = NULL; + setup.generic.in.user = ""; + setup.generic.in.domain = ""; + setup.generic.in.capabilities &= ~CAP_EXTENDED_SECURITY; + } else { + setup.generic.in.password = password; + setup.generic.in.user = user; + setup.generic.in.domain = domain; + } status = smb_raw_session_setup(cli->session, mem_ctx, &setup); -- cgit From c5fbb6f23c2d399c7510bc552cdb1a27b1ef66a8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 4 Aug 2004 13:23:35 +0000 Subject: r1654: rename cli_ -> smbcli_ rename CLI_ -> SMBCLI_ metze (This used to be commit 8441750fd9427dd6fe477f27e603821b4026f038) --- source4/libcli/cliconnect.c | 58 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 8b064f161e..8753f26b5f 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -21,45 +21,45 @@ #include "includes.h" /* - wrapper around cli_sock_connect() + wrapper around smbcli_sock_connect() */ -BOOL cli_socket_connect(struct cli_state *cli, const char *server, struct in_addr *ip) +BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server, struct in_addr *ip) { - struct cli_socket *sock; + struct smbcli_socket *sock; - sock = cli_sock_init(); + sock = smbcli_sock_init(); if (!sock) return False; - if (!cli_sock_connect_byname(sock, server, 0)) { - cli_sock_close(sock); + if (!smbcli_sock_connect_byname(sock, server, 0)) { + smbcli_sock_close(sock); return False; } - cli->transport = cli_transport_init(sock); + cli->transport = smbcli_transport_init(sock); if (!cli->transport) { - cli_sock_close(sock); + smbcli_sock_close(sock); return False; } return True; } -/* wrapper around cli_transport_connect() */ -BOOL cli_transport_establish(struct cli_state *cli, +/* wrapper around smbcli_transport_connect() */ +BOOL smbcli_transport_establish(struct smbcli_state *cli, struct nmb_name *calling, struct nmb_name *called) { - return cli_transport_connect(cli->transport, calling, called); + return smbcli_transport_connect(cli->transport, calling, called); } /* wrapper around smb_raw_negotiate() */ -NTSTATUS cli_negprot(struct cli_state *cli) +NTSTATUS smbcli_negprot(struct smbcli_state *cli) { return smb_raw_negotiate(cli->transport); } /* wrapper around smb_raw_session_setup() */ -NTSTATUS cli_session_setup(struct cli_state *cli, +NTSTATUS smbcli_session_setup(struct smbcli_state *cli, const char *user, const char *password, const char *domain) @@ -68,10 +68,10 @@ NTSTATUS cli_session_setup(struct cli_state *cli, NTSTATUS status; TALLOC_CTX *mem_ctx; - cli->session = cli_session_init(cli->transport); + cli->session = smbcli_session_init(cli->transport); if (!cli->session) return NT_STATUS_UNSUCCESSFUL; - mem_ctx = talloc_init("cli_session_setup"); + mem_ctx = talloc_init("smbcli_session_setup"); if (!mem_ctx) return NT_STATUS_NO_MEMORY; setup.generic.level = RAW_SESSSETUP_GENERIC; @@ -98,14 +98,14 @@ NTSTATUS cli_session_setup(struct cli_state *cli, } /* wrapper around smb_tree_connect() */ -NTSTATUS cli_send_tconX(struct cli_state *cli, const char *sharename, +NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, const char *devtype, const char *password) { union smb_tcon tcon; TALLOC_CTX *mem_ctx; NTSTATUS status; - cli->tree = cli_tree_init(cli->session); + cli->tree = smbcli_tree_init(cli->session); if (!cli->tree) return NT_STATUS_UNSUCCESSFUL; cli->tree->reference_count++; @@ -132,9 +132,9 @@ NTSTATUS cli_send_tconX(struct cli_state *cli, const char *sharename, /* - easy way to get to a fully connected cli_state in one call + easy way to get to a fully connected smbcli_state in one call */ -NTSTATUS cli_full_connection(struct cli_state **ret_cli, +NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli, const char *myname, const char *host, struct in_addr *ip, @@ -146,12 +146,12 @@ NTSTATUS cli_full_connection(struct cli_state **ret_cli, uint_t flags, BOOL *retry) { - struct cli_tree *tree; + struct smbcli_tree *tree; NTSTATUS status; char *p; TALLOC_CTX *mem_ctx; - mem_ctx = talloc_init("cli_full_connection"); + mem_ctx = talloc_init("smbcli_full_connection"); *ret_cli = NULL; @@ -162,13 +162,13 @@ NTSTATUS cli_full_connection(struct cli_state **ret_cli, username = talloc_strdup(mem_ctx, p+1); } - status = cli_tree_full_connection(&tree, myname, host, 0, sharename, devtype, + status = smbcli_tree_full_connection(&tree, myname, host, 0, sharename, devtype, username, domain, password); if (!NT_STATUS_IS_OK(status)) { goto done; } - (*ret_cli) = cli_state_init(); + (*ret_cli) = smbcli_state_init(); (*ret_cli)->tree = tree; (*ret_cli)->session = tree->session; @@ -184,7 +184,7 @@ done: /* disconnect the tree */ -NTSTATUS cli_tdis(struct cli_state *cli) +NTSTATUS smbcli_tdis(struct smbcli_state *cli) { return smb_tree_disconnect(cli->tree); } @@ -192,12 +192,12 @@ NTSTATUS cli_tdis(struct cli_state *cli) /**************************************************************************** Initialise a client state structure. ****************************************************************************/ -struct cli_state *cli_state_init(void) +struct smbcli_state *smbcli_state_init(void) { - struct cli_state *cli; + struct smbcli_state *cli; TALLOC_CTX *mem_ctx; - mem_ctx = talloc_init("cli_state"); + mem_ctx = talloc_init("smbcli_state"); if (!mem_ctx) return NULL; cli = talloc_zero(mem_ctx, sizeof(*cli)); @@ -209,12 +209,12 @@ struct cli_state *cli_state_init(void) /**************************************************************************** Shutdown a client structure. ****************************************************************************/ -void cli_shutdown(struct cli_state *cli) +void smbcli_shutdown(struct smbcli_state *cli) { if (!cli) return; if (cli->tree) { cli->tree->reference_count++; - cli_tree_close(cli->tree); + smbcli_tree_close(cli->tree); } if (cli->mem_ctx) { talloc_destroy(cli->mem_ctx); -- cgit From 1129c7808354dc04f7725be505fd23c0bf11a29d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 18 Aug 2004 20:13:08 +0000 Subject: r1897: added a choose_called_name() function that allows us to more sanely handle connections using the IP as the server name, while not trying for NBT name resolution on names like "192" and "192.168.1.2". also removed the ip address argument to smbcli_socket_connect() as it isn't used and doesn't really make sense. (This used to be commit 2ce4028842556328da4da0de9bee942bed02cc62) --- source4/libcli/cliconnect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 8753f26b5f..14f7d5a1b3 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -23,7 +23,7 @@ /* wrapper around smbcli_sock_connect() */ -BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server, struct in_addr *ip) +BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server) { struct smbcli_socket *sock; @@ -163,7 +163,7 @@ NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli, } status = smbcli_tree_full_connection(&tree, myname, host, 0, sharename, devtype, - username, domain, password); + username, domain, password); if (!NT_STATUS_IS_OK(status)) { goto done; } -- cgit From b7e1ea20dc873a753ff64653987130f03897a4e9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 21 Aug 2004 07:43:29 +0000 Subject: r1985: take advantage of the new talloc in a few more places (This used to be commit 6ffdfd779936ce8c5ca49c5f444e8da2bbeee0a8) --- source4/libcli/cliconnect.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 14f7d5a1b3..d89925eda5 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -195,13 +195,11 @@ NTSTATUS smbcli_tdis(struct smbcli_state *cli) struct smbcli_state *smbcli_state_init(void) { struct smbcli_state *cli; - TALLOC_CTX *mem_ctx; - - mem_ctx = talloc_init("smbcli_state"); - if (!mem_ctx) return NULL; - cli = talloc_zero(mem_ctx, sizeof(*cli)); - cli->mem_ctx = mem_ctx; + cli = talloc_named(NULL, sizeof(*cli), "smbcli_state"); + if (cli) { + ZERO_STRUCTP(cli); + } return cli; } @@ -216,7 +214,5 @@ void smbcli_shutdown(struct smbcli_state *cli) cli->tree->reference_count++; smbcli_tree_close(cli->tree); } - if (cli->mem_ctx) { - talloc_destroy(cli->mem_ctx); - } + talloc_free(cli); } -- cgit From 8293df91bcec574fb4a2b290cc11dd83353264ae Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 8 Sep 2004 00:00:56 +0000 Subject: r2247: talloc_destroy -> talloc_free (This used to be commit 6c1a72c5d667245b1eec94f58e68acd22dd720ce) --- source4/libcli/cliconnect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index d89925eda5..220a450433 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -92,7 +92,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, cli->session->vuid = setup.generic.out.vuid; - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return status; } @@ -125,7 +125,7 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, cli->tree->tid = tcon.tconx.out.cnum; - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return status; } @@ -176,7 +176,7 @@ NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli, tree->reference_count++; done: - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return status; } -- cgit From ed4d10fb43ea462500dbaf690b8e04d910bfac4e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Sep 2004 04:41:17 +0000 Subject: r2463: make sure we don't send the password in a tconx unless we really have to (This used to be commit 3e84c06f4c76d62f4f2606b457d9a76b6c1a061d) --- source4/libcli/cliconnect.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 220a450433..f25f29f86e 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -99,7 +99,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, /* wrapper around smb_tree_connect() */ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, - const char *devtype, const char *password) + const char *devtype, const char *password) { union smb_tcon tcon; TALLOC_CTX *mem_ctx; @@ -110,17 +110,25 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, cli->tree->reference_count++; + mem_ctx = talloc_init("tcon"); + if (!mem_ctx) { + return NT_STATUS_NO_MEMORY; + } + /* setup a tree connect */ tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; - tcon.tconx.in.password = data_blob(password, strlen(password)+1); + if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) { + tcon.tconx.in.password = data_blob(NULL, 0); + } else if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) { + tcon.tconx.in.password = data_blob_talloc(mem_ctx, NULL, 16); + E_md4hash(password, tcon.tconx.in.password.data); + } else { + tcon.tconx.in.password = data_blob_talloc(mem_ctx, password, strlen(password)+1); + } tcon.tconx.in.path = sharename; tcon.tconx.in.device = devtype; - mem_ctx = talloc_init("tcon"); - if (!mem_ctx) - return NT_STATUS_NO_MEMORY; - status = smb_tree_connect(cli->tree, mem_ctx, &tcon); cli->tree->tid = tcon.tconx.out.cnum; -- cgit From 1d2611df82e80d7b5af7f75ffd66ce18ea68858e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 22 Sep 2004 05:13:00 +0000 Subject: r2494: fixed connecting to a share mode server (tested and really works now) (This used to be commit 25f725c9be8fe5a7fd85488214b598bc431d4c7f) --- source4/libcli/cliconnect.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index f25f29f86e..66882f605d 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -83,7 +83,11 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, setup.generic.in.domain = ""; setup.generic.in.capabilities &= ~CAP_EXTENDED_SECURITY; } else { - setup.generic.in.password = password; + if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) { + setup.generic.in.password = password; + } else { + setup.generic.in.password = NULL; + } setup.generic.in.user = user; setup.generic.in.domain = domain; } @@ -121,8 +125,11 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) { tcon.tconx.in.password = data_blob(NULL, 0); } else if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) { - tcon.tconx.in.password = data_blob_talloc(mem_ctx, NULL, 16); - E_md4hash(password, tcon.tconx.in.password.data); + tcon.tconx.in.password = data_blob_talloc(mem_ctx, NULL, 24); + if (cli->transport->negotiate.secblob.length < 8) { + return NT_STATUS_INVALID_PARAMETER; + } + SMBencrypt(password, cli->transport->negotiate.secblob.data, tcon.tconx.in.password.data); } else { tcon.tconx.in.password = data_blob_talloc(mem_ctx, password, strlen(password)+1); } -- cgit From 3ea916b2278c202c99c80c02e80e588bd7daedb8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 26 Sep 2004 06:44:08 +0000 Subject: r2654: fixed some more server memory leaks. We are now down to a single leak of 16 bytes, caused by the 16 byte data_blob in the smb_signing code. (This used to be commit 2f1b788e09686e065d22f621f5c0c585192c6740) --- source4/libcli/cliconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 66882f605d..27caaa9df9 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -211,7 +211,7 @@ struct smbcli_state *smbcli_state_init(void) { struct smbcli_state *cli; - cli = talloc_named(NULL, sizeof(*cli), "smbcli_state"); + cli = talloc_p(NULL, struct smbcli_state); if (cli) { ZERO_STRUCTP(cli); } -- cgit From e3880fa759cfa03222262327854fe7bbe585fe01 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 26 Sep 2004 11:30:20 +0000 Subject: r2660: - converted the libcli/raw/ library to use talloc_increase_ref_count() rather than manual reference counts - properly support SMBexit in the cifs and posix backends - added a logoff method to all backends With these changes the RAW-CONTEXT test now passes against the posix backend (This used to be commit c315d6ac1cc40546fde1474702a6d66d07ee13c8) --- source4/libcli/cliconnect.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 27caaa9df9..f772070305 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -31,13 +31,13 @@ BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server) if (!sock) return False; if (!smbcli_sock_connect_byname(sock, server, 0)) { - smbcli_sock_close(sock); + talloc_free(sock); return False; } cli->transport = smbcli_transport_init(sock); if (!cli->transport) { - smbcli_sock_close(sock); + talloc_free(sock); return False; } @@ -112,8 +112,6 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, cli->tree = smbcli_tree_init(cli->session); if (!cli->tree) return NT_STATUS_UNSUCCESSFUL; - cli->tree->reference_count++; - mem_ctx = talloc_init("tcon"); if (!mem_ctx) { return NT_STATUS_NO_MEMORY; @@ -188,7 +186,6 @@ NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli, (*ret_cli)->tree = tree; (*ret_cli)->session = tree->session; (*ret_cli)->transport = tree->session->transport; - tree->reference_count++; done: talloc_free(mem_ctx); @@ -225,9 +222,6 @@ struct smbcli_state *smbcli_state_init(void) void smbcli_shutdown(struct smbcli_state *cli) { if (!cli) return; - if (cli->tree) { - cli->tree->reference_count++; - smbcli_tree_close(cli->tree); - } + talloc_free(cli->tree); talloc_free(cli); } -- cgit From aa12305945df5f1578250b56ae2f3653b051736f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Sep 2004 08:41:39 +0000 Subject: r2680: switched the libcli/raw/ code over to use talloc_reference(), which simplifies things quite a bit (This used to be commit c82a9cf750829c4f6982ca3133295c8599023c4e) --- source4/libcli/cliconnect.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index f772070305..aa6aec4a1e 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -36,8 +36,8 @@ BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server) } cli->transport = smbcli_transport_init(sock); + talloc_free(sock); if (!cli->transport) { - talloc_free(sock); return False; } @@ -60,9 +60,9 @@ NTSTATUS smbcli_negprot(struct smbcli_state *cli) /* wrapper around smb_raw_session_setup() */ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, - const char *user, - const char *password, - const char *domain) + const char *user, + const char *password, + const char *domain) { union smb_sesssetup setup; NTSTATUS status; @@ -70,6 +70,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, cli->session = smbcli_session_init(cli->transport); if (!cli->session) return NT_STATUS_UNSUCCESSFUL; + talloc_free(cli->transport); mem_ctx = talloc_init("smbcli_session_setup"); if (!mem_ctx) return NT_STATUS_NO_MEMORY; @@ -110,6 +111,7 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, NTSTATUS status; cli->tree = smbcli_tree_init(cli->session); + talloc_free(cli->session); if (!cli->tree) return NT_STATUS_UNSUCCESSFUL; mem_ctx = talloc_init("tcon"); @@ -183,7 +185,8 @@ NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli, (*ret_cli) = smbcli_state_init(); - (*ret_cli)->tree = tree; + (*ret_cli)->tree = talloc_reference(*ret_cli, tree); + talloc_free(tree); (*ret_cli)->session = tree->session; (*ret_cli)->transport = tree->session->transport; @@ -221,7 +224,5 @@ struct smbcli_state *smbcli_state_init(void) ****************************************************************************/ void smbcli_shutdown(struct smbcli_state *cli) { - if (!cli) return; - talloc_free(cli->tree); talloc_free(cli); } -- cgit From b2f1a29e4348a5bc34a87d72d526e23e421ed9d5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Sep 2004 05:44:59 +0000 Subject: r2710: continue with the new style of providing a parent context whenever possible to a structure creation routine. This makes for much easier global cleanup. (This used to be commit e14ee428ec357fab76a960387a9820a673786e27) --- source4/libcli/cliconnect.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index aa6aec4a1e..8e7e128a4e 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -27,7 +27,7 @@ BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server) { struct smbcli_socket *sock; - sock = smbcli_sock_init(); + sock = smbcli_sock_init(cli); if (!sock) return False; if (!smbcli_sock_connect_byname(sock, server, 0)) { @@ -149,17 +149,18 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, /* easy way to get to a fully connected smbcli_state in one call */ -NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli, - const char *myname, - const char *host, - struct in_addr *ip, - const char *sharename, - const char *devtype, - const char *username, - const char *domain, - const char *password, - uint_t flags, - BOOL *retry) +NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, + struct smbcli_state **ret_cli, + const char *myname, + const char *host, + struct in_addr *ip, + const char *sharename, + const char *devtype, + const char *username, + const char *domain, + const char *password, + uint_t flags, + BOOL *retry) { struct smbcli_tree *tree; NTSTATUS status; @@ -177,21 +178,23 @@ NTSTATUS smbcli_full_connection(struct smbcli_state **ret_cli, username = talloc_strdup(mem_ctx, p+1); } - status = smbcli_tree_full_connection(&tree, myname, host, 0, sharename, devtype, + status = smbcli_tree_full_connection(parent_ctx, + &tree, myname, host, 0, sharename, devtype, username, domain, password); if (!NT_STATUS_IS_OK(status)) { goto done; } - (*ret_cli) = smbcli_state_init(); + (*ret_cli) = smbcli_state_init(parent_ctx); - (*ret_cli)->tree = talloc_reference(*ret_cli, tree); - talloc_free(tree); + (*ret_cli)->tree = tree; (*ret_cli)->session = tree->session; (*ret_cli)->transport = tree->session->transport; - + talloc_steal(*ret_cli, tree->session->transport->socket); + done: talloc_free(mem_ctx); + return status; } @@ -207,11 +210,11 @@ NTSTATUS smbcli_tdis(struct smbcli_state *cli) /**************************************************************************** Initialise a client state structure. ****************************************************************************/ -struct smbcli_state *smbcli_state_init(void) +struct smbcli_state *smbcli_state_init(TALLOC_CTX *mem_ctx) { struct smbcli_state *cli; - cli = talloc_p(NULL, struct smbcli_state); + cli = talloc_p(mem_ctx, struct smbcli_state); if (cli) { ZERO_STRUCTP(cli); } -- cgit From 9f1210a243654fd6d94acdef83f468a33c1b3b3f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2004 01:03:22 +0000 Subject: r3419: moved the libcli/raw structures into libcli/raw/libcliraw.h and made them private (This used to be commit 386ac565c452ede1d74e06acb401ca9db99d3ff3) --- source4/libcli/cliconnect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 8e7e128a4e..c3bc43aa8c 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "libcli/raw/libcliraw.h" /* wrapper around smbcli_sock_connect() -- cgit From 284349482f5293a9a23d0f72d7c2aab46b55843b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2004 22:48:25 +0000 Subject: r3443: the next stage in the include files re-organisation. I have created the include/system/ directory, which will contain the wrappers for the system includes for logical subsystems. So far I have created include/system/kerberos.h and include/system/network.h, which contain all the system includes for kerberos code and networking code. These are the included in subsystems that need kerberos or networking respectively. Note that this method avoids the mess of #ifdef HAVE_XXX_H in every C file, instead each C module includes the include/system/XXX.h file for the logical system support it needs, and the details are kept isolated in include/system/ This patch also creates a "struct ipv4_addr" which replaces "struct in_addr" in our code. That avoids every C file needing to import all the system networking headers. (This used to be commit 2e25c71853f8996f73755277e448e7d670810349) --- source4/libcli/cliconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index c3bc43aa8c..2949633b86 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -154,7 +154,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, struct smbcli_state **ret_cli, const char *myname, const char *host, - struct in_addr *ip, + struct ipv4_addr *ip, const char *sharename, const char *devtype, const char *username, -- cgit From edbfc0f6e70150e321822365bf0eead2821551bd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Nov 2004 02:57:18 +0000 Subject: r3453: - split out the auth and popt includes - tidied up some of the system includes - moved a few more structures back from misc.idl to netlogon.idl and samr.idl now that pidl knows about inter-IDL dependencies (This used to be commit 7b7477ac42d96faac1b0ff361525d2c63cedfc64) --- source4/libcli/cliconnect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 2949633b86..2c66a1b5b3 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "system/filesys.h" #include "libcli/raw/libcliraw.h" /* -- cgit From ad3ee0a81c4b2bf2ae67ba461e936f7777584345 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 6 Dec 2004 07:12:38 +0000 Subject: r4073: - added a set of lsa helper routines to make lsa lookups that are related to filesharing. For example, in order to manipulate ACLs properly its important to be able to call LookupSids, and to be able to lookup what privileges a SID has. - added 3 new commands to smbclient "lookupname", "lookupsid" and "privileges" (This used to be commit 8780c40f0539da72652d17455e98fcaee6d197d1) --- source4/libcli/cliconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 2c66a1b5b3..6185ba7b7d 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -216,7 +216,7 @@ struct smbcli_state *smbcli_state_init(TALLOC_CTX *mem_ctx) { struct smbcli_state *cli; - cli = talloc_p(mem_ctx, struct smbcli_state); + cli = talloc_zero_p(mem_ctx, struct smbcli_state); if (cli) { ZERO_STRUCTP(cli); } -- cgit From 592fce7fb149ca5e82b14d9c8f13a4da1babe2b7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 13 Jan 2005 18:49:10 +0000 Subject: r4726: - use the name tcon and tid instead of conn and cnum - make use of talloc destructors metze (This used to be commit 8308da6ce4a95f8c10e22949ef00e9e64f2dbb85) --- source4/libcli/cliconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 6185ba7b7d..a0ba5ae0a1 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -140,7 +140,7 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, status = smb_tree_connect(cli->tree, mem_ctx, &tcon); - cli->tree->tid = tcon.tconx.out.cnum; + cli->tree->tid = tcon.tconx.out.tid; talloc_free(mem_ctx); -- cgit From 61a3d370b98ca4b75cd61e22f0d6b0f3fb7561b3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 15 Jan 2005 11:58:52 +0000 Subject: r4758: - added async support to the session request code - added async support to the negprot client code - removed two unused parameters from smbcli_full_connection() code - converted smbclient to use smbcli_full_connection() rather than reinventing everything itself (This used to be commit 71cbe2873473e039b4511511302cb63f1c50bce8) --- source4/libcli/cliconnect.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index a0ba5ae0a1..4d46d1d23c 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -57,7 +57,7 @@ BOOL smbcli_transport_establish(struct smbcli_state *cli, /* wrapper around smb_raw_negotiate() */ NTSTATUS smbcli_negprot(struct smbcli_state *cli) { - return smb_raw_negotiate(cli->transport); + return smb_raw_negotiate(cli->transport, lp_maxprotocol()); } /* wrapper around smb_raw_session_setup() */ @@ -155,14 +155,11 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, struct smbcli_state **ret_cli, const char *myname, const char *host, - struct ipv4_addr *ip, const char *sharename, const char *devtype, const char *username, const char *domain, - const char *password, - uint_t flags, - BOOL *retry) + const char *password) { struct smbcli_tree *tree; NTSTATUS status; @@ -231,3 +228,31 @@ void smbcli_shutdown(struct smbcli_state *cli) { talloc_free(cli); } + +/* + parse a //server/share type UNC name +*/ +BOOL smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, + const char **hostname, const char **sharename) +{ + char *p; + + if (strncmp(unc_name, "\\\\", 2) && + strncmp(unc_name, "//", 2)) { + return False; + } + + *hostname = talloc_strdup(mem_ctx, &unc_name[2]); + p = strchr_m(&(*hostname)[2],'/'); + if (!p) { + p = strchr_m(&(*hostname)[2],'\\'); + if (!p) return False; + } + *p = 0; + *sharename = talloc_strdup(mem_ctx, p+1); + + return True; +} + + + -- cgit From 7cbc768376ed0a839afca64aeea99cd53d0fbc6f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 16 Jan 2005 11:15:08 +0000 Subject: r4777: added a smb_composite_sesssetup() async composite function. This encapsulates all the different session setup methods, including the multi-pass spnego code. I have hooked this into all the places that previously used the RAW_SESSSETUP_GENERIC method, and have removed the old RAW_SESSSETUP_GENERIC code from clisession.c and clitree.c. A nice side effect is that these two modules are now very simple again, back to being "raw" session setup handling, which was what was originally intended. I have also used this to replace the session setup code in the smb_composite_connect() code, and used that to build a very simple replacement for smbcli_tree_full_connection(). As a result, smbclient, smbtorture and all our other SMB connection code now goes via these composite async functions. That should give them a good workout! (This used to be commit 080d0518bc7d6fd4bc3ef783e7d4d2e3275d0799) --- source4/libcli/cliconnect.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 4d46d1d23c..0f916d1eb1 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -21,6 +21,7 @@ #include "includes.h" #include "system/filesys.h" #include "libcli/raw/libcliraw.h" +#include "libcli/composite/composite.h" /* wrapper around smbcli_sock_connect() @@ -66,7 +67,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, const char *password, const char *domain) { - union smb_sesssetup setup; + struct smb_composite_sesssetup setup; NTSTATUS status; TALLOC_CTX *mem_ctx; @@ -77,27 +78,26 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, mem_ctx = talloc_init("smbcli_session_setup"); if (!mem_ctx) return NT_STATUS_NO_MEMORY; - setup.generic.level = RAW_SESSSETUP_GENERIC; - setup.generic.in.sesskey = cli->transport->negotiate.sesskey; - setup.generic.in.capabilities = cli->transport->negotiate.capabilities; + setup.in.sesskey = cli->transport->negotiate.sesskey; + setup.in.capabilities = cli->transport->negotiate.capabilities; if (!user || !user[0]) { - setup.generic.in.password = NULL; - setup.generic.in.user = ""; - setup.generic.in.domain = ""; - setup.generic.in.capabilities &= ~CAP_EXTENDED_SECURITY; + setup.in.password = NULL; + setup.in.user = ""; + setup.in.domain = ""; + setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; } else { if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) { - setup.generic.in.password = password; + setup.in.password = password; } else { - setup.generic.in.password = NULL; + setup.in.password = NULL; } - setup.generic.in.user = user; - setup.generic.in.domain = domain; + setup.in.user = user; + setup.in.domain = domain; } - status = smb_raw_session_setup(cli->session, mem_ctx, &setup); + status = smb_composite_sesssetup(cli->session, &setup); - cli->session->vuid = setup.generic.out.vuid; + cli->session->vuid = setup.out.vuid; talloc_free(mem_ctx); -- cgit From 2383787f199c51cdc202a3cef5822a9fe6b8774c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 21 Jan 2005 11:18:56 +0000 Subject: r4891: - added a generic resolve_name() async interface in libcli/resolve/, which will eventually try all resolution methods setup in smb.conf - only resolution backend at the moment is bcast, which does a parallel broadcast to all configured network interfaces, and takes the first reply that comes in (this nicely demonstrates how to do parallel requests using the async APIs) - converted all the existing code to use the new resolve_name() api - removed all the old nmb code (yay!) (This used to be commit 239c310f255e43dd2d1c2433f666c9faaacbdce3) --- source4/libcli/cliconnect.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 0f916d1eb1..aaed36eb05 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -1,7 +1,9 @@ /* Unix SMB/CIFS implementation. + client connect/disconnect routines - Copyright (C) Andrew Tridgell 2003 + + Copyright (C) Andrew Tridgell 2003-2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,8 +51,8 @@ BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server) /* wrapper around smbcli_transport_connect() */ BOOL smbcli_transport_establish(struct smbcli_state *cli, - struct nmb_name *calling, - struct nmb_name *called) + struct nbt_name *calling, + struct nbt_name *called) { return smbcli_transport_connect(cli->transport, calling, called); } -- cgit From 9d6e923aab2036d6ce72e31aa4633d55b5991558 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 23 Jan 2005 09:01:46 +0000 Subject: r4938: allow the caller to supply an existing event_context if they want to in smb_composite_connect_send(). This makes doing parallel calls much easier. (This used to be commit 442308970c123b9fb25615673049e1c1c234a0b9) --- source4/libcli/cliconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index aaed36eb05..4d9fb5ba1f 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -32,7 +32,7 @@ BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server) { struct smbcli_socket *sock; - sock = smbcli_sock_init(cli); + sock = smbcli_sock_init(cli, NULL); if (!sock) return False; if (!smbcli_sock_connect_byname(sock, server, 0)) { -- cgit From 3e44c4a3ba6acd7d9bc997c012d1863377e9d873 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 24 Jan 2005 00:57:14 +0000 Subject: r4951: some of the code dealing with libcli was getting too complex trying to handle the inverted memory hierarchy that a normal session establishment gave. The inverted hierarchy came from that fact that you first establish a socket, then a transport, then a session and finally a tree. That leads to the socket being at the top of the memory hierarchy and the tree at the bottom, which makes no sense from the users point of view, as they want to be able to free the tree and have everything disappear. The core problem was that the libcli interface didn't distinguish between establishing a primary context and a secondary context. If you establish a 2nd session on a transport then you want the transport to be referenced by the session, whereas if you establish a primary session then you want the transport to be a child of the session. To fix this I have added "parent_ctx" and "primary" arguments to the libcli intialisation functions. This makes using the library much easier, and gives us a memory hierarchy that makes much more sense. I was prompted to do this by a bug in the cifs backend, which was caused by the socket not being properly torn down on a disconnect due to the inverted memory hierarchy. (This used to be commit 5e8fd5f70178992e249805c2e1ddafaf6840739b) --- source4/libcli/cliconnect.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 4d9fb5ba1f..5aabb55f5d 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -40,8 +40,7 @@ BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server) return False; } - cli->transport = smbcli_transport_init(sock); - talloc_free(sock); + cli->transport = smbcli_transport_init(sock, cli, True); if (!cli->transport) { return False; } @@ -73,9 +72,8 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, NTSTATUS status; TALLOC_CTX *mem_ctx; - cli->session = smbcli_session_init(cli->transport); + cli->session = smbcli_session_init(cli->transport, cli, True); if (!cli->session) return NT_STATUS_UNSUCCESSFUL; - talloc_free(cli->transport); mem_ctx = talloc_init("smbcli_session_setup"); if (!mem_ctx) return NT_STATUS_NO_MEMORY; @@ -114,8 +112,7 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, TALLOC_CTX *mem_ctx; NTSTATUS status; - cli->tree = smbcli_tree_init(cli->session); - talloc_free(cli->session); + cli->tree = smbcli_tree_init(cli->session, cli, True); if (!cli->tree) return NT_STATUS_UNSUCCESSFUL; mem_ctx = talloc_init("tcon"); -- cgit From 52ad7774b5f9ff701a5b03d801a54aa7e7005640 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 24 Jan 2005 01:04:15 +0000 Subject: r4952: removed a bogus talloc_steal() that was trying to cope with the inverted memory hierarchy. Now the memory hierarchy is logical its not needed (and can cause a double free in RPC-SCHANNEL) (This used to be commit f8a950b57d7137c6fd0a77d063d946b4f9b3f014) --- source4/libcli/cliconnect.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 5aabb55f5d..354840b84c 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -188,7 +188,6 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, (*ret_cli)->tree = tree; (*ret_cli)->session = tree->session; (*ret_cli)->transport = tree->session->transport; - talloc_steal(*ret_cli, tree->session->transport->socket); done: talloc_free(mem_ctx); -- cgit From 759da3b915e2006d4c87b5ace47f399accd9ce91 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 27 Jan 2005 07:08:20 +0000 Subject: r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0) --- source4/libcli/cliconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 354840b84c..263527ffc0 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -211,7 +211,7 @@ struct smbcli_state *smbcli_state_init(TALLOC_CTX *mem_ctx) { struct smbcli_state *cli; - cli = talloc_zero_p(mem_ctx, struct smbcli_state); + cli = talloc_zero(mem_ctx, struct smbcli_state); if (cli) { ZERO_STRUCTP(cli); } -- cgit From 9515fc4406464b6a015a06d89ca0370810977486 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Feb 2005 02:08:39 +0000 Subject: r5322: removed a whole bunch of #include lines that minimal_includes.pl thinks are not needed. Now to see how this fares on the build farm :) (This used to be commit 80ffcc650c9c86141507edd8338b97814a85f868) --- source4/libcli/cliconnect.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 263527ffc0..f391b6bc0d 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -21,7 +21,6 @@ */ #include "includes.h" -#include "system/filesys.h" #include "libcli/raw/libcliraw.h" #include "libcli/composite/composite.h" -- cgit From 13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Mar 2005 23:35:58 +0000 Subject: r5929: Use cli_credentials for the SMB functions as well. Fix a couple of bugs in the new cli_credentials code (This used to be commit 4ad481cfe5cde514d2ef9646147239f3faaa6173) --- source4/libcli/cliconnect.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index f391b6bc0d..3834d49e49 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -63,9 +63,7 @@ NTSTATUS smbcli_negprot(struct smbcli_state *cli) /* wrapper around smb_raw_session_setup() */ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, - const char *user, - const char *password, - const char *domain) + struct cli_credentials *credentials) { struct smb_composite_sesssetup setup; NTSTATUS status; @@ -79,19 +77,19 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - if (!user || !user[0]) { + if (cli_credentials_is_anonymous(credentials)) { setup.in.password = NULL; setup.in.user = ""; setup.in.domain = ""; setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; } else { if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) { - setup.in.password = password; + setup.in.password = cli_credentials_get_password(credentials); } else { setup.in.password = NULL; } - setup.in.user = user; - setup.in.domain = domain; + setup.in.user = cli_credentials_get_username(credentials); + setup.in.domain = cli_credentials_get_domain(credentials); } status = smb_composite_sesssetup(cli->session, &setup); @@ -155,29 +153,19 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, const char *host, const char *sharename, const char *devtype, - const char *username, - const char *domain, - const char *password) + struct cli_credentials *credentials) { struct smbcli_tree *tree; NTSTATUS status; - char *p; TALLOC_CTX *mem_ctx; mem_ctx = talloc_init("smbcli_full_connection"); *ret_cli = NULL; - /* if the username is of the form DOMAIN\username then split out the domain */ - p = strpbrk(username, "\\/"); - if (p) { - domain = talloc_strndup(mem_ctx, username, PTR_DIFF(p, username)); - username = talloc_strdup(mem_ctx, p+1); - } - status = smbcli_tree_full_connection(parent_ctx, &tree, myname, host, 0, sharename, devtype, - username, domain, password); + credentials); if (!NT_STATUS_IS_OK(status)) { goto done; } -- cgit From 645711c602313940dcf80ec786557920ecfbf884 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 22 Mar 2005 08:00:45 +0000 Subject: r5941: Commit this patch much earlier than I would normally prefer, but metze needs a working tree... The main volume of this patch was what I started working on today: - Cleans up memory handling around DCE/RPC pipes, to have a parent talloc context. - Uses sepereate inner loops for some of the DCE/RPC tests The other and more important part of this patch fixes issues surrounding the new credentials framwork: This makes the struct cli_credentials always a talloc() structure, rather than on the stack. Parts of the cli_credentials code already assumed this. There were other issues, particularly in the DCERPC over SMB handling, as well as little things that had to be tidied up before test_w2k3.sh would start to pass. Andrew Bartlett (This used to be commit 0453f9d05d2e336fba1f85dbf2718d01fa2bf778) --- source4/libcli/cliconnect.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 3834d49e49..7459460137 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -78,11 +78,6 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; if (cli_credentials_is_anonymous(credentials)) { - setup.in.password = NULL; - setup.in.user = ""; - setup.in.domain = ""; - setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; - } else { if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) { setup.in.password = cli_credentials_get_password(credentials); } else { -- cgit From 2eb3d680625286431a3a60e37b75f47e0738f253 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 24 Mar 2005 04:14:06 +0000 Subject: r6028: A MAJOR update to intergrate the new credentails system fully with GENSEC, and to pull SCHANNEL into GENSEC, by making it less 'special'. GENSEC now no longer has it's own handling of 'set username' etc, instead it uses cli_credentials calls. In order to link the credentails code right though Samba, a lot of interfaces have changed to remove 'username, domain, password' arguments, and these have been replaced with a single 'struct cli_credentials'. In the session setup code, a new parameter 'workgroup' contains the client/server current workgroup, which seems unrelated to the authentication exchange (it was being filled in from the auth info). This allows in particular kerberos to only call back for passwords when it actually needs to perform the kinit. The kerberos code has been modified not to use the SPNEGO provided 'principal name' (in the mechListMIC), but to instead use the name the host was connected to as. This better matches Microsoft behaviour, is more secure and allows better use of standard kerberos functions. To achieve this, I made changes to our socket code so that the hostname (before name resolution) is now recorded on the socket. In schannel, most of the code from librpc/rpc/dcerpc_schannel.c is now in libcli/auth/schannel.c, and it looks much more like a standard GENSEC module. The actual sign/seal code moved to libcli/auth/schannel_sign.c in a previous commit. The schannel credentails structure is now merged with the rest of the credentails, as many of the values (username, workstation, domain) where already present there. This makes handling this in a generic manner much easier, as there is no longer a custom entry-point. The auth_domain module continues to be developed, but is now just as functional as auth_winbind. The changes here are consequential to the schannel changes. The only removed function at this point is the RPC-LOGIN test (simulating the load of a WinXP login), which needs much more work to clean it up (it contains copies of too much code from all over the torture suite, and I havn't been able to penetrate its 'structure'). Andrew Bartlett (This used to be commit 2301a4b38a21aa60917973451687063d83d18d66) --- source4/libcli/cliconnect.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 7459460137..53a97da168 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -63,7 +63,7 @@ NTSTATUS smbcli_negprot(struct smbcli_state *cli) /* wrapper around smb_raw_session_setup() */ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, - struct cli_credentials *credentials) + struct cli_credentials *credentials) { struct smb_composite_sesssetup setup; NTSTATUS status; @@ -77,15 +77,8 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - if (cli_credentials_is_anonymous(credentials)) { - if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) { - setup.in.password = cli_credentials_get_password(credentials); - } else { - setup.in.password = NULL; - } - setup.in.user = cli_credentials_get_username(credentials); - setup.in.domain = cli_credentials_get_domain(credentials); - } + setup.in.credentials = credentials; + setup.in.workgroup = lp_workgroup(); status = smb_composite_sesssetup(cli->session, &setup); @@ -144,7 +137,6 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, */ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, struct smbcli_state **ret_cli, - const char *myname, const char *host, const char *sharename, const char *devtype, @@ -159,7 +151,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, *ret_cli = NULL; status = smbcli_tree_full_connection(parent_ctx, - &tree, myname, host, 0, sharename, devtype, + &tree, host, 0, sharename, devtype, credentials); if (!NT_STATUS_IS_OK(status)) { goto done; -- cgit From 302b4db004c51700dac7714d88ca27cdafe9612f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 10 Jun 2005 07:49:00 +0000 Subject: r7455: Remove some talloc contexts that aren't used. (This used to be commit b0ad51f2ce6c3646d664773aaa32fe55172ad88b) --- source4/libcli/cliconnect.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 53a97da168..ace9389ae8 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -67,14 +67,10 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, { struct smb_composite_sesssetup setup; NTSTATUS status; - TALLOC_CTX *mem_ctx; cli->session = smbcli_session_init(cli->transport, cli, True); if (!cli->session) return NT_STATUS_UNSUCCESSFUL; - mem_ctx = talloc_init("smbcli_session_setup"); - if (!mem_ctx) return NT_STATUS_NO_MEMORY; - setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; setup.in.credentials = credentials; @@ -84,8 +80,6 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, cli->session->vuid = setup.out.vuid; - talloc_free(mem_ctx); - return status; } @@ -144,9 +138,6 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, { struct smbcli_tree *tree; NTSTATUS status; - TALLOC_CTX *mem_ctx; - - mem_ctx = talloc_init("smbcli_full_connection"); *ret_cli = NULL; @@ -164,8 +155,6 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, (*ret_cli)->transport = tree->session->transport; done: - talloc_free(mem_ctx); - return status; } -- cgit From 6412e8eeae6b4abfb65514b00c49419a7cb97b1a Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sat, 11 Jun 2005 03:35:28 +0000 Subject: r7482: Rename smbcli_send_tconX() to smbcli_tconX() so as not to get it confused with an async function. (This used to be commit 340ad67cada15329051c205c5b094ad641718c72) --- source4/libcli/cliconnect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index ace9389ae8..a866e26970 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -84,8 +84,8 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, } /* wrapper around smb_tree_connect() */ -NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename, - const char *devtype, const char *password) +NTSTATUS smbcli_tconX(struct smbcli_state *cli, const char *sharename, + const char *devtype, const char *password) { union smb_tcon tcon; TALLOC_CTX *mem_ctx; -- cgit From af237084ecd4f9928c6c282b9c5c73598d5c73d6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 16 Jun 2005 11:36:09 +0000 Subject: r7633: this patch started as an attempt to make the dcerpc code use a given event_context for the socket_connect() call, so that when things that use dcerpc are running alongside anything else it doesn't block the whole process during a connect. Then of course I needed to change any code that created a dcerpc connection (such as the auth code) to also take an event context, and anything that called that and so on .... thus the size of the patch. There were 3 places where I punted: - abartlet wanted me to add a gensec_set_event_context() call instead of adding it to the gensec init calls. Andrew, my apologies for not doing this. I didn't do it as adding a new parameter allowed me to catch all the callers with the compiler. Now that its done, we could go back and use gensec_set_event_context() - the ejs code calls auth initialisation, which means it should pass in the event context from the web server. I punted on that. Needs fixing. - I used a NULL event context in dcom_get_pipe(). This is equivalent to what we did already, but should be fixed to use a callers event context. Jelmer, can you think of a clean way to do that? I also cleaned up a couple of things: - libnet_context_destroy() makes no sense. I removed it. - removed some unused vars in various places (This used to be commit 3a3025485bdb8f600ab528c0b4b4eef0c65e3fc9) --- source4/libcli/cliconnect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index a866e26970..0009151429 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -134,7 +134,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, const char *host, const char *sharename, const char *devtype, - struct cli_credentials *credentials) + struct cli_credentials *credentials, + struct event_context *ev) { struct smbcli_tree *tree; NTSTATUS status; @@ -143,7 +144,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, status = smbcli_tree_full_connection(parent_ctx, &tree, host, 0, sharename, devtype, - credentials); + credentials, ev); if (!NT_STATUS_IS_OK(status)) { goto done; } -- cgit From ee57c76a687c72ac7e8dc7c135ab53baa7a42776 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 18 Jun 2005 00:02:36 +0000 Subject: r7704: - fixed open_nbt_connection() to return NULL when the connection failed - got rid of smbcli_shutdown() and use talloc_free() instead. (This used to be commit 1011b1bf51d420d6702ef448c894ea8ebeafa284) --- source4/libcli/cliconnect.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 0009151429..489aea82dd 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -183,14 +183,6 @@ struct smbcli_state *smbcli_state_init(TALLOC_CTX *mem_ctx) return cli; } -/**************************************************************************** - Shutdown a client structure. -****************************************************************************/ -void smbcli_shutdown(struct smbcli_state *cli) -{ - talloc_free(cli); -} - /* parse a //server/share type UNC name */ -- cgit From d929f32dbe577b2bd389497433fb0a05c109a04b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 26 Jul 2005 07:23:57 +0000 Subject: r8777: make sure that the tree connect is a child of the return cli state structure. This fixes the BASE-DISCONNECT test (This used to be commit 86fe5817b1abc754763eede64b615dc8c9db5362) --- source4/libcli/cliconnect.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 489aea82dd..624b54c3f2 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -154,6 +154,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, (*ret_cli)->tree = tree; (*ret_cli)->session = tree->session; (*ret_cli)->transport = tree->session->transport; + + talloc_steal(*ret_cli, tree); done: return status; @@ -173,14 +175,7 @@ NTSTATUS smbcli_tdis(struct smbcli_state *cli) ****************************************************************************/ struct smbcli_state *smbcli_state_init(TALLOC_CTX *mem_ctx) { - struct smbcli_state *cli; - - cli = talloc_zero(mem_ctx, struct smbcli_state); - if (cli) { - ZERO_STRUCTP(cli); - } - - return cli; + return talloc_zero(mem_ctx, struct smbcli_state); } /* -- cgit From 2fa50ab671ba4a7e552e001f0dfde3a7cc330f8e Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 9 Aug 2005 03:09:47 +0000 Subject: r9222: Rename smb_tree_connect() to smb_raw_tcon() to match other raw function names. (This used to be commit 26b191b3c9529b2dae5d004819dab46657064408) --- source4/libcli/cliconnect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 624b54c3f2..cc02af1162 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -83,7 +83,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, return status; } -/* wrapper around smb_tree_connect() */ +/* wrapper around smb_raw_tcon() */ NTSTATUS smbcli_tconX(struct smbcli_state *cli, const char *sharename, const char *devtype, const char *password) { @@ -116,7 +116,7 @@ NTSTATUS smbcli_tconX(struct smbcli_state *cli, const char *sharename, tcon.tconx.in.path = sharename; tcon.tconx.in.device = devtype; - status = smb_tree_connect(cli->tree, mem_ctx, &tcon); + status = smb_raw_tcon(cli->tree, mem_ctx, &tcon); cli->tree->tid = tcon.tconx.out.tid; -- cgit From 172cee9adc86ab1950b50ffc008587e6d42585ed Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 9 Aug 2005 04:11:09 +0000 Subject: r9223: Rename smb_raw_session_setup() to smb_raw_sesssetup(). (This used to be commit 5e6d330e7388e47e1b2bfc96fff07682e90f63a5) --- source4/libcli/cliconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index cc02af1162..aba7f361a2 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -61,7 +61,7 @@ NTSTATUS smbcli_negprot(struct smbcli_state *cli) return smb_raw_negotiate(cli->transport, lp_maxprotocol()); } -/* wrapper around smb_raw_session_setup() */ +/* wrapper around smb_raw_sesssetup() */ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, struct cli_credentials *credentials) { -- cgit From ab4d635b92b116b02b88843b4ec4f5b7517bab1a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 26 Sep 2005 11:47:55 +0000 Subject: r10504: - seperate implementation specific stuff, from the generic composite stuff. - don't use SMBCLI_REQUEST_* state's in the genreic composite stuff - move monitor_fn to libnet. NOTE: I have maybe found some bugs, in code that is dirrectly in DONE or ERROR state in the _send() function. I haven't fixed this bugs in this commit! We may need some composite_trigger_*() functions or so. And maybe some other generic helper functions... metze (This used to be commit 4527815a0a9b96e460f301cb1f0c0b3964c166fc) --- source4/libcli/cliconnect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index aba7f361a2..00c5012074 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" #include "libcli/composite/composite.h" +#include "libcli/smb_composite/smb_composite.h" /* wrapper around smbcli_sock_connect() -- cgit From 134b2488c82ae13392121f71e4960178a38f3e01 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Oct 2005 11:02:42 +0000 Subject: r11369: Implement socket_connect_multi: Connect to multiple ipv4 tcp ports in sequence, with a 2-millisecond timeout between firing the syn packets. Build smbcli_sock_connect_send upon that. Volker (This used to be commit 5718df44d90d113304c5deed1e2e7f82ff9e928f) --- source4/libcli/cliconnect.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 00c5012074..c344ece385 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -32,13 +32,9 @@ BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server) { struct smbcli_socket *sock; - sock = smbcli_sock_init(cli, NULL); - if (!sock) return False; + sock = smbcli_sock_connect_byname(server, 0, NULL, NULL); - if (!smbcli_sock_connect_byname(sock, server, 0)) { - talloc_free(sock); - return False; - } + if (sock == NULL) return False; cli->transport = smbcli_transport_init(sock, cli, True); if (!cli->transport) { -- cgit From d4de4c2d210d2e8c9b5aedf70695594809ad6a0b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 30 Dec 2005 13:16:54 +0000 Subject: r12608: Remove some unused #include lines. (This used to be commit 70e7449318aa0e9d2639c76730a7d1683b2f4981) --- source4/libcli/cliconnect.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index c344ece385..220b5a3898 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -22,7 +22,6 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" -#include "libcli/composite/composite.h" #include "libcli/smb_composite/smb_composite.h" /* -- cgit From 78c50015bb8bd5a1d831a6e7ec796b3367c73145 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Jan 2006 15:40:05 +0000 Subject: r12694: Move some headers to the directory of the subsystem they belong to. (This used to be commit c722f665c90103f3ed57621c460e32ad33e7a8a3) --- source4/libcli/cliconnect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 220b5a3898..fe0ad9c9f5 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" #include "libcli/smb_composite/smb_composite.h" -- cgit From 60f8666ae88c5a03b0da58acb94015337442e18b Mon Sep 17 00:00:00 2001 From: James Peach Date: Tue, 31 Jan 2006 06:09:18 +0000 Subject: r13255: New CIFS dd client for use in performance testing. The guts of this is in client/cifsdd*, which implements a minimal implementation of dd. The IO path is careful to always perform IO at the requested block size. There is a very basic test suite in script/tests/test_cifsdd.sh which covers local and remote IO at a variety of block sizes. Added to lib/util_str.c is a small set of conv_str_*() functions to convert strings to the corresponding type. smbcli_parse_unc is modified to insert NULL terminators after its hostname and sharename parameters. This allows it to correctly parse a path of the form //foo/share/path/file. (This used to be commit cd2f94a65817bfae20ac21b730a2c42d8e581ab3) --- source4/libcli/cliconnect.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index fe0ad9c9f5..9a5236a661 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -4,6 +4,7 @@ client connect/disconnect routines Copyright (C) Andrew Tridgell 2003-2005 + Copyright (C) James Peach 2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -175,11 +176,33 @@ struct smbcli_state *smbcli_state_init(TALLOC_CTX *mem_ctx) return talloc_zero(mem_ctx, struct smbcli_state); } +/* Insert a NULL at the first separator of the given path and return a pointer + * to the location it was inserted at. + */ +static char * +terminate_path_at_separator(char * path) +{ + char * p; + + if ((p = strchr_m(path, '/'))) { + *p = '\0'; + return(p); + } + + if ((p = strchr_m(path, '\\'))) { + *p = '\0'; + return(p); + } + + /* No terminator. Return pointer to the last byte. */ + return(p + strlen(path)); +} + /* parse a //server/share type UNC name */ BOOL smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, - const char **hostname, const char **sharename) + char **hostname, char **sharename) { char *p; @@ -189,13 +212,10 @@ BOOL smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, } *hostname = talloc_strdup(mem_ctx, &unc_name[2]); - p = strchr_m(&(*hostname)[2],'/'); - if (!p) { - p = strchr_m(&(*hostname)[2],'\\'); - if (!p) return False; - } - *p = 0; + p = terminate_path_at_separator(*hostname); + *sharename = talloc_strdup(mem_ctx, p+1); + p = terminate_path_at_separator(*sharename); return True; } -- cgit From b7f7adb2e1068d1c382f774e54d1b495e6345938 Mon Sep 17 00:00:00 2001 From: James Peach Date: Wed, 8 Feb 2006 05:13:11 +0000 Subject: r13387: Make sure smbcli_parse_unc reports a failure for strings of the form //server. Make sure failure cases are well-defined. (This used to be commit e0020df66bf38873eaaacb95cadac55e17f432be) --- source4/libcli/cliconnect.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 9a5236a661..8103208a26 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -177,25 +177,29 @@ struct smbcli_state *smbcli_state_init(TALLOC_CTX *mem_ctx) } /* Insert a NULL at the first separator of the given path and return a pointer - * to the location it was inserted at. + * to the remainder of the string. */ static char * terminate_path_at_separator(char * path) { char * p; + if (!path) { + return NULL; + } + if ((p = strchr_m(path, '/'))) { - *p = '\0'; - return(p); + *p = '\0'; + return p + 1; } if ((p = strchr_m(path, '\\'))) { - *p = '\0'; - return(p); + *p = '\0'; + return p + 1; } - /* No terminator. Return pointer to the last byte. */ - return(p + strlen(path)); + /* No separator. */ + return NULL; } /* @@ -206,6 +210,8 @@ BOOL smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, { char *p; + *hostname = *sharename = NULL; + if (strncmp(unc_name, "\\\\", 2) && strncmp(unc_name, "//", 2)) { return False; @@ -214,10 +220,19 @@ BOOL smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, *hostname = talloc_strdup(mem_ctx, &unc_name[2]); p = terminate_path_at_separator(*hostname); - *sharename = talloc_strdup(mem_ctx, p+1); - p = terminate_path_at_separator(*sharename); + if (p && *p) { + *sharename = talloc_strdup(mem_ctx, p); + terminate_path_at_separator(*sharename); + } - return True; + if (*hostname && *sharename) { + return True; + } + + talloc_free(*hostname); + talloc_free(*sharename); + *hostname = *sharename = NULL; + return False; } -- cgit From 4ac2be99588b48b0652a524bf12fb1aa9c3f5fbb Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 7 Mar 2006 11:07:23 +0000 Subject: r13924: Split more prototypes out of include/proto.h + initial work on header file dependencies (This used to be commit 122835876748a3eaf5e8d31ad1abddab9acb8781) --- source4/libcli/cliconnect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 8103208a26..8616e42cd4 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -24,6 +24,7 @@ #include "includes.h" #include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" +#include "libcli/auth/proto.h" #include "libcli/smb_composite/smb_composite.h" /* -- cgit From 3f16241a1d3243447d0244ebac05b447aec94df8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Mar 2006 01:29:56 +0000 Subject: r14363: Remove credentials.h from the global includes. (This used to be commit 98c4c3051391c6f89df5d133665f51bef66b1563) --- source4/libcli/cliconnect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 8616e42cd4..a718f43d96 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -24,6 +24,7 @@ #include "includes.h" #include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" +#include "auth/credentials/credentials.h" #include "libcli/auth/proto.h" #include "libcli/smb_composite/smb_composite.h" -- cgit From e3f2414cf9e582a4e4deecc662b64a7bb2679a34 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Mar 2006 15:03:25 +0000 Subject: r14380: Reduce the size of structs.h (This used to be commit 1a16a6f1dfa66499af43a6b88b3ea69a6a75f1fe) --- source4/libcli/cliconnect.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index a718f43d96..d89d6a1568 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -24,8 +24,7 @@ #include "includes.h" #include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" -#include "auth/credentials/credentials.h" -#include "libcli/auth/proto.h" +#include "libcli/auth/libcli_auth.h" #include "libcli/smb_composite/smb_composite.h" /* -- cgit From 7bf085571eba5f321d35ff449d68da39ec303dab Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 22 Jun 2006 17:06:36 +0000 Subject: r16464: split client and server min/max protocol settings metze (This used to be commit 6164d1e22e0545f558315591d49f862de06ea945) --- source4/libcli/cliconnect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index d89d6a1568..45f44adba1 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -57,7 +57,7 @@ BOOL smbcli_transport_establish(struct smbcli_state *cli, /* wrapper around smb_raw_negotiate() */ NTSTATUS smbcli_negprot(struct smbcli_state *cli) { - return smb_raw_negotiate(cli->transport, lp_maxprotocol()); + return smb_raw_negotiate(cli->transport, lp_cli_maxprotocol()); } /* wrapper around smb_raw_sesssetup() */ -- cgit From b7e20c87e317ae73feb7f393a38d0ab0fa64d5d8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 30 Apr 2007 22:38:27 +0000 Subject: r22616: allow the unclist file to not specify a share name, and instead inherit the share name from the command line if it is not specified. This allows you to just specify the servers in the unclist, and connect to the same share on all servers. (This used to be commit 946f5d09ae204348026170173cf2bfd30d49e4f2) --- source4/libcli/cliconnect.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 45f44adba1..27f9736371 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -224,6 +224,9 @@ BOOL smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, if (p && *p) { *sharename = talloc_strdup(mem_ctx, p); terminate_path_at_separator(*sharename); + } else { + *sharename = talloc_strdup(mem_ctx, + lp_parm_string(-1, "torture", "share")); } if (*hostname && *sharename) { -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/libcli/cliconnect.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 27f9736371..e0f3c598b4 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -17,8 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From bd5a802a26f427779663a3de5f6d49f352b7c473 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Sep 2007 11:47:03 +0000 Subject: r24992: Remove some uses of lp_*(). (This used to be commit a5a1a5540510cdb1bfbb3e89b84f4ba5b2812c55) --- source4/libcli/cliconnect.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index e0f3c598b4..50fe41c2bc 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -205,7 +205,7 @@ terminate_path_at_separator(char * path) /* parse a //server/share type UNC name */ -BOOL smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, +bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, char **hostname, char **sharename) { char *p; @@ -220,12 +220,9 @@ BOOL smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, *hostname = talloc_strdup(mem_ctx, &unc_name[2]); p = terminate_path_at_separator(*hostname); - if (p && *p) { + if (p != NULL && *p) { *sharename = talloc_strdup(mem_ctx, p); terminate_path_at_separator(*sharename); - } else { - *sharename = talloc_strdup(mem_ctx, - lp_parm_string(-1, "torture", "share")); } if (*hostname && *sharename) { -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/libcli/cliconnect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 50fe41c2bc..a91157cf5d 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -25,6 +25,7 @@ #include "libcli/raw/libcliraw.h" #include "libcli/auth/libcli_auth.h" #include "libcli/smb_composite/smb_composite.h" +#include "param/param.h" /* wrapper around smbcli_sock_connect() -- cgit From 37d53832a4623653f706e77985a79d84bd7c6694 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 28 Sep 2007 01:17:46 +0000 Subject: r25398: Parse loadparm context to all lp_*() functions. (This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238) --- source4/libcli/cliconnect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index a91157cf5d..715eb875fe 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -57,7 +57,7 @@ BOOL smbcli_transport_establish(struct smbcli_state *cli, /* wrapper around smb_raw_negotiate() */ NTSTATUS smbcli_negprot(struct smbcli_state *cli) { - return smb_raw_negotiate(cli->transport, lp_cli_maxprotocol()); + return smb_raw_negotiate(cli->transport, lp_cli_maxprotocol(global_loadparm)); } /* wrapper around smb_raw_sesssetup() */ @@ -73,7 +73,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; setup.in.credentials = credentials; - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); status = smb_composite_sesssetup(cli->session, &setup); -- cgit From 2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 1 Oct 2007 18:52:55 +0000 Subject: r25446: Merge some changes I made on the way home from SFO: 2007-09-29 More higher-level passing around of lp_ctx. 2007-09-29 Fix warning. 2007-09-29 Pass loadparm contexts on a higher level. 2007-09-29 Avoid using global loadparm context. (This used to be commit 3468952e771ab31f90b6c374ade01c5550810f42) --- source4/libcli/cliconnect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 715eb875fe..96946da7fe 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -57,7 +57,8 @@ BOOL smbcli_transport_establish(struct smbcli_state *cli, /* wrapper around smb_raw_negotiate() */ NTSTATUS smbcli_negprot(struct smbcli_state *cli) { - return smb_raw_negotiate(cli->transport, lp_cli_maxprotocol(global_loadparm)); + return smb_raw_negotiate(cli->transport, + lp_cli_maxprotocol(global_loadparm)); } /* wrapper around smb_raw_sesssetup() */ -- cgit From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/libcli/cliconnect.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 96946da7fe..a56100fc80 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -30,24 +30,24 @@ /* wrapper around smbcli_sock_connect() */ -BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server) +bool smbcli_socket_connect(struct smbcli_state *cli, const char *server) { struct smbcli_socket *sock; sock = smbcli_sock_connect_byname(server, 0, NULL, NULL); - if (sock == NULL) return False; + if (sock == NULL) return false; - cli->transport = smbcli_transport_init(sock, cli, True); + cli->transport = smbcli_transport_init(sock, cli, true); if (!cli->transport) { - return False; + return false; } - return True; + return true; } /* wrapper around smbcli_transport_connect() */ -BOOL smbcli_transport_establish(struct smbcli_state *cli, +bool smbcli_transport_establish(struct smbcli_state *cli, struct nbt_name *calling, struct nbt_name *called) { @@ -68,7 +68,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, struct smb_composite_sesssetup setup; NTSTATUS status; - cli->session = smbcli_session_init(cli->transport, cli, True); + cli->session = smbcli_session_init(cli->transport, cli, true); if (!cli->session) return NT_STATUS_UNSUCCESSFUL; setup.in.sesskey = cli->transport->negotiate.sesskey; @@ -91,7 +91,7 @@ NTSTATUS smbcli_tconX(struct smbcli_state *cli, const char *sharename, TALLOC_CTX *mem_ctx; NTSTATUS status; - cli->tree = smbcli_tree_init(cli->session, cli, True); + cli->tree = smbcli_tree_init(cli->session, cli, true); if (!cli->tree) return NT_STATUS_UNSUCCESSFUL; mem_ctx = talloc_init("tcon"); @@ -216,7 +216,7 @@ bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, if (strncmp(unc_name, "\\\\", 2) && strncmp(unc_name, "//", 2)) { - return False; + return false; } *hostname = talloc_strdup(mem_ctx, &unc_name[2]); @@ -228,13 +228,13 @@ bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, } if (*hostname && *sharename) { - return True; + return true; } talloc_free(*hostname); talloc_free(*sharename); *hostname = *sharename = NULL; - return False; + return false; } -- cgit From 8d8ad81437555affe0ce189ab9b7049501c708b1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Dec 2007 16:20:32 +0100 Subject: r26224: Remove another use of global_loadparm. (This used to be commit bd12560432b3a8faf124ae1f562b725f3b6686d9) --- source4/libcli/cliconnect.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index a56100fc80..d806653758 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -55,10 +55,9 @@ bool smbcli_transport_establish(struct smbcli_state *cli, } /* wrapper around smb_raw_negotiate() */ -NTSTATUS smbcli_negprot(struct smbcli_state *cli) +NTSTATUS smbcli_negprot(struct smbcli_state *cli, int maxprotocol) { - return smb_raw_negotiate(cli->transport, - lp_cli_maxprotocol(global_loadparm)); + return smb_raw_negotiate(cli->transport, maxprotocol); } /* wrapper around smb_raw_sesssetup() */ -- cgit From 6c999cd12344f2bb8b1d2941210b4c205b3e0aad Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Dec 2007 22:32:11 +0100 Subject: r26236: Remove more uses of global_loadparm or specify loadparm_context explicitly. (This used to be commit 5b29ef7c03d9ae76b0ca909e9f03a58e1bad3521) --- source4/libcli/cliconnect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index d806653758..39f97f4d8c 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -55,9 +55,9 @@ bool smbcli_transport_establish(struct smbcli_state *cli, } /* wrapper around smb_raw_negotiate() */ -NTSTATUS smbcli_negprot(struct smbcli_state *cli, int maxprotocol) +NTSTATUS smbcli_negprot(struct smbcli_state *cli, bool unicode, int maxprotocol) { - return smb_raw_negotiate(cli->transport, maxprotocol); + return smb_raw_negotiate(cli->transport, unicode, maxprotocol); } /* wrapper around smb_raw_sesssetup() */ -- cgit From 2f8dc4f48f1802baa3405e7803563f6840e0d1b3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 21:25:06 +0100 Subject: r26266: Remove more global_loadparm uses. (This used to be commit 99113075c4a96679bcec4f4d6bba4acb3dee4245) --- source4/libcli/cliconnect.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 39f97f4d8c..b9fd06db1a 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -30,15 +30,19 @@ /* wrapper around smbcli_sock_connect() */ -bool smbcli_socket_connect(struct smbcli_state *cli, const char *server) +bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, + const char **name_resolve_order, + int max_xmit, int max_mux) { struct smbcli_socket *sock; - sock = smbcli_sock_connect_byname(server, 0, NULL, NULL); + sock = smbcli_sock_connect_byname(server, 0, NULL, name_resolve_order, + NULL); if (sock == NULL) return false; - cli->transport = smbcli_transport_init(sock, cli, true); + cli->transport = smbcli_transport_init(sock, cli, true, max_xmit, + max_mux); if (!cli->transport) { return false; } -- cgit From 5f4842cf65ce64bfdf577cd549565da20ca818cf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 10 Dec 2007 18:41:19 +0100 Subject: r26376: Add context for libcli_resolve. (This used to be commit 459e1466a411d6f83b7372e248566e6e71c745fc) --- source4/libcli/cliconnect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index b9fd06db1a..d70f592d9d 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -31,12 +31,12 @@ wrapper around smbcli_sock_connect() */ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, - const char **name_resolve_order, + struct resolve_context *resolve_ctx, int max_xmit, int max_mux) { struct smbcli_socket *sock; - sock = smbcli_sock_connect_byname(server, 0, NULL, name_resolve_order, + sock = smbcli_sock_connect_byname(server, 0, NULL, resolve_ctx, NULL); if (sock == NULL) return false; -- cgit From 3971827b6ee7c84beaf4449e3c12dfe9f2d62c77 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 10 Dec 2007 18:42:04 +0100 Subject: r26384: Fix another global_loadparm instance. (This used to be commit 881ec40d7a4c97863abee5740187e9aa0a1801bb) --- source4/libcli/cliconnect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index d70f592d9d..a170024def 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -66,7 +66,8 @@ NTSTATUS smbcli_negprot(struct smbcli_state *cli, bool unicode, int maxprotocol) /* wrapper around smb_raw_sesssetup() */ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, - struct cli_credentials *credentials) + struct cli_credentials *credentials, + const char *workgroup) { struct smb_composite_sesssetup setup; NTSTATUS status; @@ -77,7 +78,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; setup.in.credentials = credentials; - setup.in.workgroup = lp_workgroup(global_loadparm); + setup.in.workgroup = workgroup; status = smb_composite_sesssetup(cli->session, &setup); -- cgit From 4b0199a5493ea2b88558cc40871e63c1dc8dbb56 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 12 Dec 2007 02:15:29 +0100 Subject: r26409: Pass smb ports along. (This used to be commit 2833f320de1f1fd39c710ad0a61c3fa1bb1df31f) --- source4/libcli/cliconnect.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index a170024def..7ec914e831 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -31,12 +31,12 @@ wrapper around smbcli_sock_connect() */ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, - struct resolve_context *resolve_ctx, + const char **ports, struct resolve_context *resolve_ctx, int max_xmit, int max_mux) { struct smbcli_socket *sock; - sock = smbcli_sock_connect_byname(server, 0, NULL, resolve_ctx, + sock = smbcli_sock_connect_byname(server, ports, NULL, resolve_ctx, NULL); if (sock == NULL) return false; @@ -136,6 +136,7 @@ NTSTATUS smbcli_tconX(struct smbcli_state *cli, const char *sharename, NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, struct smbcli_state **ret_cli, const char *host, + const char **ports, const char *sharename, const char *devtype, struct cli_credentials *credentials, @@ -147,7 +148,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, *ret_cli = NULL; status = smbcli_tree_full_connection(parent_ctx, - &tree, host, 0, sharename, devtype, + &tree, host, ports, + sharename, devtype, credentials, ev); if (!NT_STATUS_IS_OK(status)) { goto done; -- cgit From 771b347f9b185895390445be96081c781e28a26d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Jan 2008 18:39:01 -0600 Subject: r26644: Janitorial: Pass resolve_context explicitly to various SMB functions, should help fix the build for OpenChange. (This used to be commit 385ffe4f4cc9a21a760c0f00410f56e2592fd507) --- source4/libcli/cliconnect.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 7ec914e831..c13dde9711 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -32,7 +32,7 @@ */ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, const char **ports, struct resolve_context *resolve_ctx, - int max_xmit, int max_mux) + int max_xmit, int max_mux, bool use_spnego) { struct smbcli_socket *sock; @@ -42,7 +42,7 @@ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, if (sock == NULL) return false; cli->transport = smbcli_transport_init(sock, cli, true, max_xmit, - max_mux); + max_mux, use_spnego); if (!cli->transport) { return false; } @@ -140,6 +140,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, const char *sharename, const char *devtype, struct cli_credentials *credentials, + struct resolve_context *resolve_ctx, struct event_context *ev) { struct smbcli_tree *tree; @@ -150,7 +151,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, status = smbcli_tree_full_connection(parent_ctx, &tree, host, ports, sharename, devtype, - credentials, ev); + credentials, resolve_ctx, ev); if (!NT_STATUS_IS_OK(status)) { goto done; } -- cgit From 425732f688865ebe2bfe568c8278edec50cbdedf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Jan 2008 17:21:58 -0600 Subject: r26651: libsmb: Allow specifying signing policy from higher up. The number of arguments is getting a bit excessive now, so it probably makes sense to pass in the smbcli_options struct rather than all members individually and add a convenience function for obtaining a smbcli_options struct from a loadparm context. (This used to be commit 9f64213463b5bf3bcbf36913139e9a5042e967a2) --- source4/libcli/cliconnect.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index c13dde9711..c1fadaa679 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -31,8 +31,10 @@ wrapper around smbcli_sock_connect() */ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, - const char **ports, struct resolve_context *resolve_ctx, - int max_xmit, int max_mux, bool use_spnego) + const char **ports, + struct resolve_context *resolve_ctx, + int max_xmit, int max_mux, bool use_spnego, + enum smb_signing_state signing) { struct smbcli_socket *sock; @@ -42,7 +44,7 @@ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, if (sock == NULL) return false; cli->transport = smbcli_transport_init(sock, cli, true, max_xmit, - max_mux, use_spnego); + max_mux, use_spnego, signing); if (!cli->transport) { return false; } -- cgit From dcc282590b34537fc1ead61c3300172528273b44 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Jan 2008 17:22:12 -0600 Subject: r26654: libcli/smb_composite: Rather than specifying each of the gazillion options for SMB individually, just specify the smbcli_options struct. (This used to be commit 8a97886e24a4b969aa91409c06f423b71a45f6eb) --- source4/libcli/cliconnect.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index c1fadaa679..666dfe8446 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -33,8 +33,7 @@ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, const char **ports, struct resolve_context *resolve_ctx, - int max_xmit, int max_mux, bool use_spnego, - enum smb_signing_state signing) + struct smbcli_options *options) { struct smbcli_socket *sock; @@ -43,8 +42,7 @@ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, if (sock == NULL) return false; - cli->transport = smbcli_transport_init(sock, cli, true, max_xmit, - max_mux, use_spnego, signing); + cli->transport = smbcli_transport_init(sock, cli, true, options); if (!cli->transport) { return false; } @@ -143,7 +141,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, const char *devtype, struct cli_credentials *credentials, struct resolve_context *resolve_ctx, - struct event_context *ev) + struct event_context *ev, + struct smbcli_options *options) { struct smbcli_tree *tree; NTSTATUS status; @@ -153,7 +152,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, status = smbcli_tree_full_connection(parent_ctx, &tree, host, ports, sharename, devtype, - credentials, resolve_ctx, ev); + credentials, resolve_ctx, ev, + options); if (!NT_STATUS_IS_OK(status)) { goto done; } -- cgit From afe3e8172ddaa5e4aa811faceecda4f943d6e2ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 04:53:27 +0200 Subject: Install public header files again and include required prototypes. (This used to be commit 47ffbbf67435904754469544390b67d34c958343) --- source4/libcli/cliconnect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 666dfe8446..4858a96110 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" +#include "libcli/raw/raw_proto.h" #include "libcli/auth/libcli_auth.h" #include "libcli/smb_composite/smb_composite.h" #include "param/param.h" -- cgit From 4e83011f72ba3df387512755a17760b42a7bf2f2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 21 Apr 2008 17:58:23 -0400 Subject: Remove more event_context_init() uses from function calls within deep down the code. Make sure we pass around the event_context where we need it instead. All test but a few python ones fail. Jelmer promised to fix them. (This used to be commit 3045d391626fba169aa26be52174883e18d323e9) --- source4/libcli/cliconnect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4/libcli/cliconnect.c') diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 4858a96110..c20a7fd935 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -33,13 +33,14 @@ */ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, const char **ports, + struct event_context *ev_ctx, struct resolve_context *resolve_ctx, struct smbcli_options *options) { struct smbcli_socket *sock; - sock = smbcli_sock_connect_byname(server, ports, NULL, resolve_ctx, - NULL); + sock = smbcli_sock_connect_byname(server, ports, NULL, + resolve_ctx, ev_ctx); if (sock == NULL) return false; -- cgit