addition of samr_SetSecurity() from kai
authorAndrew Tridgell <tridge@samba.org>
Fri, 19 Dec 2003 23:44:26 +0000 (23:44 +0000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 19 Dec 2003 23:44:26 +0000 (23:44 +0000)
we needed to adjust the alignment of [relative] buffers for this to
work. I wonder if they are always 4 byte aligned?
(This used to be commit 9cd0a0b8b976e62c6da71b7e55cba5b38483620d)

source4/librpc/idl/misc.idl
source4/librpc/idl/samr.idl
source4/librpc/ndr/ndr.c
source4/torture/rpc/samr.c

index 7b41f45980fb080812819c502dccb9c9c3c6ff25..fca8fe876e2d0b5d80b2fc8af7bed8edd23f5a86 100644 (file)
@@ -28,6 +28,7 @@ interface misc
        typedef [public] struct {
                uint8 type;  /* xxxx_xxxx_ACE_TYPE - e.g allowed / denied etc */
                uint8 flags; /* xxxx_INHERIT_xxxx - e.g OBJECT_INHERIT_ACE */
+               [value(ndr_size_security_ace(r))] uint16 size;
                uint32 access_mask;
 
 #if 0
@@ -44,6 +45,7 @@ interface misc
 
        typedef [public] struct {
                uint16 revision;
+               [value(ndr_size_security_acl(r))] uint16 size;
                uint32 num_aces;
                security_ace aces[num_aces];
        } security_acl;
index bbf1e400860f5f054e8a54fd0d3f440a28f334fd..1226d1f7707c1c4a2c8cc33d0d6f3c3ce6dbf070 100644 (file)
 
        /******************/
        /* Function: 0x02 */
-       NTSTATUS samr_SetSecurity ();
-
-       /******************/
-       /* Function: 0x03 */
 
        typedef struct {
                [value(ndr_size_security_descriptor(r->sd))] uint32 sd_size;
                [subcontext(4)] security_descriptor *sd;
        } samr_SdBuf;
 
+       NTSTATUS samr_SetSecurity (
+               [in,ref]          policy_handle *handle,
+               [in]              uint32 sec_info,
+               [in,ref]          samr_SdBuf *sdbuf
+               );
+
+       /******************/
+       /* Function: 0x03 */
+
        NTSTATUS samr_QuerySecurity (
                [in,ref]          policy_handle *handle,
                [in]              uint32 sec_info,
index a1e5fe538f55585f873696a5032e8ebf222333c2..2af63c76769a7b3d2465c4dbb669d37ae58f426f 100644 (file)
@@ -708,7 +708,7 @@ NTSTATUS ndr_push_relative(struct ndr_push *ndr, int ndr_flags, const void *p,
                if (ndr->relative_list == NULL) {
                        ndr->relative_list_end = NULL;
                }
-               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_align(ndr, 4));
                ndr_push_save(ndr, &save);
                ndr->offset = ofs->offset;
                NDR_CHECK(ndr_push_uint32(ndr, save.offset - ndr->ofs_list->offset));
index e5e44934805417dafb0e46eb34b599d7d9157eff..f77b7ebde4f9ce96b06cd7c72c96c85a1eec7757 100644 (file)
@@ -63,6 +63,7 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 {
        NTSTATUS status;
        struct samr_QuerySecurity r;
+       struct samr_SetSecurity s;
 
        r.in.handle = handle;
        r.in.sec_info = 7;
@@ -73,6 +74,22 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                return False;
        }
 
+       s.in.handle = handle;
+       s.in.sec_info = 7;
+       s.in.sdbuf = r.out.sdbuf;
+
+       status = dcerpc_samr_SetSecurity(p, mem_ctx, &s);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("SetSecurity failed - %s\n", nt_errstr(status));
+               return False;
+       }
+
+       status = dcerpc_samr_QuerySecurity(p, mem_ctx, &r);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("QuerySecurity failed - %s\n", nt_errstr(status));
+               return False;
+       }
+
        return True;
 }