summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-05-15 04:51:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:17:03 -0500
commitf9480025b5192263084c601bdb8d15508a61409c (patch)
tree307671a8a1ff61545912107c947e4dc5473abfdc
parentbb4856b14afcaf488d5bc960e881e8734feb532f (diff)
downloadsamba-f9480025b5192263084c601bdb8d15508a61409c.tar.gz
samba-f9480025b5192263084c601bdb8d15508a61409c.tar.bz2
samba-f9480025b5192263084c601bdb8d15508a61409c.zip
r15610: Fix Coverity #288 - possible null deref.
Jeremy. (This used to be commit b108ab7b122cc607f31772614b221379403b211b)
-rw-r--r--source3/libsmb/cliconnect.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index beabddc782..3bdd78560f 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -922,6 +922,7 @@ BOOL cli_ulogoff(struct cli_state *cli)
/****************************************************************************
Send a tconX.
****************************************************************************/
+
BOOL cli_send_tconX(struct cli_state *cli,
const char *share, const char *dev, const char *pass, int passlen)
{
@@ -936,10 +937,13 @@ BOOL cli_send_tconX(struct cli_state *cli,
if (cli->sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) {
passlen = 1;
pass = "";
+ } else if (!pass) {
+ DEBUG(1, ("Server not using user level security and no password supplied.\n"));
+ return False;
}
if ((cli->sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) &&
- pass && *pass && passlen != 24) {
+ *pass && passlen != 24) {
if (!lp_client_lanman_auth()) {
DEBUG(1, ("Server requested LANMAN password (share-level security) but 'client use lanman auth'"
" is disabled\n"));
@@ -965,7 +969,9 @@ BOOL cli_send_tconX(struct cli_state *cli,
passlen = clistr_push(cli, pword, pass, sizeof(pword), STR_TERMINATE);
} else {
- memcpy(pword, pass, passlen);
+ if (passlen) {
+ memcpy(pword, pass, passlen);
+ }
}
}
@@ -980,7 +986,9 @@ BOOL cli_send_tconX(struct cli_state *cli,
SSVAL(cli->outbuf,smb_vwv3,passlen);
p = smb_buf(cli->outbuf);
- memcpy(p,pword,passlen);
+ if (passlen) {
+ memcpy(p,pword,passlen);
+ }
p += passlen;
p += clistr_push(cli, p, fullshare, -1, STR_TERMINATE |STR_UPPER);
p += clistr_push(cli, p, dev, -1, STR_TERMINATE |STR_UPPER | STR_ASCII);