idmap_autorid: add idmap_autorid_build_keystr_talloc()
authorMichael Adam <obnox@samba.org>
Sun, 15 Sep 2013 09:58:02 +0000 (11:58 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 1 Oct 2013 08:49:24 +0000 (10:49 +0200)
talloc version of idmap_autorid_build_keystr()

Signed-off-by: Michael Adam <obnox@samba.org>
source3/winbindd/idmap_autorid_tdb.c

index 95cc12c4e25af7c6d612695bd33787b27efe687a..cf08959633796cacff893df643ddea4d4c40607a 100644 (file)
@@ -42,6 +42,23 @@ static void idmap_autorid_build_keystr(const char *domsid,
        }
 }
 
+static char *idmap_autorid_build_keystr_talloc(TALLOC_CTX *mem_ctx,
+                                             const char *domsid,
+                                             uint32_t domain_range_index)
+{
+       char *keystr;
+
+       if (domain_range_index > 0) {
+               keystr = talloc_asprintf(mem_ctx, "%s#%"PRIu32, domsid,
+                                        domain_range_index);
+       } else {
+               keystr = talloc_strdup(mem_ctx, domsid);
+       }
+
+       return keystr;
+}
+
+
 static bool idmap_autorid_validate_sid(const char *sid)
 {
        struct dom_sid ignore;