summaryrefslogtreecommitdiff
path: root/source4/libcli/cliconnect.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-23 08:35:17 +0200
committerStefan Metzmacher <metze@samba.org>2011-11-30 15:13:36 +0100
commit4afbda221c20ffa36a1d1e37ef11f86073a49da6 (patch)
tree8d9cc7d03f5bb4ea4ffa761dfee0ba7e9cdc005c /source4/libcli/cliconnect.c
parent99ef6a4bec1058b3649e5e72f8ea85f6df93a154 (diff)
downloadsamba-4afbda221c20ffa36a1d1e37ef11f86073a49da6.tar.gz
samba-4afbda221c20ffa36a1d1e37ef11f86073a49da6.tar.bz2
samba-4afbda221c20ffa36a1d1e37ef11f86073a49da6.zip
s4:libcli/raw: implement on top of smbXcli_conn/req
metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Wed Nov 30 15:13:36 CET 2011 on sn-devel-104
Diffstat (limited to 'source4/libcli/cliconnect.c')
-rw-r--r--source4/libcli/cliconnect.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index a8e86a0488..45d8d2a776 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -39,9 +39,10 @@ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
struct nbt_name *calling,
struct nbt_name *called)
{
- struct smbcli_socket *sock = NULL;
NTSTATUS status;
+ cli->options = *options;
+
status = smbcli_sock_connect(cli,
NULL, /* host_addr */
ports,
@@ -51,22 +52,30 @@ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
socket_options,
calling,
called,
- &sock);
+ &cli->sock);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
- cli->transport = smbcli_transport_init(sock, cli, true, options);
- if (!cli->transport) {
- return false;
- }
-
return true;
}
/* wrapper around smb_raw_negotiate() */
NTSTATUS smbcli_negprot(struct smbcli_state *cli, bool unicode, int maxprotocol)
{
+ if (unicode) {
+ cli->options.unicode = 1;
+ } else {
+ cli->options.unicode = 0;
+ }
+
+ cli->transport = smbcli_transport_init(cli->sock, cli,
+ true, &cli->options);
+ cli->sock = NULL;
+ if (!cli->transport) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
return smb_raw_negotiate(cli->transport, unicode, maxprotocol);
}