summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-11 06:22:58 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-11 06:22:58 +0000
commitbde602b9e1192945d7c0139fd4226b431fc214f2 (patch)
tree0d6c322ae65423b4b28de81d1731a48564cc01da
parentd720f3d2e40daee197a228924f2301c2c6ddd392 (diff)
downloadsamba-bde602b9e1192945d7c0139fd4226b431fc214f2.tar.gz
samba-bde602b9e1192945d7c0139fd4226b431fc214f2.tar.bz2
samba-bde602b9e1192945d7c0139fd4226b431fc214f2.zip
support lsa_AuditEventsInfo
(This used to be commit 7e7cb975936252083c5c02a64c00ee2667099c22)
-rw-r--r--source4/librpc/idl/lsa.idl7
-rw-r--r--source4/librpc/ndr/ndr_basic.c51
-rw-r--r--source4/librpc/ndr/ndr_lsa.c40
-rw-r--r--source4/librpc/ndr/ndr_lsa.h6
-rw-r--r--source4/torture/rpc/lsa.c23
5 files changed, 118 insertions, 9 deletions
diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl
index 93cae36ae0..0fdaa6afd2 100644
--- a/source4/librpc/idl/lsa.idl
+++ b/source4/librpc/idl/lsa.idl
@@ -106,8 +106,15 @@
uint32 unknown;
} lsa_AuditLogInfo;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] uint32 settings[*];
+ } lsa_AuditSettings;
+
typedef struct {
uint32 auditing_mode;
+ lsa_AuditSettings *settings;
} lsa_AuditEventsInfo;
typedef union {
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 2276b76e95..3cb9e38749 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -117,6 +117,39 @@ NTSTATUS ndr_pull_array_uint8(struct ndr_pull *ndr, char *data, uint32 n)
/*
+ pull an array of uint16
+*/
+NTSTATUS ndr_pull_array_uint16(struct ndr_pull *ndr, uint16 *data, uint32 n)
+{
+ uint32 len, i;
+ NDR_CHECK(ndr_pull_uint32(ndr, &len));
+ if (len != n) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ for (i=0;i<n;i++) {
+ NDR_CHECK(ndr_pull_uint16(ndr, &data[i]));
+ }
+ return NT_STATUS_OK;
+}
+
+/*
+ pull an array of uint32
+*/
+NTSTATUS ndr_pull_array_uint32(struct ndr_pull *ndr, uint32 *data, uint32 n)
+{
+ uint32 len, i;
+ NDR_CHECK(ndr_pull_uint32(ndr, &len));
+ if (len != n) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ for (i=0;i<n;i++) {
+ NDR_CHECK(ndr_pull_uint32(ndr, &data[i]));
+ }
+ return NT_STATUS_OK;
+}
+
+
+/*
parse a GUID
*/
NTSTATUS ndr_pull_guid(struct ndr_pull *ndr, GUID *guid)
@@ -428,3 +461,21 @@ void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16 level)
{
ndr->print(ndr, "UNKNOWN LEVEL %u", level);
}
+
+void ndr_print_array_uint32(struct ndr_print *ndr, const char *name,
+ uint32 *data, uint32 count)
+{
+ int i;
+
+ ndr->print(ndr, "%s: ARRAY(%d)", name, count);
+ ndr->depth++;
+ for (i=0;i<count;i++) {
+ char *idx=NULL;
+ asprintf(&idx, "[%d]", i);
+ if (idx) {
+ ndr_print_uint32(ndr, idx, data[i]);
+ free(idx);
+ }
+ }
+ ndr->depth--;
+}
diff --git a/source4/librpc/ndr/ndr_lsa.c b/source4/librpc/ndr/ndr_lsa.c
index d0b1c0e760..20591c04ab 100644
--- a/source4/librpc/ndr/ndr_lsa.c
+++ b/source4/librpc/ndr/ndr_lsa.c
@@ -345,12 +345,46 @@ void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name, struct
ndr->depth--;
}
+static NTSTATUS ndr_pull_lsa_AuditSettings(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditSettings *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->count));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_ALLOC_N_SIZE(ndr, r->settings, r->count, sizeof(r->settings[0]));
+ NDR_CHECK(ndr_pull_array_uint32(ndr, r->settings, r->count));
+done:
+ return NT_STATUS_OK;
+}
+
+void ndr_print_lsa_AuditSettings(struct ndr_print *ndr, const char *name, struct lsa_AuditSettings *r)
+{
+ ndr_print_struct(ndr, name, "lsa_AuditSettings");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "settings", r->settings);
+ ndr->depth++;
+ ndr_print_array_uint32(ndr, "settings", r->settings, r->count);
+ ndr->depth--;
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_AuditEventsInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditEventsInfo *r)
{
+ uint32 _ptr_settings;
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_uint32(ndr, &r->auditing_mode));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_settings));
+ if (_ptr_settings) {
+ NDR_ALLOC(ndr, r->settings);
+ } else {
+ r->settings = NULL;
+ }
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->settings) {
+ NDR_CHECK(ndr_pull_lsa_AuditSettings(ndr, NDR_SCALARS|NDR_BUFFERS, r->settings));
+ }
done:
return NT_STATUS_OK;
}
@@ -360,6 +394,12 @@ void ndr_print_lsa_AuditEventsInfo(struct ndr_print *ndr, const char *name, stru
ndr_print_struct(ndr, name, "lsa_AuditEventsInfo");
ndr->depth++;
ndr_print_uint32(ndr, "auditing_mode", r->auditing_mode);
+ ndr_print_ptr(ndr, "settings", r->settings);
+ ndr->depth++;
+ if (r->settings) {
+ ndr_print_lsa_AuditSettings(ndr, "settings", r->settings);
+ }
+ ndr->depth--;
ndr->depth--;
}
diff --git a/source4/librpc/ndr/ndr_lsa.h b/source4/librpc/ndr/ndr_lsa.h
index 6eee70fb60..3ef03516ae 100644
--- a/source4/librpc/ndr/ndr_lsa.h
+++ b/source4/librpc/ndr/ndr_lsa.h
@@ -123,8 +123,14 @@ struct lsa_AuditLogInfo {
uint32 unknown;
};
+struct lsa_AuditSettings {
+ uint32 count;
+ uint32 *settings;
+};
+
struct lsa_AuditEventsInfo {
uint32 auditing_mode;
+ struct lsa_AuditSettings *settings;
};
union lsa_PolicyInformation {
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 71c1ce2147..e3b3a2ae8d 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -492,21 +492,26 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p,
{
struct lsa_QueryInfoPolicy r;
NTSTATUS status;
+ int i;
+ BOOL ret = True;
printf("\nTesting QueryInfoPolicy\n");
- r.in.handle = handle;
- r.in.level = 1;
+ for (i=1;i<13;i++) {
+ r.in.handle = handle;
+ r.in.level = i;
- status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("QueryInfoPolicy failed - %s\n", nt_errstr(status));
- return False;
- }
+ status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("QueryInfoPolicy failed - %s\n", nt_errstr(status));
+ ret = False;
+ continue;
+ }
- NDR_PRINT_UNION_DEBUG(lsa_PolicyInformation, r.in.level, r.out.info);
+ NDR_PRINT_UNION_DEBUG(lsa_PolicyInformation, r.in.level, r.out.info);
+ }
- return True;
+ return ret;
}
static BOOL test_Delete(struct dcerpc_pipe *p,