summaryrefslogtreecommitdiff
path: root/source4/libcli/raw
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-18 01:41:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:57 -0500
commit012be92f0a771d8437f783dc8ed14f38c669893c (patch)
tree13a87d0d0fdec7bf691a1767151915831d89f7d8 /source4/libcli/raw
parentbbf009b46f75f292a625b853b9331b5d5e0da7c2 (diff)
downloadsamba-012be92f0a771d8437f783dc8ed14f38c669893c.tar.gz
samba-012be92f0a771d8437f783dc8ed14f38c669893c.tar.bz2
samba-012be92f0a771d8437f783dc8ed14f38c669893c.zip
r3830: unified the query/set security descriptor code with the rest of the
queryfileinfo/setfileinfo logic, so querying/setting a security descriptor is treated as just another file query/set operation. This will allow NTVFS backends to see the query/set security descriptor operations as RAW_FILEINFO_SEC_DESC and RAW_SFILEINFO_SEC_DESC operations. (This used to be commit f68a6b6b915c37e48c42390c1e74c2d1c2636fa9)
Diffstat (limited to 'source4/libcli/raw')
-rw-r--r--source4/libcli/raw/rawacl.c33
-rw-r--r--source4/libcli/raw/rawfileinfo.c9
-rw-r--r--source4/libcli/raw/rawsetfileinfo.c4
3 files changed, 29 insertions, 17 deletions
diff --git a/source4/libcli/raw/rawacl.c b/source4/libcli/raw/rawacl.c
index 2e05002491..253a3cbbe7 100644
--- a/source4/libcli/raw/rawacl.c
+++ b/source4/libcli/raw/rawacl.c
@@ -27,7 +27,7 @@
fetch file ACL (async send)
****************************************************************************/
struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree,
- struct smb_query_secdesc *query)
+ union smb_fileinfo *io)
{
struct smb_nttrans nt;
uint8_t params[8];
@@ -39,9 +39,9 @@ struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree,
nt.in.function = NT_TRANSACT_QUERY_SECURITY_DESC;
nt.in.setup = NULL;
- SSVAL(params, 0, query->in.fnum);
+ SSVAL(params, 0, io->query_secdesc.in.fnum);
SSVAL(params, 2, 0); /* padding */
- SIVAL(params, 4, query->in.secinfo_flags);
+ SIVAL(params, 4, io->query_secdesc.in.secinfo_flags);
nt.in.params.data = params;
nt.in.params.length = 8;
@@ -57,7 +57,7 @@ fetch file ACL (async recv)
****************************************************************************/
NTSTATUS smb_raw_query_secdesc_recv(struct smbcli_request *req,
TALLOC_CTX *mem_ctx,
- struct smb_query_secdesc *query)
+ union smb_fileinfo *io)
{
NTSTATUS status;
struct smb_nttrans nt;
@@ -81,11 +81,12 @@ NTSTATUS smb_raw_query_secdesc_recv(struct smbcli_request *req,
return NT_STATUS_INVALID_PARAMETER;
}
- query->out.sd = talloc_p(mem_ctx, struct security_descriptor);
- if (!query->out.sd) {
+ io->query_secdesc.out.sd = talloc_p(mem_ctx, struct security_descriptor);
+ if (!io->query_secdesc.out.sd) {
return NT_STATUS_NO_MEMORY;
}
- status = ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, query->out.sd);
+ status = ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS,
+ io->query_secdesc.out.sd);
return status;
}
@@ -96,10 +97,10 @@ fetch file ACL (sync interface)
****************************************************************************/
NTSTATUS smb_raw_query_secdesc(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
- struct smb_query_secdesc *query)
+ union smb_fileinfo *io)
{
- struct smbcli_request *req = smb_raw_query_secdesc_send(tree, query);
- return smb_raw_query_secdesc_recv(req, mem_ctx, query);
+ struct smbcli_request *req = smb_raw_query_secdesc_send(tree, io);
+ return smb_raw_query_secdesc_recv(req, mem_ctx, io);
}
@@ -108,7 +109,7 @@ NTSTATUS smb_raw_query_secdesc(struct smbcli_tree *tree,
set file ACL (async send)
****************************************************************************/
struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree,
- struct smb_set_secdesc *set)
+ union smb_setfileinfo *io)
{
struct smb_nttrans nt;
uint8_t params[8];
@@ -123,9 +124,9 @@ struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree,
nt.in.function = NT_TRANSACT_SET_SECURITY_DESC;
nt.in.setup = NULL;
- SSVAL(params, 0, set->in.fnum);
+ SSVAL(params, 0, io->set_secdesc.file.fnum);
SSVAL(params, 2, 0); /* padding */
- SIVAL(params, 4, set->in.secinfo_flags);
+ SIVAL(params, 4, io->set_secdesc.in.secinfo_flags);
nt.in.params.data = params;
nt.in.params.length = 8;
@@ -133,7 +134,7 @@ struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree,
ndr = ndr_push_init();
if (!ndr) return NULL;
- status = ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, set->in.sd);
+ status = ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, io->set_secdesc.in.sd);
if (!NT_STATUS_IS_OK(status)) {
ndr_push_free(ndr);
return NULL;
@@ -151,8 +152,8 @@ struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree,
set file ACL (sync interface)
****************************************************************************/
NTSTATUS smb_raw_set_secdesc(struct smbcli_tree *tree,
- struct smb_set_secdesc *set)
+ union smb_setfileinfo *io)
{
- struct smbcli_request *req = smb_raw_set_secdesc_send(tree, set);
+ struct smbcli_request *req = smb_raw_set_secdesc_send(tree, io);
return smbcli_request_simple_recv(req);
}
diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c
index c844f923b8..6f875f51a7 100644
--- a/source4/libcli/raw/rawfileinfo.c
+++ b/source4/libcli/raw/rawfileinfo.c
@@ -48,6 +48,7 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session,
case RAW_FILEINFO_GENERIC:
case RAW_FILEINFO_GETATTR:
case RAW_FILEINFO_GETATTRE:
+ case RAW_FILEINFO_SEC_DESC:
/* not handled here */
return NT_STATUS_INVALID_LEVEL;
@@ -460,12 +461,15 @@ failed:
Query file info (async send)
****************************************************************************/
struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree,
- union smb_fileinfo *parms)
+ union smb_fileinfo *parms)
{
/* pass off the non-trans2 level to specialised functions */
if (parms->generic.level == RAW_FILEINFO_GETATTRE) {
return smb_raw_getattrE_send(tree, parms);
}
+ if (parms->generic.level == RAW_FILEINFO_SEC_DESC) {
+ return smb_raw_query_secdesc_send(tree, parms);
+ }
if (parms->generic.level >= RAW_FILEINFO_GENERIC) {
return NULL;
}
@@ -489,6 +493,9 @@ NTSTATUS smb_raw_fileinfo_recv(struct smbcli_request *req,
if (parms->generic.level == RAW_FILEINFO_GETATTRE) {
return smb_raw_getattrE_recv(req, parms);
}
+ if (parms->generic.level == RAW_FILEINFO_SEC_DESC) {
+ return smb_raw_query_secdesc_recv(req, mem_ctx, parms);
+ }
if (parms->generic.level == RAW_FILEINFO_GETATTR) {
return smb_raw_getattr_recv(req, parms);
}
diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c
index 0c263ac082..76756971ae 100644
--- a/source4/libcli/raw/rawsetfileinfo.c
+++ b/source4/libcli/raw/rawsetfileinfo.c
@@ -41,6 +41,7 @@ static BOOL smb_raw_setinfo_backend(struct smbcli_tree *tree,
case RAW_SFILEINFO_GENERIC:
case RAW_SFILEINFO_SETATTR:
case RAW_SFILEINFO_SETATTRE:
+ case RAW_SFILEINFO_SEC_DESC:
/* not handled here */
return False;
@@ -262,6 +263,9 @@ struct smbcli_request *smb_raw_setfileinfo_send(struct smbcli_tree *tree,
if (parms->generic.level == RAW_SFILEINFO_SETATTRE) {
return smb_raw_setattrE_send(tree, parms);
}
+ if (parms->generic.level == RAW_SFILEINFO_SEC_DESC) {
+ return smb_raw_set_secdesc_send(tree, parms);
+ }
if (parms->generic.level >= RAW_SFILEINFO_GENERIC) {
return NULL;
}