passdb: Use dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Fri, 26 Oct 2018 06:25:14 +0000 (08:25 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 2 Nov 2018 20:21:16 +0000 (21:21 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/groupdb/mapping_tdb.c

index 3561057..b5b1176 100644 (file)
@@ -133,15 +133,10 @@ static bool init_group_mapping(void)
 
 static char *group_mapping_key(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
 {
-       char sidstr[DOM_SID_STR_BUFLEN];
-       int len;
-
-       len = dom_sid_string_buf(sid, sidstr, sizeof(sidstr));
-       if (len >= sizeof(sidstr)) {
-               return NULL;
-       }
+       struct dom_sid_buf sidstr;
 
-       return talloc_asprintf(mem_ctx, "%s%s", GROUP_PREFIX, sidstr);
+       return talloc_asprintf(
+               mem_ctx, "%s%s", GROUP_PREFIX, dom_sid_str_buf(sid, &sidstr));
 }
 
 /****************************************************************************