struct tevent_context *ev_ctx,
struct resolve_context *resolve_ctx,
struct smbcli_options *options,
- const char *socket_options)
+ const char *socket_options,
+ struct nbt_name *calling,
+ struct nbt_name *called)
{
- struct smbcli_socket *sock;
-
- sock = smbcli_sock_connect_byname(server, ports, NULL,
- resolve_ctx, ev_ctx,
- socket_options);
-
- if (sock == NULL) return false;
-
- cli->transport = smbcli_transport_init(sock, cli, true, options);
- if (!cli->transport) {
- return false;
- }
-
- return true;
-}
-
-/* wrapper around smbcli_transport_connect() */
-bool smbcli_transport_establish(struct smbcli_state *cli,
- struct nbt_name *calling,
- struct nbt_name *called)
-{
- uint32_t timeout_msec = cli->transport->options.request_timeout * 1000;
NTSTATUS status;
- status = smbcli_transport_connect(cli->transport->socket,
- timeout_msec,
- calling, called);
+ cli->options = *options;
+
+ status = smbcli_sock_connect(cli,
+ NULL, /* host_addr */
+ ports,
+ server,
+ resolve_ctx,
+ ev_ctx,
+ socket_options,
+ calling,
+ called,
+ &cli->sock);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
/* 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);
}