summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_search.c
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2014-10-27 15:11:08 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-11-05 15:26:32 +0100
commit1a9f66352070d71a6b998c5afbc268ba6fddc51c (patch)
treef069bf7a43ddebd35e9f140971f7fe36c42628e5 /src/db/sysdb_search.c
parent16c37880f089431211290aa31bdcd3c9bc12aa77 (diff)
downloadsssd-1a9f66352070d71a6b998c5afbc268ba6fddc51c.tar.gz
sssd-1a9f66352070d71a6b998c5afbc268ba6fddc51c.tar.xz
sssd-1a9f66352070d71a6b998c5afbc268ba6fddc51c.zip
sysdb_add_overrides_to_object: add new parameter and multi-value support
With the new parameter an attribute list other than the default one can be used. Override attributes with multiple values (e.g. SSH public keys) are now supported as well. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/db/sysdb_search.c')
-rw-r--r--src/db/sysdb_search.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index dacbd239d..677257405 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -124,7 +124,8 @@ errno_t sysdb_getpwnam_with_views(TALLOC_CTX *mem_ctx,
* the original object. */
if (DOM_HAS_VIEWS(domain) && orig_obj->count == 1) {
ret = sysdb_add_overrides_to_object(domain, orig_obj->msgs[0],
- override_obj == NULL ? NULL : override_obj ->msgs[0]);
+ override_obj == NULL ? NULL : override_obj->msgs[0],
+ NULL);
if (ret != EOK && ret != ENOENT) {
DEBUG(SSSDBG_OP_FAILURE, "sysdb_add_overrides_to_object failed.\n");
goto done;
@@ -229,7 +230,8 @@ errno_t sysdb_getpwuid_with_views(TALLOC_CTX *mem_ctx,
* the original object. */
if (DOM_HAS_VIEWS(domain) && orig_obj->count == 1) {
ret = sysdb_add_overrides_to_object(domain, orig_obj->msgs[0],
- override_obj == NULL ? NULL : override_obj->msgs[0]);
+ override_obj == NULL ? NULL : override_obj->msgs[0],
+ NULL);
if (ret != EOK && ret != ENOENT) {
DEBUG(SSSDBG_OP_FAILURE, "sysdb_add_overrides_to_object failed.\n");
goto done;
@@ -314,7 +316,8 @@ int sysdb_enumpwent_with_views(TALLOC_CTX *mem_ctx,
if (DOM_HAS_VIEWS(domain)) {
for (c = 0; c < res->count; c++) {
- ret = sysdb_add_overrides_to_object(domain, res->msgs[c], NULL);
+ ret = sysdb_add_overrides_to_object(domain, res->msgs[c], NULL,
+ NULL);
/* enumeration assumes that the cache is up-to-date, hence we do not
* need to handle ENOENT separately. */
if (ret != EOK) {
@@ -426,7 +429,8 @@ int sysdb_getgrnam_with_views(TALLOC_CTX *mem_ctx,
}
ret = sysdb_add_overrides_to_object(domain, orig_obj->msgs[0],
- override_obj == NULL ? NULL : override_obj ->msgs[0]);
+ override_obj == NULL ? NULL : override_obj ->msgs[0],
+ NULL);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, "sysdb_add_overrides_to_object failed.\n");
goto done;
@@ -578,7 +582,8 @@ int sysdb_getgrgid_with_views(TALLOC_CTX *mem_ctx,
}
ret = sysdb_add_overrides_to_object(domain, orig_obj->msgs[0],
- override_obj == NULL ? NULL : override_obj ->msgs[0]);
+ override_obj == NULL ? NULL : override_obj ->msgs[0],
+ NULL);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, "sysdb_add_overrides_to_object failed.\n");
goto done;
@@ -734,7 +739,8 @@ int sysdb_enumgrent_with_views(TALLOC_CTX *mem_ctx,
if (DOM_HAS_VIEWS(domain)) {
for (c = 0; c < res->count; c++) {
- ret = sysdb_add_overrides_to_object(domain, res->msgs[c], NULL);
+ ret = sysdb_add_overrides_to_object(domain, res->msgs[c], NULL,
+ NULL);
/* enumeration assumes that the cache is up-to-date, hence we do not
* need to handle ENOENT separately. */
if (ret != EOK) {
@@ -956,7 +962,8 @@ int sysdb_initgroups_with_views(TALLOC_CTX *mem_ctx,
if (DOM_HAS_VIEWS(domain)) {
/* Skip user entry because it already has override values added */
for (c = 1; c < res->count; c++) {
- ret = sysdb_add_overrides_to_object(domain, res->msgs[c], NULL);
+ ret = sysdb_add_overrides_to_object(domain, res->msgs[c], NULL,
+ NULL);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
"sysdb_add_overrides_to_object failed.\n");
@@ -1083,7 +1090,8 @@ int sysdb_get_user_attr_with_views(TALLOC_CTX *mem_ctx,
* the original object. */
if (DOM_HAS_VIEWS(domain) && orig_obj->count == 1) {
ret = sysdb_add_overrides_to_object(domain, orig_obj->msgs[0],
- override_obj == NULL ? NULL : override_obj ->msgs[0]);
+ override_obj == NULL ? NULL : override_obj ->msgs[0],
+ attrs);
if (ret != EOK && ret != ENOENT) {
DEBUG(SSSDBG_OP_FAILURE, "sysdb_add_overrides_to_object failed.\n");
return ret;