s3:smbd: add PIPE_BUSY handling for SMBtrans calls on named pipes
authorStefan Metzmacher <metze@samba.org>
Wed, 28 Apr 2010 13:15:23 +0000 (15:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 27 May 2010 05:13:55 +0000 (07:13 +0200)
metze

source3/smbd/ipc.c

index 97b338a536e757a1af0ffb4b1aca2307b38d9fea..08494b4dca66bf642f5a2ef0e36699c914c90901 100644 (file)
@@ -227,12 +227,23 @@ static void api_dcerpc_cmd(connection_struct *conn, struct smb_request *req,
 {
        struct tevent_req *subreq;
        struct dcerpc_cmd_state *state;
+       bool busy;
 
        if (!fsp_is_np(fsp)) {
                api_no_reply(conn, req);
                return;
        }
 
+       /*
+        * Trans requests are only allowed
+        * if no other Trans or Read is active
+        */
+       busy = np_read_in_progress(fsp->fake_file_handle);
+       if (busy) {
+               reply_nterror(req, NT_STATUS_PIPE_BUSY);
+               return;
+       }
+
        state = talloc(req, struct dcerpc_cmd_state);
        if (state == NULL) {
                reply_nterror(req, NT_STATUS_NO_MEMORY);