diff options
author | Jan Zeleny <jzeleny@redhat.com> | 2011-05-20 03:48:05 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-08-15 09:16:39 -0400 |
commit | e79d23932ef9d52cf4eb32ddec2d0a9b3af9a9eb (patch) | |
tree | 4dc9339ee81eb20437e7091b77c7cc7ea19782c1 /src/providers | |
parent | 8a1738f9379a1b8fb5c95c3df649e014ff5a1434 (diff) | |
download | sssd-e79d23932ef9d52cf4eb32ddec2d0a9b3af9a9eb.tar.gz sssd-e79d23932ef9d52cf4eb32ddec2d0a9b3af9a9eb.tar.xz sssd-e79d23932ef9d52cf4eb32ddec2d0a9b3af9a9eb.zip |
sysdb refactoring: memory context deleted
This patch deletes memory context parameter in those places in sysdb
where it is not necessary. The code using modified functions has been
updated. Tests updated as well.
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/ipa/ipa_access.c | 2 | ||||
-rw-r--r-- | src/providers/ipa/ipa_hbac_common.c | 4 | ||||
-rw-r--r-- | src/providers/krb5/krb5_auth.c | 7 | ||||
-rw-r--r-- | src/providers/ldap/ldap_auth.c | 3 | ||||
-rw-r--r-- | src/providers/ldap/ldap_id.c | 12 | ||||
-rw-r--r-- | src/providers/ldap/ldap_id_cleanup.c | 4 | ||||
-rw-r--r-- | src/providers/ldap/sdap_access.c | 3 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async_accounts.c | 18 | ||||
-rw-r--r-- | src/providers/proxy/proxy_auth.c | 3 | ||||
-rw-r--r-- | src/providers/proxy/proxy_id.c | 18 |
10 files changed, 31 insertions, 43 deletions
diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c index 74136d31c..a74d6a97c 100644 --- a/src/providers/ipa/ipa_access.c +++ b/src/providers/ipa/ipa_access.c @@ -454,7 +454,7 @@ static void hbac_sysdb_save(struct tevent_req *req) return; } - ret = sysdb_delete_recursive(tmp_ctx, sysdb, base_dn, true); + ret = sysdb_delete_recursive(sysdb, base_dn, true); talloc_free(tmp_ctx); if (ret != EOK) { DEBUG(1, ("sysdb_delete_recursive failed.\n")); diff --git a/src/providers/ipa/ipa_hbac_common.c b/src/providers/ipa/ipa_hbac_common.c index 36c67e492..08cb02543 100644 --- a/src/providers/ipa/ipa_hbac_common.c +++ b/src/providers/ipa/ipa_hbac_common.c @@ -50,7 +50,7 @@ ipa_hbac_save_list(struct sysdb_ctx *sysdb, bool delete_subdir, goto done; } - ret = sysdb_delete_recursive(tmp_ctx, sysdb, base_dn, true); + ret = sysdb_delete_recursive(sysdb, base_dn, true); if (ret != EOK) { DEBUG(1, ("sysdb_delete_recursive failed.\n")); goto done; @@ -77,7 +77,7 @@ ipa_hbac_save_list(struct sysdb_ctx *sysdb, bool delete_subdir, } DEBUG(9, ("Object name: [%s].\n", object_name)); - ret = sysdb_store_custom(tmp_ctx, sysdb, object_name, subdir, list[c]); + ret = sysdb_store_custom(sysdb, object_name, subdir, list[c]); if (ret != EOK) { DEBUG(1, ("sysdb_store_custom failed.\n")); goto done; diff --git a/src/providers/krb5/krb5_auth.c b/src/providers/krb5/krb5_auth.c index c8dc86526..d74068601 100644 --- a/src/providers/krb5/krb5_auth.c +++ b/src/providers/krb5/krb5_auth.c @@ -193,7 +193,7 @@ static int krb5_mod_ccname(TALLOC_CTX *mem_ctx, goto done; } - ret = sysdb_set_user_attr(tmpctx, sysdb, name, attrs, mod_op); + ret = sysdb_set_user_attr(sysdb, name, attrs, mod_op); if (ret != EOK) { DEBUG(6, ("Error: %d (%s)\n", ret, strerror(ret))); sysdb_transaction_cancel(sysdb); @@ -1083,8 +1083,7 @@ static void krb5_save_ccname_done(struct tevent_req *req) talloc_set_destructor((TALLOC_CTX *)password, password_destructor); - ret = sysdb_cache_password(state, state->be_ctx->sysdb, pd->user, - password); + ret = sysdb_cache_password(state->be_ctx->sysdb, pd->user, password); if (ret) { DEBUG(2, ("Failed to cache password, offline auth may not work." " (%d)[%s]!?\n", ret, strerror(ret))); @@ -1112,7 +1111,7 @@ static void krb5_pam_handler_cache_auth_step(struct tevent_req *req) struct krb5_ctx *krb5_ctx = state->kr->krb5_ctx; int ret; - ret = sysdb_cache_auth(state, state->be_ctx->sysdb, pd->user, pd->authtok, + ret = sysdb_cache_auth(state->be_ctx->sysdb, pd->user, pd->authtok, pd->authtok_size, state->be_ctx->cdb, true, NULL, NULL); if (ret != EOK) { diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c index efc9f5278..ad4549e7c 100644 --- a/src/providers/ldap/ldap_auth.c +++ b/src/providers/ldap/ldap_auth.c @@ -1098,8 +1098,7 @@ static void sdap_pam_auth_done(struct tevent_req *req) } talloc_set_destructor((TALLOC_CTX *)password, password_destructor); - ret = sysdb_cache_password(state, - state->breq->be_ctx->sysdb, + ret = sysdb_cache_password(state->breq->be_ctx->sysdb, state->username, password); /* password caching failures are not fatal errors */ diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c index 9525224bf..2d8aefff8 100644 --- a/src/providers/ldap/ldap_id.c +++ b/src/providers/ldap/ldap_id.c @@ -227,7 +227,7 @@ static void users_get_done(struct tevent_req *subreq) tevent_req_error(req, ret); return; case BE_FILTER_NAME: - ret = sysdb_delete_user(state, state->sysdb, state->name, 0); + ret = sysdb_delete_user(state->sysdb, state->name, 0); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; @@ -241,7 +241,7 @@ static void users_get_done(struct tevent_req *subreq) return; } - ret = sysdb_delete_user(state, state->sysdb, NULL, uid); + ret = sysdb_delete_user(state->sysdb, NULL, uid); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; @@ -470,7 +470,7 @@ static void groups_get_done(struct tevent_req *subreq) tevent_req_error(req, ret); return; case BE_FILTER_NAME: - ret = sysdb_delete_group(state, state->sysdb, state->name, 0); + ret = sysdb_delete_group(state->sysdb, state->name, 0); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; @@ -484,7 +484,7 @@ static void groups_get_done(struct tevent_req *subreq) return; } - ret = sysdb_delete_group(state, state->sysdb, NULL, gid); + ret = sysdb_delete_group(state->sysdb, NULL, gid); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; @@ -652,9 +652,7 @@ static void groups_by_user_done(struct tevent_req *subreq) } if (ret == ENOENT) { - ret = sysdb_delete_user(state, - state->ctx->be->sysdb, - state->name, 0); + ret = sysdb_delete_user(state->ctx->be->sysdb, state->name, 0); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c index fc6592712..9c50ee485 100644 --- a/src/providers/ldap/ldap_id_cleanup.c +++ b/src/providers/ldap/ldap_id_cleanup.c @@ -336,7 +336,7 @@ static int cleanup_users(TALLOC_CTX *memctx, struct sdap_id_ctx *ctx) /* If not logged in or cannot check the table, delete him */ DEBUG(9, ("About to delete user %s\n", name)); - ret = sysdb_delete_user(tmpctx, sysdb, name, 0); + ret = sysdb_delete_user(sysdb, name, 0); if (ret) { goto done; } @@ -465,7 +465,7 @@ static int cleanup_groups(TALLOC_CTX *memctx, } DEBUG(8, ("About to delete group %s\n", name)); - ret = sysdb_delete_group(tmpctx, sysdb, name, 0); + ret = sysdb_delete_group(sysdb, name, 0); if (ret) { DEBUG(2, ("Group delete returned %d (%s)\n", ret, strerror(ret))); diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c index 0ac0f639b..9f10a1464 100644 --- a/src/providers/ldap/sdap_access.c +++ b/src/providers/ldap/sdap_access.c @@ -1058,8 +1058,7 @@ static void sdap_access_filter_get_access_done(struct tevent_req *subreq) goto done; } - ret = sysdb_set_user_attr(attrs, - state->be_ctx->sysdb, + ret = sysdb_set_user_attr(state->be_ctx->sysdb, state->username, attrs, SYSDB_MOD_REP); if (ret != EOK) { diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c index a6907a34d..476532459 100644 --- a/src/providers/ldap/sdap_async_accounts.c +++ b/src/providers/ldap/sdap_async_accounts.c @@ -298,8 +298,7 @@ static int sdap_save_user(TALLOC_CTX *memctx, DEBUG(6, ("Storing info for user %s\n", name)); - ret = sysdb_store_user(user_attrs, ctx, - name, pwd, uid, gid, gecos, homedir, shell, + ret = sysdb_store_user(ctx, name, pwd, uid, gid, gecos, homedir, shell, user_attrs, missing, cache_timeout); if (ret) goto fail; @@ -664,8 +663,7 @@ done: /* FIXME: support storing additional attributes */ static errno_t -sdap_store_group_with_gid(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *ctx, +sdap_store_group_with_gid(struct sysdb_ctx *ctx, const char *name, gid_t gid, struct sysdb_attrs *group_attrs, @@ -684,9 +682,7 @@ sdap_store_group_with_gid(TALLOC_CTX *mem_ctx, } } - ret = sysdb_store_group(mem_ctx, ctx, - name, gid, group_attrs, - cache_timeout); + ret = sysdb_store_group(ctx, name, gid, group_attrs, cache_timeout); if (ret) { DEBUG(2, ("Could not store group %s\n", name)); return ret; @@ -856,8 +852,7 @@ static int sdap_save_group(TALLOC_CTX *memctx, DEBUG(6, ("Storing info for group %s\n", name)); - ret = sdap_store_group_with_gid(group_attrs, ctx, - name, gid, group_attrs, + ret = sdap_store_group_with_gid(ctx, name, gid, group_attrs, dp_opt_get_int(opts->basic, SDAP_ENTRY_CACHE_TIMEOUT), posix_group); @@ -928,7 +923,7 @@ static int sdap_save_grpmem(TALLOC_CTX *memctx, DEBUG(6, ("Storing members for group %s\n", name)); - ret = sysdb_store_group(memctx, ctx, name, 0, group_attrs, + ret = sysdb_store_group(ctx, name, 0, group_attrs, dp_opt_get_int(opts->basic, SDAP_ENTRY_CACHE_TIMEOUT)); if (ret) goto fail; @@ -2052,8 +2047,7 @@ static errno_t sdap_nested_group_populate_users(struct sysdb_ctx *sysdb, ret = sysdb_attrs_add_string(attrs, SYSDB_NAME, username); if (ret) goto done; - ret = sysdb_set_user_attr(tmp_ctx, sysdb, - sysdb_name, attrs, SYSDB_MOD_REP); + ret = sysdb_set_user_attr(sysdb, sysdb_name, attrs, SYSDB_MOD_REP); if (ret != EOK) goto done; } diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c index 57eb483c4..f92c64714 100644 --- a/src/providers/proxy/proxy_auth.c +++ b/src/providers/proxy/proxy_auth.c @@ -759,8 +759,7 @@ static void proxy_child_done(struct tevent_req *req) } talloc_set_destructor((TALLOC_CTX *)password, password_destructor); - ret = sysdb_cache_password(client_ctx, - client_ctx->be_req->be_ctx->sysdb, + ret = sysdb_cache_password(client_ctx->be_req->be_ctx->sysdb, pd->user, password); /* password caching failures are not fatal errors */ diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c index b4dcac7cc..041e25f26 100644 --- a/src/providers/proxy/proxy_id.c +++ b/src/providers/proxy/proxy_id.c @@ -97,7 +97,7 @@ static int get_pw_name(TALLOC_CTX *mem_ctx, break; } - ret = sysdb_store_user(tmpctx, sysdb, + ret = sysdb_store_user(sysdb, pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, @@ -212,7 +212,7 @@ static int get_pw_uid(TALLOC_CTX *mem_ctx, break; } - ret = sysdb_store_user(tmpctx, sysdb, + ret = sysdb_store_user(sysdb, pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, @@ -241,7 +241,7 @@ static int get_pw_uid(TALLOC_CTX *mem_ctx, DEBUG(7, ("User %d does not exist (or is invalid) on remote server," " deleting!\n", uid)); - ret = sysdb_delete_user(tmpctx, sysdb, NULL, uid); + ret = sysdb_delete_user(sysdb, NULL, uid); if (ret) { goto done; } @@ -352,7 +352,7 @@ again: goto again; /* skip */ } - ret = sysdb_store_user(tmpctx, sysdb, + ret = sysdb_store_user(sysdb, pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, @@ -515,7 +515,7 @@ again: members = NULL; } - ret = sysdb_store_group(tmpctx, sysdb, + ret = sysdb_store_group(sysdb, grp->gr_name, grp->gr_gid, members, @@ -666,7 +666,7 @@ again: members = NULL; } - ret = sysdb_store_group(tmpctx, sysdb, + ret = sysdb_store_group(sysdb, grp->gr_name, grp->gr_gid, members, @@ -691,7 +691,7 @@ again: DEBUG(7, ("Group %d does not exist (or is invalid) on remote server," " deleting!\n", gid)); - ret = sysdb_delete_group(tmpctx, sysdb, NULL, gid); + ret = sysdb_delete_group(sysdb, NULL, gid); if (ret) { goto done; } @@ -821,7 +821,7 @@ again: members = NULL; } - ret = sysdb_store_group(tmpctx, sysdb, + ret = sysdb_store_group(sysdb, grp->gr_name, grp->gr_gid, members, @@ -928,7 +928,7 @@ static int get_initgr(TALLOC_CTX *mem_ctx, break; } - ret = sysdb_store_user(tmpctx, sysdb, + ret = sysdb_store_user(sysdb, pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, |