diff options
Diffstat (limited to 'src/providers/ldap/sdap_async_accounts.c')
-rw-r--r-- | src/providers/ldap/sdap_async_accounts.c | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c index 0244d93e..9a950d73 100644 --- a/src/providers/ldap/sdap_async_accounts.c +++ b/src/providers/ldap/sdap_async_accounts.c @@ -57,7 +57,6 @@ static struct tevent_req *sdap_save_user_send(TALLOC_CTX *memctx, const char *gecos; const char *homedir; const char *shell; - unsigned long l; uid_t uid; gid_t gid; struct sysdb_attrs *user_attrs; @@ -111,16 +110,15 @@ static struct tevent_req *sdap_save_user_send(TALLOC_CTX *memctx, if (el->num_values == 0) shell = NULL; else shell = (const char *)el->values[0].data; - ret = sysdb_attrs_get_ulong(attrs, - opts->user_map[SDAP_AT_USER_UID].sys_name, - &l); + ret = sysdb_attrs_get_uint32_t(attrs, + opts->user_map[SDAP_AT_USER_UID].sys_name, + &uid); if (ret != EOK) { DEBUG(1, ("no uid provided for [%s] in domain [%s].\n", state->name, dom->name)); ret = EINVAL; goto fail; } - uid = l; /* check that the uid is valid for this domain */ if (OUT_OF_ID_RANGE(uid, dom->id_min, dom->id_max)) { @@ -130,16 +128,15 @@ static struct tevent_req *sdap_save_user_send(TALLOC_CTX *memctx, goto fail; } - ret = sysdb_attrs_get_ulong(attrs, - opts->user_map[SDAP_AT_USER_GID].sys_name, - &l); + ret = sysdb_attrs_get_uint32_t(attrs, + opts->user_map[SDAP_AT_USER_GID].sys_name, + &gid); if (ret != EOK) { DEBUG(1, ("no gid provided for [%s] in domain [%s].\n", state->name, dom->name)); ret = EINVAL; goto fail; } - gid = l; /* check that the gid is valid for this domain */ if (OUT_OF_ID_RANGE(gid, dom->id_min, dom->id_max)) { @@ -818,7 +815,6 @@ static struct tevent_req *sdap_save_group_send(TALLOC_CTX *memctx, struct sdap_save_group_state *state; struct ldb_message_element *el; struct sysdb_attrs *group_attrs; - unsigned long l; gid_t gid; int ret; @@ -840,16 +836,15 @@ static struct tevent_req *sdap_save_group_send(TALLOC_CTX *memctx, } state->name = (const char *)el->values[0].data; - ret = sysdb_attrs_get_ulong(attrs, - opts->group_map[SDAP_AT_GROUP_GID].sys_name, - &l); + ret = sysdb_attrs_get_uint32_t(attrs, + opts->group_map[SDAP_AT_GROUP_GID].sys_name, + &gid); if (ret != EOK) { DEBUG(1, ("no gid provided for [%s] in domain [%s].\n", state->name, dom->name)); ret = EINVAL; goto fail; } - gid = l; /* check that the gid is valid for this domain */ if (OUT_OF_ID_RANGE(gid, dom->id_min, dom->id_max)) { @@ -2359,26 +2354,14 @@ static void sdap_add_incomplete_groups_next(struct tevent_req *subreq) name = (const char *)el->values[0].data; if (strcmp(name, state->groupnames[state->cur]) == 0) { - ret = sysdb_attrs_get_el(state->ldap_groups[ai], - SYSDB_GIDNUM, - &el); + ret = sysdb_attrs_get_uint32_t(state->ldap_groups[ai], + SYSDB_GIDNUM, + &gid); if (ret) { + DEBUG(1, ("no gid provided for [%s]\n", name)); tevent_req_error(req, ret); return; } - if (el->num_values == 0) { - DEBUG(1, ("no gid provided for [%s]\n", - name)); - tevent_req_error(req, EINVAL); - return; - } - - errno = 0; - gid = (gid_t) strtol((const char *)el->values[0].data, NULL, 0); - if (errno) { - tevent_req_error(req, errno); - return; - } add_req = sysdb_add_incomplete_group_send(state, state->ev, |