[GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
[samba.git] / source / libsmb / cliconnect.c
index a4bbf9a6ec3de63197035a48189a9a2392089db2..78cc63de50f8d2dcfdfa81275432378d7a0f3851 100644 (file)
@@ -98,7 +98,7 @@ static NTSTATUS cli_session_setup_lanman2(struct cli_state *cli,
 
        /* send a session setup command */
        memset(cli->outbuf,'\0',smb_size);
-       set_message(NULL,cli->outbuf,10, 0, True);
+       set_message(cli->outbuf,10, 0, True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
        cli_setup_packet(cli);
        
@@ -168,7 +168,7 @@ static NTSTATUS cli_session_setup_guest(struct cli_state *cli)
        uint32 capabilities = cli_session_setup_capabilities(cli);
 
        memset(cli->outbuf, '\0', smb_size);
-       set_message(NULL,cli->outbuf,13,0,True);
+       set_message(cli->outbuf,13,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
        cli_setup_packet(cli);
                        
@@ -228,7 +228,7 @@ static NTSTATUS cli_session_setup_plaintext(struct cli_state *cli,
        fstr_sprintf( lanman, "Samba %s", SAMBA_VERSION_STRING);
 
        memset(cli->outbuf, '\0', smb_size);
-       set_message(NULL,cli->outbuf,13,0,True);
+       set_message(cli->outbuf,13,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
        cli_setup_packet(cli);
                        
@@ -377,7 +377,7 @@ static NTSTATUS cli_session_setup_nt1(struct cli_state *cli, const char *user,
        /* send a session setup command */
        memset(cli->outbuf,'\0',smb_size);
 
-       set_message(NULL,cli->outbuf,13,0,True);
+       set_message(cli->outbuf,13,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
        cli_setup_packet(cli);
                        
@@ -457,7 +457,7 @@ static BOOL cli_session_setup_blob_send(struct cli_state *cli, DATA_BLOB blob)
        /* send a session setup command */
        memset(cli->outbuf,'\0',smb_size);
 
-       set_message(NULL,cli->outbuf,12,0,True);
+       set_message(cli->outbuf,12,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
 
        cli_setup_packet(cli);
@@ -765,7 +765,7 @@ static NTSTATUS cli_session_setup_ntlmssp(struct cli_state *cli, const char *use
                }
        }
 
-       /* we have a reference counter on ntlmssp_state, if we are signing
+       /* we have a reference conter on ntlmssp_state, if we are signing
           then the state will be kept by the signing engine */
 
        ntlmssp_end(&ntlmssp_state);
@@ -822,36 +822,20 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
                free(OIDs[i]);
        }
 
+       DEBUG(3,("got principal=%s\n", principal ? principal : "<null>"));
 
        if (got_kerberos_mechanism && (principal == NULL)) {
-               fstring dns_name;
-               fstring nb_name;
-
                /*
-                * We didn't get a valid principal in the negTokenInit.  Fake
-                * it, or fall back on NTLM. We prefer to fake it, and hit the
-                * translate_name cache to get a REAL realm name.
-                */ 
-               if (!(cli->desthost && translate_name(domain, dns_name,
-                           nb_name) && 
-                   asprintf(&principal, "host/%s@%s", cli->desthost, 
-                       dns_name))) {
-
-                       /*
-                        * It is WRONG to depend on the principal sent in the
-                        * negprot reply, but right now we do it. So for safety
-                        * (don't segfault later) disable Kerberos when no 
-                        * principal was sent. -- VL
-                        */
-                       DEBUG(1, ("Kerberos mech was offered, but no principal was "
-                               "sent, disabling Kerberos\n"));
-                       cli->use_kerberos = False;
-               }
-
+                * It is WRONG to depend on the principal sent in the negprot
+                * reply, but right now we do it. So for safety (don't
+                * segfault later) disable Kerberos when no principal was
+                * sent. -- VL
+                */
+               DEBUG(1, ("Kerberos mech was offered, but no principal was "
+                         "sent, disabling Kerberos\n"));
+               cli->use_kerberos = False;
        }
 
-       DEBUG(3,("got principal=%s\n", principal ? principal : "<null>"));
-
        fstrcpy(cli->user_name, user);
 
 #ifdef HAVE_KRB5
@@ -888,9 +872,7 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
 
 ntlmssp:
 
-       /* NTLM is sensitive to adding a domain with a UPN */
-       return ADS_ERROR_NT(cli_session_setup_ntlmssp(cli, user, pass,
-               (strchr(user, '@') ? NULL : domain)));
+       return ADS_ERROR_NT(cli_session_setup_ntlmssp(cli, user, pass, domain));
 }
 
 /****************************************************************************
@@ -996,6 +978,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
        }
 
        return NT_STATUS_OK;
+
 }
 
 /****************************************************************************
@@ -1005,7 +988,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
 BOOL cli_ulogoff(struct cli_state *cli)
 {
        memset(cli->outbuf,'\0',smb_size);
-       set_message(NULL,cli->outbuf,2,0,True);
+       set_message(cli->outbuf,2,0,True);
        SCVAL(cli->outbuf,smb_com,SMBulogoffX);
        cli_setup_packet(cli);
        SSVAL(cli->outbuf,smb_vwv0,0xFF);
@@ -1082,7 +1065,7 @@ BOOL cli_send_tconX(struct cli_state *cli,
        slprintf(fullshare, sizeof(fullshare)-1,
                 "\\\\%s\\%s", cli->desthost, share);
 
-       set_message(NULL,cli->outbuf,4, 0, True);
+       set_message(cli->outbuf,4, 0, True);
        SCVAL(cli->outbuf,smb_com,SMBtconX);
        cli_setup_packet(cli);
 
@@ -1133,7 +1116,7 @@ BOOL cli_send_tconX(struct cli_state *cli,
 BOOL cli_tdis(struct cli_state *cli)
 {
        memset(cli->outbuf,'\0',smb_size);
-       set_message(NULL,cli->outbuf,0,0,True);
+       set_message(cli->outbuf,0,0,True);
        SCVAL(cli->outbuf,smb_com,SMBtdis);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
        cli_setup_packet(cli);
@@ -1165,7 +1148,7 @@ void cli_negprot_send(struct cli_state *cli)
        memset(cli->outbuf,'\0',smb_size);
 
        /* setup the protocol strings */
-       set_message(NULL,cli->outbuf,0,0,True);
+       set_message(cli->outbuf,0,0,True);
 
        p = smb_buf(cli->outbuf);
        for (numprots=0;
@@ -1205,7 +1188,7 @@ BOOL cli_negprot(struct cli_state *cli)
             numprots++)
                plength += strlen(prots[numprots].name)+2;
     
-       set_message(NULL,cli->outbuf,0,plength,True);
+       set_message(cli->outbuf,0,plength,True);
 
        p = smb_buf(cli->outbuf);
        for (numprots=0;
@@ -1738,7 +1721,7 @@ NTSTATUS cli_raw_tcon(struct cli_state *cli,
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(NULL,cli->outbuf, 0, 0, True);
+       set_message(cli->outbuf, 0, 0, True);
        SCVAL(cli->outbuf,smb_com,SMBtcon);
        cli_setup_packet(cli);