libcli/raw: in SMB_SIGNING_ENGINE_BSRSPYL state it's ok to accept any signature
authorStefan Metzmacher <metze@samba.org>
Tue, 9 Sep 2008 15:56:11 +0000 (17:56 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 9 Sep 2008 19:11:24 +0000 (21:11 +0200)
Even if signing is mandatory.

With NTLMSSP this happens for the session setup:

request1  => BSRSPYL
response1 => BSRSPYL
request2  => <SIGNATURE>
response2  => <SIGNATURE>

metze

source/libcli/raw/smb_signing.c

index ae17dadf33560f072377609ca9ed848341f3a8f6..0d71247ecab46fb8406f790e47810a53d0166303 100644 (file)
@@ -310,6 +310,23 @@ bool smbcli_request_check_sign_mac(struct smbcli_request *req)
        case SMB_SIGNING_ENGINE_OFF:
                return true;
        case SMB_SIGNING_ENGINE_BSRSPYL:
+               if (req->in.size < (HDR_SS_FIELD + 8)) {
+                       return false;
+               }
+
+               good = check_signed_incoming_message(&req->in,
+                                                    &req->transport->negotiate.sign_info.mac_key,
+                                                    req->seq_num+1);
+               if (good) {
+                       return signing_good(&req->transport->negotiate.sign_info,
+                                           req->seq_num+1, good);
+               }
+               /*
+                * It's not an error if the signature isn't valid.
+                * It could be "BSRSPYL " or any other value
+                */
+               return true;
+
        case SMB_SIGNING_ENGINE_ON:
        {                       
                if (req->in.size < (HDR_SS_FIELD + 8)) {