r5256: More verbose description of functions (as I learn the code).
[samba.git] / source4 / smb_server / signing.c
index b3fac2fa706e77fe3637c379d475b7eac1a949d1..afd562340d770bcf9bd020703ae7b41ecabfe911 100644 (file)
@@ -19,6 +19,8 @@
 */
 
 #include "includes.h"
+#include "smb_server/smb_server.h"
+
 
 /*
   sign an outgoing packet
@@ -82,8 +84,8 @@ void srv_signing_restart(struct smbsrv_connection *smb_conn,
                srv_setup_signing(smb_conn, session_key, response);
                smb_conn->signing.next_seq_num = 2;
                if (smb_conn->signing.mandatory_signing) {
-                       DEBUG(5, ("Configured for mandetory signing, 'good packet seen' forced on\n"));
-                       /* if this is mandetory, then
+                       DEBUG(5, ("Configured for mandatory signing, 'good packet seen' forced on\n"));
+                       /* if this is mandatory, then
                         * pretend we have seen a
                         * valid packet, so we don't
                         * turn it off */
@@ -128,13 +130,21 @@ static void req_signing_alloc_seq_num(struct smbsrv_request *req)
 {
        req->seq_num = req->smb_conn->signing.next_seq_num;
 
-       /* TODO: we need to handle one-way requests like NTcancel, which 
-          only increment the sequence number by 1 */
        if (req->smb_conn->signing.signing_state != SMB_SIGNING_OFF) {
                req->smb_conn->signing.next_seq_num += 2;
        }
 }
 
+/*
+  called for requests that do not produce a reply of their own
+*/
+void req_signing_no_reply(struct smbsrv_request *req)
+{
+       if (req->smb_conn->signing.signing_state != SMB_SIGNING_OFF) {
+               req->smb_conn->signing.next_seq_num--;
+       }
+}
+
 /***********************************************************
  SMB signing - Simple implementation - check a MAC sent by client
 ************************************************************/