summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/ndr/libndr.h15
-rw-r--r--source4/librpc/ndr/ndr.c61
-rw-r--r--source4/librpc/ndr/ndr_basic.c45
-rw-r--r--source4/librpc/ndr/ndr_lsa.c293
-rw-r--r--source4/librpc/ndr/ndr_sec.c53
-rw-r--r--source4/librpc/rpc/dcerpc.c2
6 files changed, 469 insertions, 0 deletions
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index 870500d169..24ae09f538 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -58,9 +58,23 @@ struct ndr_push_save {
uint32 offset;
};
+
+/* structure passed to functions that print IDL structures */
+struct ndr_print {
+ uint32 flags; /* LIBNDR_FLAG_* */
+ TALLOC_CTX *mem_ctx;
+ uint32 depth;
+ void (*print)(struct ndr_print *, const char *, ...);
+};
+
#define LIBNDR_FLAG_BIGENDIAN 1
+/* useful macro for debugging */
+#define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
+
+
+
/*
flags passed to control parse flow
*/
@@ -97,6 +111,7 @@ typedef NTSTATUS (*ndr_pull_fn_t)(struct ndr_pull *, void *);
typedef NTSTATUS (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, void *);
typedef NTSTATUS (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);
+typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, void *);
/* now pull in the individual parsers */
#include "librpc/ndr/ndr_sec.h"
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 2ab78d3d09..f7aead014c 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -243,3 +243,64 @@ buffers:
done:
return NT_STATUS_OK;
}
+
+
+/*
+ print a generic array
+*/
+void ndr_print_array(struct ndr_print *ndr, const char *name, void *base,
+ size_t elsize, uint32 count,
+ void (*print_fn)(struct ndr_print *, const char *, void *))
+{
+ int i;
+ char *p = base;
+ 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) {
+ print_fn(ndr, idx, p);
+ free(idx);
+ }
+ p += elsize;
+ }
+ ndr->depth--;
+}
+
+
+
+static void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...)
+{
+ va_list ap;
+ char *s = NULL;
+ int i;
+
+ va_start(ap, format);
+ vasprintf(&s, format, ap);
+ va_end(ap);
+
+ for (i=0;i<ndr->depth;i++) {
+ DEBUG(0,(" "));
+ }
+
+ DEBUG(0,("%s\n", s));
+ free(s);
+}
+
+/*
+ a useful helper function for printing idl structures via DEBUG()
+*/
+void ndr_print_debug(void (*fn)(struct ndr_print *, const char *, void *),
+ const char *name,
+ void *ptr)
+{
+ struct ndr_print ndr;
+
+ ndr.mem_ctx = talloc_init("ndr_print_debug");
+ if (!ndr.mem_ctx) return;
+ ndr.print = ndr_print_debug_helper;
+ ndr.depth = 0;
+ fn(&ndr, name, ptr);
+ talloc_destroy(ndr.mem_ctx);
+}
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index b6c5a0cd53..11f3bb5e23 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -373,3 +373,48 @@ NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, NTTIME *t)
NDR_CHECK(ndr_pull_uint32(ndr, &t->high));
return NT_STATUS_OK;
}
+
+
+void ndr_print_struct(struct ndr_print *ndr, const char *name)
+{
+ ndr->print(ndr, "%s:", name);
+}
+
+void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8 v)
+{
+ ndr->print(ndr, "%-25s: 0x%02x (%u)", name, v, v);
+}
+
+void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16 v)
+{
+ ndr->print(ndr, "%-25s: 0x%04x (%u)", name, v, v);
+}
+
+void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32 v)
+{
+ ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v);
+}
+
+void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p)
+{
+ if (p) {
+ ndr->print(ndr, "%-25s: *", name);
+ } else {
+ ndr->print(ndr, "%-25s: NULL", name);
+ }
+}
+
+void ndr_print_unistr_noterm(struct ndr_print *ndr, const char *name, const char *s)
+{
+ ndr->print(ndr, "%-25s: '%s'", name, s);
+}
+
+void ndr_print_unistr(struct ndr_print *ndr, const char *name, const char *s)
+{
+ ndr->print(ndr, "%-25s: '%s'", name, s);
+}
+
+void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t)
+{
+ ndr->print(ndr, "%-25s: %s", name, nt_time_string(ndr->mem_ctx, &t));
+}
diff --git a/source4/librpc/ndr/ndr_lsa.c b/source4/librpc/ndr/ndr_lsa.c
index 2a2d5a5c03..89c59f7c00 100644
--- a/source4/librpc/ndr/ndr_lsa.c
+++ b/source4/librpc/ndr/ndr_lsa.c
@@ -67,6 +67,21 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_Name(struct ndr_print *ndr, const char *name, struct lsa_Name *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint16(ndr, "name_len", r->name_len);
+ ndr_print_uint16(ndr, "name_size", r->name_size);
+ ndr_print_ptr(ndr, "name", r->name);
+ ndr->depth++;
+ if (r->name) {
+ ndr_print_unistr_noterm(ndr, "name", r->name);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_PrivEntry(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivEntry *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -80,6 +95,16 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_PrivEntry(struct ndr_print *ndr, const char *name, struct lsa_PrivEntry *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_lsa_Name(ndr, "name", &r->name);
+ ndr_print_uint32(ndr, "luid_low", r->luid_low);
+ ndr_print_uint32(ndr, "luid_high", r->luid_high);
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_PrivArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivArray *r)
{
uint32 _ptr_privs;
@@ -101,6 +126,20 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_PrivArray(struct ndr_print *ndr, const char *name, struct lsa_PrivArray *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "privs", r->privs);
+ ndr->depth++;
+ if (r->privs) {
+ ndr_print_array(ndr, "privs", r->privs, sizeof(r->privs[0]), r->count, (ndr_print_fn_t)ndr_print_lsa_PrivEntry);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
NTSTATUS ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, struct lsa_EnumPrivs *r)
{
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
@@ -179,6 +218,16 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_QosInfo(struct ndr_print *ndr, const char *name, struct lsa_QosInfo *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint16(ndr, "impersonation_level", r->impersonation_level);
+ ndr_print_uint8(ndr, "context_mode", r->context_mode);
+ ndr_print_uint8(ndr, "effective_only", r->effective_only);
+ ndr->depth--;
+}
+
static NTSTATUS ndr_push_lsa_ObjectAttribute(struct ndr_push *ndr, int ndr_flags, struct lsa_ObjectAttribute *r)
{
struct ndr_push_save _save1, _save2, _save3;
@@ -214,6 +263,38 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_ObjectAttribute(struct ndr_print *ndr, const char *name, struct lsa_ObjectAttribute *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_ptr(ndr, "root_dir", r->root_dir);
+ ndr->depth++;
+ if (r->root_dir) {
+ ndr_print_uint8(ndr, "root_dir", *r->root_dir);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "object_name", r->object_name);
+ ndr->depth++;
+ if (r->object_name) {
+ ndr_print_unistr(ndr, "object_name", r->object_name);
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "attributes", r->attributes);
+ ndr_print_ptr(ndr, "sec_desc", r->sec_desc);
+ ndr->depth++;
+ if (r->sec_desc) {
+ ndr_print_security_descriptor(ndr, "sec_desc", r->sec_desc);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "sec_qos", r->sec_qos);
+ ndr->depth++;
+ if (r->sec_qos) {
+ ndr_print_lsa_QosInfo(ndr, "sec_qos", r->sec_qos);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
NTSTATUS ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, struct lsa_OpenPolicy *r)
{
NDR_CHECK(ndr_push_ptr(ndr, r->in.system_name));
@@ -250,6 +331,20 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name, struct lsa_AuditLogInfo *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "percent_full", r->percent_full);
+ ndr_print_uint32(ndr, "log_size", r->log_size);
+ ndr_print_NTTIME(ndr, "retention_time", r->retention_time);
+ ndr_print_uint8(ndr, "shutdown_in_progress", r->shutdown_in_progress);
+ ndr_print_NTTIME(ndr, "time_to_shutdown", r->time_to_shutdown);
+ ndr_print_uint32(ndr, "next_audit_record", r->next_audit_record);
+ ndr_print_uint32(ndr, "unknown", r->unknown);
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_AuditEventsInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditEventsInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -260,6 +355,14 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_AuditEventsInfo(struct ndr_print *ndr, const char *name, struct lsa_AuditEventsInfo *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "auditing_mode", r->auditing_mode);
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_PolicyInformation(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union lsa_PolicyInformation *r)
{
NDR_CHECK(ndr_pull_uint16(ndr, level));
@@ -294,6 +397,10 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_PolicyInformation(struct ndr_print *ndr, const char *name, uint16 level, union lsa_PolicyInformation *r)
+{
+}
+
NTSTATUS ndr_push_lsa_QueryInfoPolicy(struct ndr_push *ndr, struct lsa_QueryInfoPolicy *r)
{
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
@@ -393,6 +500,19 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_SidPtr(struct ndr_print *ndr, const char *name, struct lsa_SidPtr *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_ptr(ndr, "sid", r->sid);
+ ndr->depth++;
+ if (r->sid) {
+ ndr_print_dom_sid2(ndr, "sid", r->sid);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static NTSTATUS ndr_push_lsa_SidArray(struct ndr_push *ndr, int ndr_flags, struct lsa_SidArray *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -428,6 +548,20 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_SidArray(struct ndr_print *ndr, const char *name, struct lsa_SidArray *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "num_sids", r->num_sids);
+ ndr_print_ptr(ndr, "sids", r->sids);
+ ndr->depth++;
+ if (r->sids) {
+ ndr_print_array(ndr, "sids", r->sids, sizeof(r->sids[0]), r->num_sids, (ndr_print_fn_t)ndr_print_lsa_SidPtr);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
NTSTATUS ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, struct lsa_EnumAccounts *r)
{
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
@@ -480,6 +614,20 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_DomainInformation(struct ndr_print *ndr, const char *name, struct lsa_DomainInformation *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_lsa_Name(ndr, "name", &r->name);
+ ndr_print_ptr(ndr, "sid", r->sid);
+ ndr->depth++;
+ if (r->sid) {
+ ndr_print_dom_sid2(ndr, "sid", r->sid);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_DomainList(struct ndr_pull *ndr, int ndr_flags, struct lsa_DomainList *r)
{
uint32 _ptr_domains;
@@ -501,6 +649,20 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_DomainList(struct ndr_print *ndr, const char *name, struct lsa_DomainList *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "domains", r->domains);
+ ndr->depth++;
+ if (r->domains) {
+ ndr_print_array(ndr, "domains", r->domains, sizeof(r->domains[0]), r->count, (ndr_print_fn_t)ndr_print_lsa_DomainInformation);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
NTSTATUS ndr_push_lsa_EnumTrustDom(struct ndr_push *ndr, struct lsa_EnumTrustDom *r)
{
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
@@ -543,6 +705,16 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_TranslatedSid(struct ndr_print *ndr, const char *name, struct lsa_TranslatedSid *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint16(ndr, "sid_type", r->sid_type);
+ ndr_print_uint32(ndr, "rid", r->rid);
+ ndr_print_uint32(ndr, "sid_index", r->sid_index);
+ ndr->depth--;
+}
+
static NTSTATUS ndr_push_lsa_TransSidArray(struct ndr_push *ndr, int ndr_flags, struct lsa_TransSidArray *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -578,6 +750,20 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_TransSidArray(struct ndr_print *ndr, const char *name, struct lsa_TransSidArray *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "sids", r->sids);
+ ndr->depth++;
+ if (r->sids) {
+ ndr_print_array(ndr, "sids", r->sids, sizeof(r->sids[0]), r->count, (ndr_print_fn_t)ndr_print_lsa_TranslatedSid);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_TrustInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustInformation *r)
{
uint32 _ptr_sid;
@@ -599,6 +785,20 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_TrustInformation(struct ndr_print *ndr, const char *name, struct lsa_TrustInformation *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_lsa_Name(ndr, "name", &r->name);
+ ndr_print_ptr(ndr, "sid", r->sid);
+ ndr->depth++;
+ if (r->sid) {
+ ndr_print_dom_sid2(ndr, "sid", r->sid);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_RefDomainList(struct ndr_pull *ndr, int ndr_flags, struct lsa_RefDomainList *r)
{
uint32 _ptr_domains;
@@ -621,6 +821,21 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_RefDomainList(struct ndr_print *ndr, const char *name, struct lsa_RefDomainList *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "domains", r->domains);
+ ndr->depth++;
+ if (r->domains) {
+ ndr_print_array(ndr, "domains", r->domains, sizeof(r->domains[0]), r->count, (ndr_print_fn_t)ndr_print_lsa_TrustInformation);
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "max_count", r->max_count);
+ ndr->depth--;
+}
+
NTSTATUS ndr_push_lsa_LookupNames(struct ndr_push *ndr, struct lsa_LookupNames *r)
{
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
@@ -681,6 +896,16 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_TranslatedName(struct ndr_print *ndr, const char *name, struct lsa_TranslatedName *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint16(ndr, "sid_type", r->sid_type);
+ ndr_print_lsa_Name(ndr, "name", &r->name);
+ ndr_print_uint32(ndr, "sid_index", r->sid_index);
+ ndr->depth--;
+}
+
static NTSTATUS ndr_push_lsa_TransNameArray(struct ndr_push *ndr, int ndr_flags, struct lsa_TransNameArray *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -716,6 +941,20 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_TransNameArray(struct ndr_print *ndr, const char *name, struct lsa_TransNameArray *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "names", r->names);
+ ndr->depth++;
+ if (r->names) {
+ ndr_print_array(ndr, "names", r->names, sizeof(r->names[0]), r->count, (ndr_print_fn_t)ndr_print_lsa_TranslatedName);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
NTSTATUS ndr_push_lsa_LookupSids(struct ndr_push *ndr, struct lsa_LookupSids *r)
{
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
@@ -787,6 +1026,15 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_LUID(struct ndr_print *ndr, const char *name, struct lsa_LUID *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "low", r->low);
+ ndr_print_uint32(ndr, "high", r->high);
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_LUIDAttribute(struct ndr_pull *ndr, int ndr_flags, struct lsa_LUIDAttribute *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -799,6 +1047,15 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_LUIDAttribute(struct ndr_print *ndr, const char *name, struct lsa_LUIDAttribute *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_lsa_LUID(ndr, "luid", &r->luid);
+ ndr_print_uint32(ndr, "attribute", r->attribute);
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_PrivilegeSet(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivilegeSet *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -811,6 +1068,15 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_PrivilegeSet(struct ndr_print *ndr, const char *name, struct lsa_PrivilegeSet *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_lsa_LUIDAttribute(ndr, "set", r->set);
+ ndr->depth--;
+}
+
NTSTATUS ndr_push_lsa_EnumPrivsAccount(struct ndr_push *ndr, struct lsa_EnumPrivsAccount *r)
{
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
@@ -1070,6 +1336,19 @@ NTSTATUS ndr_pull_ENUMACCTWITHRIGHT(struct ndr_pull *ndr, struct ENUMACCTWITHRIG
return NT_STATUS_OK;
}
+void ndr_print_lsa_RightAttribute(struct ndr_print *ndr, const char *name, struct lsa_RightAttribute *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_ptr(ndr, "name", r->name);
+ ndr->depth++;
+ if (r->name) {
+ ndr_print_unistr(ndr, "name", r->name);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static NTSTATUS ndr_pull_lsa_RightSet(struct ndr_pull *ndr, int ndr_flags, struct lsa_RightSet *r)
{
uint32 _ptr_names;
@@ -1091,6 +1370,20 @@ done:
return NT_STATUS_OK;
}
+void ndr_print_lsa_RightSet(struct ndr_print *ndr, const char *name, struct lsa_RightSet *r)
+{
+ ndr_print_struct(ndr, name);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "names", r->names);
+ ndr->depth++;
+ if (r->names) {
+ ndr_print_array(ndr, "names", r->names, sizeof(r->names[0]), r->count, (ndr_print_fn_t)ndr_print_lsa_Name);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
NTSTATUS ndr_push_lsa_EnumAccountRights(struct ndr_push *ndr, struct lsa_EnumAccountRights *r)
{
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
diff --git a/source4/librpc/ndr/ndr_sec.c b/source4/librpc/ndr/ndr_sec.c
index b83bf87771..98f40e0ea3 100644
--- a/source4/librpc/ndr/ndr_sec.c
+++ b/source4/librpc/ndr/ndr_sec.c
@@ -314,3 +314,56 @@ NTSTATUS ndr_push_security_descriptor(struct ndr_push *ndr,
return NT_STATUS_OK;
}
+
+
+/*
+ print a dom_sid
+*/
+void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, struct dom_sid *sid)
+{
+ int i, ofs, maxlen;
+ uint32 ia;
+ char *ret;
+
+ if (!sid) {
+ ndr->print(ndr, "%-25s: (NULL SID)", name);
+ return;
+ }
+
+ maxlen = sid->num_auths * 11 + 25;
+ ret = talloc(ndr->mem_ctx, maxlen);
+ if (!ret) return;
+
+ ia = (sid->id_auth[5]) +
+ (sid->id_auth[4] << 8 ) +
+ (sid->id_auth[3] << 16) +
+ (sid->id_auth[2] << 24);
+
+ ofs = snprintf(ret, maxlen, "S-%u-%lu",
+ (unsigned int)sid->sid_rev_num, (unsigned long)ia);
+
+ for (i = 0; i < sid->num_auths; i++) {
+ ofs += snprintf(ret + ofs, maxlen - ofs, "-%lu", (unsigned long)sid->sub_auths[i]);
+ }
+
+ ndr->print(ndr, "%-25s: %s", name, ret);
+}
+
+void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, struct dom_sid2 *sid)
+{
+ ndr_print_dom_sid(ndr, name, sid);
+}
+
+/*
+ print a security descriptor
+*/
+void ndr_print_security_descriptor(struct ndr_print *ndr,
+ const char *name,
+ struct security_descriptor *sd)
+{
+ ndr->print(ndr->depth, "%-25s: ndr_print_security_descriptor not implemented",
+ name);
+}
+
+
+
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 97aa466e3a..3018b8621b 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -808,3 +808,5 @@ failed:
ndr_push_free(push);
return status;
}
+
+