diff options
author | Simo Sorce <ssorce@redhat.com> | 2010-02-28 04:27:20 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-04-12 09:22:13 -0400 |
commit | 506d34d2e84268c6589f613de0cb3992b8fb87a6 (patch) | |
tree | e13bc01ad05c4b99b595dd75c9ca1507c22c7f0f /src/tools | |
parent | 5c69fd7c03e762a6fb08a7224eb1d6fd2967d09c (diff) | |
download | sssd-506d34d2e84268c6589f613de0cb3992b8fb87a6.tar.gz sssd-506d34d2e84268c6589f613de0cb3992b8fb87a6.tar.bz2 sssd-506d34d2e84268c6589f613de0cb3992b8fb87a6.zip |
sysdb: convert sysdb_set_entry/user/group_attr
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/sss_sync_ops.c | 113 |
1 files changed, 12 insertions, 101 deletions
diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c index 7feeedf2..b68bd4a6 100644 --- a/src/tools/sss_sync_ops.c +++ b/src/tools/sss_sync_ops.c @@ -488,7 +488,6 @@ static int usermod_build_attrs(TALLOC_CTX *mem_ctx, return EOK; } -static void user_mod_attr_done(struct tevent_req *attrreq); static void user_mod_attr_wakeup(struct tevent_req *subreq); static void user_mod_rm_group_done(struct tevent_req *groupreq); static void user_mod_add_group_done(struct tevent_req *groupreq); @@ -553,18 +552,17 @@ static void user_mod_attr_wakeup(struct tevent_req *subreq) struct tevent_req); struct user_mod_state *state = tevent_req_data(req, struct user_mod_state); - struct tevent_req *attrreq, *groupreq; + struct tevent_req *groupreq; + int ret; if (state->attrs->num != 0) { - attrreq = sysdb_set_user_attr_send(state, state->ev, state->handle, - state->data->domain, state->data->name, - state->attrs, SYSDB_MOD_REP); - if (!attrreq) { - tevent_req_error(req, ENOMEM); + ret = sysdb_set_user_attr(state, sysdb_handle_get_ctx(state->handle), + state->data->domain, state->data->name, + state->attrs, SYSDB_MOD_REP); + if (ret) { + tevent_req_error(req, ret); return; } - tevent_req_set_callback(attrreq, user_mod_attr_done, req); - return; } if (state->data->rmgroups != NULL) { @@ -593,47 +591,6 @@ static void user_mod_attr_wakeup(struct tevent_req *subreq) tevent_req_done(req); } -static void user_mod_attr_done(struct tevent_req *attrreq) -{ - struct tevent_req *req = tevent_req_callback_data(attrreq, - struct tevent_req); - struct user_mod_state *state = tevent_req_data(req, - struct user_mod_state); - int ret; - struct tevent_req *groupreq; - - ret = sysdb_set_user_attr_recv(attrreq); - talloc_zfree(attrreq); - if (ret != EOK) { - tevent_req_error(req, ret); - return; - } - - if (state->data->rmgroups != NULL) { - groupreq = remove_from_groups_send(state, state->ev, state->sysdb, - state->handle, state->data, state->member_dn); - if (!groupreq) { - tevent_req_error(req, ENOMEM); - return; - } - tevent_req_set_callback(groupreq, user_mod_rm_group_done, req); - return; - } - - if (state->data->addgroups != NULL) { - groupreq = add_to_groups_send(state, state->ev, state->sysdb, - state->handle, state->data, state->member_dn); - if (!groupreq) { - tevent_req_error(req, ENOMEM); - return; - } - tevent_req_set_callback(groupreq, user_mod_add_group_done, req); - return; - } - - return tevent_req_done(req); -} - static void user_mod_rm_group_done(struct tevent_req *groupreq) { struct tevent_req *req = tevent_req_callback_data(groupreq, @@ -766,7 +723,6 @@ struct group_mod_state { struct ops_ctx *data; }; -static void group_mod_attr_done(struct tevent_req *); static void group_mod_attr_wakeup(struct tevent_req *); static void group_mod_add_group_done(struct tevent_req *groupreq); static void group_mod_rm_group_done(struct tevent_req *groupreq); @@ -817,7 +773,6 @@ static void group_mod_attr_wakeup(struct tevent_req *subreq) struct group_mod_state *state = tevent_req_data(req, struct group_mod_state); struct sysdb_attrs *attrs; - struct tevent_req *attrreq; struct tevent_req *groupreq; int ret; @@ -833,16 +788,13 @@ static void group_mod_attr_wakeup(struct tevent_req *subreq) return; } - attrreq = sysdb_set_group_attr_send(state, state->ev, state->handle, - state->data->domain, state->data->name, - attrs, SYSDB_MOD_REP); - if (!attrreq) { - tevent_req_error(req, ENOMEM); + ret = sysdb_set_group_attr(state, sysdb_handle_get_ctx(state->handle), + state->data->domain, state->data->name, + attrs, SYSDB_MOD_REP); + if (ret) { + tevent_req_error(req, ret); return; } - - tevent_req_set_callback(attrreq, group_mod_attr_done, req); - return; } if (state->data->rmgroups != NULL) { @@ -871,47 +823,6 @@ static void group_mod_attr_wakeup(struct tevent_req *subreq) tevent_req_done(req); } -static void group_mod_attr_done(struct tevent_req *attrreq) -{ - struct tevent_req *req = tevent_req_callback_data(attrreq, - struct tevent_req); - struct group_mod_state *state = tevent_req_data(req, - struct group_mod_state); - int ret; - struct tevent_req *groupreq; - - ret = sysdb_set_group_attr_recv(attrreq); - talloc_zfree(attrreq); - if (ret != EOK) { - tevent_req_error(req, ret); - return; - } - - if (state->data->rmgroups != NULL) { - groupreq = remove_from_groups_send(state, state->ev, state->sysdb, - state->handle, state->data, state->member_dn); - if (!groupreq) { - tevent_req_error(req, ENOMEM); - return; - } - tevent_req_set_callback(groupreq, group_mod_rm_group_done, req); - return; - } - - if (state->data->addgroups != NULL) { - groupreq = add_to_groups_send(state, state->ev, state->sysdb, - state->handle, state->data, state->member_dn); - if (!groupreq) { - tevent_req_error(req, ENOMEM); - return; - } - tevent_req_set_callback(groupreq, group_mod_add_group_done, req); - return; - } - - return tevent_req_done(req); -} - static void group_mod_rm_group_done(struct tevent_req *groupreq) { struct tevent_req *req = tevent_req_callback_data(groupreq, |