From 82c3185b2ccc1e99ff6c6d63d09754cbd0705e6c Mon Sep 17 00:00:00 2001 From: Jan Zeleny Date: Wed, 18 May 2011 08:53:26 -0400 Subject: sysdb refactoring: renamed ctx variable to sysdb --- src/db/sysdb_search.c | 74 +++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'src/db/sysdb_search.c') diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c index dfae4ddf0..8705b83d7 100644 --- a/src/db/sysdb_search.c +++ b/src/db/sysdb_search.c @@ -28,7 +28,7 @@ /* users */ int sysdb_getpwnam(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, const char *name, struct ldb_result **_res) @@ -49,7 +49,7 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx, return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_TMPL_USER_BASE, domain->name); if (!base_dn) { ret = ENOMEM; @@ -61,7 +61,7 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx, goto done; } - ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, SYSDB_PWNAM_FILTER, sanitized_name); if (ret) { @@ -77,7 +77,7 @@ done: } int sysdb_getpwuid(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, uid_t uid, struct ldb_result **_res) @@ -98,14 +98,14 @@ int sysdb_getpwuid(TALLOC_CTX *mem_ctx, return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_TMPL_USER_BASE, domain->name); if (!base_dn) { ret = ENOMEM; goto done; } - ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, SYSDB_PWUID_FILTER, ul_uid); if (ret) { ret = sysdb_error_to_errno(ret); @@ -120,7 +120,7 @@ done: } int sysdb_enumpwent(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, struct ldb_result **_res) { @@ -139,14 +139,14 @@ int sysdb_enumpwent(TALLOC_CTX *mem_ctx, return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_TMPL_USER_BASE, domain->name); if (!base_dn) { ret = ENOMEM; goto done; } - ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, SYSDB_PWENT_FILTER); if (ret) { ret = sysdb_error_to_errno(ret); @@ -205,7 +205,7 @@ static int mpg_res_convert(struct ldb_result *res) } int sysdb_getgrnam(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, const char *name, struct ldb_result **_res) @@ -227,13 +227,13 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx, return ENOMEM; } - if (ctx->mpg) { + if (sysdb->mpg) { fmt_filter = SYSDB_GRNAM_MPG_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_DOM_BASE, domain->name); } else { fmt_filter = SYSDB_GRNAM_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_TMPL_GROUP_BASE, domain->name); } if (!base_dn) { @@ -246,7 +246,7 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx, goto done; } - ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, fmt_filter, sanitized_name); if (ret) { @@ -267,7 +267,7 @@ done: } int sysdb_getgrgid(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, gid_t gid, struct ldb_result **_res) @@ -289,13 +289,13 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx, return ENOMEM; } - if (ctx->mpg) { + if (sysdb->mpg) { fmt_filter = SYSDB_GRGID_MPG_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_DOM_BASE, domain->name); } else { fmt_filter = SYSDB_GRGID_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_TMPL_GROUP_BASE, domain->name); } if (!base_dn) { @@ -303,7 +303,7 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx, goto done; } - ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, fmt_filter, ul_gid); if (ret) { ret = sysdb_error_to_errno(ret); @@ -323,7 +323,7 @@ done: } int sysdb_enumgrent(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, struct ldb_result **_res) { @@ -343,13 +343,13 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx, return ENOMEM; } - if (ctx->mpg) { + if (sysdb->mpg) { fmt_filter = SYSDB_GRENT_MPG_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_DOM_BASE, domain->name); } else { fmt_filter = SYSDB_GRENT_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_TMPL_GROUP_BASE, domain->name); } if (!base_dn) { @@ -357,7 +357,7 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx, goto done; } - ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, fmt_filter); if (ret) { ret = sysdb_error_to_errno(ret); @@ -377,7 +377,7 @@ done: } int sysdb_initgroups(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, const char *name, struct ldb_result **_res) @@ -396,7 +396,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx, return ENOMEM; } - ret = sysdb_getpwnam(tmpctx, ctx, domain, name, &res); + ret = sysdb_getpwnam(tmpctx, sysdb, domain, name, &res); if (ret != EOK) { DEBUG(1, ("sysdb_getpwnam failed: [%d][%s]\n", ret, strerror(ret))); @@ -450,7 +450,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx, control->src_attr_len = strlen(control->source_attribute); ctrl[0]->data = control; - ret = ldb_build_search_req(&req, ctx->ldb, tmpctx, + ret = ldb_build_search_req(&req, sysdb->ldb, tmpctx, user_dn, LDB_SCOPE_BASE, SYSDB_INITGR_FILTER, attrs, ctrl, res, ldb_search_default_callback, @@ -460,7 +460,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx, goto done; } - ret = ldb_request(ctx->ldb, req); + ret = ldb_request(sysdb->ldb, req); if (ret == LDB_SUCCESS) { ret = ldb_wait(req->handle, LDB_WAIT_ALL); } @@ -477,7 +477,7 @@ done: } int sysdb_get_user_attr(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, const char *name, const char **attributes, @@ -498,7 +498,7 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx, return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_TMPL_USER_BASE, domain->name); if (!base_dn) { ret = ENOMEM; @@ -510,7 +510,7 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx, goto done; } - ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, LDB_SCOPE_SUBTREE, attributes, SYSDB_PWNAM_FILTER, sanitized_name); if (ret) { @@ -780,7 +780,7 @@ done: } errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, const char *netgroup, struct ldb_result **res) @@ -803,7 +803,7 @@ errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx, return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmp_ctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_NETGROUP_BASE, domain->name); if (!base_dn) { @@ -823,7 +823,7 @@ errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx, goto done; } - lret = ldb_search(ctx->ldb, tmp_ctx, &result, base_dn, + lret = ldb_search(sysdb->ldb, tmp_ctx, &result, base_dn, LDB_SCOPE_SUBTREE, attrs, SYSDB_NETGR_TRIPLES_FILTER, sanitized_netgroup, netgroup_dn); @@ -841,7 +841,7 @@ done: } int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, + struct sysdb_ctx *sysdb, struct sss_domain_info *domain, const char *netgrname, const char **attributes, @@ -862,7 +862,7 @@ int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx, return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, + base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_TMPL_NETGROUP_BASE, domain->name); if (!base_dn) { ret = ENOMEM; @@ -874,7 +874,7 @@ int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx, goto done; } - ret = ldb_search(ctx->ldb, tmpctx, &result, base_dn, + ret = ldb_search(sysdb->ldb, tmpctx, &result, base_dn, LDB_SCOPE_SUBTREE, attributes, SYSDB_NETGR_FILTER, sanitized_netgroup); -- cgit