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/db | |
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/db')
-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 |
5 files changed, 57 insertions, 69 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); |