Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test
[jra/samba/.git] / source / lib / util_sid.c
index 868ac36d11a23d4efa352faa58ed44a2a97de548..222b32ed3a141f92de878e7695da8e97a45c2978 100644 (file)
@@ -172,7 +172,7 @@ const char *get_global_sam_name(void)
  Convert a SID to an ascii string.
 *****************************************************************/
 
-char *sid_to_string(fstring sidstr_out, const DOM_SID *sid)
+char *sid_to_fstring(fstring sidstr_out, const DOM_SID *sid)
 {
        char *str = sid_string_talloc(talloc_tos(), sid);
        fstrcpy(sidstr_out, str);
@@ -382,7 +382,7 @@ bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid)
 {
        size_t i;
 
-       if (len < sid_size(sid))
+       if (len < ndr_size_dom_sid(sid, 0))
                return False;
 
        SCVAL(outbuf,0,sid->sid_rev_num);
@@ -494,18 +494,6 @@ bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2)
        return sid_compare(sid1, sid2) == 0;
 }
 
-/*****************************************************************
- Calculates size of a sid.
-*****************************************************************/  
-
-size_t sid_size(const DOM_SID *sid)
-{
-       if (sid == NULL)
-               return 0;
-
-       return sid->num_auths * sizeof(uint32) + 8;
-}
-
 /*****************************************************************
  Returns true if SID is internal (and non-mappable).
 *****************************************************************/
@@ -535,7 +523,7 @@ bool non_mappable_sid(DOM_SID *sid)
 char *sid_binstring(const DOM_SID *sid)
 {
        char *buf, *s;
-       int len = sid_size(sid);
+       int len = ndr_size_dom_sid(sid, 0);
        buf = (char *)SMB_MALLOC(len);
        if (!buf)
                return NULL;
@@ -553,7 +541,7 @@ char *sid_binstring(const DOM_SID *sid)
 char *sid_binstring_hex(const DOM_SID *sid)
 {
        char *buf, *s;
-       int len = sid_size(sid);
+       int len = ndr_size_dom_sid(sid, 0);
        buf = (char *)SMB_MALLOC(len);
        if (!buf)
                return NULL;