summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-10-22 15:30:47 -0700
committerKarolin Seeger <kseeger@samba.org>2009-10-26 11:52:33 +0100
commit00c42f0981a10144dc78b86336f5d5177780a4bd (patch)
treebbc427e4f337cf721ac0f32e60fa1f01236518f1
parent6cbf9e806644021aef4ad0d1d97c97e1e972e18e (diff)
downloadsamba-00c42f0981a10144dc78b86336f5d5177780a4bd.tar.gz
Fix bug 6829 - smbclient does not show special characters properly. All successful calls to cli_session_setup() *must* be followed by calls to cli_init_creds() to stash the credentials we successfully connected with. There were 2 codepaths where this was missing. This caused smbclient to be unable to open the \srvsvc pipe to do an RPC netserverenum, and cause it to fall back to a RAP netserverenum, which uses DOS codepage conversion rather than the full UCS2 of RPC, so the returned characters were not correct (unless the DOS codepage was set correctly). Phew. That was fun to track down :-). Includes logic simplification in libsmb_server.c Jeremy.
(cherry picked from commit 587ca743bf1491e97c984ce4bec5a9bd0a1ae69a)
-rw-r--r--source3/libsmb/clidfs.c9
-rw-r--r--source3/libsmb/libsmb_server.c8
2 files changed, 17 insertions, 0 deletions
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 5e944f1aaad..53dc6d79844 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -216,6 +216,15 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
return NULL;
}
d_printf("Anonymous login successful\n");
+ status = cli_init_creds(c, "", lp_workgroup(), "");
+ } else {
+ status = cli_init_creds(c, username, lp_workgroup(), password);
+ }
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10,("cli_init_creds() failed: %s\n", nt_errstr(status)));
+ cli_shutdown(c);
+ return NULL;
}
if ( show_sessetup ) {
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 60849c812fe..cf2d1d57867 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -500,6 +500,14 @@ again:
}
}
+ status = cli_init_creds(c, username_used,
+ *pp_workgroup, *pp_password);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ cli_shutdown(c);
+ return NULL;
+ }
+
DEBUG(4,(" session setup ok\n"));
status = cli_tcon_andx(c, share, "?????", *pp_password,