summaryrefslogtreecommitdiffstats
path: root/server/db
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/db
parentaf6b9f749f3f9ade3727bb0b43baffbdbd26cdcb (diff)
downloadsssd-6aca93fb4d5d39a100b900a8c297d08629407960.tar.gz
sssd-6aca93fb4d5d39a100b900a8c297d08629407960.tar.xz
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/db')
-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
5 files changed, 208 insertions, 208 deletions
diff --git a/server/db/sysdb.h b/server/db/sysdb.h
index 5a5badb3e..6da833187 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 d8fe83c45..9b3f28283 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 a4e83e0ab..8c10d9519 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 15d8aa851..a768fefb2 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 7dd467e87..7e0aed8f2 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;