s3:smbd: pass smbXsrv_connection to get_challenge()
authorStefan Metzmacher <metze@samba.org>
Wed, 11 Jun 2014 10:42:56 +0000 (12:42 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 6 Aug 2014 07:51:13 +0000 (09:51 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/smbd/negprot.c

index 7db714d7f6fd21d92535db57b43bbf768b5a4c5f..86a4acd7d365dcdc66362ca27c4932fb9a5d72b9 100644 (file)
@@ -31,9 +31,8 @@
 
 extern fstring remote_proto;
 
-static void get_challenge(struct smbd_server_connection *sconn, uint8 buff[8])
+static void get_challenge(struct smbXsrv_connection *xconn, uint8 buff[8])
 {
-       struct smbXsrv_connection *xconn = sconn->conn;
        NTSTATUS nt_status;
 
        /* We might be called more than once, multiple negprots are
@@ -65,8 +64,7 @@ static void reply_lanman1(struct smb_request *req, uint16 choice)
 {
        int secword=0;
        time_t t = time(NULL);
-       struct smbd_server_connection *sconn = req->sconn;
-       struct smbXsrv_connection *xconn = sconn->conn;
+       struct smbXsrv_connection *xconn = req->xconn;
        uint16_t raw;
        if (lp_async_smb_echo_handler()) {
                raw = 0;
@@ -87,11 +85,11 @@ static void reply_lanman1(struct smb_request *req, uint16 choice)
        SSVAL(req->outbuf,smb_vwv1,secword);
        /* Create a token value and add it to the outgoing packet. */
        if (xconn->smb1.negprot.encrypted_passwords) {
-               get_challenge(sconn, (uint8 *)smb_buf(req->outbuf));
+               get_challenge(xconn, (uint8 *)smb_buf(req->outbuf));
                SSVAL(req->outbuf,smb_vwv11, 8);
        }
 
-       smbXsrv_connection_init_tables(req->sconn->conn, PROTOCOL_LANMAN1);
+       smbXsrv_connection_init_tables(xconn, PROTOCOL_LANMAN1);
 
        /* Reply, SMBlockread, SMBwritelock supported. */
        SCVAL(req->outbuf,smb_flg, FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
@@ -116,8 +114,7 @@ static void reply_lanman2(struct smb_request *req, uint16 choice)
 {
        int secword=0;
        time_t t = time(NULL);
-       struct smbd_server_connection *sconn = req->sconn;
-       struct smbXsrv_connection *xconn = sconn->conn;
+       struct smbXsrv_connection *xconn = req->xconn;
        uint16_t raw;
        if (lp_async_smb_echo_handler()) {
                raw = 0;
@@ -140,11 +137,11 @@ static void reply_lanman2(struct smb_request *req, uint16 choice)
 
        /* Create a token value and add it to the outgoing packet. */
        if (xconn->smb1.negprot.encrypted_passwords) {
-               get_challenge(sconn, (uint8 *)smb_buf(req->outbuf));
+               get_challenge(xconn, (uint8 *)smb_buf(req->outbuf));
                SSVAL(req->outbuf,smb_vwv11, 8);
        }
 
-       smbXsrv_connection_init_tables(req->sconn->conn, PROTOCOL_LANMAN2);
+       smbXsrv_connection_init_tables(xconn, PROTOCOL_LANMAN2);
 
        /* Reply, SMBlockread, SMBwritelock supported. */
        SCVAL(req->outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
@@ -252,7 +249,6 @@ static void reply_nt1(struct smb_request *req, uint16 choice)
        bool negotiate_spnego = False;
        struct timespec ts;
        ssize_t ret;
-       struct smbd_server_connection *sconn = req->sconn;
        struct smbXsrv_connection *xconn = req->xconn;
        bool signing_desired = false;
        bool signing_required = false;
@@ -352,7 +348,7 @@ static void reply_nt1(struct smb_request *req, uint16 choice)
                        uint8 chal[8];
                        /* note that we do not send a challenge at all if
                           we are using plaintext */
-                       get_challenge(sconn, chal);
+                       get_challenge(xconn, chal);
                        ret = message_push_blob(
                                &req->outbuf, data_blob_const(chal, sizeof(chal)));
                        if (ret == -1) {
@@ -520,8 +516,8 @@ void reply_negprot(struct smb_request *req)
        char **cliprotos;
        int i;
        size_t converted_size;
-       struct smbd_server_connection *sconn = req->sconn;
-       struct smbXsrv_connection *xconn = sconn->conn;
+       struct smbXsrv_connection *xconn = req->xconn;
+       struct smbd_server_connection *sconn = xconn->sconn;
 
        START_PROFILE(SMBnegprot);