From 9b7f9f90d2cdc8fd5919f7a94558f5346d35481e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 15 Sep 2013 11:58:02 +0200 Subject: idmap_autorid: add idmap_autorid_build_keystr_talloc() talloc version of idmap_autorid_build_keystr() Signed-off-by: Michael Adam Reviewed-by: Volker Lendecke --- source3/winbindd/idmap_autorid_tdb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source3/winbindd') diff --git a/source3/winbindd/idmap_autorid_tdb.c b/source3/winbindd/idmap_autorid_tdb.c index 597d9b6194..5fecb9fad3 100644 --- a/source3/winbindd/idmap_autorid_tdb.c +++ b/source3/winbindd/idmap_autorid_tdb.c @@ -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; -- cgit