* fixed a segv when -U is not used in smbtorture.
authorAndrew Tridgell <tridge@samba.org>
Thu, 15 Jan 2004 23:19:07 +0000 (23:19 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 15 Jan 2004 23:19:07 +0000 (23:19 +0000)
* fixed the handling of anonymous logins
(This used to be commit 7cbc4ad8710ad33387145bfc9974d0ed4b0fb231)

source4/libcli/raw/clisession.c
source4/libcli/raw/clitree.c

index 9d154e10cd220c1bc1c3b3516614206a48484541..c5d4888089cbef828eb2e146e2bf1b72bb0efcf7 100644 (file)
@@ -272,7 +272,10 @@ static NTSTATUS smb_raw_session_setup_generic_old(struct cli_session *session,
        s2.old.in.os = "Unix";
        s2.old.in.lanman = "Samba";
        
-       if (session->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) {
+       if (!parms->generic.in.password) {
+               s2.old.in.password = data_blob(NULL, 0);
+       } else if (session->transport->negotiate.sec_mode & 
+                  NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) {
                s2.old.in.password = lanman_blob(parms->generic.in.password, 
                                                 session->transport->negotiate.secblob);
        } else {
@@ -318,8 +321,11 @@ static NTSTATUS smb_raw_session_setup_generic_nt1(struct cli_session *session,
        s2.nt1.in.os = "Unix";
        s2.nt1.in.lanman = "Samba";
 
-       if (s2.nt1.in.user[0] &&
-           (session->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE)) {
+       if (!parms->generic.in.password) {
+               s2.nt1.in.password1 = data_blob(NULL, 0);
+               s2.nt1.in.password2 = data_blob(NULL, 0);
+       } else if (session->transport->negotiate.sec_mode & 
+                  NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) {
                s2.nt1.in.password1 = lanman_blob(parms->generic.in.password, 
                                                  session->transport->negotiate.secblob);
                s2.nt1.in.password2 = nt_blob(parms->generic.in.password, 
index 1114c8a9c5dd73663be54188db512668ba356231..b35bf67c94a3ce76c8dee005b7b3d11a640e601c 100644 (file)
@@ -238,9 +238,15 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree,
        setup.generic.in.capabilities = CAP_UNICODE | CAP_STATUS32 | 
                CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | 
                CAP_W2K_SMBS | CAP_LARGE_READX | CAP_LARGE_WRITEX;
-       setup.generic.in.password = password;
-       setup.generic.in.user = user;
-       setup.generic.in.domain = domain;
+       if (!user || !user[0]) {
+               setup.generic.in.password = NULL;
+               setup.generic.in.user = "";
+               setup.generic.in.domain = "";
+       } else {
+               setup.generic.in.password = password;
+               setup.generic.in.user = user;
+               setup.generic.in.domain = domain;
+       }
 
        mem_ctx = talloc_init("tcon");
        if (!mem_ctx) {