From 7d9763325cd68f8769d01e2e311aba5356d80077 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 6 Apr 2004 08:05:04 +0000 Subject: r66: fixed a segv when printing an error from a session setup failure. This was caused by the cli to cli->tree conversion a while ago (This used to be commit f88f1d33618562f8b8273ec45a79b819c9e48686) --- source4/client/client.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source4/client') diff --git a/source4/client/client.c b/source4/client/client.c index 61d52b82d9..0430689865 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -2683,6 +2683,7 @@ static struct cli_state *do_connect(const char *server, const char *share) struct in_addr ip; fstring servicename; char *sharename; + NTSTATUS status; /* make a copy so we don't modify the global string 'service' */ fstrcpy(servicename, share); @@ -2745,12 +2746,14 @@ static struct cli_state *do_connect(const char *server, const char *share) } } - if (NT_STATUS_IS_ERR(cli_session_setup(c, username, password, - lp_workgroup()))) { + status = cli_session_setup(c, username, password, lp_workgroup()); + if (NT_STATUS_IS_ERR(status)) { /* if a password was not supplied then try again with a null username */ - if (password[0] || !username[0] || use_kerberos || - NT_STATUS_IS_ERR(cli_session_setup(c, "", "", lp_workgroup()))) { - d_printf("session setup failed: %s\n", cli_errstr(c->tree)); + if (password[0] || !username[0] || use_kerberos) { + status = cli_session_setup(c, "", "", lp_workgroup()); + } + if (NT_STATUS_IS_ERR(status)) { + d_printf("session setup failed: %s\n", nt_errstr(status)); cli_shutdown(c); return NULL; } -- cgit