diff options
Diffstat (limited to 'source4/smb_server')
-rw-r--r-- | source4/smb_server/blob.c | 16 | ||||
-rw-r--r-- | source4/smb_server/smb/nttrans.c | 34 | ||||
-rw-r--r-- | source4/smb_server/smb2/fileinfo.c | 24 |
3 files changed, 45 insertions, 29 deletions
diff --git a/source4/smb_server/blob.c b/source4/smb_server/blob.c index 5cbd74a028..3683991526 100644 --- a/source4/smb_server/blob.c +++ b/source4/smb_server/blob.c @@ -272,12 +272,18 @@ NTSTATUS smbsrv_push_passthru_fsinfo(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; - case RAW_QFS_OBJECTID_INFORMATION: + case RAW_QFS_OBJECTID_INFORMATION: { + enum ndr_err_code ndr_err; + BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, 64)); - BLOB_CHECK(ndr_push_struct_blob(&guid_blob, mem_ctx, - &fsinfo->objectid_information.out.guid, - (ndr_push_flags_fn_t)ndr_push_GUID)); + ndr_err = ndr_push_struct_blob(&guid_blob, mem_ctx, + &fsinfo->objectid_information.out.guid, + (ndr_push_flags_fn_t)ndr_push_GUID); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + BLOB_CHECK(ndr_map_error2ntstatus(ndr_err)); + } + memcpy(blob->data, guid_blob.data, guid_blob.length); for (i=0;i<6;i++) { @@ -285,7 +291,7 @@ NTSTATUS smbsrv_push_passthru_fsinfo(TALLOC_CTX *mem_ctx, } return NT_STATUS_OK; - + } default: return NT_STATUS_INVALID_LEVEL; } diff --git a/source4/smb_server/smb/nttrans.c b/source4/smb_server/smb/nttrans.c index 922dccff60..046f6ca0ec 100644 --- a/source4/smb_server/smb/nttrans.c +++ b/source4/smb_server/smb/nttrans.c @@ -103,6 +103,7 @@ static NTSTATUS nttrans_create(struct smbsrv_request *req, uint32_t sd_length, ea_length; NTSTATUS status; uint8_t *params; + enum ndr_err_code ndr_err; if (trans->in.params.length < 54) { return NT_STATUS_INVALID_PARAMETER; @@ -155,11 +156,11 @@ static NTSTATUS nttrans_create(struct smbsrv_request *req, if (io->ntcreatex.in.sec_desc == NULL) { return NT_STATUS_NO_MEMORY; } - status = ndr_pull_struct_blob(&blob, io, - io->ntcreatex.in.sec_desc, - (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); - if (!NT_STATUS_IS_OK(status)) { - return status; + ndr_err = ndr_pull_struct_blob(&blob, io, + io->ntcreatex.in.sec_desc, + (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); } } @@ -196,15 +197,18 @@ static NTSTATUS nttrans_query_sec_desc_send(struct nttrans_op *op) union smb_fileinfo *io = talloc_get_type(op->op_info, union smb_fileinfo); uint8_t *params; NTSTATUS status; + enum ndr_err_code ndr_err; status = nttrans_setup_reply(op, op->trans, 4, 0, 0); NT_STATUS_NOT_OK_RETURN(status); params = op->trans->out.params.data; - status = ndr_push_struct_blob(&op->trans->out.data, op, - io->query_secdesc.out.sd, - (ndr_push_flags_fn_t)ndr_push_security_descriptor); - NT_STATUS_NOT_OK_RETURN(status); + ndr_err = ndr_push_struct_blob(&op->trans->out.data, op, + io->query_secdesc.out.sd, + (ndr_push_flags_fn_t)ndr_push_security_descriptor); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } SIVAL(params, 0, op->trans->out.data.length); @@ -248,7 +252,7 @@ static NTSTATUS nttrans_set_sec_desc(struct smbsrv_request *req, { struct smb_nttrans *trans = op->trans; union smb_setfileinfo *io; - NTSTATUS status; + enum ndr_err_code ndr_err; if (trans->in.params.length < 8) { return NT_STATUS_INVALID_PARAMETER; @@ -265,10 +269,12 @@ static NTSTATUS nttrans_set_sec_desc(struct smbsrv_request *req, io->set_secdesc.in.sd = talloc(io, struct security_descriptor); NT_STATUS_HAVE_NO_MEMORY(io->set_secdesc.in.sd); - status = ndr_pull_struct_blob(&trans->in.data, req, - io->set_secdesc.in.sd, - (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); - NT_STATUS_NOT_OK_RETURN(status); + ndr_err = ndr_pull_struct_blob(&trans->in.data, req, + io->set_secdesc.in.sd, + (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } SMBSRV_CHECK_FILE_HANDLE_NTSTATUS(io->set_secdesc.in.file.ntvfs); return ntvfs_setfileinfo(req->ntvfs, io); diff --git a/source4/smb_server/smb2/fileinfo.c b/source4/smb_server/smb2/fileinfo.c index 41b31f586f..8715279dad 100644 --- a/source4/smb_server/smb2/fileinfo.c +++ b/source4/smb_server/smb2/fileinfo.c @@ -143,12 +143,14 @@ static NTSTATUS smb2srv_getinfo_fs(struct smb2srv_getinfo_op *op, uint8_t smb2_l static NTSTATUS smb2srv_getinfo_security_send(struct smb2srv_getinfo_op *op) { union smb_fileinfo *io = talloc_get_type(op->io_ptr, union smb_fileinfo); - NTSTATUS status; + enum ndr_err_code ndr_err; - status = ndr_push_struct_blob(&op->info->out.blob, op->req, - io->query_secdesc.out.sd, - (ndr_push_flags_fn_t)ndr_push_security_descriptor); - NT_STATUS_NOT_OK_RETURN(status); + ndr_err = ndr_push_struct_blob(&op->info->out.blob, op->req, + io->query_secdesc.out.sd, + (ndr_push_flags_fn_t)ndr_push_security_descriptor); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } return NT_STATUS_OK; } @@ -294,7 +296,7 @@ static NTSTATUS smb2srv_setinfo_fs(struct smb2srv_setinfo_op *op, uint8_t smb2_l static NTSTATUS smb2srv_setinfo_security(struct smb2srv_setinfo_op *op, uint8_t smb2_level) { union smb_setfileinfo *io; - NTSTATUS status; + enum ndr_err_code ndr_err; switch (smb2_level) { case 0x00: @@ -308,10 +310,12 @@ static NTSTATUS smb2srv_setinfo_security(struct smb2srv_setinfo_op *op, uint8_t io->set_secdesc.in.sd = talloc(io, struct security_descriptor); NT_STATUS_HAVE_NO_MEMORY(io->set_secdesc.in.sd); - status = ndr_pull_struct_blob(&op->info->in.blob, io, - io->set_secdesc.in.sd, - (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); - NT_STATUS_NOT_OK_RETURN(status); + ndr_err = ndr_pull_struct_blob(&op->info->in.blob, io, + io->set_secdesc.in.sd, + (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } return ntvfs_setfileinfo(op->req->ntvfs, io); } |