summaryrefslogtreecommitdiffstats
path: root/source3/libsmb/clisecdesc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-12-03 07:36:15 +0000
committerAndrew Tridgell <tridge@samba.org>2000-12-03 07:36:15 +0000
commit4fee254d678033dffa6d0ed82e55ec59d65fcd03 (patch)
tree6c167289e86cd097460ffd0bd7535d3433f65d05 /source3/libsmb/clisecdesc.c
parentc93f686f0106383cbc519eb9e1f4a781f445849e (diff)
downloadsamba-4fee254d678033dffa6d0ed82e55ec59d65fcd03.tar.gz
samba-4fee254d678033dffa6d0ed82e55ec59d65fcd03.tar.xz
samba-4fee254d678033dffa6d0ed82e55ec59d65fcd03.zip
getting/setting acls now works. The SIDs are still numeric, the next
step is to support usernames etc (This used to be commit 6cea1647fcbc6f5a903c691273dcec44fcda1fc4)
Diffstat (limited to 'source3/libsmb/clisecdesc.c')
-rw-r--r--source3/libsmb/clisecdesc.c57
1 files changed, 56 insertions, 1 deletions
diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c
index 7667938f02..e6b57f6ad4 100644
--- a/source3/libsmb/clisecdesc.c
+++ b/source3/libsmb/clisecdesc.c
@@ -39,7 +39,7 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
SEC_DESC *ret;
SIVAL(param, 0, fd);
- SSVAL(param, 4, 7);
+ SSVAL(param, 4, 0xf);
if (!cli_send_nt_trans(cli,
NT_TRANSACT_QUERY_SECURITY_DESC,
@@ -70,6 +70,7 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
if (!sec_io_desc("sd data", &psd, &pd, 1)) {
DEBUG(1,("Failed to parse secdesc\n"));
+ talloc_destroy(mem_ctx);
return NULL;
}
@@ -80,3 +81,57 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
+
+/****************************************************************************
+ set the security descriptor for a open file
+ ****************************************************************************/
+BOOL cli_set_secdesc(struct cli_state *cli,int fd, SEC_DESC *sd)
+{
+ char param[8];
+ char *rparam=NULL, *rdata=NULL;
+ int rparam_count=0, rdata_count=0;
+ TALLOC_CTX *mem_ctx;
+ prs_struct pd;
+
+ if ((mem_ctx = talloc_init()) == NULL) {
+ DEBUG(0,("talloc_init failed.\n"));
+ return False;
+ }
+
+ prs_init(&pd, 0, 4, mem_ctx, MARSHALL);
+ prs_give_memory(&pd, NULL, 0, True);
+
+ if (!sec_io_desc("sd data", &sd, &pd, 1)) {
+ DEBUG(1,("Failed to marshall secdesc\n"));
+ return False;
+ }
+
+ SIVAL(param, 0, fd);
+ SSVAL(param, 4, 0xf);
+
+ if (!cli_send_nt_trans(cli,
+ NT_TRANSACT_SET_SECURITY_DESC,
+ 0,
+ NULL, 0, 0,
+ param, 8, 0,
+ pd.data_p, pd.data_offset, 0)) {
+ DEBUG(1,("Failed to send NT_TRANSACT_SET_SECURITY_DESC\n"));
+ return False;
+ }
+
+
+ if (!cli_receive_nt_trans(cli,
+ &rparam, &rparam_count,
+ &rdata, &rdata_count)) {
+ DEBUG(1,("Failed to recv NT_TRANSACT_SET_SECURITY_DESC\n"));
+ return False;
+ }
+
+ if (rparam) free(rparam);
+ if (rdata) free(rdata);
+
+ talloc_destroy(mem_ctx);
+
+ return True;
+}
+