summaryrefslogtreecommitdiff
path: root/src/providers/ldap/ldap_common.c
diff options
context:
space:
mode:
authorJan Zeleny <jzeleny@redhat.com>2012-02-21 07:18:12 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-02-24 14:58:26 -0500
commit3ff729e6c8a371e7a52914772816c39ca73c50a9 (patch)
tree03d5c089a7b0c88dcbf79b3011f7a886d13bcfc2 /src/providers/ldap/ldap_common.c
parent277a0187190fd417696590b303a5d7a204ed0555 (diff)
downloadsssd-3ff729e6c8a371e7a52914772816c39ca73c50a9.tar.gz
sssd-3ff729e6c8a371e7a52914772816c39ca73c50a9.tar.bz2
sssd-3ff729e6c8a371e7a52914772816c39ca73c50a9.zip
Modifications to simplify list_missing_attrs
Diffstat (limited to 'src/providers/ldap/ldap_common.c')
-rw-r--r--src/providers/ldap/ldap_common.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index 3b6a1b2b..ee2b56b6 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -1511,7 +1511,6 @@ errno_t get_sysdb_attr_name(TALLOC_CTX *mem_ctx,
errno_t list_missing_attrs(TALLOC_CTX *mem_ctx,
struct sdap_attr_map *map,
size_t map_size,
- const char **expected_attrs,
struct sysdb_attrs *recvd_attrs,
char ***missing_attrs)
{
@@ -1519,10 +1518,11 @@ errno_t list_missing_attrs(TALLOC_CTX *mem_ctx,
size_t attr_count = 0;
size_t i, j, k;
char **missing = NULL;
+ const char **expected_attrs;
char *sysdb_name;
TALLOC_CTX *tmp_ctx;
- if (!expected_attrs || !recvd_attrs || !missing_attrs) {
+ if (!recvd_attrs || !missing_attrs) {
return EINVAL;
}
@@ -1531,6 +1531,11 @@ errno_t list_missing_attrs(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
+ ret = build_attrs_from_map(tmp_ctx, map, map_size, &expected_attrs);
+ if (ret != EOK) {
+ goto done;
+ }
+
/* Count the expected attrs */
while(expected_attrs[attr_count]) attr_count++;
@@ -1591,11 +1596,14 @@ errno_t list_missing_attrs(TALLOC_CTX *mem_ctx,
}
}
- /* Terminate the list */
- missing[k] = NULL;
-
+ if (k == 0) {
+ *missing = NULL;
+ } else {
+ /* Terminate the list */
+ missing[k] = NULL;
+ *missing_attrs = talloc_steal(mem_ctx, missing);
+ }
ret = EOK;
- *missing_attrs = talloc_steal(mem_ctx, missing);
done:
talloc_free(tmp_ctx);