s3:smbd: add smbd_smb2_request_done_ex()
authorStefan Metzmacher <metze@samba.org>
Wed, 20 May 2009 17:35:39 +0000 (19:35 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 20 May 2009 18:53:31 +0000 (20:53 +0200)
Some times we have to return a non-error response
with status != NT_STATUS_OK.

metze

source3/smbd/globals.h
source3/smbd/smb2_server.c

index c5dd97c7c846f139d19930ab661742a1e432cf30..93075ad9017bdd5b73ad293e2b4156dbebfea7c7 100644 (file)
@@ -214,6 +214,9 @@ NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req,
                                    NTSTATUS status, DATA_BLOB *info);
 NTSTATUS smbd_smb2_request_error(struct smbd_smb2_request *req,
                                 NTSTATUS status);
+NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
+                                  NTSTATUS status,
+                                  DATA_BLOB body, DATA_BLOB *dyn);
 NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
                                DATA_BLOB body, DATA_BLOB *dyn);
 
index 095b1f0cd7eac246144e83858e22090930a45672..c4c5492e5fdfce509dc0bda86159e7a4285dda3e 100644 (file)
@@ -436,16 +436,18 @@ NTSTATUS smbd_smb2_request_error(struct smbd_smb2_request *req,
        return smbd_smb2_request_error_ex(req, status, NULL);
 }
 
-NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
-                               DATA_BLOB body, DATA_BLOB *dyn)
+NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
+                                  NTSTATUS status,
+                                  DATA_BLOB body, DATA_BLOB *dyn)
 {
        uint8_t *outhdr;
        uint8_t *outdyn;
        int i = req->current_idx;
        uint32_t next_command_ofs;
 
-       DEBUG(10,("smbd_smb2_request_done: idx[%d] body[%u] dyn[%s:%u]\n",
-                 i, (unsigned int)body.length,
+       DEBUG(10,("smbd_smb2_request_done_ex: "
+                 "idx[%d] status[%s] body[%u] dyn[%s:%u]\n",
+                 i, nt_errstr(status), (unsigned int)body.length,
                  dyn ? "yes": "no",
                  (unsigned int)(dyn ? dyn->length : 0)));
 
@@ -462,7 +464,7 @@ NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
        outdyn = outhdr + SMB2_HDR_BODY + 8;
 
        next_command_ofs = SIVAL(outhdr, SMB2_HDR_NEXT_COMMAND, 0);
-       SIVAL(outhdr, SMB2_HDR_STATUS, NT_STATUS_V(NT_STATUS_OK));
+       SIVAL(outhdr, SMB2_HDR_STATUS, NT_STATUS_V(status));
 
        req->out.vector[i+1].iov_base = (void *)body.data;
        req->out.vector[i+1].iov_len = body.length;
@@ -498,6 +500,12 @@ NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
        return smbd_smb2_request_reply(req);
 }
 
+NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
+                               DATA_BLOB body, DATA_BLOB *dyn)
+{
+       return smbd_smb2_request_done_ex(req, NT_STATUS_OK, body, dyn);
+}
+
 static void smbd_smb2_request_dispatch_compound(struct tevent_req *subreq)
 {
        struct smbd_smb2_request *req = tevent_req_callback_data(subreq,