summaryrefslogtreecommitdiff
path: root/server/infopipe
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-06-23 23:00:08 -0400
committerSimo Sorce <ssorce@redhat.com>2009-07-03 11:07:36 -0400
commit6aca93fb4d5d39a100b900a8c297d08629407960 (patch)
tree6472343594f91db611564a497b0e1c5948710a19 /server/infopipe
parentaf6b9f749f3f9ade3727bb0b43baffbdbd26cdcb (diff)
downloadsssd-6aca93fb4d5d39a100b900a8c297d08629407960.tar.gz
sssd-6aca93fb4d5d39a100b900a8c297d08629407960.tar.bz2
sssd-6aca93fb4d5d39a100b900a8c297d08629407960.zip
Rename sysdb_req to sysdb_handle.
This sysdb_req has always really been a transaction handle and not a request. This is part of a set of patches to rewrite transaction support in sysdb to a hopefully better API, that will also let use use tevent_req async style to manipulate our cache.
Diffstat (limited to 'server/infopipe')
-rw-r--r--server/infopipe/infopipe_groups.c56
-rw-r--r--server/infopipe/infopipe_users.c52
2 files changed, 54 insertions, 54 deletions
diff --git a/server/infopipe/infopipe_groups.c b/server/infopipe/infopipe_groups.c
index 34e78958..a2fe5a40 100644
--- a/server/infopipe/infopipe_groups.c
+++ b/server/infopipe/infopipe_groups.c
@@ -35,10 +35,10 @@ struct infp_creategroup_ctx {
char **groupnames;
uint32_t name_count;
uint32_t index;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
};
-static void infp_do_group_create(struct sysdb_req *req, void *pvt);
+static void infp_do_group_create(struct sysdb_handle *handle, void *pvt);
static void infp_do_group_create_callback(void *pvt, int status,
struct ldb_result *res)
{
@@ -48,7 +48,7 @@ static void infp_do_group_create_callback(void *pvt, int status,
talloc_get_type(pvt, struct infp_creategroup_ctx);
if (status != EOK) {
- sysdb_transaction_done(grcreate_req->sysdb_req, status);
+ sysdb_transaction_done(grcreate_req->handle, status);
if (status == EEXIST) {
error_msg =
@@ -72,33 +72,33 @@ static void infp_do_group_create_callback(void *pvt, int status,
/* Status is okay, add the next group */
grcreate_req->index++;
if (grcreate_req->index < grcreate_req->name_count) {
- infp_do_group_create(grcreate_req->sysdb_req, grcreate_req);
+ infp_do_group_create(grcreate_req->handle, grcreate_req);
return;
}
/* We have no more usernames to add, so commit the transaction */
- sysdb_transaction_done(grcreate_req->sysdb_req, status);
+ sysdb_transaction_done(grcreate_req->handle, status);
infp_return_success(grcreate_req->infp_req);
talloc_free(grcreate_req);
return;
}
-static void infp_do_group_create(struct sysdb_req *req, void *pvt)
+static void infp_do_group_create(struct sysdb_handle *handle, void *pvt)
{
int ret;
struct infp_creategroup_ctx *grcreate_req =
talloc_get_type(pvt, struct infp_creategroup_ctx);
- grcreate_req->sysdb_req = req;
+ grcreate_req->handle = handle;
- ret = sysdb_add_group(grcreate_req->sysdb_req,
+ ret = sysdb_add_group(grcreate_req->handle,
grcreate_req->infp_req->domain,
grcreate_req->groupnames[grcreate_req->index], 0,
infp_do_group_create_callback, grcreate_req);
if (ret != EOK) {
DEBUG(0, ("Could not invoke sysdb_add_group\n"));
- sysdb_transaction_done(grcreate_req->sysdb_req, ret);
+ sysdb_transaction_done(grcreate_req->handle, ret);
infp_return_failure(grcreate_req->infp_req, NULL);
talloc_free(grcreate_req);
return;
@@ -231,7 +231,7 @@ error:
struct infp_deletegroup_ctx {
struct infp_req_ctx *infp_req;
struct ldb_dn *gr_dn;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
};
static void infp_do_group_delete_callback(void *pvt, int status,
@@ -241,7 +241,7 @@ static void infp_do_group_delete_callback(void *pvt, int status,
talloc_get_type(pvt, struct infp_deletegroup_ctx);
/* Commit or cancel the transaction, based on the status */
- sysdb_transaction_done(grdel_req->sysdb_req, status);
+ sysdb_transaction_done(grdel_req->handle, status);
if (status != EOK) {
DEBUG(0, ("Failed to delete group from sysdb. Error code %d\n",
@@ -255,15 +255,15 @@ static void infp_do_group_delete_callback(void *pvt, int status,
talloc_free(grdel_req);
}
-static void infp_do_group_delete(struct sysdb_req *req, void *pvt)
+static void infp_do_group_delete(struct sysdb_handle *handle, void *pvt)
{
int ret;
struct infp_deletegroup_ctx *grdel_req =
talloc_get_type(pvt, struct infp_deletegroup_ctx);
- grdel_req->sysdb_req = req;
+ grdel_req->handle = handle;
- ret = sysdb_delete_entry(grdel_req->sysdb_req,
+ ret = sysdb_delete_entry(grdel_req->handle,
grdel_req->gr_dn,
infp_do_group_delete_callback,
grdel_req);
@@ -398,10 +398,10 @@ struct infp_groupmember_ctx {
uint32_t index;
uint8_t member_type;
uint8_t modify_type;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
};
-static void infp_do_member(struct sysdb_req *req, void *pvt);
+static void infp_do_member(struct sysdb_handle *handle, void *pvt);
static void infp_do_member_callback(void *pvt, int status,
struct ldb_result *res)
@@ -417,12 +417,12 @@ static void infp_do_member_callback(void *pvt, int status,
/* Check if there are more members to process */
grmod_req->index++;
if(grmod_req->index < grmod_req->member_count) {
- infp_do_member(grmod_req->sysdb_req, grmod_req);
+ infp_do_member(grmod_req->handle, grmod_req);
return;
}
/* This was the last member. Commit the transaction */
- sysdb_transaction_done(grmod_req->sysdb_req, EOK);
+ sysdb_transaction_done(grmod_req->handle, EOK);
/* Send an ack reply */
reply = dbus_message_new_method_return(grmod_req->infp_req->req_message);
@@ -435,21 +435,21 @@ static void infp_do_member_callback(void *pvt, int status,
return;
fail:
-sysdb_transaction_done(grmod_req->sysdb_req, status);
+sysdb_transaction_done(grmod_req->handle, status);
fail_msg = talloc_asprintf(grmod_req, "Could not modify group");
infp_return_failure(grmod_req->infp_req, fail_msg);
talloc_free(grmod_req);
return;
}
-static void infp_do_member(struct sysdb_req *req, void *pvt)
+static void infp_do_member(struct sysdb_handle *handle, void *pvt)
{
int ret;
struct ldb_dn *member_dn;
struct infp_groupmember_ctx *grmod_req =
talloc_get_type(pvt, struct infp_groupmember_ctx);
- grmod_req->sysdb_req = req;
+ grmod_req->handle = handle;
if (grmod_req->member_type == INFP_GR_MEM_USER) {
member_dn =
@@ -470,14 +470,14 @@ static void infp_do_member(struct sysdb_req *req, void *pvt)
else goto error;
if (grmod_req->modify_type == INFP_ACTION_TYPE_ADDMEMBER) {
- ret = sysdb_add_group_member(grmod_req->sysdb_req,
+ ret = sysdb_add_group_member(grmod_req->handle,
member_dn,
grmod_req->group_dn,
infp_do_member_callback,
grmod_req);
}
else if (grmod_req->modify_type == INFP_ACTION_TYPE_REMOVEMEMBER) {
- ret = sysdb_remove_group_member(grmod_req->sysdb_req,
+ ret = sysdb_remove_group_member(grmod_req->handle,
member_dn,
grmod_req->group_dn,
infp_do_member_callback,
@@ -657,7 +657,7 @@ struct infp_setgid_ctx {
struct infp_req_ctx *infp_req;
char *group_name;
gid_t gid;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
};
static void infp_do_gid_callback(void *ptr,
@@ -671,7 +671,7 @@ static void infp_do_gid_callback(void *ptr,
/* Commit or cancel the transaction, based on the
* return status
*/
- sysdb_transaction_done(grmod_req->sysdb_req, status);
+ sysdb_transaction_done(grmod_req->handle, status);
if(status != EOK) {
if (status == ENOENT) {
@@ -686,7 +686,7 @@ static void infp_do_gid_callback(void *ptr,
talloc_free(grmod_req);
}
-static void infp_do_gid(struct sysdb_req *req, void *pvt)
+static void infp_do_gid(struct sysdb_handle *handle, void *pvt)
{
int ret;
DBusMessage *reply;
@@ -694,9 +694,9 @@ static void infp_do_gid(struct sysdb_req *req, void *pvt)
gid_t max;
struct infp_setgid_ctx *grmod_req =
talloc_get_type(pvt, struct infp_setgid_ctx);
- grmod_req->sysdb_req = req;
+ grmod_req->handle = handle;
- ret = sysdb_set_group_gid(grmod_req->sysdb_req,
+ ret = sysdb_set_group_gid(grmod_req->handle,
grmod_req->infp_req->domain,
grmod_req->group_name,
grmod_req->gid,
diff --git a/server/infopipe/infopipe_users.c b/server/infopipe/infopipe_users.c
index 8973c18f..aac79f7f 100644
--- a/server/infopipe/infopipe_users.c
+++ b/server/infopipe/infopipe_users.c
@@ -35,7 +35,7 @@ static int username_comparator(const void *key1, const void *key2);
struct infp_getcached_ctx {
struct infp_req_ctx *infp_req;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
char **usernames;
uint64_t min_last_login;
};
@@ -195,7 +195,7 @@ error:
struct infp_createuser_ctx {
struct infp_req_ctx *infp_req;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
char *username;
char *fullname;
@@ -212,7 +212,7 @@ static void infp_do_user_create_callback(void *pvt,
struct infp_createuser_ctx *infp_createuser_req = talloc_get_type(pvt, struct infp_createuser_ctx);
/* Commit the transaction if it we got a successful response, or cancel it if we did not */
- sysdb_transaction_done(infp_createuser_req->sysdb_req, status);
+ sysdb_transaction_done(infp_createuser_req->handle, status);
/* Verify that the addition completed successfully
* If LDB returned an error, run a search to determine
@@ -246,13 +246,13 @@ static void infp_do_user_create_callback(void *pvt,
talloc_free(infp_createuser_req);
}
-static void infp_do_user_create(struct sysdb_req *req, void *pvt)
+static void infp_do_user_create(struct sysdb_handle *handle, void *pvt)
{
int ret;
struct infp_createuser_ctx *infp_createuser_req = talloc_get_type(pvt, struct infp_createuser_ctx);
- infp_createuser_req->sysdb_req = req;
+ infp_createuser_req->handle = handle;
- ret = sysdb_add_user(infp_createuser_req->sysdb_req,
+ ret = sysdb_add_user(infp_createuser_req->handle,
infp_createuser_req->infp_req->domain,
infp_createuser_req->username,
0, 0,
@@ -263,7 +263,7 @@ static void infp_do_user_create(struct sysdb_req *req, void *pvt)
infp_createuser_req);
if (ret != EOK) {
DEBUG(0, ("Could not invoke sysdb_add_user\n"));
- sysdb_transaction_done(infp_createuser_req->sysdb_req, ret);
+ sysdb_transaction_done(infp_createuser_req->handle, ret);
infp_return_failure(infp_createuser_req->infp_req, NULL);
talloc_free(infp_createuser_req);
return;
@@ -421,7 +421,7 @@ error:
struct infp_deleteuser_ctx {
struct infp_req_ctx *infp_req;
char *username;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
struct ldb_dn *user_dn;
};
@@ -432,7 +432,7 @@ static void infp_do_user_delete_callback(void *pvt, int status,
talloc_get_type(pvt, struct infp_deleteuser_ctx);
/* Commit the transaction if it we got a successful response, or cancel it if we did not */
- sysdb_transaction_done(infp_deleteuser_req->sysdb_req, status);
+ sysdb_transaction_done(infp_deleteuser_req->handle, status);
if (status != EOK) {
DEBUG(0, ("Failed to delete user from sysdb. Error code %d\n", status));
@@ -445,12 +445,12 @@ static void infp_do_user_delete_callback(void *pvt, int status,
talloc_free(infp_deleteuser_req);
}
-static void infp_do_user_delete(struct sysdb_req *req, void *pvt)
+static void infp_do_user_delete(struct sysdb_handle *req, void *pvt)
{
int ret;
struct infp_deleteuser_ctx *infp_deleteuser_req = talloc_get_type(pvt, struct infp_deleteuser_ctx);
- infp_deleteuser_req->sysdb_req = req;
+ infp_deleteuser_req->handle = handle;
infp_deleteuser_req->user_dn = sysdb_user_dn(infp_deleteuser_req->infp_req->infp->sysdb,
infp_deleteuser_req,
@@ -463,7 +463,7 @@ static void infp_do_user_delete(struct sysdb_req *req, void *pvt)
return;
}
- ret = sysdb_delete_entry(infp_deleteuser_req->sysdb_req,
+ ret = sysdb_delete_entry(infp_deleteuser_req->handle,
infp_deleteuser_req->user_dn,
infp_do_user_delete_callback,
infp_deleteuser_req);
@@ -1298,7 +1298,7 @@ struct infp_setattr_ctx {
const char **usernames;
int username_count;
uint32_t index;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
/* Array of sysdb_attrs objects
* The number of elements in this array
@@ -1306,7 +1306,7 @@ struct infp_setattr_ctx {
*/
struct sysdb_attrs **changes;
};
-static void infp_do_user_set_attr(struct sysdb_req *req, void *pvt);
+static void infp_do_user_set_attr(struct sysdb_handle *req, void *pvt);
static void infp_do_user_set_attr_callback(void *ptr, int ldb_status, struct ldb_result *res)
{
struct infp_setattr_ctx *infp_setattr_req;
@@ -1317,7 +1317,7 @@ static void infp_do_user_set_attr_callback(void *ptr, int ldb_status, struct ldb
if (ldb_status != LDB_SUCCESS) {
DEBUG(0, ("Failed to store user attributes to the sysdb\n"));
/* Cancel the transaction */
- sysdb_transaction_done(infp_setattr_req->sysdb_req, sysdb_error_to_errno(ldb_status));
+ sysdb_transaction_done(infp_setattr_req->handle, sysdb_error_to_errno(ldb_status));
infp_return_failure(infp_setattr_req->infp_req, NULL);
talloc_free(infp_setattr_req);
return;
@@ -1326,12 +1326,12 @@ static void infp_do_user_set_attr_callback(void *ptr, int ldb_status, struct ldb
/* Process any remaining users */
infp_setattr_req->index++;
if(infp_setattr_req->index < infp_setattr_req->username_count) {
- infp_do_user_set_attr(infp_setattr_req->sysdb_req, infp_setattr_req);
+ infp_do_user_set_attr(infp_setattr_req->handle, infp_setattr_req);
return;
}
/* This was the last user. Commit the transaction */
- sysdb_transaction_done(infp_setattr_req->sysdb_req, EOK);
+ sysdb_transaction_done(infp_setattr_req->handle, EOK);
/* Send reply ack */
infp_return_success(infp_setattr_req->infp_req);
@@ -1339,16 +1339,16 @@ static void infp_do_user_set_attr_callback(void *ptr, int ldb_status, struct ldb
talloc_free(infp_setattr_req);
}
-static void infp_do_user_set_attr(struct sysdb_req *req, void *pvt)
+static void infp_do_user_set_attr(struct sysdb_handle *handle, void *pvt)
{
int ret;
struct infp_setattr_ctx *infp_setattr_req;
infp_setattr_req = talloc_get_type(pvt, struct infp_setattr_ctx);
- infp_setattr_req->sysdb_req = req;
+ infp_setattr_req->handle = handle;
DEBUG(9, ("Setting attributes for user [%s]\n", infp_setattr_req->usernames[infp_setattr_req->index]));
- ret = sysdb_set_user_attr(infp_setattr_req->sysdb_req,
+ ret = sysdb_set_user_attr(infp_setattr_req->handle,
infp_setattr_req->infp_req->domain,
infp_setattr_req->usernames[infp_setattr_req->index],
infp_setattr_req->changes[infp_setattr_req->index],
@@ -1677,7 +1677,7 @@ error:
struct infp_setuid_ctx {
struct infp_req_ctx *infp_req;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
struct sysdb_attrs *uid_attr;
char *username;
};
@@ -1687,7 +1687,7 @@ static void infp_do_user_set_uid_callback(void *ptr, int ldb_status, struct ldb_
struct infp_setuid_ctx *infp_setuid_req = talloc_get_type(ptr, struct infp_setuid_ctx);
/* Commit or cancel the transaction, based on the ldb_status */
- sysdb_transaction_done(infp_setuid_req->sysdb_req, sysdb_error_to_errno(ldb_status));
+ sysdb_transaction_done(infp_setuid_req->handle, sysdb_error_to_errno(ldb_status));
/* Check the LDB result */
if (ldb_status != LDB_SUCCESS) {
@@ -1703,23 +1703,23 @@ static void infp_do_user_set_uid_callback(void *ptr, int ldb_status, struct ldb_
talloc_free(infp_setuid_req);
}
-static void infp_do_user_set_uid(struct sysdb_req *req, void *pvt)
+static void infp_do_user_set_uid(struct sysdb_handle *handle, void *pvt)
{
int ret;
struct infp_setuid_ctx *infp_setuid_req;
infp_setuid_req = talloc_get_type(pvt, struct infp_setuid_ctx);
- infp_setuid_req->sysdb_req = req;
+ infp_setuid_req->handle = handle;
DEBUG(9, ("Setting UID for user [%s]\n", infp_setuid_req->username));
- ret = sysdb_set_user_attr(infp_setuid_req->sysdb_req,
+ ret = sysdb_set_user_attr(infp_setuid_req->handle,
infp_setuid_req->infp_req->domain,
infp_setuid_req->username,
infp_setuid_req->uid_attr,
infp_do_user_set_uid_callback, infp_setuid_req);
if (ret != EOK) {
DEBUG(0, ("Could not invoke sysdb_set_user_attr"));
- sysdb_transaction_done(infp_setuid_req->sysdb_req, ret);
+ sysdb_transaction_done(infp_setuid_req->handle, ret);
infp_return_failure(infp_setuid_req->infp_req, NULL);
talloc_free(infp_setuid_req);
return;