libcli:smb: Check return code of smb_signing_md5()
authorAndreas Schneider <asn@samba.org>
Thu, 11 Apr 2019 08:24:49 +0000 (10:24 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 21 May 2019 00:03:21 +0000 (00:03 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/smb/smb_signing.c

index 93e2c82..89b57b5 100644 (file)
@@ -316,6 +316,7 @@ bool smb_signing_check_pdu(struct smb_signing_state *si,
        bool good;
        uint8_t calc_md5_mac[16];
        const uint8_t *reply_sent_mac;
+       NTSTATUS status;
 
        if (si->mac_key.length == 0) {
                return true;
@@ -328,8 +329,16 @@ bool smb_signing_check_pdu(struct smb_signing_state *si,
                return false;
        }
 
-       smb_signing_md5(&si->mac_key, inhdr, len,
-                       seqnum, calc_md5_mac);
+       status = smb_signing_md5(&si->mac_key,
+                                inhdr,
+                                len,
+                                seqnum,
+                                calc_md5_mac);
+       if (!NT_STATUS_IS_OK(status)) {
+               DBG_ERR("Failed to calculate signing mac: %s\n",
+                       nt_errstr(status));
+               return false;
+       }
 
        reply_sent_mac = &inhdr[HDR_SS_FIELD];
        good = (memcmp(reply_sent_mac, calc_md5_mac, 8) == 0);