1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

support lsa_AuditEventsInfo

(This used to be commit 7e7cb975936252083c5c02a64c00ee2667099c22)
This commit is contained in:
Andrew Tridgell 2003-11-11 06:22:58 +00:00
parent d720f3d2e4
commit bde602b9e1
5 changed files with 120 additions and 11 deletions

View File

@ -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 {

View File

@ -116,6 +116,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
*/
@ -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--;
}

View File

@ -345,12 +345,46 @@ void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name, struct
ndr->depth--;
}
static NTSTATUS ndr_pull_lsa_AuditEventsInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditEventsInfo *r)
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->auditing_mode));
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--;
}

View File

@ -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 {

View File

@ -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,