r25398: Parse loadparm context to all lp_*() functions.
[kai/samba.git] / source4 / libcli / cliconnect.c
index e0f3c598b4b6c48ad4b9b383f0b7ac086f5c611e..715eb875fee0045fa6ad0d9bee2018cb3063b941 100644 (file)
@@ -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()
@@ -56,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() */
@@ -72,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);
 
@@ -205,7 +206,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 +221,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) {