The branch, master has been updated
       via  9b4c300 s3:smbd: also send the server name in the negprot response
       via  e99017a s3:libsmb: also remember the optional server name from the 
negprot response
       via  aea76a3 s3:libsmb: the workgroup in the non-extended-security 
negprot is not aligned (#8573)
      from  4f3e86f systemd: Fix dependencies.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9b4c300922d16856d2e1207072915eba48bd3f47
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Nov 4 13:49:05 2011 +0100

    s3:smbd: also send the server name in the negprot response
    
    This matches W2K (at least sp4) and higher.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <[email protected]>
    Autobuild-Date: Fri Nov  4 15:50:06 CET 2011 on sn-devel-104

commit e99017af7211be96a702ed86502b2f8be4b31d9d
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Nov 4 12:59:54 2011 +0100

    s3:libsmb: also remember the optional server name from the negprot response
    
    W2K (at least sp4) and higher also send the server name.
    
    metze

commit aea76a3aaa7ea52f563e7bc8a8ed60d9651f9e34
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Nov 4 12:52:44 2011 +0100

    s3:libsmb: the workgroup in the non-extended-security negprot is not 
aligned (#8573)
    
    I've tested the fix against NT4 sp6a, W2K sp4, W2K8R2 and Win8pre0.
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source3/include/client.h    |    1 +
 source3/libsmb/cliconnect.c |   32 ++++++++++++++++++++++++++++----
 source3/smbd/negprot.c      |    8 ++++++++
 3 files changed, 37 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/client.h b/source3/include/client.h
index 37c1dcd..65da738 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -138,6 +138,7 @@ struct cli_state {
                                DATA_BLOB gss_blob;
                                uint8_t challenge[8];
                                const char *workgroup;
+                               const char *name;
                                int time_zone;
                                time_t system_time;
                        } server;
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 049763f..af6c51b 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2620,6 +2620,7 @@ static void cli_negprot_done(struct tevent_req *subreq)
        DATA_BLOB server_gss_blob = data_blob_null;
        uint8_t server_challenge[8];
        char *server_workgroup = NULL;
+       char *server_name = NULL;
        int server_time_zone = 0;
        time_t server_system_time = 0;
        enum protocol_types protocol;
@@ -2713,8 +2714,8 @@ static void cli_negprot_done(struct tevent_req *subreq)
                        }
                        server_gss_blob = blob2;
                } else {
-                       DATA_BLOB blob1;
-                       ssize_t ret;
+                       DATA_BLOB blob1, blob2;
+                       ssize_t ret = 0;
 
                        if (num_bytes < key_len) {
                                tevent_req_nterror(req, 
NT_STATUS_INVALID_NETWORK_RESPONSE);
@@ -2731,13 +2732,35 @@ static void cli_negprot_done(struct tevent_req *subreq)
                        }
 
                        blob1 = data_blob_const(bytes+key_len, 
num_bytes-key_len);
+                       blob2 = data_blob_const(bytes+key_len, 
num_bytes-key_len);
                        if (blob1.length > 0) {
                                ret = pull_string_talloc(state,
                                                         (char *)inbuf,
                                                         SVAL(inbuf, smb_flg2),
                                                         &server_workgroup,
-                                                        blob1.data, 
blob1.length,
-                                                        STR_TERMINATE);
+                                                        blob1.data,
+                                                        blob1.length,
+                                                        STR_TERMINATE|
+                                                        STR_UNICODE|
+                                                        STR_NOALIGN);
+                               if (ret == -1) {
+                                       tevent_req_oom(req);
+                                       return;
+                               }
+                       }
+
+                       blob2.data += ret;
+                       blob2.length -= ret;
+                       if (blob2.length > 0) {
+                               ret = pull_string_talloc(state,
+                                                        (char *)inbuf,
+                                                        SVAL(inbuf, smb_flg2),
+                                                        &server_name,
+                                                        blob2.data,
+                                                        blob2.length,
+                                                        STR_TERMINATE|
+                                                        STR_UNICODE|
+                                                        STR_NOALIGN);
                                if (ret == -1) {
                                        tevent_req_oom(req);
                                        return;
@@ -2868,6 +2891,7 @@ static void cli_negprot_done(struct tevent_req *subreq)
        cli->conn.smb1.server.guid = server_guid;
        memcpy(cli->conn.smb1.server.challenge, server_challenge, 8);
        cli->conn.smb1.server.workgroup = talloc_move(cli, &server_workgroup);
+       cli->conn.smb1.server.name = talloc_move(cli, &server_name);
 
        cli->conn.smb1.server.time_zone = server_time_zone;
        cli->conn.smb1.server.system_time = server_system_time;
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 3afa8b1..9b58a79 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -423,6 +423,14 @@ static void reply_nt1(struct smb_request *req, uint16 
choice)
                        reply_nterror(req, NT_STATUS_NO_MEMORY);
                        return;
                }
+               ret = message_push_string(&req->outbuf, lp_netbios_name(),
+                                         STR_UNICODE|STR_TERMINATE
+                                         |STR_NOALIGN);
+               if (ret == -1) {
+                       DEBUG(0, ("Could not push netbios name string\n"));
+                       reply_nterror(req, NT_STATUS_NO_MEMORY);
+                       return;
+               }
                DEBUG(3,("not using SPNEGO\n"));
        } else {
                DATA_BLOB spnego_blob = negprot_spnego(req, req->sconn);


-- 
Samba Shared Repository

Reply via email to