diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_sid.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index 06ff9510b7..0f1b22ca27 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -494,7 +494,6 @@ DOM_SID *sid_dup(DOM_SID *src) /***************************************************************** Write a sid out into on-the-wire format. *****************************************************************/ - BOOL sid_linearize(char *outbuf, size_t len, DOM_SID *sid) { size_t i; @@ -512,6 +511,23 @@ BOOL sid_linearize(char *outbuf, size_t len, DOM_SID *sid) } /***************************************************************** + parse a on-the-wire SID to a DOM_SID +*****************************************************************/ +BOOL sid_parse(char *inbuf, size_t len, DOM_SID *sid) +{ + int i; + if (len < 8) return False; + sid->sid_rev_num = CVAL(inbuf, 0); + sid->num_auths = CVAL(inbuf, 1); + memcpy(sid->id_auth, inbuf+2, 6); + if (len < 8 + sid->num_auths*4) return False; + for (i=0;i<sid->num_auths;i++) { + sid->sub_auths[i] = IVAL(inbuf, 8+i*4); + } + return True; +} + +/***************************************************************** Compare two sids. *****************************************************************/ int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2) |