summaryrefslogtreecommitdiff
path: root/src/providers/ldap/sdap_async_groups.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2012-04-23 08:55:58 -0400
committerStephen Gallagher <sgallagh@redhat.com>2012-05-03 14:09:14 -0400
commit58d02e0d3d6d48c97fccdb2ad7212e065671ad6d (patch)
tree6dc162349f366cfb2a20429f98141b258a739369 /src/providers/ldap/sdap_async_groups.c
parent532eb49e129bedf57cdbd0a66f39ad228b8f2482 (diff)
downloadsssd-58d02e0d3d6d48c97fccdb2ad7212e065671ad6d.tar.gz
sssd-58d02e0d3d6d48c97fccdb2ad7212e065671ad6d.tar.bz2
sssd-58d02e0d3d6d48c97fccdb2ad7212e065671ad6d.zip
LDAP: Add helper routine to convert LDAP blob to SID string
Diffstat (limited to 'src/providers/ldap/sdap_async_groups.c')
-rw-r--r--src/providers/ldap/sdap_async_groups.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index 89882be0..67720025 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -198,7 +198,6 @@ static int sdap_save_group(TALLOC_CTX *memctx,
TALLOC_CTX *tmpctx = NULL;
bool posix_group;
bool use_id_mapping = dp_opt_get_bool(opts->basic, SDAP_ID_MAPPING);
- struct dom_sid *dom_sid;
char *sid_str;
char *dom_sid_str;
enum idmap_error_code err;
@@ -229,25 +228,10 @@ static int sdap_save_group(TALLOC_CTX *memctx,
DEBUG(SSSDBG_TRACE_LIBS,
("Mapping group [%s] objectSID to unix ID\n", name));
- ret = sysdb_attrs_get_el(attrs,
- opts->group_map[SDAP_AT_GROUP_OBJECTSID].sys_name,
- &el);
- if (ret != EOK || el->num_values != 1) {
- DEBUG(SSSDBG_MINOR_FAILURE,
- ("No [%s] attribute for group [%s] while id-mapping\n",
- opts->group_map[SDAP_AT_GROUP_OBJECTSID].name,
- name));
- goto fail;
- }
-
- ret = binary_to_dom_sid(tmpctx,
- el->values[0].data,
- el->values[0].length,
- &dom_sid);
- if (ret != EOK) goto fail;
-
- ret = dom_sid_to_string(tmpctx, dom_sid, &sid_str);
- talloc_zfree(dom_sid);
+ ret = sdap_attrs_get_sid_str(
+ tmpctx, opts->idmap_ctx, attrs,
+ opts->group_map[SDAP_AT_GROUP_OBJECTSID].sys_name,
+ &sid_str);
if (ret != EOK) goto fail;
/* Add string representation to the cache for easier