stricter checking of SMB2 echo body (per the spec)
authorAndrew Tridgell <tridge@samba.org>
Wed, 24 Sep 2008 03:01:06 +0000 (20:01 -0700)
committerAndrew Tridgell <tridge@samba.org>
Thu, 25 Sep 2008 01:10:22 +0000 (18:10 -0700)
thanks to the bluearc test suite

source4/smb_server/smb2/keepalive.c

index f40bcc485c594e2f87c31b584870efe5047b69d9..d1a0ef3d722e5c670a4036aa4c7e3eb408b7d40f 100644 (file)
@@ -54,11 +54,16 @@ void smb2srv_keepalive_recv(struct smb2srv_request *req)
 {
        uint16_t _pad;
 
-       if (req->in.body_size < 0x04) {
+       if (req->in.body_size != 0x04) {
                smb2srv_send_error(req,  NT_STATUS_FOOBAR);
                return;
        }
 
+       if (SVAL(req->in.body, 0x00) != 0x04) {
+               smb2srv_send_error(req,  NT_STATUS_INVALID_PARAMETER);
+               return;
+       }
+
        _pad    = SVAL(req->in.body, 0x02);
 
        req->status = smb2srv_keepalive_backend(req);