summaryrefslogtreecommitdiff
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
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.
-rw-r--r--server/db/sysdb.h42
-rw-r--r--server/db/sysdb_ops.c176
-rw-r--r--server/db/sysdb_private.h6
-rw-r--r--server/db/sysdb_req.c172
-rw-r--r--server/db/sysdb_search.c20
-rw-r--r--server/infopipe/infopipe_groups.c56
-rw-r--r--server/infopipe/infopipe_users.c52
-rw-r--r--server/providers/ldap/ldap_auth.c10
-rw-r--r--server/providers/proxy.c90
-rw-r--r--server/responder/pam/pam_LOCAL_domain.c12
-rw-r--r--server/responder/pam/pamsrv_cache.c6
-rw-r--r--server/tests/sysdb-tests.c102
-rw-r--r--server/tools/sss_groupadd.c12
-rw-r--r--server/tools/sss_groupdel.c12
-rw-r--r--server/tools/sss_groupmod.c16
-rw-r--r--server/tools/sss_useradd.c14
-rw-r--r--server/tools/sss_userdel.c12
-rw-r--r--server/tools/sss_usermod.c16
18 files changed, 410 insertions, 416 deletions
diff --git a/server/db/sysdb.h b/server/db/sysdb.h
index 5a5badb3..6da83318 100644
--- a/server/db/sysdb.h
+++ b/server/db/sysdb.h
@@ -127,7 +127,7 @@
struct confdb_ctx;
struct sysdb_ctx;
-struct sysdb_req;
+struct sysdb_handle;
struct sysdb_attrs {
int num;
@@ -148,11 +148,11 @@ int sysdb_error_to_errno(int ldberr);
/* callbacks */
typedef void (*sysdb_callback_t)(void *, int, struct ldb_result *);
-typedef void (*sysdb_req_fn_t)(struct sysdb_req *, void *pvt);
+typedef void (*sysdb_fn_t)(struct sysdb_handle *, void *pvt);
/* service functions */
struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *ctx);
-struct sysdb_ctx *sysdb_req_get_ctx(struct sysdb_req *req);
+struct sysdb_ctx *sysdb_handle_get_ctx(struct sysdb_handle *req);
/* function to start and finish a transaction
* After sysdb_transaction() is successfully called,
@@ -165,16 +165,16 @@ struct sysdb_ctx *sysdb_req_get_ctx(struct sysdb_req *req);
*/
int sysdb_transaction(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *ctx,
- sysdb_req_fn_t fn, void *pvt);
-void sysdb_transaction_done(struct sysdb_req *req, int error);
+ sysdb_fn_t fn, void *pvt);
+void sysdb_transaction_done(struct sysdb_handle *req, int error);
/* An operation blocks the transaction queue as well, but does not
* start a transaction, normally useful only for search type calls.
* Cannot be called within a transaction */
int sysdb_operation(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *ctx,
- sysdb_req_fn_t fn, void *pvt);
-void sysdb_operation_done(struct sysdb_req *req);
+ sysdb_fn_t fn, void *pvt);
+void sysdb_operation_done(struct sysdb_handle *req);
struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *ctx, void *memctx,
const char *domain, const char *name);
@@ -244,81 +244,81 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx,
/* functions that modify the databse
* they have to be called within a transaction
* See sysdb_transaction() */
-int sysdb_add_group_member(struct sysdb_req *sysreq,
+int sysdb_add_group_member(struct sysdb_handle *handle,
struct ldb_dn *member_dn,
struct ldb_dn *group_dn,
sysdb_callback_t fn, void *pvt);
-int sysdb_remove_group_member(struct sysdb_req *sysreq,
+int sysdb_remove_group_member(struct sysdb_handle *handle,
struct ldb_dn *member_dn,
struct ldb_dn *group_dn,
sysdb_callback_t fn, void *pvt);
-int sysdb_delete_entry(struct sysdb_req *sysreq,
+int sysdb_delete_entry(struct sysdb_handle *handle,
struct ldb_dn *dn,
sysdb_callback_t fn, void *pvt);
-int sysdb_delete_user_by_uid(struct sysdb_req *sysreq,
+int sysdb_delete_user_by_uid(struct sysdb_handle *handle,
struct sss_domain_info *domain,
uid_t uid,
sysdb_callback_t fn, void *pvt);
-int sysdb_delete_group_by_gid(struct sysdb_req *sysreq,
+int sysdb_delete_group_by_gid(struct sysdb_handle *handle,
struct sss_domain_info *domain,
gid_t gid,
sysdb_callback_t fn, void *pvt);
-int sysdb_set_user_attr(struct sysdb_req *sysreq,
+int sysdb_set_user_attr(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attributes,
sysdb_callback_t fn, void *ptr);
-int sysdb_add_user(struct sysdb_req *sysreq,
+int sysdb_add_user(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name,
uid_t uid, gid_t gid, const char *fullname,
const char *homedir, const char *shell,
sysdb_callback_t fn, void *pvt);
-int sysdb_add_group(struct sysdb_req *sysreq,
+int sysdb_add_group(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name, gid_t gid,
sysdb_callback_t fn, void *pvt);
-int sysdb_set_group_gid(struct sysdb_req *sysreq,
+int sysdb_set_group_gid(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name, gid_t gid,
sysdb_callback_t fn, void *pvt);
/* legacy functions for proxy providers */
-int sysdb_legacy_store_user(struct sysdb_req *sysreq,
+int sysdb_legacy_store_user(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,
sysdb_callback_t fn, void *pvt);
-int sysdb_legacy_store_group(struct sysdb_req *sysreq,
+int sysdb_legacy_store_group(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name, gid_t gid,
const char **members,
sysdb_callback_t fn, void *pvt);
-int sysdb_legacy_add_group_member(struct sysdb_req *sysreq,
+int sysdb_legacy_add_group_member(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *group,
const char *member,
sysdb_callback_t fn, void *pvt);
-int sysdb_legacy_remove_group_member(struct sysdb_req *sysreq,
+int sysdb_legacy_remove_group_member(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *group,
const char *member,
sysdb_callback_t fn, void *pvt);
-int sysdb_set_cached_password(struct sysdb_req *sysreq,
+int sysdb_set_cached_password(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *user,
const char *password,
diff --git a/server/db/sysdb_ops.c b/server/db/sysdb_ops.c
index d8fe83c4..9b3f2828 100644
--- a/server/db/sysdb_ops.c
+++ b/server/db/sysdb_ops.c
@@ -114,7 +114,7 @@ static int sysdb_op_callback(struct ldb_request *req, struct ldb_reply *rep)
return sysdb_ret_done(cbctx);
}
-int sysdb_add_group_member(struct sysdb_req *sysreq,
+int sysdb_add_group_member(struct sysdb_handle *handle,
struct ldb_dn *member_dn,
struct ldb_dn *group_dn,
sysdb_callback_t fn, void *pvt)
@@ -126,14 +126,14 @@ int sysdb_add_group_member(struct sysdb_req *sysreq,
const char *dn;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- cbctx = talloc_zero(sysreq, struct sysdb_cb_ctx);
+ cbctx = talloc_zero(handle, struct sysdb_cb_ctx);
if (!cbctx) return ENOMEM;
cbctx->fn = fn;
@@ -168,7 +168,7 @@ int sysdb_add_group_member(struct sysdb_req *sysreq,
return EOK;
}
-int sysdb_remove_group_member(struct sysdb_req *sysreq,
+int sysdb_remove_group_member(struct sysdb_handle *handle,
struct ldb_dn *member_dn,
struct ldb_dn *group_dn,
sysdb_callback_t fn, void *pvt)
@@ -180,14 +180,14 @@ int sysdb_remove_group_member(struct sysdb_req *sysreq,
const char *dn;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- cbctx = talloc_zero(sysreq, struct sysdb_cb_ctx);
+ cbctx = talloc_zero(handle, struct sysdb_cb_ctx);
if (!cbctx) return ENOMEM;
cbctx->fn = fn;
@@ -222,7 +222,7 @@ int sysdb_remove_group_member(struct sysdb_req *sysreq,
return EOK;
}
-int sysdb_delete_entry(struct sysdb_req *sysreq,
+int sysdb_delete_entry(struct sysdb_handle *handle,
struct ldb_dn *dn,
sysdb_callback_t fn, void *pvt)
{
@@ -231,14 +231,14 @@ int sysdb_delete_entry(struct sysdb_req *sysreq,
struct ldb_request *req;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- cbctx = talloc_zero(sysreq, struct sysdb_cb_ctx);
+ cbctx = talloc_zero(handle, struct sysdb_cb_ctx);
if (!cbctx) return ENOMEM;
cbctx->fn = fn;
@@ -261,7 +261,7 @@ int sysdb_delete_entry(struct sysdb_req *sysreq,
}
struct delete_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sysdb_cb_ctx *cbctx;
struct ldb_result *res;
@@ -278,7 +278,7 @@ static int delete_callback(struct ldb_request *req, struct ldb_reply *rep)
int ret, err;
del_ctx = talloc_get_type(req->context, struct delete_ctx);
- ctx = sysdb_req_get_ctx(del_ctx->sysreq);
+ ctx = sysdb_handle_get_ctx(del_ctx->handle);
cbctx = del_ctx->cbctx;
res = del_ctx->res;
@@ -342,7 +342,7 @@ static int delete_callback(struct ldb_request *req, struct ldb_reply *rep)
return LDB_SUCCESS;
}
-int sysdb_delete_user_by_uid(struct sysdb_req *sysreq,
+int sysdb_delete_user_by_uid(struct sysdb_handle *handle,
struct sss_domain_info *domain,
uid_t uid,
sysdb_callback_t fn, void *pvt)
@@ -355,20 +355,20 @@ int sysdb_delete_user_by_uid(struct sysdb_req *sysreq,
char *filter;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- del_ctx = talloc_zero(sysreq, struct delete_ctx);
+ del_ctx = talloc_zero(handle, struct delete_ctx);
if (!del_ctx) return ENOMEM;
del_ctx->cbctx = talloc_zero(del_ctx, struct sysdb_cb_ctx);
if (!del_ctx->cbctx) return ENOMEM;
- del_ctx->sysreq = sysreq;
+ del_ctx->handle = handle;
del_ctx->cbctx->fn = fn;
del_ctx->cbctx->pvt = pvt;
del_ctx->cbctx->ignore_not_found = true;
@@ -399,7 +399,7 @@ int sysdb_delete_user_by_uid(struct sysdb_req *sysreq,
return EOK;
}
-int sysdb_delete_group_by_gid(struct sysdb_req *sysreq,
+int sysdb_delete_group_by_gid(struct sysdb_handle *handle,
struct sss_domain_info *domain,
gid_t gid,
sysdb_callback_t fn, void *pvt)
@@ -412,20 +412,20 @@ int sysdb_delete_group_by_gid(struct sysdb_req *sysreq,
char *filter;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- del_ctx = talloc_zero(sysreq, struct delete_ctx);
+ del_ctx = talloc_zero(handle, struct delete_ctx);
if (!del_ctx) return ENOMEM;
del_ctx->cbctx = talloc_zero(del_ctx, struct sysdb_cb_ctx);
if (!del_ctx->cbctx) return ENOMEM;
- del_ctx->sysreq = sysreq;
+ del_ctx->handle = handle;
del_ctx->cbctx->fn = fn;
del_ctx->cbctx->pvt = pvt;
del_ctx->cbctx->ignore_not_found = true;
@@ -456,7 +456,7 @@ int sysdb_delete_group_by_gid(struct sysdb_req *sysreq,
return EOK;
}
-int sysdb_set_user_attr(struct sysdb_req *sysreq,
+int sysdb_set_user_attr(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
@@ -468,16 +468,16 @@ int sysdb_set_user_attr(struct sysdb_req *sysreq,
struct ldb_request *req;
int i, ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
if (attrs->num == 0) return EINVAL;
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- cbctx = talloc_zero(sysreq, struct sysdb_cb_ctx);
+ cbctx = talloc_zero(handle, struct sysdb_cb_ctx);
if (!cbctx) return ENOMEM;
cbctx->fn = fn;
@@ -516,7 +516,7 @@ struct next_id {
};
struct next_id_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sss_domain_info *domain;
struct sysdb_cb_ctx *cbctx;
@@ -531,7 +531,7 @@ struct next_id_ctx {
static int nextid_callback(struct ldb_request *req, struct ldb_reply *rep);
-static int sysdb_get_next_available_id(struct sysdb_req *sysreq,
+static int sysdb_get_next_available_id(struct sysdb_handle *handle,
struct sss_domain_info *domain,
struct next_id *result,
sysdb_callback_t fn, void *pvt)
@@ -542,21 +542,21 @@ static int sysdb_get_next_available_id(struct sysdb_req *sysreq,
struct ldb_request *req;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- idctx = talloc_zero(sysreq, struct next_id_ctx);
+ idctx = talloc_zero(handle, struct next_id_ctx);
if (!idctx) return ENOMEM;
- idctx->sysreq = sysreq;
+ idctx->handle = handle;
idctx->domain = domain;
idctx->result = result;
- idctx->cbctx = talloc_zero(sysreq, struct sysdb_cb_ctx);
+ idctx->cbctx = talloc_zero(handle, struct sysdb_cb_ctx);
if (!idctx->cbctx) return ENOMEM;
idctx->cbctx->fn = fn;
@@ -597,7 +597,7 @@ static int nextid_callback(struct ldb_request *req, struct ldb_reply *rep)
int ret, err;
idctx = talloc_get_type(req->context, struct next_id_ctx);
- ctx = sysdb_req_get_ctx(idctx->sysreq);
+ ctx = sysdb_handle_get_ctx(idctx->handle);
cbctx = idctx->cbctx;
res = idctx->res;
@@ -748,7 +748,7 @@ static int nextid_callback(struct ldb_request *req, struct ldb_reply *rep)
static int check_name_callback(struct ldb_request *req, struct ldb_reply *rep);
-int sysdb_check_name_unique(struct sysdb_req *sysreq,
+int sysdb_check_name_unique(struct sysdb_handle *handle,
struct sss_domain_info *domain,
TALLOC_CTX *mem_ctx, const char *name,
sysdb_callback_t fn, void *pvt)
@@ -761,12 +761,12 @@ int sysdb_check_name_unique(struct sysdb_req *sysreq,
char *filter;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
cbctx = talloc_zero(mem_ctx, struct sysdb_cb_ctx);
if (!cbctx) return ENOMEM;
@@ -831,7 +831,7 @@ static int check_name_callback(struct ldb_request *req, struct ldb_reply *rep)
struct user_add_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sysdb_cb_ctx *cbctx;
struct sss_domain_info *domain;
@@ -850,7 +850,7 @@ static int user_add_id(struct user_add_ctx *user_ctx);
static void user_add_id_callback(void *pvt, int error, struct ldb_result *res);
static int user_add_call(struct user_add_ctx *user_ctx);
-int sysdb_add_user(struct sysdb_req *sysreq,
+int sysdb_add_user(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name,
uid_t uid, gid_t gid, const char *fullname,
@@ -859,7 +859,7 @@ int sysdb_add_user(struct sysdb_req *sysreq,
{
struct user_add_ctx *user_ctx;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
@@ -879,13 +879,13 @@ int sysdb_add_user(struct sysdb_req *sysreq,
}
- user_ctx = talloc(sysreq, struct user_add_ctx);
+ user_ctx = talloc(handle, struct user_add_ctx);
if (!user_ctx) return ENOMEM;
user_ctx->cbctx = talloc_zero(user_ctx, struct sysdb_cb_ctx);
if (!user_ctx->cbctx) return ENOMEM;
- user_ctx->sysreq = sysreq;
+ user_ctx->handle = handle;
user_ctx->domain = domain;
user_ctx->cbctx->fn = fn;
user_ctx->cbctx->pvt = pvt;
@@ -900,7 +900,7 @@ int sysdb_add_user(struct sysdb_req *sysreq,
/* if the domain is mpg we need to check we do not have there are no
* name conflicts */
- return sysdb_check_name_unique(sysreq, domain, user_ctx, name,
+ return sysdb_check_name_unique(handle, domain, user_ctx, name,
user_check_callback, user_ctx);
}
@@ -934,7 +934,7 @@ static int user_add_id(struct user_add_ctx *user_ctx)
if (user_ctx->uid == 0 || user_ctx->gid == 0) {
/* Must generate uid/gid pair */
- return sysdb_get_next_available_id(user_ctx->sysreq,
+ return sysdb_get_next_available_id(user_ctx->handle,
user_ctx->domain,
&(user_ctx->id),
user_add_id_callback, user_ctx);
@@ -977,7 +977,7 @@ static int user_add_call(struct user_add_ctx *user_ctx)
int flags = LDB_FLAG_MOD_ADD;
int ret;
- ctx = sysdb_req_get_ctx(user_ctx->sysreq);
+ ctx = sysdb_handle_get_ctx(user_ctx->handle);
msg = ldb_msg_new(user_ctx);
if (!msg) return ENOMEM;
@@ -1047,7 +1047,7 @@ static int user_add_call(struct user_add_ctx *user_ctx)
}
struct group_add_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sysdb_cb_ctx *cbctx;
struct sss_domain_info *domain;
@@ -1062,14 +1062,14 @@ static int group_add_id(struct group_add_ctx *group_ctx);
static void group_add_id_callback(void *pvt, int error, struct ldb_result *res);
static int group_add_call(struct group_add_ctx *group_ctx);
-int sysdb_add_group(struct sysdb_req *sysreq,
+int sysdb_add_group(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name, gid_t gid,
sysdb_callback_t fn, void *pvt)
{
struct group_add_ctx *group_ctx;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
@@ -1081,13 +1081,13 @@ int sysdb_add_group(struct sysdb_req *sysreq,
return EINVAL;
}
- group_ctx = talloc(sysreq, struct group_add_ctx);
+ group_ctx = talloc(handle, struct group_add_ctx);
if (!group_ctx) return ENOMEM;
group_ctx->cbctx = talloc_zero(group_ctx, struct sysdb_cb_ctx);
if (!group_ctx->cbctx) return ENOMEM;
- group_ctx->sysreq = sysreq;
+ group_ctx->handle = handle;
group_ctx->domain = domain;
group_ctx->cbctx->fn = fn;
group_ctx->cbctx->pvt = pvt;
@@ -1098,7 +1098,7 @@ int sysdb_add_group(struct sysdb_req *sysreq,
/* if the domain is mpg we need to check we do not have there are no
* name conflicts */
- return sysdb_check_name_unique(sysreq, domain, group_ctx, name,
+ return sysdb_check_name_unique(handle, domain, group_ctx, name,
group_check_callback, group_ctx);
}
@@ -1126,7 +1126,7 @@ static int group_add_id(struct group_add_ctx *group_ctx)
{
if (group_ctx->gid == 0) {
/* Must generate uid/gid pair */
- return sysdb_get_next_available_id(group_ctx->sysreq,
+ return sysdb_get_next_available_id(group_ctx->handle,
group_ctx->domain,
&(group_ctx->id),
group_add_id_callback, group_ctx);
@@ -1163,7 +1163,7 @@ static int group_add_call(struct group_add_ctx *group_ctx)
int flags = LDB_FLAG_MOD_ADD;
int ret;
- ctx = sysdb_req_get_ctx(group_ctx->sysreq);
+ ctx = sysdb_handle_get_ctx(group_ctx->handle);
msg = ldb_msg_new(group_ctx);
if (!msg) return ENOMEM;
@@ -1209,7 +1209,7 @@ static int group_add_call(struct group_add_ctx *group_ctx)
* will perform is whether the requested GID is in the range
* of IDs allocated for the domain.
*/
-int sysdb_set_group_gid(struct sysdb_req *sysreq,
+int sysdb_set_group_gid(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name, gid_t gid,
sysdb_callback_t fn, void *pvt)
@@ -1221,7 +1221,7 @@ int sysdb_set_group_gid(struct sysdb_req *sysreq,
int flags = LDB_FLAG_MOD_REPLACE;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
@@ -1233,20 +1233,20 @@ int sysdb_set_group_gid(struct sysdb_req *sysreq,
return EDOM;
}
- group_ctx = talloc(sysreq, struct group_add_ctx);
+ group_ctx = talloc(handle, struct group_add_ctx);
if (!group_ctx) return ENOMEM;
group_ctx->cbctx = talloc_zero(group_ctx, struct sysdb_cb_ctx);
if (!group_ctx->cbctx) return ENOMEM;
- group_ctx->sysreq = sysreq;
+ group_ctx->handle = handle;
group_ctx->domain = domain;
group_ctx->cbctx->fn = fn;
group_ctx->cbctx->pvt = pvt;
group_ctx->name = name;
group_ctx->gid = gid;
- sysdb = sysdb_req_get_ctx(group_ctx->sysreq);
+ sysdb = sysdb_handle_get_ctx(group_ctx->handle);
msg = ldb_msg_new(group_ctx);
if (!msg) return ENOMEM;
@@ -1278,7 +1278,7 @@ int sysdb_set_group_gid(struct sysdb_req *sysreq,
* be nested and can't reference foreign sources */
struct legacy_user_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sysdb_cb_ctx *cbctx;
struct sss_domain_info *domain;
@@ -1298,7 +1298,7 @@ struct legacy_user_ctx {
static int legacy_user_callback(struct ldb_request *req,
struct ldb_reply *rep);
-int sysdb_legacy_store_user(struct sysdb_req *sysreq,
+int sysdb_legacy_store_user(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name, const char *pwd,
uid_t uid, gid_t gid, const char *gecos,
@@ -1311,14 +1311,14 @@ int sysdb_legacy_store_user(struct sysdb_req *sysreq,
struct ldb_request *req;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- user_ctx = talloc(sysreq, struct legacy_user_ctx);
+ user_ctx = talloc(handle, struct legacy_user_ctx);
if (!user_ctx) return ENOMEM;
user_ctx->cbctx = talloc_zero(user_ctx, struct sysdb_cb_ctx);
@@ -1327,7 +1327,7 @@ int sysdb_legacy_store_user(struct sysdb_req *sysreq,
user_ctx->dn = sysdb_user_dn(ctx, user_ctx, domain->name, name);
if (!user_ctx->dn) return ENOMEM;
- user_ctx->sysreq = sysreq;
+ user_ctx->handle = handle;
user_ctx->cbctx->fn = fn;
user_ctx->cbctx->pvt = pvt;
user_ctx->domain = domain;
@@ -1371,7 +1371,7 @@ static int legacy_user_callback(struct ldb_request *req,
int ret, err;
user_ctx = talloc_get_type(req->context, struct legacy_user_ctx);
- ctx = sysdb_req_get_ctx(user_ctx->sysreq);
+ ctx = sysdb_handle_get_ctx(user_ctx->handle);
cbctx = user_ctx->cbctx;
res = user_ctx->res;
@@ -1535,7 +1535,7 @@ static int legacy_user_callback(struct ldb_request *req,
/* this function does not check that all user members are actually present */
struct legacy_group_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sysdb_cb_ctx *cbctx;
struct sss_domain_info *domain;
@@ -1551,7 +1551,7 @@ struct legacy_group_ctx {
static int legacy_group_callback(struct ldb_request *req,
struct ldb_reply *rep);
-int sysdb_legacy_store_group(struct sysdb_req *sysreq,
+int sysdb_legacy_store_group(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *name, gid_t gid,
const char **members,
@@ -1563,14 +1563,14 @@ int sysdb_legacy_store_group(struct sysdb_req *sysreq,
struct ldb_request *req;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- group_ctx = talloc(sysreq, struct legacy_group_ctx);
+ group_ctx = talloc(handle, struct legacy_group_ctx);
if (!group_ctx) return ENOMEM;
group_ctx->cbctx = talloc_zero(group_ctx, struct sysdb_cb_ctx);
@@ -1579,7 +1579,7 @@ int sysdb_legacy_store_group(struct sysdb_req *sysreq,
group_ctx->dn = sysdb_group_dn(ctx, group_ctx, domain->name, name);
if (!group_ctx->dn) return ENOMEM;
- group_ctx->sysreq = sysreq;
+ group_ctx->handle = handle;
group_ctx->cbctx->fn = fn;
group_ctx->cbctx->pvt = pvt;
group_ctx->domain = domain;
@@ -1619,7 +1619,7 @@ static int legacy_group_callback(struct ldb_request *req,
int i, ret, err;
group_ctx = talloc_get_type(req->context, struct legacy_group_ctx);
- ctx = sysdb_req_get_ctx(group_ctx->sysreq);
+ ctx = sysdb_handle_get_ctx(group_ctx->handle);
cbctx = group_ctx->cbctx;
res = group_ctx->res;
@@ -1741,7 +1741,7 @@ static int legacy_group_callback(struct ldb_request *req,
return LDB_SUCCESS;
}
-int sysdb_legacy_add_group_member(struct sysdb_req *sysreq,
+int sysdb_legacy_add_group_member(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *group,
const char *member,
@@ -1753,14 +1753,14 @@ int sysdb_legacy_add_group_member(struct sysdb_req *sysreq,
struct ldb_message *msg;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- cbctx = talloc_zero(sysreq, struct sysdb_cb_ctx);
+ cbctx = talloc_zero(handle, struct sysdb_cb_ctx);
if (!cbctx) return ENOMEM;
cbctx->fn = fn;
@@ -1790,7 +1790,7 @@ int sysdb_legacy_add_group_member(struct sysdb_req *sysreq,
return EOK;
}
-int sysdb_legacy_remove_group_member(struct sysdb_req *sysreq,
+int sysdb_legacy_remove_group_member(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *group,
const char *member,
@@ -1802,14 +1802,14 @@ int sysdb_legacy_remove_group_member(struct sysdb_req *sysreq,
struct ldb_message *msg;
int ret;
- if (!sysdb_req_check_running(sysreq)) {
+ if (!sysdb_handle_check_running(handle)) {
DEBUG(2, ("Invalid request! Not running at this time.\n"));
return EINVAL;
}
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
- cbctx = talloc_zero(sysreq, struct sysdb_cb_ctx);
+ cbctx = talloc_zero(handle, struct sysdb_cb_ctx);
if (!cbctx) return ENOMEM;
cbctx->fn = fn;
@@ -1839,7 +1839,7 @@ int sysdb_legacy_remove_group_member(struct sysdb_req *sysreq,
return EOK;
}
-int sysdb_set_cached_password(struct sysdb_req *sysreq,
+int sysdb_set_cached_password(struct sysdb_handle *handle,
struct sss_domain_info *domain,
const char *user,
const char *password,
@@ -1851,22 +1851,22 @@ int sysdb_set_cached_password(struct sysdb_req *sysreq,
char *salt;
int ret;
- ctx = sysdb_req_get_ctx(sysreq);
+ ctx = sysdb_handle_get_ctx(handle);
if (!ctx) return EFAULT;
- ret = s3crypt_gen_salt(sysreq, &salt);
+ ret = s3crypt_gen_salt(handle, &salt);
if (ret) {
DEBUG(4, ("Failed to generate random salt.\n"));
return ret;
}
- ret = s3crypt_sha512(sysreq, password, salt, &hash);
+ ret = s3crypt_sha512(handle, password, salt, &hash);
if (ret) {
DEBUG(4, ("Failed to create password hash.\n"));
return ret;
}
- attrs = sysdb_new_attrs(sysreq);
+ attrs = sysdb_new_attrs(handle);
if (!attrs) {
return ENOMEM;
}
@@ -1879,7 +1879,7 @@ int sysdb_set_cached_password(struct sysdb_req *sysreq,
(long)time(NULL));
if (ret) return ret;
- ret = sysdb_set_user_attr(sysreq, domain, user, attrs, fn, pvt);
+ ret = sysdb_set_user_attr(handle, domain, user, attrs, fn, pvt);
if (ret) return ret;
return EOK;
diff --git a/server/db/sysdb_private.h b/server/db/sysdb_private.h
index a4e83e0a..8c10d951 100644
--- a/server/db/sysdb_private.h
+++ b/server/db/sysdb_private.h
@@ -68,15 +68,15 @@
#include "db/sysdb.h"
-struct sysdb_req;
+struct sysdb_handle;
struct sysdb_ctx {
struct tevent_context *ev;
struct ldb_context *ldb;
char *ldb_file;
- struct sysdb_req *queue;
+ struct sysdb_handle *queue;
};
-bool sysdb_req_check_running(struct sysdb_req *req);
+bool sysdb_handle_check_running(struct sysdb_handle *handle);
#endif /* __INT_SYS_DB_H__ */
diff --git a/server/db/sysdb_req.c b/server/db/sysdb_req.c
index 15d8aa85..a768fefb 100644
--- a/server/db/sysdb_req.c
+++ b/server/db/sysdb_req.c
@@ -25,38 +25,38 @@
#include "db/sysdb_private.h"
#include "ldb.h"
-struct sysdb_req {
- struct sysdb_req *next, *prev;
+struct sysdb_handle {
+ struct sysdb_handle *next, *prev;
struct sysdb_ctx *ctx;
- sysdb_req_fn_t fn;
+ sysdb_fn_t fn;
void *pvt;
int status;
bool transaction_active;
};
-bool sysdb_req_check_running(struct sysdb_req *req)
+bool sysdb_handle_check_running(struct sysdb_handle *handle)
{
- if (req->ctx->queue == req) return true;
+ if (handle->ctx->queue == handle) return true;
return false;
}
-struct sysdb_ctx *sysdb_req_get_ctx(struct sysdb_req *req)
+struct sysdb_ctx *sysdb_handle_get_ctx(struct sysdb_handle *handle)
{
- return req->ctx;
+ return handle->ctx;
}
-static void sysdb_req_run(struct tevent_context *ev,
+static void sysdb_queue_run(struct tevent_context *ev,
struct tevent_timer *te,
struct timeval tv, void *ptr)
{
- struct sysdb_req *req = talloc_get_type(ptr, struct sysdb_req);
+ struct sysdb_handle *handle = talloc_get_type(ptr, struct sysdb_handle);
- if (req != req->ctx->queue) abort();
+ if (handle != handle->ctx->queue) abort();
- req->fn(req, req->pvt);
+ handle->fn(handle, handle->pvt);
}
-static int sysdb_req_schedule(struct sysdb_req *req)
+static int sysdb_queue_schedule(struct sysdb_handle *handle)
{
struct tevent_timer *te = NULL;
struct timeval tv;
@@ -65,7 +65,7 @@ static int sysdb_req_schedule(struct sysdb_req *req)
tv.tv_sec = 0;
tv.tv_usec = 0;
- te = tevent_add_timer(req->ctx->ev, req, tv, sysdb_req_run, req);
+ te = tevent_add_timer(handle->ctx->ev, handle, tv, sysdb_queue_run, handle);
if (te == NULL) {
return EIO;
}
@@ -73,180 +73,180 @@ static int sysdb_req_schedule(struct sysdb_req *req)
return EOK;
}
-static int sysdb_req_enqueue(struct sysdb_req *req)
+static int sysdb_enqueue(struct sysdb_handle *handle)
{
int ret = EOK;
- DLIST_ADD_END(req->ctx->queue, req, struct sysdb_req *);
+ DLIST_ADD_END(handle->ctx->queue, handle, struct sysdb_handle *);
- if (req->ctx->queue == req) {
- ret = sysdb_req_schedule(req);
+ if (handle->ctx->queue == handle) {
+ ret = sysdb_queue_schedule(handle);
}
return ret;
}
-static void sysdb_transaction_end(struct sysdb_req *req);
+static void sysdb_transaction_end(struct sysdb_handle *handle);
-static int sysdb_req_destructor(void *ptr)
+static int sysdb_handle_destructor(void *ptr)
{
- struct sysdb_req *req;
+ struct sysdb_handle *handle;
int ret;
- req = talloc_get_type(ptr, struct sysdb_req);
+ handle = talloc_get_type(ptr, struct sysdb_handle);
- if (req->ctx->queue != req) {
- DLIST_REMOVE(req->ctx->queue, req);
+ if (handle->ctx->queue != handle) {
+ DLIST_REMOVE(handle->ctx->queue, handle);
return 0;
}
- /* req is the currently running operation or
+ /* handle is the currently running operation or
* scheduled to run operation */
- if (req->transaction_active) {
+ if (handle->transaction_active) {
/* freeing before the transaction is complete */
- req->status = ETIMEDOUT;
- sysdb_transaction_end(req);
+ handle->status = ETIMEDOUT;
+ sysdb_transaction_end(handle);
}
- DLIST_REMOVE(req->ctx->queue, req);
+ DLIST_REMOVE(handle->ctx->queue, handle);
/* make sure we schedule the next in line if any */
- if (req->ctx->queue) {
- ret = sysdb_req_schedule(req->ctx->queue);
+ if (handle->ctx->queue) {
+ ret = sysdb_queue_schedule(handle->ctx->queue);
if (ret != EOK) abort();
}
return 0;
}
-static struct sysdb_req *sysdb_new_req(TALLOC_CTX *memctx,
+static struct sysdb_handle *sysdb_new_req(TALLOC_CTX *memctx,
struct sysdb_ctx *ctx,
- sysdb_req_fn_t fn, void *pvt)
+ sysdb_fn_t fn, void *pvt)
{
- struct sysdb_req *req;
+ struct sysdb_handle *handle;
- req = talloc_zero(memctx, struct sysdb_req);
- if (!req) return NULL;
+ handle = talloc_zero(memctx, struct sysdb_handle);
+ if (!handle) return NULL;
- req->ctx = ctx;
- req->fn = fn;
- req->pvt = pvt;
+ handle->ctx = ctx;
+ handle->fn = fn;
+ handle->pvt = pvt;
- talloc_set_destructor((TALLOC_CTX *)req, sysdb_req_destructor);
+ talloc_set_destructor((TALLOC_CTX *)handle, sysdb_handle_destructor);
- return req;
+ return handle;
}
-static void sysdb_transaction_int(struct sysdb_req *intreq, void *pvt)
+static void sysdb_transaction_int(struct sysdb_handle *ihandle, void *pvt)
{
- struct sysdb_req *req = talloc_get_type(pvt, struct sysdb_req);
+ struct sysdb_handle *handle = talloc_get_type(pvt, struct sysdb_handle);
int ret;
- /* first of all swap this internal request with the real one on the queue
+ /* first of all swap this internal handle with the real one on the queue
* otherwise request_done() will later abort */
- DLIST_REMOVE(req->ctx->queue, intreq);
- DLIST_ADD(req->ctx->queue, req);
+ DLIST_REMOVE(handle->ctx->queue, ihandle);
+ DLIST_ADD(handle->ctx->queue, handle);
- if (intreq->status != EOK) {
- req->status = intreq->status;
- req->fn(req, req->pvt);
+ if (ihandle->status != EOK) {
+ handle->status = ihandle->status;
+ handle->fn(handle, handle->pvt);
return;
}
- ret = ldb_transaction_start(req->ctx->ldb);
+ ret = ldb_transaction_start(handle->ctx->ldb);
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to start ldb transaction! (%d)\n", ret));
- req->status = sysdb_error_to_errno(ret);
+ handle->status = sysdb_error_to_errno(ret);
}
- req->transaction_active = true;
+ handle->transaction_active = true;
- req->fn(req, req->pvt);
+ handle->fn(handle, handle->pvt);
}
-static void sysdb_transaction_end(struct sysdb_req *req)
+static void sysdb_transaction_end(struct sysdb_handle *handle)
{
int ret;
- if (req->status == EOK) {
- ret = ldb_transaction_commit(req->ctx->ldb);
+ if (handle->status == EOK) {
+ ret = ldb_transaction_commit(handle->ctx->ldb);
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to commit ldb transaction! (%d)\n", ret));
}
} else {
DEBUG(4, ("Canceling transaction (%d[%s])\n",
- req->status, strerror(req->status)));
- ret = ldb_transaction_cancel(req->ctx->ldb);
+ handle->status, strerror(handle->status)));
+ ret = ldb_transaction_cancel(handle->ctx->ldb);
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to cancel ldb transaction! (%d)\n", ret));
/* FIXME: abort() ? */
}
}
- req->transaction_active = false;
+ handle->transaction_active = false;
}
int sysdb_transaction(TALLOC_CTX *memctx, struct sysdb_ctx *ctx,
- sysdb_req_fn_t fn, void *pvt)
+ sysdb_fn_t fn, void *pvt)
{
- struct sysdb_req *req, *intreq;
+ struct sysdb_handle *handle, *ihandle;
- req = sysdb_new_req(memctx, ctx, fn, pvt);
- if (!req) return ENOMEM;
+ handle = sysdb_new_req(memctx, ctx, fn, pvt);
+ if (!handle) return ENOMEM;
- intreq = sysdb_new_req(req, ctx, sysdb_transaction_int, req);
- if (!intreq) {
- talloc_free(intreq);
+ ihandle = sysdb_new_req(handle, ctx, sysdb_transaction_int, handle);
+ if (!ihandle) {
+ talloc_free(ihandle);
return ENOMEM;
}
- return sysdb_req_enqueue(intreq);
+ return sysdb_enqueue(ihandle);
}
-void sysdb_transaction_done(struct sysdb_req *req, int status)
+void sysdb_transaction_done(struct sysdb_handle *handle, int status)
{
int ret;
- if (req->ctx->queue != req) abort();
- if (!req->transaction_active) abort();
+ if (handle->ctx->queue != handle) abort();
+ if (!handle->transaction_active) abort();
- req->status = status;
+ handle->status = status;
- sysdb_transaction_end(req);
+ sysdb_transaction_end(handle);
- DLIST_REMOVE(req->ctx->queue, req);
+ DLIST_REMOVE(handle->ctx->queue, handle);
- if (req->ctx->queue) {
- ret = sysdb_req_schedule(req->ctx->queue);
+ if (handle->ctx->queue) {
+ ret = sysdb_queue_schedule(handle->ctx->queue);
if (ret != EOK) abort();
}
- talloc_free(req);
+ talloc_free(handle);
}
int sysdb_operation(TALLOC_CTX *memctx, struct sysdb_ctx *ctx,
- sysdb_req_fn_t fn, void *pvt)
+ sysdb_fn_t fn, void *pvt)
{
- struct sysdb_req *req;
+ struct sysdb_handle *handle;
- req = sysdb_new_req(memctx, ctx, fn, pvt);
- if (!req) return ENOMEM;
+ handle = sysdb_new_req(memctx, ctx, fn, pvt);
+ if (!handle) return ENOMEM;
- return sysdb_req_enqueue(req);
+ return sysdb_enqueue(handle);
}
-void sysdb_operation_done(struct sysdb_req *req)
+void sysdb_operation_done(struct sysdb_handle *handle)
{
int ret;
- if (req->ctx->queue != req) abort();
+ if (handle->ctx->queue != handle) abort();
- DLIST_REMOVE(req->ctx->queue, req);
+ DLIST_REMOVE(handle->ctx->queue, handle);
- if (req->ctx->queue) {
- ret = sysdb_req_schedule(req->ctx->queue);
+ if (handle->ctx->queue) {
+ ret = sysdb_queue_schedule(handle->ctx->queue);
if (ret != EOK) abort();
}
- talloc_free(req);
+ talloc_free(handle);
}
diff --git a/server/db/sysdb_search.c b/server/db/sysdb_search.c
index 7dd467e8..7e0aed8f 100644
--- a/server/db/sysdb_search.c
+++ b/server/db/sysdb_search.c
@@ -30,7 +30,7 @@ typedef void (*gen_callback)(struct sysdb_search_ctx *);
struct sysdb_search_ctx {
struct sysdb_ctx *ctx;
- struct sysdb_req *req;
+ struct sysdb_handle *handle;
struct sss_domain_info *domain;
@@ -75,19 +75,19 @@ static struct sysdb_search_ctx *init_src_ctx(TALLOC_CTX *mem_ctx,
static void request_ldberror(struct sysdb_search_ctx *sctx, int error)
{
- sysdb_operation_done(sctx->req);
+ sysdb_operation_done(sctx->handle);
sctx->callback(sctx->ptr, sysdb_error_to_errno(error), NULL);
}
static void request_error(struct sysdb_search_ctx *sctx, int error)
{
- sysdb_operation_done(sctx->req);
+ sysdb_operation_done(sctx->handle);
sctx->callback(sctx->ptr, error, NULL);
}
static void request_done(struct sysdb_search_ctx *sctx)
{
- sysdb_operation_done(sctx->req);
+ sysdb_operation_done(sctx->handle);
sctx->callback(sctx->ptr, EOK, sctx->res);
}
@@ -162,7 +162,7 @@ static int get_gen_callback(struct ldb_request *req,
/* users */
-static void user_search(struct sysdb_req *sysreq, void *ptr)
+static void user_search(struct sysdb_handle *handle, void *ptr)
{
struct sysdb_search_ctx *sctx;
struct ldb_request *req;
@@ -170,7 +170,7 @@ static void user_search(struct sysdb_req *sysreq, void *ptr)
int ret;
sctx = talloc_get_type(ptr, struct sysdb_search_ctx);
- sctx->req = sysreq;
+ sctx->handle = handle;
base_dn = ldb_dn_new_fmt(sctx, sctx->ctx->ldb,
SYSDB_TMPL_USER_BASE, sctx->domain->name);
@@ -478,7 +478,7 @@ static int get_grp_callback(struct ldb_request *req,
return LDB_SUCCESS;
}
-static void grp_search(struct sysdb_req *sysreq, void *ptr)
+static void grp_search(struct sysdb_handle *handle, void *ptr)
{
struct sysdb_search_ctx *sctx;
static const char *attrs[] = SYSDB_GRSRC_ATTRS;
@@ -487,7 +487,7 @@ static void grp_search(struct sysdb_req *sysreq, void *ptr)
int ret;
sctx = talloc_get_type(ptr, struct sysdb_search_ctx);
- sctx->req = sysreq;
+ sctx->handle = handle;
if (sctx->domain->mpg) {
base_dn = ldb_dn_new_fmt(sctx, sctx->ctx->ldb,
@@ -720,7 +720,7 @@ static void initgr_mem_search(struct sysdb_search_ctx *sctx)
}
}
-static void initgr_search(struct sysdb_req *sysreq, void *ptr)
+static void initgr_search(struct sysdb_handle *handle, void *ptr)
{
struct sysdb_search_ctx *sctx;
static const char *attrs[] = SYSDB_PW_ATTRS;
@@ -729,7 +729,7 @@ static void initgr_search(struct sysdb_req *sysreq, void *ptr)
int ret;
sctx = talloc_get_type(ptr, struct sysdb_search_ctx);
- sctx->req = sysreq;
+ sctx->handle = handle;
if (sctx->domain->legacy) {
sctx->gen_aux_fn = initgr_mem_legacy;
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;
diff --git a/server/providers/ldap/ldap_auth.c b/server/providers/ldap/ldap_auth.c
index cd3902f0..89e301aa 100644
--- a/server/providers/ldap/ldap_auth.c
+++ b/server/providers/ldap/ldap_auth.c
@@ -656,7 +656,7 @@ done:
}
struct sdap_pw_cache {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sdap_req *lr;
};
@@ -674,13 +674,13 @@ static void sdap_cache_pw_callback(void *pvt, int error,
error, strerror(error)));
}
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
/* password caching failures are not fatal errors */
sdap_reply(data->lr->req, data->lr->pd->pam_status, NULL);
}
-static void sdap_cache_pw_op(struct sysdb_req *req, void *pvt)
+static void sdap_cache_pw_op(struct sysdb_handle *handle, void *pvt)
{
struct sdap_pw_cache *data = talloc_get_type(pvt, struct sdap_pw_cache);
struct pam_data *pd;
@@ -688,7 +688,7 @@ static void sdap_cache_pw_op(struct sysdb_req *req, void *pvt)
char *password;
int ret;
- data->sysreq = req;
+ data->handle = handle;
pd = data->lr->pd;
username = pd->user;
@@ -715,7 +715,7 @@ static void sdap_cache_pw_op(struct sysdb_req *req, void *pvt)
return;
}
- ret = sysdb_set_cached_password(req,
+ ret = sysdb_set_cached_password(handle,
data->lr->req->be_ctx->domain,
username,
password,
diff --git a/server/providers/proxy.c b/server/providers/proxy.c
index 937b1d07..6870cef1 100644
--- a/server/providers/proxy.c
+++ b/server/providers/proxy.c
@@ -261,7 +261,7 @@ static void proxy_pam_handler(struct be_req *req) {
}
struct proxy_data {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct proxy_ctx *ctx;
struct be_req *req;
@@ -294,20 +294,20 @@ static void cache_pw_return(void *pvt, int error, struct ldb_result *ignore)
error, strerror(error)));
}
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
/* password caching failures are not fatal errors */
return proxy_reply(data->req, EOK, NULL);
}
-static void cache_pw_op(struct sysdb_req *req, void *pvt)
+static void cache_pw_op(struct sysdb_handle *handle, void *pvt)
{
struct proxy_data *data = talloc_get_type(pvt, struct proxy_data);
int ret;
- data->sysreq = req;
+ data->handle = handle;
- ret = sysdb_set_cached_password(req,
+ ret = sysdb_set_cached_password(handle,
data->req->be_ctx->domain,
data->pwd->pw_name,
data->pwd->pw_passwd,
@@ -365,35 +365,35 @@ static void proxy_return(void *pvt, int error, struct ldb_result *ignore)
if (error != EOK) err = "Operation failed";
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
return proxy_reply(data->req, error, err);
}
-static void del_db_entry(struct sysdb_req *req, void *pvt)
+static void del_db_entry(struct sysdb_handle *handle, void *pvt)
{
struct proxy_data *data = talloc_get_type(pvt, struct proxy_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_delete_entry(req, data->dn, data->next_fn, data);
+ ret = sysdb_delete_entry(handle, data->dn, data->next_fn, data);
if (ret != EOK) {
proxy_return(data, ret, NULL);
}
}
-static void del_pw_uid(struct sysdb_req *req, void *pvt)
+static void del_pw_uid(struct sysdb_handle *handle, void *pvt)
{
struct proxy_data *data = talloc_get_type(pvt, struct proxy_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_delete_user_by_uid(req,
+ ret = sysdb_delete_user_by_uid(handle,
data->req->be_ctx->domain,
data->pwd->pw_uid,
data->next_fn, data);
@@ -402,16 +402,16 @@ static void del_pw_uid(struct sysdb_req *req, void *pvt)
}
}
-static void set_pw_name(struct sysdb_req *req, void *pvt)
+static void set_pw_name(struct sysdb_handle *handle, void *pvt)
{
struct proxy_data *data = talloc_get_type(pvt, struct proxy_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_legacy_store_user(req, data->req->be_ctx->domain,
+ ret = sysdb_legacy_store_user(handle, data->req->be_ctx->domain,
data->pwd->pw_name, data->pwd->pw_passwd,
data->pwd->pw_uid, data->pwd->pw_gid,
data->pwd->pw_gecos, data->pwd->pw_dir,
@@ -556,7 +556,7 @@ static void get_pw_uid(struct be_req *req, uid_t uid)
#define MAX_BUF_SIZE 1024*1024 /* max 1MiB */
-static void get_pw_entry(struct sysdb_req *req, void *pvt);
+static void get_pw_entry(struct sysdb_handle *handle, void *pvt);
static void get_next_pw_entry(void *pvt, int error, struct ldb_result *ignore)
{
@@ -564,10 +564,10 @@ static void get_next_pw_entry(void *pvt, int error, struct ldb_result *ignore)
if (error != EOK) proxy_return(data, error, NULL);
- get_pw_entry(data->sysreq, data);
+ get_pw_entry(data->handle, data);
}
-static void get_pw_entry(struct sysdb_req *req, void *pvt)
+static void get_pw_entry(struct sysdb_handle *handle, void *pvt)
{
struct proxy_data *data = talloc_get_type(pvt, struct proxy_data);
enum nss_status status;
@@ -575,8 +575,8 @@ static void get_pw_entry(struct sysdb_req *req, void *pvt)
char *newb;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
retry:
status = data->ctx->ops.getpwent_r(data->pwd,
@@ -611,7 +611,7 @@ retry:
goto retry; /* skip */
}
- ret = sysdb_legacy_store_user(req, data->req->be_ctx->domain,
+ ret = sysdb_legacy_store_user(handle, data->req->be_ctx->domain,
data->pwd->pw_name,
data->pwd->pw_passwd,
data->pwd->pw_uid,
@@ -676,16 +676,16 @@ static void enum_users(struct be_req *req)
}
}
-static void del_gr_gid(struct sysdb_req *req, void *pvt)
+static void del_gr_gid(struct sysdb_handle *handle, void *pvt)
{
struct proxy_data *data = talloc_get_type(pvt, struct proxy_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_delete_group_by_gid(req,
+ ret = sysdb_delete_group_by_gid(handle,
data->req->be_ctx->domain,
data->grp->gr_gid,
data->next_fn, data);
@@ -694,16 +694,16 @@ static void del_gr_gid(struct sysdb_req *req, void *pvt)
}
}
-static void set_gr_name(struct sysdb_req *req, void *pvt)
+static void set_gr_name(struct sysdb_handle *handle, void *pvt)
{
struct proxy_data *data = talloc_get_type(pvt, struct proxy_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_legacy_store_group(req, data->req->be_ctx->domain,
+ ret = sysdb_legacy_store_group(handle, data->req->be_ctx->domain,
data->grp->gr_name,
data->grp->gr_gid,
(const char **)data->grp->gr_mem,
@@ -845,7 +845,7 @@ static void get_gr_gid(struct be_req *req, gid_t gid)
}
}
-static void get_gr_entry(struct sysdb_req *req, void *pvt);
+static void get_gr_entry(struct sysdb_handle *handle, void *pvt);
static void get_next_gr_entry(void *pvt, int error, struct ldb_result *ignore)
{
@@ -853,10 +853,10 @@ static void get_next_gr_entry(void *pvt, int error, struct ldb_result *ignore)
if (error != EOK) proxy_return(data, error, NULL);
- get_gr_entry(data->sysreq, data);
+ get_gr_entry(data->handle, data);
}
-static void get_gr_entry(struct sysdb_req *req, void *pvt)
+static void get_gr_entry(struct sysdb_handle *handle, void *pvt)
{
struct proxy_data *data = talloc_get_type(pvt, struct proxy_data);
enum nss_status status;
@@ -864,8 +864,8 @@ static void get_gr_entry(struct sysdb_req *req, void *pvt)
char *newb;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
retry:
status = data->ctx->ops.getgrent_r(data->grp,
@@ -898,7 +898,7 @@ retry:
if (data->grp->gr_gid == 0) {
goto retry;
}
- ret = sysdb_legacy_store_group(req, data->req->be_ctx->domain,
+ ret = sysdb_legacy_store_group(handle, data->req->be_ctx->domain,
data->grp->gr_name,
data->grp->gr_gid,
(const char **)data->grp->gr_mem,
@@ -959,7 +959,7 @@ static void enum_groups(struct be_req *req)
}
}
-static void get_gid_entry(struct sysdb_req *req, void *pvt);
+static void get_gid_entry(struct sysdb_handle *handle, void *pvt);
static void get_next_gid_entry(void *pvt, int error, struct ldb_result *ignore)
{
@@ -967,10 +967,10 @@ static void get_next_gid_entry(void *pvt, int error, struct ldb_result *ignore)
if (error != EOK) proxy_return(data, error, NULL);
- get_gid_entry(data->sysreq, data);
+ get_gid_entry(data->handle, data);
}
-static void get_gid_entry(struct sysdb_req *req, void *pvt)
+static void get_gid_entry(struct sysdb_handle *handle, void *pvt)
{
struct proxy_data *data = talloc_get_type(pvt, struct proxy_data);
enum nss_status status;
@@ -978,7 +978,7 @@ static void get_gid_entry(struct sysdb_req *req, void *pvt)
char *newb;
int ret;
- ctx = sysdb_req_get_ctx(req);
+ ctx = sysdb_handle_get_ctx(handle);
/* all done */
if (data->cur == data->num)
@@ -1008,7 +1008,7 @@ retry:
data->cur++;
DEBUG(4, ("gid [%lu] not found, removing group\n",
(unsigned long)(data->groups[data->cur])));
- ret = sysdb_delete_group_by_gid(req, data->req->be_ctx->domain,
+ ret = sysdb_delete_group_by_gid(handle, data->req->be_ctx->domain,
data->groups[data->cur-1],
get_next_gid_entry, data);
if (ret != EOK) {
@@ -1020,7 +1020,7 @@ retry:
case NSS_STATUS_SUCCESS:
data->cur++;
- ret = sysdb_legacy_store_group(req, data->req->be_ctx->domain,
+ ret = sysdb_legacy_store_group(handle, data->req->be_ctx->domain,
data->grp->gr_name,
data->grp->gr_gid,
(const char **)data->grp->gr_mem,
@@ -1092,7 +1092,7 @@ retry:
data->num = start;
DEBUG(4, ("User [%s] appears to be member of %lu groups\n",
name, data->num));
- get_gid_entry(data->sysreq, data);
+ get_gid_entry(data->handle, data);
break;
default:
diff --git a/server/responder/pam/pam_LOCAL_domain.c b/server/responder/pam/pam_LOCAL_domain.c
index 010bd8d4..15116a5e 100644
--- a/server/responder/pam/pam_LOCAL_domain.c
+++ b/server/responder/pam/pam_LOCAL_domain.c
@@ -49,7 +49,7 @@
struct LOCAL_request {
struct sysdb_ctx *dbctx;
struct sysdb_attrs *mod_attrs;
- struct sysdb_req *sysdb_req;
+ struct sysdb_handle *handle;
struct ldb_result *res;
int error;
@@ -95,7 +95,7 @@ static void set_user_attr_callback(void *pvt, int ldb_status, struct ldb_result
lreq = talloc_get_type(pvt, struct LOCAL_request);
- sysdb_transaction_done(lreq->sysdb_req, sysdb_error_to_errno(ldb_status));
+ sysdb_transaction_done(lreq->handle, sysdb_error_to_errno(ldb_status));
NEQ_CHECK_OR_JUMP(ldb_status, LDB_SUCCESS, ("set_user_attr failed.\n"),
lreq->error, sysdb_error_to_errno(ldb_status), done);
@@ -104,7 +104,7 @@ done:
prepare_reply(lreq);
}
-static void set_user_attr_req(struct sysdb_req *req, void *pvt)
+static void set_user_attr_req(struct sysdb_handle *handle, void *pvt)
{
int ret;
struct LOCAL_request *lreq;
@@ -113,13 +113,13 @@ static void set_user_attr_req(struct sysdb_req *req, void *pvt)
lreq = talloc_get_type(pvt, struct LOCAL_request);
- lreq->sysdb_req = req;
+ lreq->handle = handle;
- ret = sysdb_set_user_attr(req, lreq->preq->domain,
+ ret = sysdb_set_user_attr(handle, lreq->preq->domain,
lreq->preq->pd->user, lreq->mod_attrs,
set_user_attr_callback, lreq);
if (ret != EOK)
- sysdb_transaction_done(lreq->sysdb_req, ret);
+ sysdb_transaction_done(lreq->handle, ret);
NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_set_user_attr failed.\n"),
lreq->error, ret, done);
diff --git a/server/responder/pam/pamsrv_cache.c b/server/responder/pam/pamsrv_cache.c
index d1c34e5f..7cfd97b1 100644
--- a/server/responder/pam/pamsrv_cache.c
+++ b/server/responder/pam/pamsrv_cache.c
@@ -51,12 +51,6 @@ static int authtok2str(const void *mem_ctx,
return EOK;
}
-struct set_attrs_ctx {
- struct pam_auth_req *preq;
- struct sysdb_req *sysreq;
- char *password;
-};
-
static void pam_cache_auth_return(struct pam_auth_req *preq, int error)
{
preq->pd->pam_status = error;
diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c
index 20e85f7b..bc894962 100644
--- a/server/tests/sysdb-tests.c
+++ b/server/tests/sysdb-tests.c
@@ -121,7 +121,7 @@ static int setup_sysdb_tests(struct sysdb_test_ctx **ctx)
}
struct test_data {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sss_domain_info *domain;
struct sysdb_test_ctx *ctx;
@@ -173,13 +173,13 @@ static void test_return(void *pvt, int error, struct ldb_result *ignore)
if (error != EOK) err = "Operation failed";
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
data->error = error;
data->finished = true;
}
-static void test_add_user(struct sysdb_req *req, void *pvt)
+static void test_add_user(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
@@ -190,17 +190,17 @@ static void test_add_user(struct sysdb_req *req, void *pvt)
homedir = talloc_asprintf(data, "/home/testuser%d", data->uid);
gecos = talloc_asprintf(data, "Test User %d", data->uid);
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_add_user(req, data->domain,
+ ret = sysdb_add_user(handle, data->domain,
data->username, data->uid, data->gid,
gecos, homedir, "/bin/bash",
data->next_fn, data);
if (ret != EOK) test_return(data, ret, NULL);
}
-static void test_add_legacy_user(struct sysdb_req *req, void *pvt)
+static void test_add_legacy_user(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
@@ -211,56 +211,56 @@ static void test_add_legacy_user(struct sysdb_req *req, void *pvt)
homedir = talloc_asprintf(data, "/home/testuser%d", data->uid);
gecos = talloc_asprintf(data, "Test User %d", data->uid);
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_legacy_store_user(req, data->domain, data->username, "x",
+ ret = sysdb_legacy_store_user(handle, data->domain, data->username, "x",
data->uid, data->gid, gecos, homedir,
"/bin/bash", data->next_fn, data);
if (ret != EOK) test_return(data, ret, NULL);
}
-static void test_remove_user(struct sysdb_req *req, void *pvt)
+static void test_remove_user(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
struct ldb_dn *user_dn;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
user_dn = sysdb_user_dn(ctx, data, "LOCAL", data->username);
if (!user_dn) return test_return(data, ENOMEM, NULL);
- ret = sysdb_delete_entry(req, user_dn, data->next_fn, data);
+ ret = sysdb_delete_entry(handle, user_dn, data->next_fn, data);
if (ret != EOK) test_return(data, ret, NULL);
}
-static void test_remove_user_by_uid(struct sysdb_req *req, void *pvt)
+static void test_remove_user_by_uid(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_delete_user_by_uid(req, data->domain, data->uid,
+ ret = sysdb_delete_user_by_uid(handle, data->domain, data->uid,
data->next_fn, data);
if (ret != EOK) test_return(data, ret, NULL);
}
-static void test_add_group(struct sysdb_req *req, void *pvt)
+static void test_add_group(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_add_group(req, data->domain,
+ ret = sysdb_add_group(handle, data->domain,
data->groupname, data->gid,
data->next_fn, data);
if (ret != EOK) {
@@ -268,16 +268,16 @@ static void test_add_group(struct sysdb_req *req, void *pvt)
}
}
-static void test_add_legacy_group(struct sysdb_req *req, void *pvt)
+static void test_add_legacy_group(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_legacy_store_group(req, data->domain,
+ ret = sysdb_legacy_store_group(handle, data->domain,
data->groupname,
data->gid, NULL,
data->next_fn, data);
@@ -286,47 +286,47 @@ static void test_add_legacy_group(struct sysdb_req *req, void *pvt)
}
}
-static void test_remove_group(struct sysdb_req *req, void *pvt)
+static void test_remove_group(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
struct ldb_dn *group_dn;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
group_dn = sysdb_group_dn(ctx, data, "LOCAL", data->groupname);
if (!group_dn) return test_return(data, ENOMEM, NULL);
- ret = sysdb_delete_entry(req, group_dn, data->next_fn, data);
+ ret = sysdb_delete_entry(handle, group_dn, data->next_fn, data);
if (ret != EOK) test_return(data, ret, NULL);
}
-static void test_remove_group_by_gid(struct sysdb_req *req, void *pvt)
+static void test_remove_group_by_gid(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_delete_group_by_gid(req, data->domain, data->gid,
+ ret = sysdb_delete_group_by_gid(handle, data->domain, data->gid,
data->next_fn, data);
if (ret != EOK) test_return(data, ret, NULL);
}
-static void test_add_legacy_group_member(struct sysdb_req *req, void *pvt)
+static void test_add_legacy_group_member(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_legacy_add_group_member(req, data->domain,
+ ret = sysdb_legacy_add_group_member(handle, data->domain,
data->groupname,
data->username,
data->next_fn, data);
@@ -335,16 +335,16 @@ static void test_add_legacy_group_member(struct sysdb_req *req, void *pvt)
}
}
-static void test_remove_legacy_group_member(struct sysdb_req *req, void *pvt)
+static void test_remove_legacy_group_member(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct sysdb_ctx *ctx;
int ret;
- data->sysreq = req;
- ctx = sysdb_req_get_ctx(req);
+ data->handle = handle;
+ ctx = sysdb_handle_get_ctx(handle);
- ret = sysdb_legacy_remove_group_member(req, data->domain,
+ ret = sysdb_legacy_remove_group_member(handle, data->domain,
data->groupname,
data->username,
data->next_fn, data);
@@ -493,14 +493,14 @@ static void test_enumpwent(void *pvt, int error, struct ldb_result *res)
data->error = EOK;
}
-static void test_set_user_attr(struct sysdb_req *req, void *pvt)
+static void test_set_user_attr(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
int ret;
- data->sysreq = req;
+ data->handle = handle;
- ret = sysdb_set_user_attr(req,
+ ret = sysdb_set_user_attr(handle,
data->domain,
data->username,
data->attrs,
@@ -534,7 +534,7 @@ static void test_get_user_attr(void *pvt, int error, struct ldb_result *res)
}
}
-static void test_add_group_member(struct sysdb_req *req, void *pvt)
+static void test_add_group_member(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct ldb_dn *user_dn;
@@ -567,9 +567,9 @@ static void test_add_group_member(struct sysdb_req *req, void *pvt)
test_return(data, ENOMEM, NULL);
}
- data->sysreq = req;
+ data->handle = handle;
- ret = sysdb_add_group_member(req,
+ ret = sysdb_add_group_member(handle,
user_dn,
group_dn,
test_return,
@@ -581,7 +581,7 @@ static void test_add_group_member(struct sysdb_req *req, void *pvt)
talloc_free(tmp_ctx);
}
-static void test_remove_group_member(struct sysdb_req *req, void *pvt)
+static void test_remove_group_member(struct sysdb_handle *handle, void *pvt)
{
struct test_data *data = talloc_get_type(pvt, struct test_data);
struct ldb_dn *user_dn;
@@ -614,9 +614,9 @@ static void test_remove_group_member(struct sysdb_req *req, void *pvt)
test_return(data, ENOMEM, NULL);
}
- data->sysreq = req;
+ data->handle = handle;
- ret = sysdb_remove_group_member(req,
+ ret = sysdb_remove_group_member(handle,
user_dn,
group_dn,
test_return,
diff --git a/server/tools/sss_groupadd.c b/server/tools/sss_groupadd.c
index 685de6ff..acb26f3a 100644
--- a/server/tools/sss_groupadd.c
+++ b/server/tools/sss_groupadd.c
@@ -44,7 +44,7 @@
#endif
struct group_add_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sss_domain_info *domain;
struct tools_ctx *ctx;
@@ -63,22 +63,22 @@ static void add_group_done(void *pvt, int error, struct ldb_result *ignore)
data->done = true;
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
if (error)
data->error = error;
}
-/* sysdb_req_fn_t */
-static void add_group(struct sysdb_req *req, void *pvt)
+/* sysdb_fn_t */
+static void add_group(struct sysdb_handle *handle, void *pvt)
{
struct group_add_ctx *group_ctx;
int ret;
group_ctx = talloc_get_type(pvt, struct group_add_ctx);
- group_ctx->sysreq = req;
+ group_ctx->handle = handle;
- ret = sysdb_add_group(req, group_ctx->domain,
+ ret = sysdb_add_group(handle, group_ctx->domain,
group_ctx->groupname,
group_ctx->gid,
add_group_done,
diff --git a/server/tools/sss_groupdel.c b/server/tools/sss_groupdel.c
index fa23ea82..820cf252 100644
--- a/server/tools/sss_groupdel.c
+++ b/server/tools/sss_groupdel.c
@@ -41,7 +41,7 @@
struct group_del_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
sysdb_callback_t next_fn;
gid_t gid;
@@ -62,22 +62,22 @@ static void groupdel_done(void *pvt, int error, struct ldb_result *ignore)
data->done = true;
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
if (error)
data->error = error;
}
-/* sysdb_req_fn_t */
-static void group_del(struct sysdb_req *req, void *pvt)
+/* sysdb_fn_t */
+static void group_del(struct sysdb_handle *handle, void *pvt)
{
struct group_del_ctx *group_ctx;
int ret;
group_ctx = talloc_get_type(pvt, struct group_del_ctx);
- group_ctx->sysreq = req;
+ group_ctx->handle = handle;
- ret = sysdb_delete_entry(req,
+ ret = sysdb_delete_entry(handle,
group_ctx->group_dn,
groupdel_done,
group_ctx);
diff --git a/server/tools/sss_groupmod.c b/server/tools/sss_groupmod.c
index 9bc3ef6f..0c2abda8 100644
--- a/server/tools/sss_groupmod.c
+++ b/server/tools/sss_groupmod.c
@@ -45,7 +45,7 @@
#endif
struct group_mod_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sss_domain_info *domain;
struct tools_ctx *ctx;
@@ -68,7 +68,7 @@ static void mod_group_done(void *pvt, int error, struct ldb_result *ignore)
data->done = true;
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
if (error)
data->error = error;
@@ -76,19 +76,19 @@ static void mod_group_done(void *pvt, int error, struct ldb_result *ignore)
static void add_to_groups(void *, int, struct ldb_result *);
-/* sysdb_req_fn_t */
-static void mod_group(struct sysdb_req *req, void *pvt)
+/* sysdb_fn_t */
+static void mod_group(struct sysdb_handle *handle, void *pvt)
{
struct group_mod_ctx *group_ctx;
int ret;
group_ctx = talloc_get_type(pvt, struct group_mod_ctx);
- group_ctx->sysreq = req;
+ group_ctx->handle = handle;
if(group_ctx->gid == 0) {
add_to_groups(group_ctx, EOK, NULL);
} else {
- ret = sysdb_set_group_gid(req,
+ ret = sysdb_set_group_gid(handle,
group_ctx->domain,
group_ctx->groupname,
group_ctx->gid,
@@ -134,7 +134,7 @@ static void remove_from_groups(void *pvt, int error, struct ldb_result *ignore)
return;
}
- ret = sysdb_remove_group_member(group_ctx->sysreq,
+ ret = sysdb_remove_group_member(group_ctx->handle,
group_dn, parent_group_dn,
remove_from_groups, group_ctx);
if (ret != EOK)
@@ -179,7 +179,7 @@ static void add_to_groups(void *pvt, int error, struct ldb_result *ignore)
return;
}
- ret = sysdb_add_group_member(group_ctx->sysreq,
+ ret = sysdb_add_group_member(group_ctx->handle,
group_dn, parent_group_dn,
add_to_groups, group_ctx);
if (ret != EOK)
diff --git a/server/tools/sss_useradd.c b/server/tools/sss_useradd.c
index 5ee01165..d1d83cf1 100644
--- a/server/tools/sss_useradd.c
+++ b/server/tools/sss_useradd.c
@@ -84,7 +84,7 @@
#define DFL_BASEDIR_VAL "/home"
struct user_add_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sss_domain_info *domain;
struct tools_ctx *ctx;
@@ -196,22 +196,22 @@ static void add_user_done(void *pvt, int error, struct ldb_result *ignore)
data->done = true;
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
if (error)
data->error = error;
}
-/* sysdb_req_fn_t */
-static void add_user(struct sysdb_req *req, void *pvt)
+/* sysdb_fn_t */
+static void add_user(struct sysdb_handle *handle, void *pvt)
{
struct user_add_ctx *user_ctx;
int ret;
user_ctx = talloc_get_type(pvt, struct user_add_ctx);
- user_ctx->sysreq = req;
+ user_ctx->handle = handle;
- ret = sysdb_add_user(req, user_ctx->domain,
+ ret = sysdb_add_user(handle, user_ctx->domain,
user_ctx->username,
user_ctx->uid,
user_ctx->gid,
@@ -258,7 +258,7 @@ static void add_to_groups(void *pvt, int error, struct ldb_result *ignore)
return;
}
- ret = sysdb_add_group_member(user_ctx->sysreq,
+ ret = sysdb_add_group_member(user_ctx->handle,
user_dn, group_dn,
add_to_groups, user_ctx);
if (ret != EOK)
diff --git a/server/tools/sss_userdel.c b/server/tools/sss_userdel.c
index 90dfdaf1..0222d00c 100644
--- a/server/tools/sss_userdel.c
+++ b/server/tools/sss_userdel.c
@@ -40,7 +40,7 @@
#endif
struct user_del_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
sysdb_callback_t next_fn;
uid_t uid;
@@ -61,22 +61,22 @@ static void userdel_done(void *pvt, int error, struct ldb_result *ignore)
data->done = true;
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
if (error)
data->error = error;
}
-/* sysdb_req_fn_t */
-static void user_del(struct sysdb_req *req, void *pvt)
+/* sysdb_fn_t */
+static void user_del(struct sysdb_handle *handle, void *pvt)
{
struct user_del_ctx *user_ctx;
int ret;
user_ctx = talloc_get_type(pvt, struct user_del_ctx);
- user_ctx->sysreq = req;
+ user_ctx->handle = handle;
- ret = sysdb_delete_entry(req,
+ ret = sysdb_delete_entry(handle,
user_ctx->user_dn,
userdel_done,
user_ctx);
diff --git a/server/tools/sss_usermod.c b/server/tools/sss_usermod.c
index d34a6c72..7bb8d663 100644
--- a/server/tools/sss_usermod.c
+++ b/server/tools/sss_usermod.c
@@ -82,7 +82,7 @@
#endif
struct user_mod_ctx {
- struct sysdb_req *sysreq;
+ struct sysdb_handle *handle;
struct sss_domain_info *domain;
struct tools_ctx *ctx;
@@ -105,7 +105,7 @@ static void mod_user_done(void *pvt, int error, struct ldb_result *ignore)
data->done = true;
- sysdb_transaction_done(data->sysreq, error);
+ sysdb_transaction_done(data->handle, error);
if (error)
data->error = error;
@@ -113,19 +113,19 @@ static void mod_user_done(void *pvt, int error, struct ldb_result *ignore)
static void add_to_groups(void *, int, struct ldb_result *);
-/* sysdb_req_fn_t */
-static void mod_user(struct sysdb_req *req, void *pvt)
+/* sysdb_fn_t */
+static void mod_user(struct sysdb_handle *handle, void *pvt)
{
struct user_mod_ctx *user_ctx;
int ret;
user_ctx = talloc_get_type(pvt, struct user_mod_ctx);
- user_ctx->sysreq = req;
+ user_ctx->handle = handle;
if(user_ctx->attrs->num == 0) {
add_to_groups(user_ctx, EOK, NULL);
} else {
- ret = sysdb_set_user_attr(req,
+ ret = sysdb_set_user_attr(handle,
user_ctx->domain,
user_ctx->username,
user_ctx->attrs,
@@ -172,7 +172,7 @@ static void remove_from_groups(void *pvt, int error, struct ldb_result *ignore)
return;
}
- ret = sysdb_remove_group_member(user_ctx->sysreq,
+ ret = sysdb_remove_group_member(user_ctx->handle,
user_dn, group_dn,
remove_from_groups, user_ctx);
if (ret != EOK)
@@ -217,7 +217,7 @@ static void add_to_groups(void *pvt, int error, struct ldb_result *ignore)
return;
}
- ret = sysdb_add_group_member(user_ctx->sysreq,
+ ret = sysdb_add_group_member(user_ctx->handle,
user_dn, group_dn,
add_to_groups, user_ctx);
if (ret != EOK)