diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-11 04:04:36 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-11 04:04:36 +0000 |
commit | cecbf0cd8b99f7019a83def88baec889d6a06e6f (patch) | |
tree | 108181e24bac1a4fa10a55de40547d9177b488e8 /source4/librpc/ndr/ndr_sec.c | |
parent | a934f89549b3d23199d68b7dc3fc3ad16e86b9ad (diff) | |
download | samba-cecbf0cd8b99f7019a83def88baec889d6a06e6f.tar.gz samba-cecbf0cd8b99f7019a83def88baec889d6a06e6f.tar.bz2 samba-cecbf0cd8b99f7019a83def88baec889d6a06e6f.zip |
automatically generate ndr_print_*() functions for every IDL
structure. This allows easy debug and test tool writing without having
to write functions that print every element of complex structures.
(This used to be commit 81d6181172e36c6fbae0907550a29511ce708574)
Diffstat (limited to 'source4/librpc/ndr/ndr_sec.c')
-rw-r--r-- | source4/librpc/ndr/ndr_sec.c | 53 |
1 files changed, 53 insertions, 0 deletions
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); +} + + + |