s4:libcli/finddcs_nbt.c - optimise headers
[sfrench/samba-autobuild/.git] / source4 / libcli / cliconnect.c
index 1b3d2c98c95110fea0cdf0a055097fb8257af011..d670324c88cf161243bb99c3022583e710c9cac4 100644 (file)
 #include "libcli/raw/raw_proto.h"
 #include "libcli/auth/libcli_auth.h"
 #include "libcli/smb_composite/smb_composite.h"
-#include "param/param.h"
 
 /*
   wrapper around smbcli_sock_connect()
 */
 bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, 
                           const char **ports, 
-                          struct event_context *ev_ctx,
+                          struct tevent_context *ev_ctx,
                           struct resolve_context *resolve_ctx,
                           struct smbcli_options *options,
-                          struct smb_iconv_convenience *iconv_convenience)
+               const char *socket_options)
 {
        struct smbcli_socket *sock;
 
        sock = smbcli_sock_connect_byname(server, ports, NULL,
-                                         resolve_ctx, ev_ctx);
+                                         resolve_ctx, ev_ctx,
+                      socket_options);
 
        if (sock == NULL) return false;
        
-       cli->transport = smbcli_transport_init(sock, cli, true, options, 
-                                                                                  iconv_convenience);
+       cli->transport = smbcli_transport_init(sock, cli, true, options);
        if (!cli->transport) {
                return false;
        }
@@ -72,7 +71,8 @@ NTSTATUS smbcli_negprot(struct smbcli_state *cli, bool unicode, int maxprotocol)
 NTSTATUS smbcli_session_setup(struct smbcli_state *cli, 
                              struct cli_credentials *credentials,
                              const char *workgroup,
-                             struct smbcli_session_options options)
+                             struct smbcli_session_options options,
+                             struct gensec_settings *gensec_settings)
 {
        struct smb_composite_sesssetup setup;
        NTSTATUS status;
@@ -85,6 +85,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli,
        setup.in.capabilities = cli->transport->negotiate.capabilities;
        setup.in.credentials = credentials;
        setup.in.workgroup = workgroup;
+       setup.in.gensec_settings = gensec_settings;
 
        status = smb_composite_sesssetup(cli->session, &setup);
 
@@ -145,12 +146,13 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
                                const char **ports,
                                const char *sharename,
                                const char *devtype,
+                               const char *socket_options,
                                struct cli_credentials *credentials,
                                struct resolve_context *resolve_ctx,
-                               struct event_context *ev,
+                               struct tevent_context *ev,
                                struct smbcli_options *options,
                                struct smbcli_session_options *session_options,
-                               struct smb_iconv_convenience *iconv_convenience)
+                               struct gensec_settings *gensec_settings)
 {
        struct smbcli_tree *tree;
        NTSTATUS status;
@@ -160,10 +162,11 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
        status = smbcli_tree_full_connection(parent_ctx,
                                             &tree, host, ports, 
                                             sharename, devtype,
+                                                socket_options,
                                             credentials, resolve_ctx, ev,
                                             options,
                                             session_options,
-                                                iconv_convenience);
+                                                gensec_settings);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
@@ -231,13 +234,13 @@ 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;
        }
 
+       *hostname = *sharename = NULL;
+
        *hostname = talloc_strdup(mem_ctx, &unc_name[2]);
        p = terminate_path_at_separator(*hostname);