Connect set security descriptor into SMB2 code.
authorJeremy Allison <jra@samba.org>
Wed, 28 Apr 2010 21:13:22 +0000 (14:13 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 28 Apr 2010 21:13:22 +0000 (14:13 -0700)
Jeremy.

source3/include/proto.h
source3/smbd/nttrans.c
source3/smbd/smb2_setinfo.c

index f5e9ec4e063856b3ef9c6daa2e50bc2b8fdabea3..1eaa008320d2cf991fbbb08d6069dc49253585bf 100644 (file)
@@ -6613,6 +6613,8 @@ void send_nt_replies(connection_struct *conn,
                     char *params, int paramsize,
                     char *pdata, int datasize);
 void reply_ntcreate_and_X(struct smb_request *req);
+NTSTATUS set_sd(files_struct *fsp, uint8_t *data, uint32_t sd_len,
+                       uint32_t security_info_sent);
 struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
 void reply_ntcancel(struct smb_request *req);
 void reply_ntrename(struct smb_request *req);
index 3ce196d4673f6ac5d379e57bbe623141bc0c21bc..b594b7e4bc1b242c5103138bbae802659599d463 100644 (file)
@@ -828,8 +828,8 @@ static void do_nt_transact_create_pipe(connection_struct *conn,
  Internal fn to set security descriptors.
 ****************************************************************************/
 
-static NTSTATUS set_sd(files_struct *fsp, uint8 *data, uint32 sd_len,
-                      uint32 security_info_sent)
+NTSTATUS set_sd(files_struct *fsp, uint8_t *data, uint32_t sd_len,
+                      uint32_t security_info_sent)
 {
        SEC_DESC *psd = NULL;
        NTSTATUS status;
index f6dbf78c21445ddfe780f87a30b10bf931d5c211..410d9f722389420d0cf311bba15579bc59e67c14 100644 (file)
@@ -161,11 +161,12 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
                                                 uint32_t in_additional_information,
                                                 uint64_t in_file_id_volatile)
 {
-       struct tevent_req *req;
-       struct smbd_smb2_setinfo_state *state;
-       struct smb_request *smbreq;
+       struct tevent_req *req = NULL;
+       struct smbd_smb2_setinfo_state *state = NULL;
+       struct smb_request *smbreq = NULL;
        connection_struct *conn = smb2req->tcon->compat_conn;
-       files_struct *fsp;
+       files_struct *fsp = NULL;
+       NTSTATUS status;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smbd_smb2_setinfo_state);
@@ -208,7 +209,6 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
                char *data;
                int data_size;
                int ret_size = 0;
-               NTSTATUS status;
 
 
                file_info_level = in_file_info_class + 1000;
@@ -285,7 +285,7 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
                if (data_size > 0) {
                        data = (char *)SMB_MALLOC_ARRAY(char, data_size);
                        if (tevent_req_nomem(data, req)) {
-
+                               return tevent_req_post(req, ev);
                        }
                        memcpy(data, in_input_buffer.data, data_size);
                }
@@ -308,6 +308,19 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
                break;
        }
 
+       case 0x03:/* SMB2_SETINFO_SECURITY */
+       {
+               status = set_sd(fsp,
+                               in_input_buffer.data,
+                               in_input_buffer.length,
+                               in_additional_information);
+               if (!NT_STATUS_IS_OK(status)) {
+                       tevent_req_nterror(req, status);
+                       return tevent_req_post(req, ev);
+               }
+               break;
+       }
+
        default:
                tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
                return tevent_req_post(req, ev);