From b54692bea7b6c75d38505ce2995c7f4472a4f4fb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 20 Sep 2001 21:06:02 +0000 Subject: smbmount fixes from Urban. Jeremy. (This used to be commit 73ec9392396af6183bdf43b9f8ac0a6a0359a074) --- source3/client/smbmount.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'source3/client') diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index 8650152faf..56a1443722 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -195,11 +195,17 @@ static struct cli_state *do_connection(char *service) password, strlen(password), password, strlen(password), workgroup)) { - DEBUG(0,("%d: session setup failed: %s\n", - getpid(), cli_errstr(c))); - cli_shutdown(c); - SAFE_FREE(c); - return NULL; + /* if a password was not supplied then try again with a + null username */ + if (password[0] || !username[0] || + !cli_session_setup(c, "", "", 0, "", 0, workgroup)) { + DEBUG(0,("%d: session setup failed: %s\n", + getpid(), cli_errstr(c))); + cli_shutdown(c); + SAFE_FREE(c); + return NULL; + } + DEBUG(0,("Anonymous login successful\n")); } DEBUG(4,("%d: session setup ok\n", getpid())); @@ -776,6 +782,7 @@ static void parse_mount_smb(int argc, char **argv) fprintf(stderr, "Unhandled option: %s\n", opteq+1); exit(1); } else if(!strcmp(opts, "guest")) { + *password = '\0'; got_pass = True; } else if(!strcmp(opts, "rw")) { mount_ro = 0; @@ -816,6 +823,15 @@ static void parse_mount_smb(int argc, char **argv) /* here we are interactive, even if run from autofs */ setup_logging("mount.smbfs",True); + /* CLI_FORCE_ASCII=false makes smbmount negotiate unicode. The default + is to not announce any unicode capabilities as current smbfs does + not support it. */ + p = getenv("CLI_FORCE_ASCII"); + if (p && !strcmp(p, "false")) + unsetenv("CLI_FORCE_ASCII"); + else + setenv("CLI_FORCE_ASCII", "true", 1); + TimeInit(); in_client = True; /* Make sure that we tell lp_load we are */ -- cgit