s3: Fix a segfault in "net" version 3.3
authorVolker Lendecke <vl@samba.org>
Mon, 7 Dec 2009 21:35:35 +0000 (22:35 +0100)
committerKarolin Seeger <kseeger@samba.org>
Wed, 13 Jan 2010 13:01:04 +0000 (14:01 +0100)
When neither LOGNAME nor -U is set, "net" and probably other client utils
segfault. Reported by "vinnix" on irc.

Volker

Fix bug #6973 (segfault in client tools).
(cherry picked from commit 6aa17a7b82333de674274045f574bf6c0ce72638)

source/libsmb/clientgen.c

index cb8f8279f51a475bae7e56ebb5c601657cd9a757..2dbf67a4c99f2aeda2c423698f3cc6c5357ac802 100644 (file)
@@ -408,7 +408,7 @@ void cli_init_creds(struct cli_state *cli, const char *username, const char *dom
        fstrcpy(cli->domain, domain);
        fstrcpy(cli->user_name, username);
        pwd_set_cleartext(&cli->pwd, password);
-       if (!*username) {
+       if ((username == NULL) || (!*username)) {
                cli->pwd.null_pwd = true;
        }