diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-01-11 05:16:07 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2004-01-11 05:16:07 +0000 |
commit | b827102934342c91ac166e26dad1ed1be5f90304 (patch) | |
tree | 8a29eaa9c1000a90159cc146fa0a2cb20732e514 | |
parent | ae2164093e89c70704193b8db6fc2e10578eae45 (diff) | |
download | samba-b827102934342c91ac166e26dad1ed1be5f90304.tar.gz samba-b827102934342c91ac166e26dad1ed1be5f90304.tar.bz2 samba-b827102934342c91ac166e26dad1ed1be5f90304.zip |
added dom_sid_string() function
(This used to be commit 399f95536bf64890284a51e4a2bbb7a15c91c3be)
-rw-r--r-- | source4/librpc/ndr/ndr_sec.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source4/librpc/ndr/ndr_sec.c b/source4/librpc/ndr/ndr_sec.c index 49c88d1563..3ea0f4e303 100644 --- a/source4/librpc/ndr/ndr_sec.c +++ b/source4/librpc/ndr/ndr_sec.c @@ -51,22 +51,21 @@ NTSTATUS ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, struct dom_sid * /* - print a dom_sid + convert a dom_sid to a string */ -void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, struct dom_sid *sid) +const char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid) { int i, ofs, maxlen; uint32 ia; char *ret; if (!sid) { - ndr->print(ndr, "%-25s: (NULL SID)", name); - return; + return "(NULL SID)"; } maxlen = sid->num_auths * 11 + 25; - ret = talloc(ndr->mem_ctx, maxlen); - if (!ret) return; + ret = talloc(mem_ctx, maxlen); + if (!ret) return "(SID ERR)"; ia = (sid->id_auth[5]) + (sid->id_auth[4] << 8 ) + @@ -79,8 +78,17 @@ void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, struct dom_sid * for (i = 0; i < sid->num_auths; i++) { ofs += snprintf(ret + ofs, maxlen - ofs, "-%lu", (unsigned long)sid->sub_auths[i]); } + + return ret; +} + - ndr->print(ndr, "%-25s: %s", name, ret); +/* + print a dom_sid +*/ +void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, struct dom_sid *sid) +{ + ndr->print(ndr, "%-25s: %s", name, dom_sid_string(ndr->mem_ctx, sid)); } void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, struct dom_sid2 *sid) |