diff options
author | Jan Zeleny <jzeleny@redhat.com> | 2011-08-12 08:48:49 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-08-15 09:16:39 -0400 |
commit | 844015b85bb4e488161ee6c8912f3f4b4c4572c5 (patch) | |
tree | 388a59579080f44d04cd087c58d2734f9ea45058 | |
parent | e79d23932ef9d52cf4eb32ddec2d0a9b3af9a9eb (diff) | |
download | sssd-844015b85bb4e488161ee6c8912f3f4b4c4572c5.tar.gz sssd-844015b85bb4e488161ee6c8912f3f4b4c4572c5.tar.xz sssd-844015b85bb4e488161ee6c8912f3f4b4c4572c5.zip |
Remaining memory context variables renamed
memctx to mem_ctx
tmpctx to tmp_ctx
-rw-r--r-- | src/db/sysdb.h | 26 | ||||
-rw-r--r-- | src/db/sysdb_search.c | 124 |
2 files changed, 75 insertions, 75 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index ab6d797d3..ee1c86816 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -185,7 +185,7 @@ struct sysdb_attrs { }; /* sysdb_attrs helper functions */ -struct sysdb_attrs *sysdb_new_attrs(TALLOC_CTX *memctx); +struct sysdb_attrs *sysdb_new_attrs(TALLOC_CTX *mem_ctx); /* values are copied in the structure, allocated on "attrs" */ int sysdb_attrs_add_val(struct sysdb_attrs *attrs, @@ -240,30 +240,30 @@ errno_t sysdb_attrs_primary_name_list(struct sysdb_ctx *sysdb, int sysdb_error_to_errno(int ldberr); /* DNs related helper functions */ -errno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, void *memctx, +errno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, void *mem_ctx, const char *_dn, char **_name, char **_val); -struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, void *memctx, +struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, void *mem_ctx, const char *domain, const char *name); -struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, void *memctx, +struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, void *mem_ctx, const char *domain, const char *name); -struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, void *memctx, +struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, void *mem_ctx, const char *domain, const char *name); -struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, void *memctx, +struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, void *mem_ctx, const char *domain); -errno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, void *memctx, +errno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, void *mem_ctx, const char *dn_str, char **name); -struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, void *memctx, +struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, void *mem_ctx, const char *domain); -struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, void *memctx, +struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, void *mem_ctx, const char *domain, const char *object_name, const char *subtree_name); -struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, void *memctx, +struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, void *mem_ctx, const char *domain, const char *subtree_name); -char *sysdb_user_strdn(TALLOC_CTX *memctx, +char *sysdb_user_strdn(TALLOC_CTX *mem_ctx, const char *domain, const char *name); -char *sysdb_group_strdn(TALLOC_CTX *memctx, +char *sysdb_group_strdn(TALLOC_CTX *mem_ctx, const char *domain, const char *name); @@ -661,7 +661,7 @@ int sysdb_search_netgroups(TALLOC_CTX *mem_ctx, int sysdb_delete_netgroup(struct sysdb_ctx *sysdb, const char *name); -errno_t sysdb_attrs_to_list(TALLOC_CTX *memctx, +errno_t sysdb_attrs_to_list(TALLOC_CTX *mem_ctx, struct sysdb_attrs **attrs, int attr_count, const char *attr_name, diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c index 8f3825203..37d6e14b2 100644 --- a/src/db/sysdb_search.c +++ b/src/db/sysdb_search.c @@ -32,31 +32,31 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx, const char *name, struct ldb_result **_res) { - TALLOC_CTX *tmpctx; + TALLOC_CTX *tmp_ctx; static const char *attrs[] = SYSDB_PW_ATTRS; struct ldb_dn *base_dn; struct ldb_result *res; char *sanitized_name; int ret; - tmpctx = talloc_new(NULL); - if (!tmpctx) { + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; } - ret = sss_filter_sanitize(tmpctx, name, &sanitized_name); + ret = sss_filter_sanitize(tmp_ctx, name, &sanitized_name); if (ret != EOK) { goto done; } - ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmp_ctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, SYSDB_PWNAM_FILTER, sanitized_name); if (ret) { @@ -67,7 +67,7 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx, *_res = talloc_steal(mem_ctx, res); done: - talloc_zfree(tmpctx); + talloc_zfree(tmp_ctx); return ret; } @@ -76,26 +76,26 @@ int sysdb_getpwuid(TALLOC_CTX *mem_ctx, uid_t uid, struct ldb_result **_res) { - TALLOC_CTX *tmpctx; + TALLOC_CTX *tmp_ctx; unsigned long int ul_uid = uid; static const char *attrs[] = SYSDB_PW_ATTRS; struct ldb_dn *base_dn; struct ldb_result *res; int ret; - tmpctx = talloc_new(NULL); - if (!tmpctx) { + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; } - ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmp_ctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, SYSDB_PWUID_FILTER, ul_uid); if (ret) { ret = sysdb_error_to_errno(ret); @@ -105,7 +105,7 @@ int sysdb_getpwuid(TALLOC_CTX *mem_ctx, *_res = talloc_steal(mem_ctx, res); done: - talloc_zfree(tmpctx); + talloc_zfree(tmp_ctx); return ret; } @@ -113,25 +113,25 @@ int sysdb_enumpwent(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, struct ldb_result **_res) { - TALLOC_CTX *tmpctx; + TALLOC_CTX *tmp_ctx; static const char *attrs[] = SYSDB_PW_ATTRS; struct ldb_dn *base_dn; struct ldb_result *res; int ret; - tmpctx = talloc_new(NULL); - if (!tmpctx) { + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; } - ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmp_ctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, SYSDB_PWENT_FILTER); if (ret) { ret = sysdb_error_to_errno(ret); @@ -141,7 +141,7 @@ int sysdb_enumpwent(TALLOC_CTX *mem_ctx, *_res = talloc_steal(mem_ctx, res); done: - talloc_zfree(tmpctx); + talloc_zfree(tmp_ctx); return ret; } @@ -194,7 +194,7 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx, const char *name, struct ldb_result **_res) { - TALLOC_CTX *tmpctx; + TALLOC_CTX *tmp_ctx; static const char *attrs[] = SYSDB_GRSRC_ATTRS; const char *fmt_filter; char *sanitized_name; @@ -202,18 +202,18 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx, struct ldb_result *res; int ret; - tmpctx = talloc_new(NULL); - if (!tmpctx) { + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { return ENOMEM; } if (sysdb->mpg) { fmt_filter = SYSDB_GRNAM_MPG_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_DOM_BASE, sysdb->domain->name); } else { fmt_filter = SYSDB_GRNAM_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_GROUP_BASE, sysdb->domain->name); } if (!base_dn) { @@ -221,12 +221,12 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx, goto done; } - ret = sss_filter_sanitize(tmpctx, name, &sanitized_name); + ret = sss_filter_sanitize(tmp_ctx, name, &sanitized_name); if (ret != EOK) { goto done; } - ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmp_ctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, fmt_filter, sanitized_name); if (ret) { @@ -242,7 +242,7 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx, *_res = talloc_steal(mem_ctx, res); done: - talloc_zfree(tmpctx); + talloc_zfree(tmp_ctx); return ret; } @@ -251,7 +251,7 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx, gid_t gid, struct ldb_result **_res) { - TALLOC_CTX *tmpctx; + TALLOC_CTX *tmp_ctx; unsigned long int ul_gid = gid; static const char *attrs[] = SYSDB_GRSRC_ATTRS; const char *fmt_filter; @@ -259,18 +259,18 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx, struct ldb_result *res; int ret; - tmpctx = talloc_new(NULL); - if (!tmpctx) { + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { return ENOMEM; } if (sysdb->mpg) { fmt_filter = SYSDB_GRGID_MPG_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_DOM_BASE, sysdb->domain->name); } else { fmt_filter = SYSDB_GRGID_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_GROUP_BASE, sysdb->domain->name); } if (!base_dn) { @@ -278,7 +278,7 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx, goto done; } - ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmp_ctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, fmt_filter, ul_gid); if (ret) { ret = sysdb_error_to_errno(ret); @@ -293,7 +293,7 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx, *_res = talloc_steal(mem_ctx, res); done: - talloc_zfree(tmpctx); + talloc_zfree(tmp_ctx); return ret; } @@ -301,25 +301,25 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, struct ldb_result **_res) { - TALLOC_CTX *tmpctx; + TALLOC_CTX *tmp_ctx; static const char *attrs[] = SYSDB_GRSRC_ATTRS; const char *fmt_filter; struct ldb_dn *base_dn; struct ldb_result *res; int ret; - tmpctx = talloc_new(NULL); - if (!tmpctx) { + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { return ENOMEM; } if (sysdb->mpg) { fmt_filter = SYSDB_GRENT_MPG_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_DOM_BASE, sysdb->domain->name); } else { fmt_filter = SYSDB_GRENT_FILTER; - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_GROUP_BASE, sysdb->domain->name); } if (!base_dn) { @@ -327,7 +327,7 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx, goto done; } - ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmp_ctx, &res, base_dn, LDB_SCOPE_SUBTREE, attrs, fmt_filter); if (ret) { ret = sysdb_error_to_errno(ret); @@ -342,7 +342,7 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx, *_res = talloc_steal(mem_ctx, res); done: - talloc_zfree(tmpctx); + talloc_zfree(tmp_ctx); return ret; } @@ -351,7 +351,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx, const char *name, struct ldb_result **_res) { - TALLOC_CTX *tmpctx; + TALLOC_CTX *tmp_ctx; struct ldb_result *res; struct ldb_dn *user_dn; struct ldb_request *req; @@ -360,12 +360,12 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx, static const char *attrs[] = SYSDB_INITGR_ATTRS; int ret; - tmpctx = talloc_new(NULL); - if (!tmpctx) { + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { return ENOMEM; } - ret = sysdb_getpwnam(tmpctx, sysdb, name, &res); + ret = sysdb_getpwnam(tmp_ctx, sysdb, name, &res); if (ret != EOK) { DEBUG(1, ("sysdb_getpwnam failed: [%d][%s]\n", ret, strerror(ret))); @@ -392,7 +392,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx, * change so it is ok to already have a result (from the getpwnam) * even before we call the next search */ - ctrl = talloc_array(tmpctx, struct ldb_control *, 2); + ctrl = talloc_array(tmp_ctx, struct ldb_control *, 2); if (!ctrl) { ret = ENOMEM; goto done; @@ -419,7 +419,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, sysdb->ldb, tmpctx, + ret = ldb_build_search_req(&req, sysdb->ldb, tmp_ctx, user_dn, LDB_SCOPE_BASE, SYSDB_INITGR_FILTER, attrs, ctrl, res, ldb_search_default_callback, @@ -441,7 +441,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx, *_res = talloc_steal(mem_ctx, res); done: - talloc_zfree(tmpctx); + talloc_zfree(tmp_ctx); return ret; } @@ -451,30 +451,30 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx, const char **attributes, struct ldb_result **_res) { - TALLOC_CTX *tmpctx; + TALLOC_CTX *tmp_ctx; struct ldb_dn *base_dn; struct ldb_result *res; char *sanitized_name; int ret; - tmpctx = talloc_new(NULL); - if (!tmpctx) { + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; } - ret = sss_filter_sanitize(tmpctx, name, &sanitized_name); + ret = sss_filter_sanitize(tmp_ctx, name, &sanitized_name); if (ret != EOK) { goto done; } - ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn, + ret = ldb_search(sysdb->ldb, tmp_ctx, &res, base_dn, LDB_SCOPE_SUBTREE, attributes, SYSDB_PWNAM_FILTER, sanitized_name); if (ret) { @@ -485,7 +485,7 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx, *_res = talloc_steal(mem_ctx, res); done: - talloc_zfree(tmpctx); + talloc_zfree(tmp_ctx); return ret; } @@ -805,30 +805,30 @@ int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx, const char **attributes, struct ldb_result **res) { - TALLOC_CTX *tmpctx; + TALLOC_CTX *tmp_ctx; struct ldb_dn *base_dn; struct ldb_result *result; char *sanitized_netgroup; int ret; - tmpctx = talloc_new(NULL); - if (!tmpctx) { + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { return ENOMEM; } - base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, + base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_NETGROUP_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; } - ret = sss_filter_sanitize(tmpctx, netgrname, &sanitized_netgroup); + ret = sss_filter_sanitize(tmp_ctx, netgrname, &sanitized_netgroup); if (ret != EOK) { goto done; } - ret = ldb_search(sysdb->ldb, tmpctx, &result, base_dn, + ret = ldb_search(sysdb->ldb, tmp_ctx, &result, base_dn, LDB_SCOPE_SUBTREE, attributes, SYSDB_NETGR_FILTER, sanitized_netgroup); @@ -839,6 +839,6 @@ int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx, *res = talloc_steal(mem_ctx, result); done: - talloc_zfree(tmpctx); + talloc_zfree(tmp_ctx); return ret; } |