On Thu, 2009-08-27 at 01:03 -0400, Simo Sorce wrote: > This affects only the ldap driver. > Enumerations are now a background task, on startup a full enumeration is > performed. > Then every 5 minutes (changeable default) only new/modified entries are > retrieved. > So after the first full pull the quantity of data that is pulled is > limited, this is why I have not removed the large transaction yet. > > Next step is to change the group handling code into a 2 step process, or > some group membership may be lost against server that allow nested > groups via the member/memberof schema. > > 0001 simplify code, no need for a wrapper
Forgot to fix the tests code in this one, attaching new patch. Simo. -- Simo Sorce * Red Hat, Inc * New York
>From 33e03e0e52d663f4ebdfb65c12cf222d9bb2bf4e Mon Sep 17 00:00:00 2001 From: Simo Sorce <sso...@redhat.com> Date: Wed, 26 Aug 2009 16:51:57 -0400 Subject: [PATCH 1/2] Remove redunant function and always pass attrs. --- server/db/sysdb.h | 19 ++++--------------- server/db/sysdb_ops.c | 40 +++++++++++----------------------------- server/providers/proxy.c | 20 ++++++++++++-------- server/tests/sysdb-tests.c | 5 +++-- 4 files changed, 30 insertions(+), 54 deletions(-) diff --git a/server/db/sysdb.h b/server/db/sysdb.h index 70231f8..2f01ea6 100644 --- a/server/db/sysdb.h +++ b/server/db/sysdb.h @@ -449,29 +449,18 @@ struct tevent_req *sysdb_store_user_send(TALLOC_CTX *mem_ctx, uid_t uid, gid_t gid, const char *gecos, const char *homedir, - const char *shell); + const char *shell, + struct sysdb_attrs *attrs); int sysdb_store_user_recv(struct tevent_req *req); -struct tevent_req *sysdb_store_user_with_attrs_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct sysdb_handle *handle, - struct sss_domain_info *domain, - const char *name, - const char *pwd, - uid_t uid, gid_t gid, - const char *gecos, - const char *homedir, - const char *shell, - struct sysdb_attrs *attrs); -int sysdb_store_user_with_attrs_recv(struct tevent_req *req); - struct tevent_req *sysdb_store_group_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct sysdb_handle *handle, struct sss_domain_info *domain, const char *name, gid_t gid, - const char **members); + const char **members, + struct sysdb_attrs *attrs); int sysdb_store_group_recv(struct tevent_req *req); struct tevent_req *sysdb_add_group_member_send(TALLOC_CTX *mem_ctx, diff --git a/server/db/sysdb_ops.c b/server/db/sysdb_ops.c index a36b22f..5770527 100644 --- a/server/db/sysdb_ops.c +++ b/server/db/sysdb_ops.c @@ -2563,24 +2563,8 @@ struct tevent_req *sysdb_store_user_send(TALLOC_CTX *mem_ctx, uid_t uid, gid_t gid, const char *gecos, const char *homedir, - const char *shell) -{ - return sysdb_store_user_with_attrs_send(mem_ctx, ev, handle, domain, - name, pwd, uid, gid, gecos, - homedir, shell, NULL); -} - -struct tevent_req *sysdb_store_user_with_attrs_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct sysdb_handle *handle, - struct sss_domain_info *domain, - const char *name, - const char *pwd, - uid_t uid, gid_t gid, - const char *gecos, - const char *homedir, - const char *shell, - struct sysdb_attrs *attrs) + const char *shell, + struct sysdb_attrs *attrs) { struct tevent_req *req, *subreq; struct sysdb_store_user_state *state; @@ -2776,11 +2760,6 @@ int sysdb_store_user_recv(struct tevent_req *req) return sysdb_op_default_recv(req); } -int sysdb_store_user_with_attrs_recv(struct tevent_req *req) -{ - return sysdb_op_default_recv(req); -} - /* =Store-Group-(Native/Legacy)-(replaces-existing-data)================== */ /* this function does not check that all user members are actually present */ @@ -2807,7 +2786,8 @@ struct tevent_req *sysdb_store_group_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *domain, const char *name, gid_t gid, - const char **members) + const char **members, + struct sysdb_attrs *attrs) { struct tevent_req *req, *subreq; struct sysdb_store_group_state *state; @@ -2824,7 +2804,7 @@ struct tevent_req *sysdb_store_group_send(TALLOC_CTX *mem_ctx, state->name = name; state->gid = gid; state->members = members; - state->attrs = NULL; + state->attrs = attrs; subreq = sysdb_search_group_by_name_send(state, ev, NULL, handle, domain, name, src_attrs); @@ -2866,11 +2846,13 @@ static void sysdb_store_group_check(struct tevent_req *subreq) * group needs any update */ if (state->members) { - state->attrs = sysdb_new_attrs(state); if (!state->attrs) { - DEBUG(6, ("Error: Out of memory\n")); - tevent_req_error(req, ENOMEM); - return; + state->attrs = sysdb_new_attrs(state); + if (!state->attrs) { + DEBUG(6, ("Error: Out of memory\n")); + tevent_req_error(req, ENOMEM); + return; + } } for (i = 0; state->members[i]; i++) { diff --git a/server/providers/proxy.c b/server/providers/proxy.c index 2aee533..d361191 100644 --- a/server/providers/proxy.c +++ b/server/providers/proxy.c @@ -446,7 +446,7 @@ static void get_pw_name_process(struct tevent_req *subreq) state->pwd->pw_gid, state->pwd->pw_gecos, state->pwd->pw_dir, - state->pwd->pw_shell); + state->pwd->pw_shell, NULL); if (!subreq) { tevent_req_error(req, ENOMEM); return; @@ -625,7 +625,7 @@ static void get_pw_uid_process(struct tevent_req *subreq) state->pwd->pw_gid, state->pwd->pw_gecos, state->pwd->pw_dir, - state->pwd->pw_shell); + state->pwd->pw_shell, NULL); if (!subreq) { tevent_req_error(req, ENOMEM); return; @@ -808,7 +808,7 @@ again: state->pwd->pw_gid, state->pwd->pw_gecos, state->pwd->pw_dir, - state->pwd->pw_shell); + state->pwd->pw_shell, NULL); if (!subreq) { tevent_req_error(req, ENOMEM); return; @@ -949,7 +949,8 @@ again: state->domain, state->grp->gr_name, state->grp->gr_gid, - (const char **)state->grp->gr_mem); + (const char **)state->grp->gr_mem, + NULL); if (!subreq) { tevent_req_error(req, ENOMEM); return; @@ -1142,7 +1143,8 @@ again: state->domain, state->grp->gr_name, state->grp->gr_gid, - (const char **)state->grp->gr_mem); + (const char **)state->grp->gr_mem, + NULL); if (!subreq) { tevent_req_error(req, ENOMEM); return; @@ -1321,7 +1323,8 @@ again: state->domain, state->grp->gr_name, state->grp->gr_gid, - (const char **)state->grp->gr_mem); + (const char **)state->grp->gr_mem, + NULL); if (!subreq) { tevent_req_error(req, ENOMEM); return; @@ -1467,7 +1470,7 @@ static void get_initgr_process(struct tevent_req *subreq) state->pwd->pw_gid, state->pwd->pw_gecos, state->pwd->pw_dir, - state->pwd->pw_shell); + state->pwd->pw_shell, NULL); if (!subreq) { tevent_req_error(req, ENOMEM); return; @@ -1774,7 +1777,8 @@ again: state->domain, state->grp->gr_name, state->grp->gr_gid, - (const char **)state->grp->gr_mem); + (const char **)state->grp->gr_mem, + NULL); if (!subreq) { ret = ENOMEM; goto fail; diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c index 1b3ee64..72514e3 100644 --- a/server/tests/sysdb-tests.c +++ b/server/tests/sysdb-tests.c @@ -279,7 +279,8 @@ static void test_store_user(struct tevent_req *req) data->domain, data->username, "x", data->uid, 0, gecos, homedir, - data->shell ? data->shell : "/bin/bash"); + data->shell ? data->shell : "/bin/bash", + NULL); if (!subreq) { test_return(data, ENOMEM); return; @@ -484,7 +485,7 @@ static void test_store_group(struct tevent_req *req) subreq = sysdb_store_group_send(data, data->ev, data->handle, data->domain, data->groupname, - data->gid, NULL); + data->gid, NULL, NULL); if (!subreq) { test_return(data, ret); } -- 1.6.2.5
_______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/sssd-devel