diff options
author | Michal Zidek <mzidek@redhat.com> | 2013-11-05 18:36:57 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-11-15 20:20:19 +0100 |
commit | e2ac9be4f293b96f3c8992f1171e44bc1da5cfca (patch) | |
tree | e6cd887945e5ea9b47201d8c733571e3bdbe36e3 /src | |
parent | d115f40c7a3999e3cbe705a2ff9cf0fd493f80fb (diff) | |
download | sssd-e2ac9be4f293b96f3c8992f1171e44bc1da5cfca.tar.gz sssd-e2ac9be4f293b96f3c8992f1171e44bc1da5cfca.tar.xz sssd-e2ac9be4f293b96f3c8992f1171e44bc1da5cfca.zip |
SYSDB: Drop redundant sysdb_ctx parameter from sysdb.c
Diffstat (limited to 'src')
-rw-r--r-- | src/db/sysdb.c | 50 | ||||
-rw-r--r-- | src/db/sysdb.h | 27 | ||||
-rw-r--r-- | src/db/sysdb_autofs.c | 3 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 44 | ||||
-rw-r--r-- | src/db/sysdb_sudo.c | 2 | ||||
-rw-r--r-- | src/providers/ad/ad_id.c | 3 | ||||
-rw-r--r-- | src/providers/dp_refresh.c | 2 | ||||
-rw-r--r-- | src/providers/ipa/ipa_access.c | 3 | ||||
-rw-r--r-- | src/providers/ipa/ipa_hbac_common.c | 9 | ||||
-rw-r--r-- | src/providers/ipa/ipa_selinux.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/ldap_id_enum.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async_enum.c | 3 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async_groups.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async_initgroups.c | 3 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async_initgroups_ad.c | 3 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async_netgroups.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/sdap_reinit.c | 2 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 28 | ||||
-rw-r--r-- | src/tools/sss_groupshow.c | 2 | ||||
-rw-r--r-- | src/tools/sss_sync_ops.c | 12 |
20 files changed, 89 insertions, 115 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c index d86903e5a..66836a685 100644 --- a/src/db/sysdb.c +++ b/src/db/sysdb.c @@ -91,8 +91,7 @@ errno_t sysdb_dn_sanitize(TALLOC_CTX *mem_ctx, const char *input, return ret; } -struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, - TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_custom_subtree_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, const char *subtree_name) { @@ -110,7 +109,7 @@ struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, return NULL; } - dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_CUSTOM_SUBTREE, + dn = ldb_dn_new_fmt(tmp_ctx, dom->sysdb->ldb, SYSDB_TMPL_CUSTOM_SUBTREE, clean_subtree, dom->name); if (dn) { talloc_steal(mem_ctx, dn); @@ -120,7 +119,7 @@ struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, return dn; } -struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_custom_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, const char *object_name, const char *subtree_name) @@ -146,7 +145,7 @@ struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, goto done; } - dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_CUSTOM, clean_name, + dn = ldb_dn_new_fmt(mem_ctx, dom->sysdb->ldb, SYSDB_TMPL_CUSTOM, clean_name, clean_subtree, dom->name); done: @@ -154,8 +153,8 @@ done: return dn; } -struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, - struct sss_domain_info *dom, const char *name) +struct ldb_dn *sysdb_user_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, + const char *name) { errno_t ret; char *clean_name; @@ -166,14 +165,14 @@ struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, return NULL; } - dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_USER, + dn = ldb_dn_new_fmt(mem_ctx, dom->sysdb->ldb, SYSDB_TMPL_USER, clean_name, dom->name); talloc_free(clean_name); return dn; } -struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_group_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, const char *name) { errno_t ret; @@ -185,14 +184,14 @@ struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, return NULL; } - dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_GROUP, + dn = ldb_dn_new_fmt(mem_ctx, dom->sysdb->ldb, SYSDB_TMPL_GROUP, clean_name, dom->name); talloc_free(clean_name); return dn; } -struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_netgroup_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, const char *name) { errno_t ret; @@ -204,18 +203,17 @@ struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, return NULL; } - dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_NETGROUP, + dn = ldb_dn_new_fmt(mem_ctx, dom->sysdb->ldb, SYSDB_TMPL_NETGROUP, clean_name, dom->name); talloc_free(clean_name); return dn; } -struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, - TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_netgroup_base_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom) { - return ldb_dn_new_fmt(mem_ctx, sysdb->ldb, + return ldb_dn_new_fmt(mem_ctx, dom->sysdb->ldb, SYSDB_TMPL_NETGROUP_BASE, dom->name); } @@ -283,10 +281,10 @@ errno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, return sysdb_get_rdn(sysdb, mem_ctx, _dn, NULL, _name); } -struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_domain_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom) { - return ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_DOM_BASE, dom->name); + return ldb_dn_new_fmt(mem_ctx, dom->sysdb->ldb, SYSDB_DOM_BASE, dom->name); } struct ldb_dn *sysdb_base_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx) @@ -1486,8 +1484,7 @@ done: return ret; } -errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, +errno_t sysdb_has_enumerated(struct sss_domain_info *domain, bool *has_enumerated) { errno_t ret; @@ -1501,21 +1498,22 @@ errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb, goto done; } - dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_DOM_BASE, domain->name); + dn = ldb_dn_new_fmt(tmp_ctx, domain->sysdb->ldb, SYSDB_DOM_BASE, + domain->name); if (!dn) { ret = ENOMEM; goto done; } - ret = sysdb_get_bool(sysdb, dn, SYSDB_HAS_ENUMERATED, has_enumerated); + ret = sysdb_get_bool(domain->sysdb, dn, SYSDB_HAS_ENUMERATED, + has_enumerated); done: talloc_free(tmp_ctx); return ret; } -errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, +errno_t sysdb_set_enumerated(struct sss_domain_info *domain, bool enumerated) { errno_t ret; @@ -1528,13 +1526,14 @@ errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb, goto done; } - dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_DOM_BASE, domain->name); + dn = ldb_dn_new_fmt(tmp_ctx, domain->sysdb->ldb, SYSDB_DOM_BASE, + domain->name); if (!dn) { ret = ENOMEM; goto done; } - ret = sysdb_set_bool(sysdb, dn, domain->name, + ret = sysdb_set_bool(domain->sysdb, dn, domain->name, SYSDB_HAS_ENUMERATED, enumerated); done: @@ -1801,7 +1800,6 @@ done: } errno_t sysdb_get_real_name(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *sysdb, struct sss_domain_info *domain, const char *name, const char **_cname) diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 31122e2eb..1b9bdb060 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -317,7 +317,6 @@ errno_t sysdb_attrs_primary_name_list(struct sysdb_ctx *sysdb, const char *ldap_attr, char ***name_list); errno_t sysdb_get_real_name(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *sysdb, struct sss_domain_info *domain, const char *name, const char **_cname); @@ -332,26 +331,24 @@ int sysdb_error_to_errno(int ldberr); /* DNs related helper functions */ errno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, const char *_dn, char **_name, char **_val); -struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, - struct sss_domain_info *dom, const char *name); -struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, - struct sss_domain_info *dom, const char *name); -struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_user_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, + const char *name); +struct ldb_dn *sysdb_group_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, + const char *name); +struct ldb_dn *sysdb_netgroup_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, const char *name); -struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, - TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_netgroup_base_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom); errno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, const char *dn_str, char **name); -struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_domain_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom); struct ldb_dn *sysdb_base_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx); -struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_custom_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, const char *object_name, const char *subtree_name); -struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, - TALLOC_CTX *mem_ctx, +struct ldb_dn *sysdb_custom_subtree_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, const char *subtree_name); @@ -794,12 +791,10 @@ errno_t sysdb_set_bool(struct sysdb_ctx *sysdb, const char *attr_name, bool value); -errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, +errno_t sysdb_has_enumerated(struct sss_domain_info *domain, bool *has_enumerated); -errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, +errno_t sysdb_set_enumerated(struct sss_domain_info *domain, bool enumerated); errno_t sysdb_remove_attrs(struct sss_domain_info *domain, diff --git a/src/db/sysdb_autofs.c b/src/db/sysdb_autofs.c index 2706fdc42..d9f5d2564 100644 --- a/src/db/sysdb_autofs.c +++ b/src/db/sysdb_autofs.c @@ -31,8 +31,7 @@ sysdb_autofsmap_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *domain, const char *map_name) { - return sysdb_custom_dn(domain->sysdb, mem_ctx, domain, - map_name, AUTOFS_MAP_SUBDIR); + return sysdb_custom_dn(mem_ctx, domain, map_name, AUTOFS_MAP_SUBDIR); } static struct ldb_dn * diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index afc29b973..c08415b09 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -441,7 +441,7 @@ int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx, return ENOMEM; } - basedn = sysdb_group_dn(domain->sysdb, tmp_ctx, domain, name); + basedn = sysdb_group_dn(tmp_ctx, domain, name); if (!basedn) { ret = ENOMEM; goto done; @@ -556,7 +556,7 @@ int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx, return ENOMEM; } - basedn = sysdb_netgroup_dn(domain->sysdb, tmp_ctx, domain, name); + basedn = sysdb_netgroup_dn(tmp_ctx, domain, name); if (!basedn) { ret = ENOMEM; goto done; @@ -661,7 +661,7 @@ int sysdb_set_user_attr(struct sss_domain_info *domain, return ENOMEM; } - dn = sysdb_user_dn(domain->sysdb, tmp_ctx, domain, name); + dn = sysdb_user_dn(tmp_ctx, domain, name); if (!dn) { ret = ENOMEM; goto done; @@ -696,7 +696,7 @@ int sysdb_set_group_attr(struct sss_domain_info *domain, goto done; } - dn = sysdb_group_dn(domain->sysdb, tmp_ctx, domain, name); + dn = sysdb_group_dn(tmp_ctx, domain, name); if (!dn) { ret = ENOMEM; goto done; @@ -729,7 +729,7 @@ int sysdb_set_netgroup_attr(struct sss_domain_info *domain, return ENOMEM; } - dn = sysdb_netgroup_dn(domain->sysdb, tmp_ctx, domain, name); + dn = sysdb_netgroup_dn(tmp_ctx, domain, name); if (!dn) { ret = ENOMEM; goto done; @@ -765,7 +765,7 @@ int sysdb_get_new_id(struct sss_domain_info *domain, return ENOMEM; } - base_dn = sysdb_domain_dn(domain->sysdb, tmp_ctx, domain); + base_dn = sysdb_domain_dn(tmp_ctx, domain); if (!base_dn) { talloc_zfree(tmp_ctx); return ENOMEM; @@ -931,7 +931,7 @@ int sysdb_add_basic_user(struct sss_domain_info *domain, } /* user dn */ - msg->dn = sysdb_user_dn(domain->sysdb, msg, domain, name); + msg->dn = sysdb_user_dn(msg, domain, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1120,7 +1120,7 @@ sysdb_remove_ghostattr_from_groups(struct sss_domain_info *domain, goto done; } - tmpdn = sysdb_user_dn(domain->sysdb, tmp_ctx, domain, name); + tmpdn = sysdb_user_dn(tmp_ctx, domain, name); if (!tmpdn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1330,7 +1330,7 @@ int sysdb_add_basic_group(struct sss_domain_info *domain, } /* group dn */ - msg->dn = sysdb_group_dn(domain->sysdb, msg, domain, name); + msg->dn = sysdb_group_dn(msg, domain, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1591,7 +1591,7 @@ int sysdb_add_basic_netgroup(struct sss_domain_info *domain, } /* netgroup dn */ - msg->dn = sysdb_netgroup_dn(domain->sysdb, msg, domain, name); + msg->dn = sysdb_netgroup_dn(msg, domain, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1985,9 +1985,9 @@ sysdb_group_membership_mod(struct sss_domain_info *domain, } if (type == SYSDB_MEMBER_USER) { - member_dn = sysdb_user_dn(domain->sysdb, tmp_ctx, domain, member); + member_dn = sysdb_user_dn(tmp_ctx, domain, member); } else if (type == SYSDB_MEMBER_GROUP) { - member_dn = sysdb_group_dn(domain->sysdb, tmp_ctx, domain, member); + member_dn = sysdb_group_dn(tmp_ctx, domain, member); } else { ret = EINVAL; goto done; @@ -1999,7 +1999,7 @@ sysdb_group_membership_mod(struct sss_domain_info *domain, } if (!is_dn) { - group_dn = sysdb_group_dn(domain->sysdb, tmp_ctx, domain, group); + group_dn = sysdb_group_dn(tmp_ctx, domain, group); } else { group_dn = ldb_dn_new(tmp_ctx, domain->sysdb->ldb, group); } @@ -2118,8 +2118,7 @@ int sysdb_search_custom(TALLOC_CTX *mem_ctx, return EINVAL; } - basedn = sysdb_custom_subtree_dn(domain->sysdb, mem_ctx, domain, - subtree_name); + basedn = sysdb_custom_subtree_dn(mem_ctx, domain, subtree_name); if (basedn == NULL) { DEBUG(1, ("sysdb_custom_subtree_dn failed.\n")); return ENOMEM; @@ -2158,8 +2157,7 @@ int sysdb_search_custom_by_name(TALLOC_CTX *mem_ctx, return ENOMEM; } - basedn = sysdb_custom_dn(domain->sysdb, tmp_ctx, - domain, object_name, subtree_name); + basedn = sysdb_custom_dn(tmp_ctx, domain, object_name, subtree_name); if (basedn == NULL) { DEBUG(1, ("sysdb_custom_dn failed.\n")); ret = ENOMEM; @@ -2241,8 +2239,7 @@ int sysdb_store_custom(struct sss_domain_info *domain, goto done; } - msg->dn = sysdb_custom_dn(domain->sysdb, tmp_ctx, - domain, object_name, subtree_name); + msg->dn = sysdb_custom_dn(tmp_ctx, domain, object_name, subtree_name); if (!msg->dn) { DEBUG(1, ("sysdb_custom_dn failed.\n")); ret = ENOMEM; @@ -2312,8 +2309,7 @@ int sysdb_delete_custom(struct sss_domain_info *domain, return ENOMEM; } - dn = sysdb_custom_dn(domain->sysdb, tmp_ctx, - domain, object_name, subtree_name); + dn = sysdb_custom_dn(tmp_ctx, domain, object_name, subtree_name); if (dn == NULL) { DEBUG(1, ("sysdb_custom_dn failed.\n")); ret = ENOMEM; @@ -3235,15 +3231,15 @@ errno_t sysdb_remove_attrs(struct sss_domain_info *domain, switch(type) { case SYSDB_MEMBER_USER: - msg->dn = sysdb_user_dn(domain->sysdb, msg, domain, name); + msg->dn = sysdb_user_dn(msg, domain, name); break; case SYSDB_MEMBER_GROUP: - msg->dn = sysdb_group_dn(domain->sysdb, msg, domain, name); + msg->dn = sysdb_group_dn(msg, domain, name); break; case SYSDB_MEMBER_NETGROUP: - msg->dn = sysdb_netgroup_dn(domain->sysdb, msg, domain, name); + msg->dn = sysdb_netgroup_dn(msg, domain, name); break; case SYSDB_MEMBER_SERVICE: diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c index fdeeec877..d729db187 100644 --- a/src/db/sysdb_sudo.c +++ b/src/db/sysdb_sudo.c @@ -606,7 +606,7 @@ static errno_t sysdb_sudo_purge_all(struct sss_domain_info *domain) tmp_ctx = talloc_new(NULL); NULL_CHECK(tmp_ctx, ret, done); - base_dn = sysdb_custom_subtree_dn(domain->sysdb, tmp_ctx, domain, SUDORULE_SUBDIR); + base_dn = sysdb_custom_subtree_dn(tmp_ctx, domain, SUDORULE_SUBDIR); NULL_CHECK(base_dn, ret, done); ret = sysdb_delete_recursive(domain->sysdb, base_dn, true); diff --git a/src/providers/ad/ad_id.c b/src/providers/ad/ad_id.c index 736f9bb18..242e962fb 100644 --- a/src/providers/ad/ad_id.c +++ b/src/providers/ad/ad_id.c @@ -585,8 +585,7 @@ ad_enumeration_done(struct tevent_req *subreq) * process on the next SSSD service restart (to avoid * slowing down system boot-up */ - ret = sysdb_set_enumerated(state->sdom->dom->sysdb, - state->sdom->dom, true); + ret = sysdb_set_enumerated(state->sdom->dom, true); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, ("Could not mark domain as having enumerated.\n")); diff --git a/src/providers/dp_refresh.c b/src/providers/dp_refresh.c index c368668e1..f81ff1a7f 100644 --- a/src/providers/dp_refresh.c +++ b/src/providers/dp_refresh.c @@ -97,7 +97,7 @@ static errno_t be_refresh_get_netgroups(TALLOC_CTX *mem_ctx, struct ldb_dn *base_dn = NULL; errno_t ret; - base_dn = sysdb_netgroup_base_dn(domain->sysdb, mem_ctx, domain); + base_dn = sysdb_netgroup_base_dn(mem_ctx, domain); if (base_dn == NULL) { return ENOMEM; } diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c index d1574e642..c601935a6 100644 --- a/src/providers/ipa/ipa_access.c +++ b/src/providers/ipa/ipa_access.c @@ -513,8 +513,7 @@ static void hbac_sysdb_save(struct tevent_req *req) /* Delete any rules in the sysdb so offline logins * are also denied. */ - base_dn = sysdb_custom_subtree_dn(domain->sysdb, tmp_ctx, - domain, HBAC_RULES_SUBDIR); + base_dn = sysdb_custom_subtree_dn(tmp_ctx, domain, HBAC_RULES_SUBDIR); if (base_dn == NULL) { talloc_free(tmp_ctx); ipa_access_reply(hbac_ctx, PAM_SYSTEM_ERR); diff --git a/src/providers/ipa/ipa_hbac_common.c b/src/providers/ipa/ipa_hbac_common.c index a37db7554..09bfc5eb0 100644 --- a/src/providers/ipa/ipa_hbac_common.c +++ b/src/providers/ipa/ipa_hbac_common.c @@ -44,8 +44,7 @@ ipa_hbac_save_list(struct sss_domain_info *domain, } if (delete_subdir) { - base_dn = sysdb_custom_subtree_dn(domain->sysdb, tmp_ctx, - domain, subdir); + base_dn = sysdb_custom_subtree_dn(tmp_ctx, domain, subdir); if (base_dn == NULL) { ret = ENOMEM; goto done; @@ -623,8 +622,7 @@ hbac_eval_service_element(TALLOC_CTX *mem_ctx, svc->name = servicename; - svc_dn = sysdb_custom_dn(sysdb, tmp_ctx, - domain, svc->name, HBAC_SERVICES_SUBDIR); + svc_dn = sysdb_custom_dn(tmp_ctx, domain, svc->name, HBAC_SERVICES_SUBDIR); if (svc_dn == NULL) { ret = ENOMEM; goto done; @@ -731,8 +729,7 @@ hbac_eval_host_element(TALLOC_CTX *mem_ctx, goto done; } - host_dn = sysdb_custom_dn(sysdb, tmp_ctx, - domain, host->name, HBAC_HOSTS_SUBDIR); + host_dn = sysdb_custom_dn(tmp_ctx, domain, host->name, HBAC_HOSTS_SUBDIR); if (host_dn == NULL) { ret = ENOMEM; goto done; diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c index d6bb41c45..c77c8f5a5 100644 --- a/src/providers/ipa/ipa_selinux.c +++ b/src/providers/ipa/ipa_selinux.c @@ -228,7 +228,7 @@ ipa_selinux_create_op_ctx(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, goto fail; } - host_dn = sysdb_custom_dn(sysdb, op_ctx, domain, hostname, HBAC_HOSTS_SUBDIR); + host_dn = sysdb_custom_dn(op_ctx, domain, hostname, HBAC_HOSTS_SUBDIR); if (host_dn == NULL) { goto fail; } diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c index 8cccaa916..58ff459c0 100644 --- a/src/providers/ldap/ldap_id_enum.c +++ b/src/providers/ldap/ldap_id_enum.c @@ -39,7 +39,7 @@ errno_t ldap_setup_enumeration(struct sdap_id_ctx *ctx, bool has_enumerated; struct ldap_enum_ctx *ectx; - ret = sysdb_has_enumerated(sdom->dom->sysdb, sdom->dom, &has_enumerated); + ret = sysdb_has_enumerated(sdom->dom, &has_enumerated); if (ret != EOK) { return ret; } diff --git a/src/providers/ldap/sdap_async_enum.c b/src/providers/ldap/sdap_async_enum.c index a1bc0977c..a006d1e11 100644 --- a/src/providers/ldap/sdap_async_enum.c +++ b/src/providers/ldap/sdap_async_enum.c @@ -303,8 +303,7 @@ static void sdap_dom_enum_services_done(struct tevent_req *subreq) * process on the next SSSD service restart (to avoid * slowing down system boot-up */ - ret = sysdb_set_enumerated(state->sdom->dom->sysdb, - state->sdom->dom, true); + ret = sysdb_set_enumerated(state->sdom->dom, true); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, ("Could not mark domain as having enumerated.\n")); diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c index a943663ec..ff4f1bbc1 100644 --- a/src/providers/ldap/sdap_async_groups.c +++ b/src/providers/ldap/sdap_async_groups.c @@ -61,7 +61,7 @@ static int sdap_find_entry_by_origDN(TALLOC_CTX *memctx, goto done; } - base_dn = sysdb_domain_dn(ctx, tmpctx, domain); + base_dn = sysdb_domain_dn(tmpctx, domain); if (!base_dn) { ret = ENOMEM; goto done; diff --git a/src/providers/ldap/sdap_async_initgroups.c b/src/providers/ldap/sdap_async_initgroups.c index e869ea016..22df38148 100644 --- a/src/providers/ldap/sdap_async_initgroups.c +++ b/src/providers/ldap/sdap_async_initgroups.c @@ -2814,8 +2814,7 @@ static void sdap_get_initgr_user(struct tevent_req *subreq) } in_transaction = false; - ret = sysdb_get_real_name(state, state->sysdb, - state->dom, state->name, &cname); + ret = sysdb_get_real_name(state, state->dom, state->name, &cname); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, ("Cannot canonicalize username\n")); tevent_req_error(req, ret); diff --git a/src/providers/ldap/sdap_async_initgroups_ad.c b/src/providers/ldap/sdap_async_initgroups_ad.c index 7824f0b98..e533f07b5 100644 --- a/src/providers/ldap/sdap_async_initgroups_ad.c +++ b/src/providers/ldap/sdap_async_initgroups_ad.c @@ -521,8 +521,7 @@ sdap_get_ad_tokengroups_initgroups_lookup_done(struct tevent_req *subreq) goto done; } - group_ldb_dn = sysdb_group_dn(group_domain->sysdb, tmp_ctx, - group_domain, group_name); + group_ldb_dn = sysdb_group_dn(tmp_ctx, group_domain, group_name); if (group_ldb_dn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, ("sysdb_group_dn() failed\n")); ret = ENOMEM; diff --git a/src/providers/ldap/sdap_async_netgroups.c b/src/providers/ldap/sdap_async_netgroups.c index 19bcc3f48..710e6c78a 100644 --- a/src/providers/ldap/sdap_async_netgroups.c +++ b/src/providers/ldap/sdap_async_netgroups.c @@ -324,7 +324,7 @@ struct tevent_req *netgr_translate_members_send(TALLOC_CTX *memctx, goto fail; } - netgr_basedn = sysdb_netgroup_base_dn(sysdb, state, dom); + netgr_basedn = sysdb_netgroup_base_dn(state, dom); if (netgr_basedn == NULL) { ret = ENOMEM; goto fail; diff --git a/src/providers/ldap/sdap_reinit.c b/src/providers/ldap/sdap_reinit.c index 51da8128d..5c909379d 100644 --- a/src/providers/ldap/sdap_reinit.c +++ b/src/providers/ldap/sdap_reinit.c @@ -216,7 +216,7 @@ static void sdap_reinit_cleanup_done(struct tevent_req *subreq) * process on the next SSSD service restart (to avoid * slowing down system boot-up */ - ret = sysdb_set_enumerated(state->sysdb, state->domain, true); + ret = sysdb_set_enumerated(state->domain, true); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, ("Could not mark domain as having " "enumerated.\n")); diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index 3602fb45f..f7e0638b5 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -221,8 +221,7 @@ static int test_remove_user(struct test_data *data) struct ldb_dn *user_dn; int ret; - user_dn = sysdb_user_dn(data->ctx->sysdb, data, - data->ctx->domain, data->username); + user_dn = sysdb_user_dn(data, data->ctx->domain, data->username); if (!user_dn) return ENOMEM; ret = sysdb_delete_entry(data->ctx->sysdb, user_dn, true); @@ -285,8 +284,7 @@ static int test_remove_group(struct test_data *data) struct ldb_dn *group_dn; int ret; - group_dn = sysdb_group_dn(data->ctx->sysdb, data, - data->ctx->domain, data->groupname); + group_dn = sysdb_group_dn(data, data->ctx->domain, data->groupname); if (!group_dn) return ENOMEM; ret = sysdb_delete_entry(data->ctx->sysdb, group_dn, true); @@ -484,8 +482,7 @@ static int test_remove_netgroup_entry(struct test_data *data) struct ldb_dn *netgroup_dn; int ret; - netgroup_dn = sysdb_netgroup_dn(data->ctx->sysdb, data, - data->ctx->domain, data->netgrname); + netgroup_dn = sysdb_netgroup_dn(data, data->ctx->domain, data->netgrname); if (!netgroup_dn) return ENOMEM; ret = sysdb_delete_entry(data->ctx->sysdb, netgroup_dn, true); @@ -1929,8 +1926,7 @@ START_TEST (test_sysdb_asq_search) data->attrlist[0] = "gidNumber"; data->attrlist[1] = NULL; - user_dn = sysdb_user_dn(data->ctx->sysdb, data, - data->ctx->domain, ASQ_TEST_USER); + user_dn = sysdb_user_dn(data, data->ctx->domain, ASQ_TEST_USER); fail_unless(user_dn != NULL, "sysdb_user_dn failed"); ret = sysdb_asq_search(data, test_ctx->domain, @@ -3618,8 +3614,7 @@ START_TEST (test_sysdb_group_dn_name) } groupname = talloc_asprintf(test_ctx, "testgroup%d", _i); - group_dn = sysdb_group_dn(test_ctx->sysdb, test_ctx, - test_ctx->domain, groupname); + group_dn = sysdb_group_dn(test_ctx, test_ctx->domain, groupname); if (!group_dn || !groupname) { fail("Out of memory"); return; @@ -3682,8 +3677,7 @@ START_TEST (test_sysdb_search_netgroup_by_name) netgrname, NULL, &msg); fail_if(ret != EOK, "Could not find netgroup with name %s", netgrname); - netgroup_dn = sysdb_netgroup_dn(test_ctx->sysdb, test_ctx, - test_ctx->domain, netgrname); + netgroup_dn = sysdb_netgroup_dn(test_ctx, test_ctx->domain, netgrname); fail_if(netgroup_dn == NULL); fail_if(ldb_dn_compare(msg->dn, netgroup_dn) != 0, "Found wrong netgroup!\n"); talloc_free(test_ctx); @@ -3810,7 +3804,7 @@ START_TEST (test_netgroup_base_dn) ret = setup_sysdb_tests(&test_ctx); fail_if(ret != EOK, "Could not set up the test"); - base_dn = sysdb_netgroup_base_dn(test_ctx->sysdb, test_ctx, test_ctx->domain); + base_dn = sysdb_netgroup_base_dn(test_ctx, test_ctx->domain); fail_if(base_dn == NULL, "Could not get netgroup base DN"); strdn = ldb_dn_get_linearized(base_dn); @@ -4327,18 +4321,18 @@ START_TEST(test_sysdb_has_enumerated) ret = setup_sysdb_tests(&test_ctx); fail_if(ret != EOK, "Could not set up the test"); - ret = sysdb_has_enumerated(test_ctx->sysdb, test_ctx->domain, &enumerated); + ret = sysdb_has_enumerated(test_ctx->domain, &enumerated); fail_if(ret != EOK, "Error [%d][%s] checking enumeration", ret, strerror(ret)); fail_if(enumerated, "Enumeration should default to false"); - ret = sysdb_set_enumerated(test_ctx->sysdb, test_ctx->domain, true); + ret = sysdb_set_enumerated(test_ctx->domain, true); fail_if(ret != EOK, "Error [%d][%s] setting enumeration", ret, strerror(ret)); /* Recheck enumeration status */ - ret = sysdb_has_enumerated(test_ctx->sysdb, test_ctx->domain, &enumerated); + ret = sysdb_has_enumerated(test_ctx->domain, &enumerated); fail_if(ret != EOK, "Error [%d][%s] checking enumeration", ret, strerror(ret)); @@ -4381,7 +4375,7 @@ START_TEST(test_sysdb_original_dn_case_insensitive) "cn=case_sensitive_group1,cn=example,cn=com"); fail_if(filter == NULL, "Cannot construct filter\n"); - base_dn = sysdb_domain_dn(test_ctx->sysdb, test_ctx, test_ctx->domain); + base_dn = sysdb_domain_dn(test_ctx, test_ctx->domain); fail_if(base_dn == NULL, "Cannot construct basedn\n"); ret = sysdb_search_entry(test_ctx, test_ctx->sysdb, diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c index 59b8eff59..224e71c86 100644 --- a/src/tools/sss_groupshow.c +++ b/src/tools/sss_groupshow.c @@ -423,7 +423,7 @@ static int group_show_trim_memberof(TALLOC_CTX *mem_ctx, int ret; int i; - dn = sysdb_group_dn(sysdb, mem_ctx, domain, name); + dn = sysdb_group_dn(mem_ctx, domain, name); if (!dn) { return ENOMEM; } diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c index c815de80e..121efa6cc 100644 --- a/src/tools/sss_sync_ops.c +++ b/src/tools/sss_sync_ops.c @@ -71,7 +71,7 @@ static int mod_groups_member(struct sysdb_ctx *sysdb, /* FIXME: add transaction around loop */ for (i = 0; grouplist[i]; i++) { - parent_dn = sysdb_group_dn(sysdb, tmpctx, dom, grouplist[i]); + parent_dn = sysdb_group_dn(tmpctx, dom, grouplist[i]); if (!parent_dn) { ret = ENOMEM; goto done; @@ -199,7 +199,7 @@ int usermod(TALLOC_CTX *mem_ctx, int ret; if (data->addgroups || data->rmgroups) { - member_dn = sysdb_user_dn(sysdb, mem_ctx, data->domain, data->name); + member_dn = sysdb_user_dn(mem_ctx, data->domain, data->name); if (!member_dn) { return ENOMEM; } @@ -257,7 +257,7 @@ int groupmod(TALLOC_CTX *mem_ctx, int ret; if (data->addgroups || data->rmgroups) { - member_dn = sysdb_group_dn(sysdb, mem_ctx, data->domain, data->name); + member_dn = sysdb_group_dn(mem_ctx, data->domain, data->name); if (!member_dn) { return ENOMEM; } @@ -478,7 +478,7 @@ int useradd(TALLOC_CTX *mem_ctx, if (data->addgroups) { struct ldb_dn *member_dn; - member_dn = sysdb_user_dn(sysdb, mem_ctx, data->domain, data->name); + member_dn = sysdb_user_dn(mem_ctx, data->domain, data->name); if (!member_dn) { ret = ENOMEM; goto done; @@ -507,7 +507,7 @@ int userdel(TALLOC_CTX *mem_ctx, struct ldb_dn *user_dn; int ret; - user_dn = sysdb_user_dn(sysdb, mem_ctx, data->domain, data->name); + user_dn = sysdb_user_dn(mem_ctx, data->domain, data->name); if (!user_dn) { DEBUG(1, ("Could not construct a user DN\n")); return ENOMEM; @@ -549,7 +549,7 @@ int groupdel(TALLOC_CTX *mem_ctx, struct ldb_dn *group_dn; int ret; - group_dn = sysdb_group_dn(sysdb, mem_ctx, data->domain, data->name); + group_dn = sysdb_group_dn(mem_ctx, data->domain, data->name); if (group_dn == NULL) { DEBUG(1, ("Could not construct a group DN\n")); return ENOMEM; |