summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap_async_users.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_users.c
parent532eb49e129bedf57cdbd0a66f39ad228b8f2482 (diff)
downloadsssd-58d02e0d3d6d48c97fccdb2ad7212e065671ad6d.tar.gz
sssd-58d02e0d3d6d48c97fccdb2ad7212e065671ad6d.tar.xz
sssd-58d02e0d3d6d48c97fccdb2ad7212e065671ad6d.zip
LDAP: Add helper routine to convert LDAP blob to SID string
Diffstat (limited to 'src/providers/ldap/sdap_async_users.c')
-rw-r--r--src/providers/ldap/sdap_async_users.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
index c6534993a..c894e874b 100644
--- a/src/providers/ldap/sdap_async_users.c
+++ b/src/providers/ldap/sdap_async_users.c
@@ -56,7 +56,6 @@ int sdap_save_user(TALLOC_CTX *memctx,
char **missing = NULL;
TALLOC_CTX *tmpctx = NULL;
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 = NULL;
char *group_sid_str;
@@ -122,25 +121,10 @@ int sdap_save_user(TALLOC_CTX *memctx,
DEBUG(SSSDBG_TRACE_LIBS,
("Mapping user [%s] objectSID to unix ID\n", name));
- ret = sysdb_attrs_get_el(attrs,
- opts->user_map[SDAP_AT_USER_OBJECTSID].sys_name,
- &el);
- if (ret != EOK || el->num_values != 1) {
- DEBUG(SSSDBG_MINOR_FAILURE,
- ("No [%s] attribute for user [%s] while id-mapping. [%d][%s]\n",
- opts->user_map[SDAP_AT_USER_OBJECTSID].name,
- name, el->num_values, strerror(ret)));
- 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->user_map[SDAP_AT_USER_OBJECTSID].sys_name,
+ &sid_str);
if (ret != EOK) goto fail;
/* Add string representation to the cache for easier