summaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorJan Zeleny <jzeleny@redhat.com>2011-05-18 08:53:26 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-08-15 09:16:38 -0400
commit82c3185b2ccc1e99ff6c6d63d09754cbd0705e6c (patch)
treee1c1326cae8dc2528998cfe1c33eba7cbb71ca75 /src/db
parentef9b6d8e0a62d3df821b8de446f150c932c087ef (diff)
downloadsssd-82c3185b2ccc1e99ff6c6d63d09754cbd0705e6c.tar.gz
sssd-82c3185b2ccc1e99ff6c6d63d09754cbd0705e6c.tar.bz2
sssd-82c3185b2ccc1e99ff6c6d63d09754cbd0705e6c.zip
sysdb refactoring: renamed ctx variable to sysdb
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb.c252
-rw-r--r--src/db/sysdb.h108
-rw-r--r--src/db/sysdb_ops.c262
-rw-r--r--src/db/sysdb_search.c74
4 files changed, 348 insertions, 348 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 1051e5a4..99c116b8 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -89,7 +89,7 @@ errno_t sysdb_dn_sanitize(void *mem_ctx, const char *input,
return ret;
}
-struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain,
const char *subtree_name)
{
@@ -107,7 +107,7 @@ struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *ctx, void *memctx,
return NULL;
}
- dn = ldb_dn_new_fmt(tmp_ctx, ctx->ldb, SYSDB_TMPL_CUSTOM_SUBTREE,
+ dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_CUSTOM_SUBTREE,
clean_subtree, domain);
if (dn) {
talloc_steal(memctx, dn);
@@ -116,7 +116,7 @@ struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *ctx, void *memctx,
return dn;
}
-struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain, const char *object_name,
const char *subtree_name)
{
@@ -141,7 +141,7 @@ struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *ctx, void *memctx,
goto done;
}
- dn = ldb_dn_new_fmt(memctx, ctx->ldb, SYSDB_TMPL_CUSTOM, clean_name,
+ dn = ldb_dn_new_fmt(memctx, sysdb->ldb, SYSDB_TMPL_CUSTOM, clean_name,
clean_subtree, domain);
done:
@@ -149,7 +149,7 @@ done:
return dn;
}
-struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain, const char *name)
{
errno_t ret;
@@ -161,14 +161,14 @@ struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *ctx, void *memctx,
return NULL;
}
- dn = ldb_dn_new_fmt(memctx, ctx->ldb, SYSDB_TMPL_USER,
+ dn = ldb_dn_new_fmt(memctx, sysdb->ldb, SYSDB_TMPL_USER,
clean_name, domain);
talloc_free(clean_name);
return dn;
}
-struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain, const char *name)
{
errno_t ret;
@@ -180,14 +180,14 @@ struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *ctx, void *memctx,
return NULL;
}
- dn = ldb_dn_new_fmt(memctx, ctx->ldb, SYSDB_TMPL_GROUP,
+ dn = ldb_dn_new_fmt(memctx, sysdb->ldb, SYSDB_TMPL_GROUP,
clean_name, domain);
talloc_free(clean_name);
return dn;
}
-struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain, const char *name)
{
errno_t ret;
@@ -199,20 +199,20 @@ struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *ctx, void *memctx,
return NULL;
}
- dn = ldb_dn_new_fmt(memctx, ctx->ldb, SYSDB_TMPL_NETGROUP,
+ dn = ldb_dn_new_fmt(memctx, sysdb->ldb, SYSDB_TMPL_NETGROUP,
clean_name, domain);
talloc_free(clean_name);
return dn;
}
-struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain)
{
- return ldb_dn_new_fmt(memctx, ctx->ldb, SYSDB_TMPL_NETGROUP_BASE, domain);
+ return ldb_dn_new_fmt(memctx, sysdb->ldb, SYSDB_TMPL_NETGROUP_BASE, domain);
}
-errno_t sysdb_get_rdn(struct sysdb_ctx *ctx, void *memctx,
+errno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, void *memctx,
const char *_dn, char **_name, char **_val)
{
errno_t ret;
@@ -229,7 +229,7 @@ errno_t sysdb_get_rdn(struct sysdb_ctx *ctx, void *memctx,
return ENOMEM;
}
- dn = ldb_dn_new_fmt(tmpctx, ctx->ldb, "%s", _dn);
+ dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, "%s", _dn);
if (dn == NULL) {
ret = ENOMEM;
goto done;
@@ -270,21 +270,21 @@ done:
return ret;
}
-errno_t sysdb_group_dn_name(struct sysdb_ctx *ctx, void *memctx,
+errno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, void *memctx,
const char *_dn, char **_name)
{
- return sysdb_get_rdn(ctx, memctx, _dn, NULL, _name);
+ return sysdb_get_rdn(sysdb, memctx, _dn, NULL, _name);
}
-struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain)
{
- return ldb_dn_new_fmt(memctx, ctx->ldb, SYSDB_DOM_BASE, domain);
+ return ldb_dn_new_fmt(memctx, sysdb->ldb, SYSDB_DOM_BASE, domain);
}
-struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *ctx)
+struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *sysdb)
{
- return ctx->ldb;
+ return sysdb->ldb;
}
struct sysdb_attrs *sysdb_new_attrs(TALLOC_CTX *memctx)
@@ -731,33 +731,33 @@ int sysdb_error_to_errno(int ldberr)
/* =Transactions========================================================== */
-int sysdb_transaction_start(struct sysdb_ctx *ctx)
+int sysdb_transaction_start(struct sysdb_ctx *sysdb)
{
int ret;
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to start ldb transaction! (%d)\n", ret));
}
return sysdb_error_to_errno(ret);
}
-int sysdb_transaction_commit(struct sysdb_ctx *ctx)
+int sysdb_transaction_commit(struct sysdb_ctx *sysdb)
{
int ret;
- ret = ldb_transaction_commit(ctx->ldb);
+ ret = ldb_transaction_commit(sysdb->ldb);
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to commit ldb transaction! (%d)\n", ret));
}
return sysdb_error_to_errno(ret);
}
-int sysdb_transaction_cancel(struct sysdb_ctx *ctx)
+int sysdb_transaction_cancel(struct sysdb_ctx *sysdb)
{
int ret;
- ret = ldb_transaction_cancel(ctx->ldb);
+ ret = ldb_transaction_cancel(sysdb->ldb);
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to cancel ldb transaction! (%d)\n", ret));
}
@@ -968,7 +968,7 @@ static int sysdb_check_upgrade_02(TALLOC_CTX *mem_ctx,
TALLOC_CTX *tmp_ctx = NULL;
struct ldb_context *ldb;
char *ldb_file;
- struct sysdb_ctx *ctx;
+ struct sysdb_ctx *sysdb;
struct sss_domain_info *dom;
struct ldb_message_element *el;
struct ldb_message *msg;
@@ -1109,12 +1109,12 @@ static int sysdb_check_upgrade_02(TALLOC_CTX *mem_ctx,
/* create new dom db */
ret = sysdb_domain_init_internal(tmp_ctx, dom,
- db_path, false, &ctx);
+ db_path, false, &sysdb);
if (ret != EOK) {
goto done;
}
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to start ldb transaction! (%d)\n", ret));
ret = EIO;
@@ -1126,8 +1126,8 @@ static int sysdb_check_upgrade_02(TALLOC_CTX *mem_ctx,
* copy them all in the new database,
* then remove them from local */
- domain_dn = ldb_dn_new_fmt(tmp_ctx, ctx->ldb,
- SYSDB_DOM_BASE, ctx->domain->name);
+ domain_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
+ SYSDB_DOM_BASE, sysdb->domain->name);
if (!domain_dn) {
ret = ENOMEM;
goto done;
@@ -1141,14 +1141,14 @@ static int sysdb_check_upgrade_02(TALLOC_CTX *mem_ctx,
goto done;
}
- users_dn = ldb_dn_new_fmt(tmp_ctx, ctx->ldb,
- SYSDB_TMPL_USER_BASE, ctx->domain->name);
+ users_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
+ SYSDB_TMPL_USER_BASE, sysdb->domain->name);
if (!users_dn) {
ret = ENOMEM;
goto done;
}
- groups_dn = ldb_dn_new_fmt(tmp_ctx, ctx->ldb,
- SYSDB_TMPL_GROUP_BASE, ctx->domain->name);
+ groups_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
+ SYSDB_TMPL_GROUP_BASE, sysdb->domain->name);
if (!groups_dn) {
ret = ENOMEM;
goto done;
@@ -1171,19 +1171,19 @@ static int sysdb_check_upgrade_02(TALLOC_CTX *mem_ctx,
* casefolding rules (example: name changing from case insensitive
* to case sensitive) */
orig_dn = msg->dn;
- msg->dn = ldb_dn_new(msg, ctx->ldb,
+ msg->dn = ldb_dn_new(msg, sysdb->ldb,
ldb_dn_get_linearized(orig_dn));
if (!msg->dn) {
ret = ENOMEM;
goto done;
}
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("WARNING: Could not add entry %s,"
" to new ldb file! (%d [%s])\n",
ldb_dn_get_linearized(msg->dn),
- ret, ldb_errstring(ctx->ldb)));
+ ret, ldb_errstring(sysdb->ldb)));
}
ret = ldb_delete(ldb, orig_dn);
@@ -1220,7 +1220,7 @@ static int sysdb_check_upgrade_02(TALLOC_CTX *mem_ctx,
ret, ldb_errstring(ldb)));
}
- ret = ldb_transaction_commit(ctx->ldb);
+ ret = ldb_transaction_commit(sysdb->ldb);
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to commit ldb transaction! (%d)\n", ret));
ret = EIO;
@@ -1275,7 +1275,7 @@ static int sysdb_check_upgrade_02(TALLOC_CTX *mem_ctx,
done:
if (ret != EOK) {
if (ctx_trans) {
- ret = ldb_transaction_cancel(ctx->ldb);
+ ret = ldb_transaction_cancel(sysdb->ldb);
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to cancel ldb transaction! (%d)\n", ret));
}
@@ -1291,20 +1291,20 @@ exit:
return ret;
}
-static int sysdb_upgrade_03(struct sysdb_ctx *ctx, const char **ver)
+static int sysdb_upgrade_03(struct sysdb_ctx *sysdb, const char **ver)
{
TALLOC_CTX *tmp_ctx;
int ret;
struct ldb_message *msg;
- tmp_ctx = talloc_new(ctx);
+ tmp_ctx = talloc_new(sysdb);
if (!tmp_ctx) {
return ENOMEM;
}
DEBUG(0, ("UPGRADING DB TO VERSION %s\n", SYSDB_VERSION_0_4));
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret != LDB_SUCCESS) {
ret = EIO;
goto done;
@@ -1316,7 +1316,7 @@ static int sysdb_upgrade_03(struct sysdb_ctx *ctx, const char **ver)
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new(tmp_ctx, ctx->ldb, "@ATTRIBUTES");
+ msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, "@ATTRIBUTES");
if (!msg->dn) {
ret = ENOMEM;
goto done;
@@ -1328,7 +1328,7 @@ static int sysdb_upgrade_03(struct sysdb_ctx *ctx, const char **ver)
goto done;
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -1340,7 +1340,7 @@ static int sysdb_upgrade_03(struct sysdb_ctx *ctx, const char **ver)
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new(tmp_ctx, ctx->ldb, SYSDB_BASE);
+ msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, SYSDB_BASE);
if (!msg->dn) {
ret = ENOMEM;
goto done;
@@ -1357,7 +1357,7 @@ static int sysdb_upgrade_03(struct sysdb_ctx *ctx, const char **ver)
goto done;
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -1366,25 +1366,25 @@ static int sysdb_upgrade_03(struct sysdb_ctx *ctx, const char **ver)
ret = EOK;
done:
- ret = finish_upgrade(ret, ctx->ldb, SYSDB_VERSION_0_4, ver);
+ ret = finish_upgrade(ret, sysdb->ldb, SYSDB_VERSION_0_4, ver);
talloc_free(tmp_ctx);
return ret;
}
-static int sysdb_upgrade_04(struct sysdb_ctx *ctx, const char **ver)
+static int sysdb_upgrade_04(struct sysdb_ctx *sysdb, const char **ver)
{
TALLOC_CTX *tmp_ctx;
int ret;
struct ldb_message *msg;
- tmp_ctx = talloc_new(ctx);
+ tmp_ctx = talloc_new(sysdb);
if (!tmp_ctx) {
return ENOMEM;
}
DEBUG(0, ("UPGRADING DB TO VERSION %s\n", SYSDB_VERSION_0_5));
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret != LDB_SUCCESS) {
ret = EIO;
goto done;
@@ -1396,7 +1396,7 @@ static int sysdb_upgrade_04(struct sysdb_ctx *ctx, const char **ver)
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new(tmp_ctx, ctx->ldb, "@INDEXLIST");
+ msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, "@INDEXLIST");
if (!msg->dn) {
ret = ENOMEM;
goto done;
@@ -1413,7 +1413,7 @@ static int sysdb_upgrade_04(struct sysdb_ctx *ctx, const char **ver)
goto done;
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -1425,13 +1425,13 @@ static int sysdb_upgrade_04(struct sysdb_ctx *ctx, const char **ver)
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new(tmp_ctx, ctx->ldb, "@MEMBEROF-REBUILD");
+ msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, "@MEMBEROF-REBUILD");
if (!msg->dn) {
ret = ENOMEM;
goto done;
}
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -1443,7 +1443,7 @@ static int sysdb_upgrade_04(struct sysdb_ctx *ctx, const char **ver)
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new(tmp_ctx, ctx->ldb, SYSDB_BASE);
+ msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, SYSDB_BASE);
if (!msg->dn) {
ret = ENOMEM;
goto done;
@@ -1460,7 +1460,7 @@ static int sysdb_upgrade_04(struct sysdb_ctx *ctx, const char **ver)
goto done;
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -1469,25 +1469,25 @@ static int sysdb_upgrade_04(struct sysdb_ctx *ctx, const char **ver)
ret = EOK;
done:
- ret = finish_upgrade(ret, ctx->ldb, SYSDB_VERSION_0_5, ver);
+ ret = finish_upgrade(ret, sysdb->ldb, SYSDB_VERSION_0_5, ver);
talloc_free(tmp_ctx);
return ret;
}
-static int sysdb_upgrade_05(struct sysdb_ctx *ctx, const char **ver)
+static int sysdb_upgrade_05(struct sysdb_ctx *sysdb, const char **ver)
{
TALLOC_CTX *tmp_ctx;
int ret;
struct ldb_message *msg;
- tmp_ctx = talloc_new(ctx);
+ tmp_ctx = talloc_new(sysdb);
if (!tmp_ctx) {
return ENOMEM;
}
DEBUG(0, ("UPGRADING DB TO VERSION %s\n", SYSDB_VERSION_0_6));
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret != LDB_SUCCESS) {
ret = EIO;
goto done;
@@ -1499,7 +1499,7 @@ static int sysdb_upgrade_05(struct sysdb_ctx *ctx, const char **ver)
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new(tmp_ctx, ctx->ldb, "@INDEXLIST");
+ msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, "@INDEXLIST");
if (!msg->dn) {
ret = ENOMEM;
goto done;
@@ -1529,7 +1529,7 @@ static int sysdb_upgrade_05(struct sysdb_ctx *ctx, const char **ver)
goto done;
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -1541,7 +1541,7 @@ static int sysdb_upgrade_05(struct sysdb_ctx *ctx, const char **ver)
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new(tmp_ctx, ctx->ldb, SYSDB_BASE);
+ msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, SYSDB_BASE);
if (!msg->dn) {
ret = ENOMEM;
goto done;
@@ -1558,7 +1558,7 @@ static int sysdb_upgrade_05(struct sysdb_ctx *ctx, const char **ver)
goto done;
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -1567,25 +1567,25 @@ static int sysdb_upgrade_05(struct sysdb_ctx *ctx, const char **ver)
ret = EOK;
done:
- ret = finish_upgrade(ret, ctx->ldb, SYSDB_VERSION_0_6, ver);
+ ret = finish_upgrade(ret, sysdb->ldb, SYSDB_VERSION_0_6, ver);
talloc_free(tmp_ctx);
return ret;
}
-static int sysdb_upgrade_06(struct sysdb_ctx *ctx, const char **ver)
+static int sysdb_upgrade_06(struct sysdb_ctx *sysdb, const char **ver)
{
TALLOC_CTX *tmp_ctx;
int ret;
struct ldb_message *msg;
- tmp_ctx = talloc_new(ctx);
+ tmp_ctx = talloc_new(sysdb);
if (!tmp_ctx) {
return ENOMEM;
}
DEBUG(0, ("UPGRADING DB TO VERSION %s\n", SYSDB_VERSION_0_7));
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret != LDB_SUCCESS) {
ret = EIO;
goto done;
@@ -1597,7 +1597,7 @@ static int sysdb_upgrade_06(struct sysdb_ctx *ctx, const char **ver)
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new(tmp_ctx, ctx->ldb, "@ATTRIBUTES");
+ msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, "@ATTRIBUTES");
if (!msg->dn) {
ret = ENOMEM;
goto done;
@@ -1615,7 +1615,7 @@ static int sysdb_upgrade_06(struct sysdb_ctx *ctx, const char **ver)
goto done;
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -1627,7 +1627,7 @@ static int sysdb_upgrade_06(struct sysdb_ctx *ctx, const char **ver)
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new(tmp_ctx, ctx->ldb, "cn=sysdb");
+ msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, "cn=sysdb");
if (!msg->dn) {
ret = ENOMEM;
goto done;
@@ -1644,7 +1644,7 @@ static int sysdb_upgrade_06(struct sysdb_ctx *ctx, const char **ver)
goto done;
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(ret);
goto done;
@@ -1653,7 +1653,7 @@ static int sysdb_upgrade_06(struct sysdb_ctx *ctx, const char **ver)
ret = EOK;
done:
- ret = finish_upgrade(ret, ctx->ldb, SYSDB_VERSION_0_7, ver);
+ ret = finish_upgrade(ret, sysdb->ldb, SYSDB_VERSION_0_7, ver);
talloc_free(tmp_ctx);
return ret;
}
@@ -1665,7 +1665,7 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
struct sysdb_ctx **_ctx)
{
TALLOC_CTX *tmp_ctx = NULL;
- struct sysdb_ctx *ctx;
+ struct sysdb_ctx *sysdb;
const char *base_ldif;
struct ldb_ldif *ldif;
struct ldb_message *msg;
@@ -1675,45 +1675,45 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
const char *version = NULL;
int ret;
- ctx = talloc_zero(mem_ctx, struct sysdb_ctx);
- if (!ctx) {
+ sysdb = talloc_zero(mem_ctx, struct sysdb_ctx);
+ if (!sysdb) {
return ENOMEM;
}
- ctx->domain = domain;
+ sysdb->domain = domain;
/* The local provider s the only true MPG,
* for the other domains, the provider actually unrolls MPGs */
if (strcasecmp(domain->provider, "local") == 0) {
- ctx->mpg = true;
+ sysdb->mpg = true;
}
- ret = sysdb_get_db_file(ctx, domain->provider,
+ ret = sysdb_get_db_file(sysdb, domain->provider,
domain->name, db_path,
- &ctx->ldb_file);
+ &sysdb->ldb_file);
if (ret != EOK) {
goto done;
}
- DEBUG(5, ("DB File for %s: %s\n", domain->name, ctx->ldb_file));
+ DEBUG(5, ("DB File for %s: %s\n", domain->name, sysdb->ldb_file));
- ret = sysdb_ldb_connect(ctx, ctx->ldb_file, &ctx->ldb);
+ ret = sysdb_ldb_connect(sysdb, sysdb->ldb_file, &sysdb->ldb);
if (ret != EOK) {
DEBUG(1, ("sysdb_ldb_connect failed.\n"));
goto done;
}
- tmp_ctx = talloc_new(ctx);
+ tmp_ctx = talloc_new(sysdb);
if (!tmp_ctx) {
ret = ENOMEM;
goto done;
}
- verdn = ldb_dn_new(tmp_ctx, ctx->ldb, SYSDB_BASE);
+ verdn = ldb_dn_new(tmp_ctx, sysdb->ldb, SYSDB_BASE);
if (!verdn) {
ret = EIO;
goto done;
}
- ret = ldb_search(ctx->ldb, tmp_ctx, &res,
+ ret = ldb_search(sysdb->ldb, tmp_ctx, &res,
verdn, LDB_SCOPE_BASE,
NULL, NULL);
if (ret != LDB_SUCCESS) {
@@ -1757,28 +1757,28 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
domain->name, version));
if (strcmp(version, SYSDB_VERSION_0_3) == 0) {
- ret = sysdb_upgrade_03(ctx, &version);
+ ret = sysdb_upgrade_03(sysdb, &version);
if (ret != EOK) {
goto done;
}
}
if (strcmp(version, SYSDB_VERSION_0_4) == 0) {
- ret = sysdb_upgrade_04(ctx, &version);
+ ret = sysdb_upgrade_04(sysdb, &version);
if (ret != EOK) {
goto done;
}
}
if (strcmp(version, SYSDB_VERSION_0_5) == 0) {
- ret = sysdb_upgrade_05(ctx, &version);
+ ret = sysdb_upgrade_05(sysdb, &version);
if (ret != EOK) {
goto done;
}
}
if (strcmp(version, SYSDB_VERSION_0_6) == 0) {
- ret = sysdb_upgrade_06(ctx, &version);
+ ret = sysdb_upgrade_06(sysdb, &version);
if (ret != EOK) {
goto done;
}
@@ -1795,8 +1795,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
* We need to reopen the LDB to ensure that
* any changes made above take effect.
*/
- talloc_zfree(ctx->ldb);
- ret = sysdb_ldb_connect(ctx, ctx->ldb_file, &ctx->ldb);
+ talloc_zfree(sysdb->ldb);
+ ret = sysdb_ldb_connect(sysdb, sysdb->ldb_file, &sysdb->ldb);
if (ret != EOK) {
DEBUG(1, ("sysdb_ldb_connect failed.\n"));
}
@@ -1813,15 +1813,15 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
/* SYSDB_BASE does not exists, means db is empty, populate */
base_ldif = SYSDB_BASE_LDIF;
- while ((ldif = ldb_ldif_read_string(ctx->ldb, &base_ldif))) {
- ret = ldb_add(ctx->ldb, ldif->msg);
+ while ((ldif = ldb_ldif_read_string(sysdb->ldb, &base_ldif))) {
+ ret = ldb_add(sysdb->ldb, ldif->msg);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("Failed to initialize DB (%d, [%s]) for domain %s!\n",
- ret, ldb_errstring(ctx->ldb), domain->name));
+ ret, ldb_errstring(sysdb->ldb), domain->name));
ret = EIO;
goto done;
}
- ldb_ldif_read_free(ctx->ldb, ldif);
+ ldb_ldif_read_free(sysdb->ldb, ldif);
}
/* == create base domain object == */
@@ -1831,7 +1831,7 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new_fmt(msg, ctx->ldb, SYSDB_DOM_BASE, domain->name);
+ msg->dn = ldb_dn_new_fmt(msg, sysdb->ldb, SYSDB_DOM_BASE, domain->name);
if (!msg->dn) {
ret = ENOMEM;
goto done;
@@ -1842,10 +1842,10 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
goto done;
}
/* do a synchronous add */
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("Failed to initialize DB (%d, [%s]) for domain %s!\n",
- ret, ldb_errstring(ctx->ldb), domain->name));
+ ret, ldb_errstring(sysdb->ldb), domain->name));
ret = EIO;
goto done;
}
@@ -1858,7 +1858,7 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new_fmt(msg, ctx->ldb,
+ msg->dn = ldb_dn_new_fmt(msg, sysdb->ldb,
SYSDB_TMPL_USER_BASE, domain->name);
if (!msg->dn) {
ret = ENOMEM;
@@ -1870,10 +1870,10 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
goto done;
}
/* do a synchronous add */
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("Failed to initialize DB (%d, [%s]) for domain %s!\n",
- ret, ldb_errstring(ctx->ldb), domain->name));
+ ret, ldb_errstring(sysdb->ldb), domain->name));
ret = EIO;
goto done;
}
@@ -1886,7 +1886,7 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
ret = ENOMEM;
goto done;
}
- msg->dn = ldb_dn_new_fmt(msg, ctx->ldb,
+ msg->dn = ldb_dn_new_fmt(msg, sysdb->ldb,
SYSDB_TMPL_GROUP_BASE, domain->name);
if (!msg->dn) {
ret = ENOMEM;
@@ -1898,10 +1898,10 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
goto done;
}
/* do a synchronous add */
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("Failed to initialize DB (%d, [%s]) for domain %s!\n",
- ret, ldb_errstring(ctx->ldb), domain->name));
+ ret, ldb_errstring(sysdb->ldb), domain->name));
ret = EIO;
goto done;
}
@@ -1913,8 +1913,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
* (such as enabling the memberOf plugin and
* the various indexes).
*/
- talloc_zfree(ctx->ldb);
- ret = sysdb_ldb_connect(ctx, ctx->ldb_file, &ctx->ldb);
+ talloc_zfree(sysdb->ldb);
+ ret = sysdb_ldb_connect(sysdb, sysdb->ldb_file, &sysdb->ldb);
if (ret != EOK) {
DEBUG(1, ("sysdb_ldb_connect failed.\n"));
}
@@ -1922,9 +1922,9 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
done:
talloc_free(tmp_ctx);
if (ret == EOK) {
- *_ctx = ctx;
+ *_ctx = sysdb;
} else {
- talloc_free(ctx);
+ talloc_free(sysdb);
}
return ret;
}
@@ -1937,7 +1937,7 @@ int sysdb_init(TALLOC_CTX *mem_ctx,
{
struct sysdb_ctx_list *ctx_list;
struct sss_domain_info *domains, *dom;
- struct sysdb_ctx *ctx;
+ struct sysdb_ctx *sysdb;
int ret;
ctx_list = talloc_zero(mem_ctx, struct sysdb_ctx_list);
@@ -1984,13 +1984,13 @@ int sysdb_init(TALLOC_CTX *mem_ctx,
ret = sysdb_domain_init_internal(ctx_list, dom,
ctx_list->db_path,
- allow_upgrade, &ctx);
+ allow_upgrade, &sysdb);
if (ret != EOK) {
talloc_zfree(ctx_list);
return ret;
}
- ctx_list->dbs[ctx_list->num_dbs] = ctx;
+ ctx_list->dbs[ctx_list->num_dbs] = sysdb;
ctx_list->num_dbs++;
}
if (ctx_list->num_dbs == 0) {
@@ -2015,7 +2015,7 @@ int sysdb_domain_init(TALLOC_CTX *mem_ctx,
int sysdb_list_init(TALLOC_CTX *mem_ctx,
const char *path,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sysdb_ctx_list **_list)
{
struct sysdb_ctx_list *list;
@@ -2034,7 +2034,7 @@ int sysdb_list_init(TALLOC_CTX *mem_ctx,
goto fail;
}
- if (ctx) {
+ if (sysdb) {
list->num_dbs = 1;
list->dbs = talloc_array(list, struct sysdb_ctx *, list->num_dbs);
if (!list->dbs) {
@@ -2043,7 +2043,7 @@ int sysdb_list_init(TALLOC_CTX *mem_ctx,
goto fail;
}
- list->dbs[0] = talloc_steal(list, ctx);
+ list->dbs[0] = talloc_steal(list, sysdb);
}
*_list = list;
@@ -2056,17 +2056,17 @@ fail:
int sysdb_get_ctx_from_list(struct sysdb_ctx_list *ctx_list,
struct sss_domain_info *domain,
- struct sysdb_ctx **ctx)
+ struct sysdb_ctx **sysdb)
{
int i;
for (i = 0; i < ctx_list->num_dbs; i++) {
if (ctx_list->dbs[i]->domain == domain) {
- *ctx = ctx_list->dbs[i];
+ *sysdb = ctx_list->dbs[i];
return EOK;
}
if (strcasecmp(ctx_list->dbs[i]->domain->name, domain->name) == 0) {
- *ctx = ctx_list->dbs[i];
+ *sysdb = ctx_list->dbs[i];
return EOK;
}
}
@@ -2193,7 +2193,7 @@ errno_t sysdb_attrs_to_list(TALLOC_CTX *memctx,
return EOK;
}
-errno_t sysdb_has_enumerated(struct sysdb_ctx *ctx,
+errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb,
struct sss_domain_info *dom,
bool *has_enumerated)
{
@@ -2212,7 +2212,7 @@ errno_t sysdb_has_enumerated(struct sysdb_ctx *ctx,
goto done;
}
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_DOM_BASE,
dom->name);
if (!base_dn) {
@@ -2220,7 +2220,7 @@ errno_t sysdb_has_enumerated(struct sysdb_ctx *ctx,
goto done;
}
- lret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
+ lret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_BASE, attributes, NULL);
if (lret != LDB_SUCCESS) {
ret = sysdb_error_to_errno(lret);
@@ -2257,7 +2257,7 @@ done:
return ret;
}
-errno_t sysdb_set_enumerated(struct sysdb_ctx *ctx,
+errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb,
struct sss_domain_info *dom,
bool enumerated)
{
@@ -2274,7 +2274,7 @@ errno_t sysdb_set_enumerated(struct sysdb_ctx *ctx,
goto done;
}
- dn = ldb_dn_new_fmt(tmp_ctx, ctx->ldb,
+ dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
SYSDB_DOM_BASE,
dom->name);
if (!dn) {
@@ -2282,7 +2282,7 @@ errno_t sysdb_set_enumerated(struct sysdb_ctx *ctx,
goto done;
}
- lret = ldb_search(ctx->ldb, tmp_ctx, &res,
+ lret = ldb_search(sysdb->ldb, tmp_ctx, &res,
dn, LDB_SCOPE_BASE,
NULL, NULL);
if (lret != LDB_SUCCESS) {
@@ -2323,9 +2323,9 @@ errno_t sysdb_set_enumerated(struct sysdb_ctx *ctx,
}
if (res->count) {
- lret = ldb_modify(ctx->ldb, msg);
+ lret = ldb_modify(sysdb->ldb, msg);
} else {
- lret = ldb_add(ctx->ldb, msg);
+ lret = ldb_add(sysdb->ldb, msg);
}
ret = sysdb_error_to_errno(lret);
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 1eac748c..84129fda 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -240,24 +240,24 @@ errno_t sysdb_attrs_primary_name_list(struct sysdb_ctx *sysdb,
int sysdb_error_to_errno(int ldberr);
/* DNs related helper functions */
-errno_t sysdb_get_rdn(struct sysdb_ctx *ctx, void *memctx,
+errno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, void *memctx,
const char *_dn, char **_name, char **_val);
-struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain, const char *name);
-struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain, const char *name);
-struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain, const char *name);
-struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain);
-errno_t sysdb_group_dn_name(struct sysdb_ctx *ctx, void *memctx,
+errno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, void *memctx,
const char *dn_str, char **name);
-struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain);
-struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain, const char *object_name,
const char *subtree_name);
-struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *ctx, void *memctx,
+struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, void *memctx,
const char *domain,
const char *subtree_name);
@@ -267,14 +267,14 @@ char *sysdb_group_strdn(TALLOC_CTX *memctx,
const char *domain, const char *name);
-struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *ctx);
+struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *sysdb);
int compare_ldb_dn_comp_num(const void *m1, const void *m2);
/* functions to start and finish transactions */
-int sysdb_transaction_start(struct sysdb_ctx *ctx);
-int sysdb_transaction_commit(struct sysdb_ctx *ctx);
-int sysdb_transaction_cancel(struct sysdb_ctx *ctx);
+int sysdb_transaction_start(struct sysdb_ctx *sysdb);
+int sysdb_transaction_commit(struct sysdb_ctx *sysdb);
+int sysdb_transaction_cancel(struct sysdb_ctx *sysdb);
/* Sysdb initialization.
* call this function *only* once to initialize the database and get
@@ -293,7 +293,7 @@ int sysdb_domain_init(TALLOC_CTX *mem_ctx,
int sysdb_list_init(TALLOC_CTX *mem_ctx,
const char *path,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sysdb_ctx_list **_list);
int sysdb_get_ctx_from_list(struct sysdb_ctx_list *ctx_list,
@@ -304,36 +304,36 @@ int sysdb_get_ctx_from_list(struct sysdb_ctx_list *ctx_list,
* These functions automatically starts an operation
* therefore they cannot be called within a transaction */
int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct ldb_result **res);
int sysdb_getpwuid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
uid_t uid,
struct ldb_result **res);
int sysdb_enumpwent(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
struct ldb_result **res);
int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct ldb_result **res);
int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
gid_t gid,
struct ldb_result **res);
int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
struct ldb_result **res);
@@ -350,26 +350,26 @@ struct sysdb_netgroup_ctx {
};
errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *netgroup,
struct ldb_result **res);
int sysdb_initgroups(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct ldb_result **res);
int sysdb_get_user_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attributes,
struct ldb_result **res);
int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *netgrname,
const char **attributes,
@@ -380,19 +380,19 @@ int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx,
* See sysdb_transaction_send()/_recv() */
/* Delete Entry */
-int sysdb_delete_entry(struct sysdb_ctx *ctx,
+int sysdb_delete_entry(struct sysdb_ctx *sysdb,
struct ldb_dn *dn,
bool ignore_not_found);
int sysdb_delete_recursive(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct ldb_dn *dn,
bool ignore_not_found);
/* Search Entry */
int sysdb_search_entry(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct ldb_dn *base_dn,
int scope,
const char *filter,
@@ -402,14 +402,14 @@ int sysdb_search_entry(TALLOC_CTX *mem_ctx,
/* Search User (by uid or name) */
int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
struct ldb_message **msg);
int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
uid_t uid,
const char **attrs,
@@ -417,14 +417,14 @@ int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx,
/* Search Group (by gid or name) */
int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
struct ldb_message **msg);
int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
gid_t gid,
const char **attrs,
@@ -432,7 +432,7 @@ int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx,
/* Search Netgroup (by name) */
int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
@@ -440,14 +440,14 @@ int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx,
/* Replace entry attrs */
int sysdb_set_entry_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct ldb_dn *entry_dn,
struct sysdb_attrs *attrs,
int mod_op);
/* Replace user attrs */
int sysdb_set_user_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
@@ -455,14 +455,14 @@ int sysdb_set_user_attr(TALLOC_CTX *mem_ctx,
/* Replace group attrs */
int sysdb_set_group_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
int mod_op);
/* Replace netgroup attrs */
-int sysdb_set_netgroup_attr(struct sysdb_ctx *ctx,
+int sysdb_set_netgroup_attr(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
@@ -470,13 +470,13 @@ int sysdb_set_netgroup_attr(struct sysdb_ctx *ctx,
/* Allocate a new id */
int sysdb_get_new_id(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
uint32_t *id);
/* Add user (only basic attrs and w/o checks) */
int sysdb_add_basic_user(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
uid_t uid, gid_t gid,
@@ -486,7 +486,7 @@ int sysdb_add_basic_user(TALLOC_CTX *mem_ctx,
/* Add user (all checks) */
int sysdb_add_user(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
uid_t uid, gid_t gid,
@@ -496,37 +496,37 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx,
struct sysdb_attrs *attrs,
int cache_timeout);
-int sysdb_add_fake_user(struct sysdb_ctx *ctx,
+int sysdb_add_fake_user(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char *original_dn);
/* Add group (only basic attrs and w/o checks) */
int sysdb_add_basic_group(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name, gid_t gid);
/* Add group (all checks) */
int sysdb_add_group(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name, gid_t gid,
struct sysdb_attrs *attrs,
int cache_timeout);
-int sysdb_add_incomplete_group(struct sysdb_ctx *ctx,
+int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
gid_t gid,
const char *original_dn, bool posix);
/* Add netgroup (only basic attrs and w/o checks) */
-int sysdb_add_basic_netgroup(struct sysdb_ctx *ctx,
+int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name, const char *description);
-int sysdb_add_netgroup(struct sysdb_ctx *ctx,
+int sysdb_add_netgroup(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char *description,
@@ -535,13 +535,13 @@ int sysdb_add_netgroup(struct sysdb_ctx *ctx,
/* mod_op must be either LDB_FLAG_MOD_ADD or LDB_FLAG_MOD_DELETE */
int sysdb_mod_group_member(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct ldb_dn *member_dn,
struct ldb_dn *group_dn,
int mod_op);
int sysdb_store_user(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char *pwd,
@@ -554,7 +554,7 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx,
uint64_t cache_timeout);
int sysdb_store_group(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
gid_t gid,
@@ -566,13 +566,13 @@ enum sysdb_member_type {
SYSDB_MEMBER_GROUP
};
-int sysdb_add_group_member(struct sysdb_ctx *ctx,
+int sysdb_add_group_member(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *group,
const char *member,
enum sysdb_member_type type);
-int sysdb_remove_group_member(struct sysdb_ctx *ctx,
+int sysdb_remove_group_member(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *group,
const char *member,
@@ -651,7 +651,7 @@ int sysdb_cache_auth(TALLOC_CTX *mem_ctx,
time_t *_delayed_until);
int sysdb_store_custom(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *object_name,
const char *subtree_name,
@@ -676,7 +676,7 @@ int sysdb_search_custom_by_name(TALLOC_CTX *mem_ctx,
struct ldb_message ***_msgs);
int sysdb_delete_custom(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *object_name,
const char *subtree_name);
@@ -742,11 +742,11 @@ errno_t sysdb_netgr_to_entries(TALLOC_CTX *mem_ctx,
errno_t sysdb_dn_sanitize(void *mem_ctx, const char *input,
char **sanitized);
-errno_t sysdb_has_enumerated(struct sysdb_ctx *ctx,
+errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb,
struct sss_domain_info *dom,
bool *has_enumerated);
-errno_t sysdb_set_enumerated(struct sysdb_ctx *ctx,
+errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb,
struct sss_domain_info *dom,
bool enumerated);
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index a7911de4..a998b100 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -77,13 +77,13 @@ static uint32_t get_attr_as_uint32(struct ldb_message *msg, const char *attr)
/* =Remove-Entry-From-Sysdb=============================================== */
-int sysdb_delete_entry(struct sysdb_ctx *ctx,
+int sysdb_delete_entry(struct sysdb_ctx *sysdb,
struct ldb_dn *dn,
bool ignore_not_found)
{
int ret;
- ret = ldb_delete(ctx->ldb, dn);
+ ret = ldb_delete(sysdb->ldb, dn);
switch (ret) {
case LDB_SUCCESS:
return EOK;
@@ -94,7 +94,7 @@ int sysdb_delete_entry(struct sysdb_ctx *ctx,
/* fall through */
default:
DEBUG(1, ("LDB Error: %s(%d)\nError Message: [%s]\n",
- ldb_strerror(ret), ret, ldb_errstring(ctx->ldb)));
+ ldb_strerror(ret), ret, ldb_errstring(sysdb->ldb)));
return sysdb_error_to_errno(ret);
}
}
@@ -102,7 +102,7 @@ int sysdb_delete_entry(struct sysdb_ctx *ctx,
/* =Remove-Subentries-From-Sysdb=========================================== */
int sysdb_delete_recursive(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct ldb_dn *dn,
bool ignore_not_found)
{
@@ -112,13 +112,13 @@ int sysdb_delete_recursive(TALLOC_CTX *mem_ctx,
int ret;
int i;
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret) {
ret = sysdb_error_to_errno(ret);
return ret;
}
- ret = sysdb_search_entry(mem_ctx, ctx, dn,
+ ret = sysdb_search_entry(mem_ctx, sysdb, dn,
LDB_SCOPE_SUBTREE, "(distinguishedName=*)",
no_attrs, &msgs_count, &msgs);
if (ret) {
@@ -140,7 +140,7 @@ int sysdb_delete_recursive(TALLOC_CTX *mem_ctx,
DEBUG(9 ,("Trying to delete [%s].\n",
ldb_dn_get_linearized(msgs[i]->dn)));
- ret = sysdb_delete_entry(ctx, msgs[i]->dn, false);
+ ret = sysdb_delete_entry(sysdb, msgs[i]->dn, false);
if (ret) {
goto done;
}
@@ -148,10 +148,10 @@ int sysdb_delete_recursive(TALLOC_CTX *mem_ctx,
done:
if (ret == EOK) {
- ret = ldb_transaction_commit(ctx->ldb);
+ ret = ldb_transaction_commit(sysdb->ldb);
ret = sysdb_error_to_errno(ret);
} else {
- ldb_transaction_cancel(ctx->ldb);
+ ldb_transaction_cancel(sysdb->ldb);
}
return ret;
}
@@ -160,7 +160,7 @@ done:
/* =Search-Entry========================================================== */
int sysdb_search_entry(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct ldb_dn *base_dn,
int scope,
const char *filter,
@@ -171,7 +171,7 @@ int sysdb_search_entry(TALLOC_CTX *mem_ctx,
struct ldb_result *res;
int ret;
- ret = ldb_search(ctx->ldb, mem_ctx, &res,
+ ret = ldb_search(sysdb->ldb, mem_ctx, &res,
base_dn, scope, attrs,
filter?"%s":NULL, filter);
if (ret) {
@@ -192,7 +192,7 @@ int sysdb_search_entry(TALLOC_CTX *mem_ctx,
/* =Search-User-by-[UID/NAME]============================================= */
int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
@@ -210,13 +210,13 @@ int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_user_dn(ctx, tmpctx, domain->name, name);
+ basedn = sysdb_user_dn(sysdb, tmpctx, domain->name, name);
if (!basedn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_search_entry(tmpctx, ctx, basedn, LDB_SCOPE_BASE, NULL,
+ ret = sysdb_search_entry(tmpctx, sysdb, basedn, LDB_SCOPE_BASE, NULL,
attrs?attrs:def_attrs, &msgs_count, &msgs);
if (ret) {
goto done;
@@ -233,7 +233,7 @@ done:
}
int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
uid_t uid,
const char **attrs,
@@ -252,7 +252,7 @@ int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ basedn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_USER_BASE, domain->name);
if (!basedn) {
ret = ENOMEM;
@@ -269,7 +269,7 @@ int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx,
* There is a bug in LDB that makes ONELEVEL searches extremely
* slow (it ignores indexing)
*/
- ret = sysdb_search_entry(tmpctx, ctx, basedn, LDB_SCOPE_SUBTREE, filter,
+ ret = sysdb_search_entry(tmpctx, sysdb, basedn, LDB_SCOPE_SUBTREE, filter,
attrs?attrs:def_attrs, &msgs_count, &msgs);
if (ret) {
goto done;
@@ -290,7 +290,7 @@ done:
/* =Search-Group-by-[GID/NAME]============================================ */
int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
@@ -308,13 +308,13 @@ int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_group_dn(ctx, tmpctx, domain->name, name);
+ basedn = sysdb_group_dn(sysdb, tmpctx, domain->name, name);
if (!basedn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_search_entry(tmpctx, ctx, basedn, LDB_SCOPE_BASE, NULL,
+ ret = sysdb_search_entry(tmpctx, sysdb, basedn, LDB_SCOPE_BASE, NULL,
attrs?attrs:def_attrs, &msgs_count, &msgs);
if (ret) {
goto done;
@@ -331,7 +331,7 @@ done:
}
int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
gid_t gid,
const char **attrs,
@@ -350,7 +350,7 @@ int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ basedn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_GROUP_BASE, domain->name);
if (!basedn) {
ret = ENOMEM;
@@ -367,7 +367,7 @@ int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx,
* There is a bug in LDB that makes ONELEVEL searches extremely
* slow (it ignores indexing)
*/
- ret = sysdb_search_entry(tmpctx, ctx, basedn, LDB_SCOPE_SUBTREE, filter,
+ ret = sysdb_search_entry(tmpctx, sysdb, basedn, LDB_SCOPE_SUBTREE, filter,
attrs?attrs:def_attrs, &msgs_count, &msgs);
if (ret) {
goto done;
@@ -388,7 +388,7 @@ done:
/* =Search-Group-by-Name============================================ */
int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
@@ -406,13 +406,13 @@ int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_netgroup_dn(ctx, tmpctx, domain->name, name);
+ basedn = sysdb_netgroup_dn(sysdb, tmpctx, domain->name, name);
if (!basedn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_search_entry(tmpctx, ctx, basedn, LDB_SCOPE_BASE, NULL,
+ ret = sysdb_search_entry(tmpctx, sysdb, basedn, LDB_SCOPE_BASE, NULL,
attrs?attrs:def_attrs, &msgs_count, &msgs);
if (ret) {
goto done;
@@ -431,7 +431,7 @@ done:
/* =Replace-Attributes-On-Entry=========================================== */
int sysdb_set_entry_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct ldb_dn *entry_dn,
struct sysdb_attrs *attrs,
int mod_op)
@@ -463,7 +463,7 @@ int sysdb_set_entry_attr(TALLOC_CTX *mem_ctx,
msg->num_elements = attrs->num;
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
ret = sysdb_error_to_errno(ret);
fail:
@@ -478,7 +478,7 @@ fail:
/* =Replace-Attributes-On-User============================================ */
int sysdb_set_user_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
@@ -487,22 +487,22 @@ int sysdb_set_user_attr(TALLOC_CTX *mem_ctx,
struct ldb_dn *dn;
if (!domain) {
- domain = ctx->domain;
+ domain = sysdb->domain;
}
- dn = sysdb_user_dn(ctx, mem_ctx, domain->name, name);
+ dn = sysdb_user_dn(sysdb, mem_ctx, domain->name, name);
if (!dn) {
return ENOMEM;
}
- return sysdb_set_entry_attr(mem_ctx, ctx, dn, attrs, mod_op);
+ return sysdb_set_entry_attr(mem_ctx, sysdb, dn, attrs, mod_op);
}
/* =Replace-Attributes-On-Group=========================================== */
int sysdb_set_group_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
@@ -510,17 +510,17 @@ int sysdb_set_group_attr(TALLOC_CTX *mem_ctx,
{
struct ldb_dn *dn;
- dn = sysdb_group_dn(ctx, mem_ctx, domain->name, name);
+ dn = sysdb_group_dn(sysdb, mem_ctx, domain->name, name);
if (!dn) {
return ENOMEM;
}
- return sysdb_set_entry_attr(mem_ctx, ctx, dn, attrs, mod_op);
+ return sysdb_set_entry_attr(mem_ctx, sysdb, dn, attrs, mod_op);
}
/* =Replace-Attributes-On-Netgroup=========================================== */
-int sysdb_set_netgroup_attr(struct sysdb_ctx *ctx,
+int sysdb_set_netgroup_attr(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
@@ -536,16 +536,16 @@ int sysdb_set_netgroup_attr(struct sysdb_ctx *ctx,
}
if (domain == NULL) {
- domain = ctx->domain;
+ domain = sysdb->domain;
}
- dn = sysdb_netgroup_dn(ctx, tmp_ctx, domain->name, name);
+ dn = sysdb_netgroup_dn(sysdb, tmp_ctx, domain->name, name);
if (!dn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_set_entry_attr(tmp_ctx, ctx, dn, attrs, mod_op);
+ ret = sysdb_set_entry_attr(tmp_ctx, sysdb, dn, attrs, mod_op);
done:
talloc_free(tmp_ctx);
@@ -555,7 +555,7 @@ done:
/* =Get-New-ID============================================================ */
int sysdb_get_new_id(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
uint32_t *_id)
{
@@ -577,20 +577,20 @@ int sysdb_get_new_id(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- base_dn = sysdb_domain_dn(ctx, tmpctx, domain->name);
+ base_dn = sysdb_domain_dn(sysdb, tmpctx, domain->name);
if (!base_dn) {
talloc_zfree(tmpctx);
return ENOMEM;
}
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret) {
talloc_zfree(tmpctx);
ret = sysdb_error_to_errno(ret);
return ret;
}
- ret = sysdb_search_entry(tmpctx, ctx, base_dn, LDB_SCOPE_BASE,
+ ret = sysdb_search_entry(tmpctx, sysdb, base_dn, LDB_SCOPE_BASE,
SYSDB_NEXTID_FILTER, attrs_1, &count, &msgs);
switch (ret) {
case EOK:
@@ -646,7 +646,7 @@ int sysdb_get_new_id(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sysdb_search_entry(tmpctx, ctx, base_dn, LDB_SCOPE_SUBTREE,
+ ret = sysdb_search_entry(tmpctx, sysdb, base_dn, LDB_SCOPE_SUBTREE,
filter, attrs_2, &count, &msgs);
switch (ret) {
/* if anything was found, find the maximum and increment past it */
@@ -698,17 +698,17 @@ int sysdb_get_new_id(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
ret = sysdb_error_to_errno(ret);
*_id = new_id;
done:
if (ret == EOK) {
- ret = ldb_transaction_commit(ctx->ldb);
+ ret = ldb_transaction_commit(sysdb->ldb);
ret = sysdb_error_to_errno(ret);
} else {
- ldb_transaction_cancel(ctx->ldb);
+ ldb_transaction_cancel(sysdb->ldb);
}
if (ret) {
DEBUG(6, ("Error: %d (%s)\n", ret, strerror(ret)));
@@ -721,7 +721,7 @@ done:
/* =Add-Basic-User-NO-CHECKS============================================== */
int sysdb_add_basic_user(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
uid_t uid, gid_t gid,
@@ -738,7 +738,7 @@ int sysdb_add_basic_user(TALLOC_CTX *mem_ctx,
}
/* user dn */
- msg->dn = sysdb_user_dn(ctx, msg, domain->name, name);
+ msg->dn = sysdb_user_dn(sysdb, msg, domain->name, name);
if (!msg->dn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -781,7 +781,7 @@ int sysdb_add_basic_user(TALLOC_CTX *mem_ctx,
(unsigned long)time(NULL));
if (ret) goto done;
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
ret = sysdb_error_to_errno(ret);
done:
@@ -796,7 +796,7 @@ done:
/* =Add-User-Function===================================================== */
int sysdb_add_user(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
uid_t uid, gid_t gid,
@@ -813,7 +813,7 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx,
time_t now;
int ret;
- if (ctx->mpg) {
+ if (sysdb->mpg) {
if (gid != 0) {
DEBUG(0, ("Cannot add user with arbitrary GID in MPG domain!\n"));
return EINVAL;
@@ -840,20 +840,20 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret) {
ret = sysdb_error_to_errno(ret);
talloc_free(tmpctx);
return ret;
}
- if (ctx->mpg) {
+ if (sysdb->mpg) {
/* In MPG domains you can't have groups with the same name as users,
* search if a group with the same name exists.
* Don't worry about users, if we try to add a user with the same
* name the operation will fail */
- ret = sysdb_search_group_by_name(tmpctx, ctx,
+ ret = sysdb_search_group_by_name(tmpctx, sysdb,
domain, name, NULL, &msg);
if (ret != ENOENT) {
if (ret == EOK) ret = EEXIST;
@@ -863,7 +863,7 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx,
/* check no other user with the same uid exist */
if (uid != 0) {
- ret = sysdb_search_user_by_uid(tmpctx, ctx,
+ ret = sysdb_search_user_by_uid(tmpctx, sysdb,
domain, uid, NULL, &msg);
if (ret != ENOENT) {
if (ret == EOK) ret = EEXIST;
@@ -872,13 +872,13 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx,
}
/* try to add the user */
- ret = sysdb_add_basic_user(tmpctx, ctx,
+ ret = sysdb_add_basic_user(tmpctx, sysdb,
domain, name, uid, gid,
gecos, homedir, shell);
if (ret) goto done;
if (uid == 0) {
- ret = sysdb_get_new_id(tmpctx, ctx, domain, &id);
+ ret = sysdb_get_new_id(tmpctx, sysdb, domain, &id);
if (ret) goto done;
id_attrs = sysdb_new_attrs(tmpctx);
@@ -889,12 +889,12 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx,
ret = sysdb_attrs_add_uint32(id_attrs, SYSDB_UIDNUM, id);
if (ret) goto done;
- if (ctx->mpg) {
+ if (sysdb->mpg) {
ret = sysdb_attrs_add_uint32(id_attrs, SYSDB_GIDNUM, id);
if (ret) goto done;
}
- ret = sysdb_set_user_attr(tmpctx, ctx,
+ ret = sysdb_set_user_attr(tmpctx, sysdb,
domain, name, id_attrs, SYSDB_MOD_REP);
goto done;
}
@@ -917,22 +917,22 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx,
(now + cache_timeout) : 0));
if (ret) goto done;
- ret = sysdb_set_user_attr(tmpctx, ctx,
+ ret = sysdb_set_user_attr(tmpctx, sysdb,
domain, name, attrs, SYSDB_MOD_REP);
done:
if (ret == EOK) {
- ret = ldb_transaction_commit(ctx->ldb);
+ ret = ldb_transaction_commit(sysdb->ldb);
ret = sysdb_error_to_errno(ret);
} else {
DEBUG(6, ("Error: %d (%s)\n", ret, strerror(ret)));
- ldb_transaction_cancel(ctx->ldb);
+ ldb_transaction_cancel(sysdb->ldb);
}
talloc_zfree(tmpctx);
return ret;
}
-int sysdb_add_fake_user(struct sysdb_ctx *ctx,
+int sysdb_add_fake_user(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char *original_dn)
@@ -953,7 +953,7 @@ int sysdb_add_fake_user(struct sysdb_ctx *ctx,
}
/* user dn */
- msg->dn = sysdb_user_dn(ctx, msg, domain->name, name);
+ msg->dn = sysdb_user_dn(sysdb, msg, domain->name, name);
if (!msg->dn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -990,7 +990,7 @@ int sysdb_add_fake_user(struct sysdb_ctx *ctx,
if (ret) goto done;
}
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
ret = sysdb_error_to_errno(ret);
done:
@@ -1004,7 +1004,7 @@ done:
/* =Add-Basic-Group-NO-CHECKS============================================= */
int sysdb_add_basic_group(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name, gid_t gid)
{
@@ -1017,7 +1017,7 @@ int sysdb_add_basic_group(TALLOC_CTX *mem_ctx,
}
/* group dn */
- msg->dn = sysdb_group_dn(ctx, msg, domain->name, name);
+ msg->dn = sysdb_group_dn(sysdb, msg, domain->name, name);
if (!msg->dn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -1036,7 +1036,7 @@ int sysdb_add_basic_group(TALLOC_CTX *mem_ctx,
(unsigned long)time(NULL));
if (ret) goto done;
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
ret = sysdb_error_to_errno(ret);
done:
@@ -1051,7 +1051,7 @@ done:
/* =Add-Group-Function==================================================== */
int sysdb_add_group(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name, gid_t gid,
struct sysdb_attrs *attrs,
@@ -1076,20 +1076,20 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret) {
ret = sysdb_error_to_errno(ret);
talloc_free(tmpctx);
return ret;
}
- if (ctx->mpg) {
+ if (sysdb->mpg) {
/* In MPG domains you can't have groups with the same name as users,
* search if a group with the same name exists.
* Don't worry about users, if we try to add a user with the same
* name the operation will fail */
- ret = sysdb_search_user_by_name(tmpctx, ctx,
+ ret = sysdb_search_user_by_name(tmpctx, sysdb,
domain, name, NULL, &msg);
if (ret != ENOENT) {
if (ret == EOK) ret = EEXIST;
@@ -1099,7 +1099,7 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx,
/* check no other groups with the same gid exist */
if (gid != 0) {
- ret = sysdb_search_group_by_gid(tmpctx, ctx,
+ ret = sysdb_search_group_by_gid(tmpctx, sysdb,
domain, gid, NULL, &msg);
if (ret != ENOENT) {
if (ret == EOK) ret = EEXIST;
@@ -1108,7 +1108,7 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx,
}
/* try to add the group */
- ret = sysdb_add_basic_group(tmpctx, ctx, domain, name, gid);
+ ret = sysdb_add_basic_group(tmpctx, sysdb, domain, name, gid);
if (ret) goto done;
if (!attrs) {
@@ -1129,7 +1129,7 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx,
}
if (posix && gid == 0) {
- ret = sysdb_get_new_id(tmpctx, ctx, domain, &id);
+ ret = sysdb_get_new_id(tmpctx, sysdb, domain, &id);
if (ret) goto done;
ret = sysdb_attrs_add_uint32(attrs, SYSDB_GIDNUM, id);
@@ -1146,22 +1146,22 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx,
(now + cache_timeout) : 0));
if (ret) goto done;
- ret = sysdb_set_group_attr(tmpctx, ctx,
+ ret = sysdb_set_group_attr(tmpctx, sysdb,
domain, name, attrs, SYSDB_MOD_REP);
done:
if (ret == EOK) {
- ret = ldb_transaction_commit(ctx->ldb);
+ ret = ldb_transaction_commit(sysdb->ldb);
ret = sysdb_error_to_errno(ret);
} else {
DEBUG(6, ("Error: %d (%s)\n", ret, strerror(ret)));
- ldb_transaction_cancel(ctx->ldb);
+ ldb_transaction_cancel(sysdb->ldb);
}
talloc_zfree(tmpctx);
return ret;
}
-int sysdb_add_incomplete_group(struct sysdb_ctx *ctx,
+int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
gid_t gid,
@@ -1179,7 +1179,7 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *ctx,
}
/* try to add the group */
- ret = sysdb_add_basic_group(tmpctx, ctx, domain, name, gid);
+ ret = sysdb_add_basic_group(tmpctx, sysdb, domain, name, gid);
if (ret) goto done;
attrs = sysdb_new_attrs(tmpctx);
@@ -1205,7 +1205,7 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *ctx,
if (ret) goto done;
}
- ret = sysdb_set_group_attr(tmpctx, ctx,
+ ret = sysdb_set_group_attr(tmpctx, sysdb,
domain, name, attrs, SYSDB_MOD_REP);
done:
@@ -1220,7 +1220,7 @@ done:
/* mod_op must be either SYSDB_MOD_ADD or SYSDB_MOD_DEL */
int sysdb_mod_group_member(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct ldb_dn *member_dn,
struct ldb_dn *group_dn,
int mod_op)
@@ -1250,7 +1250,7 @@ int sysdb_mod_group_member(TALLOC_CTX *mem_ctx,
ERROR_OUT(ret, EINVAL, fail);
}
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
ret = sysdb_error_to_errno(ret);
fail:
@@ -1263,7 +1263,7 @@ fail:
/* =Add-Basic-Netgroup-NO-CHECKS============================================= */
-int sysdb_add_basic_netgroup(struct sysdb_ctx *ctx,
+int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name, const char *description)
{
@@ -1276,7 +1276,7 @@ int sysdb_add_basic_netgroup(struct sysdb_ctx *ctx,
}
/* netgroup dn */
- msg->dn = sysdb_netgroup_dn(ctx, msg, domain->name, name);
+ msg->dn = sysdb_netgroup_dn(sysdb, msg, domain->name, name);
if (!msg->dn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -1299,7 +1299,7 @@ int sysdb_add_basic_netgroup(struct sysdb_ctx *ctx,
(unsigned long) time(NULL));
if (ret) goto done;
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
ret = sysdb_error_to_errno(ret);
done:
@@ -1313,7 +1313,7 @@ done:
/* =Add-Netgroup-Function==================================================== */
-int sysdb_add_netgroup(struct sysdb_ctx *ctx,
+int sysdb_add_netgroup(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char *description,
@@ -1329,7 +1329,7 @@ int sysdb_add_netgroup(struct sysdb_ctx *ctx,
return ENOMEM;
}
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret) {
ret = sysdb_error_to_errno(ret);
talloc_free(tmp_ctx);
@@ -1337,7 +1337,7 @@ int sysdb_add_netgroup(struct sysdb_ctx *ctx,
}
/* try to add the netgroup */
- ret = sysdb_add_basic_netgroup(ctx, domain, name, description);
+ ret = sysdb_add_basic_netgroup(sysdb, domain, name, description);
if (ret && ret != EEXIST) goto done;
if (!attrs) {
@@ -1358,17 +1358,17 @@ int sysdb_add_netgroup(struct sysdb_ctx *ctx,
(now + cache_timeout) : 0));
if (ret) goto done;
- ret = sysdb_set_netgroup_attr(ctx, domain, name, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_netgroup_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP);
done:
if (ret == EOK) {
- ret = ldb_transaction_commit(ctx->ldb);
+ ret = ldb_transaction_commit(sysdb->ldb);
ret = sysdb_error_to_errno(ret);
}
if (ret != EOK) {
DEBUG(6, ("Error: %d (%s)\n", ret, strerror(ret)));
- ldb_transaction_cancel(ctx->ldb);
+ ldb_transaction_cancel(sysdb->ldb);
}
talloc_zfree(tmp_ctx);
return ret;
@@ -1380,7 +1380,7 @@ done:
* this will just remove it */
int sysdb_store_user(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char *pwd,
@@ -1405,7 +1405,7 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx,
}
if (!domain) {
- domain = ctx->domain;
+ domain = sysdb->domain;
}
if (!attrs) {
@@ -1421,12 +1421,12 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx,
if (ret) goto done;
}
- ret = sysdb_transaction_start(ctx);
+ ret = sysdb_transaction_start(sysdb);
if (ret != EOK) goto done;
in_transaction = true;
- ret = sysdb_search_user_by_name(tmpctx, ctx,
+ ret = sysdb_search_user_by_name(tmpctx, sysdb,
domain, name, NULL, &msg);
if (ret && ret != ENOENT) {
goto done;
@@ -1434,7 +1434,7 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx,
if (ret == ENOENT) {
/* users doesn't exist, turn into adding a user */
- ret = sysdb_add_user(tmpctx, ctx, domain, name, uid, gid,
+ ret = sysdb_add_user(tmpctx, sysdb, domain, name, uid, gid,
gecos, homedir, shell, attrs, cache_timeout);
goto done;
}
@@ -1450,7 +1450,7 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx,
if (ret) goto done;
}
- if (uid && !gid && ctx->mpg) {
+ if (uid && !gid && sysdb->mpg) {
ret = sysdb_attrs_add_uint32(attrs, SYSDB_GIDNUM, uid);
if (ret) goto done;
}
@@ -1480,12 +1480,12 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx,
(now + cache_timeout) : 0));
if (ret) goto done;
- ret = sysdb_set_user_attr(tmpctx, ctx,
+ ret = sysdb_set_user_attr(tmpctx, sysdb,
domain, name, attrs, SYSDB_MOD_REP);
if (ret != EOK) goto done;
if (remove_attrs) {
- ret = sysdb_remove_attrs(ctx, domain, name,
+ ret = sysdb_remove_attrs(sysdb, domain, name,
SYSDB_MEMBER_USER,
remove_attrs);
if (ret != EOK) {
@@ -1496,14 +1496,14 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx,
done:
if (in_transaction) {
if (ret == EOK) {
- sret = sysdb_transaction_commit(ctx);
+ sret = sysdb_transaction_commit(sysdb);
if (sret != EOK) {
DEBUG(2, ("Could not commit transaction\n"));
}
}
if (ret != EOK || sret != EOK){
- sret = sysdb_transaction_cancel(ctx);
+ sret = sysdb_transaction_cancel(sysdb);
if (sret != EOK) {
DEBUG(2, ("Could not cancel transaction\n"));
}
@@ -1521,7 +1521,7 @@ done:
/* this function does not check that all user members are actually present */
int sysdb_store_group(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
gid_t gid,
@@ -1542,10 +1542,10 @@ int sysdb_store_group(TALLOC_CTX *mem_ctx,
}
if (!domain) {
- domain = ctx->domain;
+ domain = sysdb->domain;
}
- ret = sysdb_search_group_by_name(tmpctx, ctx,
+ ret = sysdb_search_group_by_name(tmpctx, sysdb,
domain, name, src_attrs, &msg);
if (ret && ret != ENOENT) {
goto done;
@@ -1567,7 +1567,7 @@ int sysdb_store_group(TALLOC_CTX *mem_ctx,
if (new_group) {
/* group doesn't exist, turn into adding a group */
- ret = sysdb_add_group(tmpctx, ctx,
+ ret = sysdb_add_group(tmpctx, sysdb,
domain, name, gid, attrs, cache_timeout);
goto done;
}
@@ -1588,7 +1588,7 @@ int sysdb_store_group(TALLOC_CTX *mem_ctx,
(now + cache_timeout) : 0));
if (ret) goto done;
- ret = sysdb_set_group_attr(tmpctx, ctx,
+ ret = sysdb_set_group_attr(tmpctx, sysdb,
domain, name,
attrs, SYSDB_MOD_REP);
@@ -1604,7 +1604,7 @@ done:
/* =Add-User-to-Group(Native/Legacy)====================================== */
-int sysdb_add_group_member(struct sysdb_ctx *ctx,
+int sysdb_add_group_member(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *group,
const char *member,
@@ -1618,20 +1618,20 @@ int sysdb_add_group_member(struct sysdb_ctx *ctx,
return ENOMEM;
}
- group_dn = sysdb_group_dn(ctx, tmp_ctx, domain->name, group);
+ group_dn = sysdb_group_dn(sysdb, tmp_ctx, domain->name, group);
if (!group_dn) {
ret = ENOMEM;
goto done;
}
if (type == SYSDB_MEMBER_USER) {
- member_dn = sysdb_user_dn(ctx, tmp_ctx, domain->name, member);
+ member_dn = sysdb_user_dn(sysdb, tmp_ctx, domain->name, member);
if (!member_dn) {
ret = ENOMEM;
goto done;
}
} else if (type == SYSDB_MEMBER_GROUP) {
- member_dn = sysdb_group_dn(ctx, tmp_ctx, domain->name, member);
+ member_dn = sysdb_group_dn(sysdb, tmp_ctx, domain->name, member);
if (!member_dn) {
ret = ENOMEM;
goto done;
@@ -1641,7 +1641,7 @@ int sysdb_add_group_member(struct sysdb_ctx *ctx,
goto done;
}
- ret = sysdb_mod_group_member(tmp_ctx, ctx,
+ ret = sysdb_mod_group_member(tmp_ctx, sysdb,
member_dn, group_dn,
SYSDB_MOD_ADD);
@@ -1653,7 +1653,7 @@ done:
/* =Remove-member-from-Group(Native/Legacy)=============================== */
-int sysdb_remove_group_member(struct sysdb_ctx *ctx,
+int sysdb_remove_group_member(struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *group,
const char *member,
@@ -1667,20 +1667,20 @@ int sysdb_remove_group_member(struct sysdb_ctx *ctx,
return ENOMEM;
}
- group_dn = sysdb_group_dn(ctx, tmp_ctx, domain->name, group);
+ group_dn = sysdb_group_dn(sysdb, tmp_ctx, domain->name, group);
if (!group_dn) {
ret = ENOMEM;
goto done;
}
if (type == SYSDB_MEMBER_USER) {
- member_dn = sysdb_user_dn(ctx, tmp_ctx, domain->name, member);
+ member_dn = sysdb_user_dn(sysdb, tmp_ctx, domain->name, member);
if (!member_dn) {
ret = ENOMEM;
goto done;
}
} else if (type == SYSDB_MEMBER_GROUP) {
- member_dn = sysdb_group_dn(ctx, tmp_ctx, domain->name, member);
+ member_dn = sysdb_group_dn(sysdb, tmp_ctx, domain->name, member);
if (!member_dn) {
ret = ENOMEM;
goto done;
@@ -1689,7 +1689,7 @@ int sysdb_remove_group_member(struct sysdb_ctx *ctx,
ret = EINVAL;
goto done;
}
- ret = sysdb_mod_group_member(tmp_ctx, ctx,
+ ret = sysdb_mod_group_member(tmp_ctx, sysdb,
member_dn, group_dn,
SYSDB_MOD_DEL);
done:
@@ -1858,7 +1858,7 @@ done:
/* =Custom Store (replaces-existing-data)================== */
int sysdb_store_custom(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *object_name,
const char *subtree_name,
@@ -1878,7 +1878,7 @@ int sysdb_store_custom(TALLOC_CTX *mem_ctx,
return EINVAL;
}
- ret = ldb_transaction_start(ctx->ldb);
+ ret = ldb_transaction_start(sysdb->ldb);
if (ret) {
return sysdb_error_to_errno(ret);
}
@@ -1889,7 +1889,7 @@ int sysdb_store_custom(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sysdb_search_custom_by_name(tmpctx, ctx,
+ ret = sysdb_search_custom_by_name(tmpctx, sysdb,
domain, object_name, subtree_name,
search_attrs, &resp_count, &resp);
if (ret != EOK && ret != ENOENT) {
@@ -1906,7 +1906,7 @@ int sysdb_store_custom(TALLOC_CTX *mem_ctx,
goto done;
}
- msg->dn = sysdb_custom_dn(ctx, tmpctx,
+ msg->dn = sysdb_custom_dn(sysdb, tmpctx,
domain->name, object_name, subtree_name);
if (!msg->dn) {
DEBUG(1, ("sysdb_custom_dn failed.\n"));
@@ -1936,22 +1936,22 @@ int sysdb_store_custom(TALLOC_CTX *mem_ctx,
msg->num_elements = attrs->num;
if (add_object) {
- ret = ldb_add(ctx->ldb, msg);
+ ret = ldb_add(sysdb->ldb, msg);
} else {
- ret = ldb_modify(ctx->ldb, msg);
+ ret = ldb_modify(sysdb->ldb, msg);
}
if (ret != LDB_SUCCESS) {
DEBUG(1, ("Failed to store custmo entry: %s(%d)[%s]\n",
- ldb_strerror(ret), ret, ldb_errstring(ctx->ldb)));
+ ldb_strerror(ret), ret, ldb_errstring(sysdb->ldb)));
ret = sysdb_error_to_errno(ret);
}
done:
if (ret) {
DEBUG(6, ("Error: %d (%s)\n", ret, strerror(ret)));
- ldb_transaction_cancel(ctx->ldb);
+ ldb_transaction_cancel(sysdb->ldb);
} else {
- ret = ldb_transaction_commit(ctx->ldb);
+ ret = ldb_transaction_commit(sysdb->ldb);
ret = sysdb_error_to_errno(ret);
}
talloc_zfree(tmpctx);
@@ -1961,7 +1961,7 @@ done:
/* = Custom Delete======================================= */
int sysdb_delete_custom(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *object_name,
const char *subtree_name)
@@ -1979,14 +1979,14 @@ int sysdb_delete_custom(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- dn = sysdb_custom_dn(ctx, tmpctx, domain->name, object_name, subtree_name);
+ dn = sysdb_custom_dn(sysdb, tmpctx, domain->name, object_name, subtree_name);
if (dn == NULL) {
DEBUG(1, ("sysdb_custom_dn failed.\n"));
ret = ENOMEM;
goto done;
}
- ret = ldb_delete(ctx->ldb, dn);
+ ret = ldb_delete(sysdb->ldb, dn);
switch (ret) {
case LDB_SUCCESS:
@@ -1996,7 +1996,7 @@ int sysdb_delete_custom(TALLOC_CTX *mem_ctx,
default:
DEBUG(1, ("LDB Error: %s(%d)\nError Message: [%s]\n",
- ldb_strerror(ret), ret, ldb_errstring(ctx->ldb)));
+ ldb_strerror(ret), ret, ldb_errstring(sysdb->ldb)));
ret = sysdb_error_to_errno(ret);
break;
}
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index dfae4ddf..8705b83d 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -28,7 +28,7 @@
/* users */
int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct ldb_result **_res)
@@ -49,7 +49,7 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_USER_BASE, domain->name);
if (!base_dn) {
ret = ENOMEM;
@@ -61,7 +61,7 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
+ ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attrs, SYSDB_PWNAM_FILTER,
sanitized_name);
if (ret) {
@@ -77,7 +77,7 @@ done:
}
int sysdb_getpwuid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
uid_t uid,
struct ldb_result **_res)
@@ -98,14 +98,14 @@ int sysdb_getpwuid(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_USER_BASE, domain->name);
if (!base_dn) {
ret = ENOMEM;
goto done;
}
- ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
+ ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attrs, SYSDB_PWUID_FILTER, ul_uid);
if (ret) {
ret = sysdb_error_to_errno(ret);
@@ -120,7 +120,7 @@ done:
}
int sysdb_enumpwent(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
struct ldb_result **_res)
{
@@ -139,14 +139,14 @@ int sysdb_enumpwent(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_USER_BASE, domain->name);
if (!base_dn) {
ret = ENOMEM;
goto done;
}
- ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
+ ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attrs, SYSDB_PWENT_FILTER);
if (ret) {
ret = sysdb_error_to_errno(ret);
@@ -205,7 +205,7 @@ static int mpg_res_convert(struct ldb_result *res)
}
int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct ldb_result **_res)
@@ -227,13 +227,13 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- if (ctx->mpg) {
+ if (sysdb->mpg) {
fmt_filter = SYSDB_GRNAM_MPG_FILTER;
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_DOM_BASE, domain->name);
} else {
fmt_filter = SYSDB_GRNAM_FILTER;
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_GROUP_BASE, domain->name);
}
if (!base_dn) {
@@ -246,7 +246,7 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
+ ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attrs, fmt_filter,
sanitized_name);
if (ret) {
@@ -267,7 +267,7 @@ done:
}
int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
gid_t gid,
struct ldb_result **_res)
@@ -289,13 +289,13 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- if (ctx->mpg) {
+ if (sysdb->mpg) {
fmt_filter = SYSDB_GRGID_MPG_FILTER;
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_DOM_BASE, domain->name);
} else {
fmt_filter = SYSDB_GRGID_FILTER;
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_GROUP_BASE, domain->name);
}
if (!base_dn) {
@@ -303,7 +303,7 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
+ ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attrs, fmt_filter, ul_gid);
if (ret) {
ret = sysdb_error_to_errno(ret);
@@ -323,7 +323,7 @@ done:
}
int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
struct ldb_result **_res)
{
@@ -343,13 +343,13 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- if (ctx->mpg) {
+ if (sysdb->mpg) {
fmt_filter = SYSDB_GRENT_MPG_FILTER;
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_DOM_BASE, domain->name);
} else {
fmt_filter = SYSDB_GRENT_FILTER;
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_GROUP_BASE, domain->name);
}
if (!base_dn) {
@@ -357,7 +357,7 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
+ ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attrs, fmt_filter);
if (ret) {
ret = sysdb_error_to_errno(ret);
@@ -377,7 +377,7 @@ done:
}
int sysdb_initgroups(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
struct ldb_result **_res)
@@ -396,7 +396,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- ret = sysdb_getpwnam(tmpctx, ctx, domain, name, &res);
+ ret = sysdb_getpwnam(tmpctx, sysdb, domain, name, &res);
if (ret != EOK) {
DEBUG(1, ("sysdb_getpwnam failed: [%d][%s]\n",
ret, strerror(ret)));
@@ -450,7 +450,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx,
control->src_attr_len = strlen(control->source_attribute);
ctrl[0]->data = control;
- ret = ldb_build_search_req(&req, ctx->ldb, tmpctx,
+ ret = ldb_build_search_req(&req, sysdb->ldb, tmpctx,
user_dn, LDB_SCOPE_BASE,
SYSDB_INITGR_FILTER, attrs, ctrl,
res, ldb_search_default_callback,
@@ -460,7 +460,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = ldb_request(ctx->ldb, req);
+ ret = ldb_request(sysdb->ldb, req);
if (ret == LDB_SUCCESS) {
ret = ldb_wait(req->handle, LDB_WAIT_ALL);
}
@@ -477,7 +477,7 @@ done:
}
int sysdb_get_user_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attributes,
@@ -498,7 +498,7 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_USER_BASE, domain->name);
if (!base_dn) {
ret = ENOMEM;
@@ -510,7 +510,7 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = ldb_search(ctx->ldb, tmpctx, &res, base_dn,
+ ret = ldb_search(sysdb->ldb, tmpctx, &res, base_dn,
LDB_SCOPE_SUBTREE, attributes,
SYSDB_PWNAM_FILTER, sanitized_name);
if (ret) {
@@ -780,7 +780,7 @@ done:
}
errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *netgroup,
struct ldb_result **res)
@@ -803,7 +803,7 @@ errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- base_dn = ldb_dn_new_fmt(tmp_ctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
SYSDB_TMPL_NETGROUP_BASE,
domain->name);
if (!base_dn) {
@@ -823,7 +823,7 @@ errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx,
goto done;
}
- lret = ldb_search(ctx->ldb, tmp_ctx, &result, base_dn,
+ lret = ldb_search(sysdb->ldb, tmp_ctx, &result, base_dn,
LDB_SCOPE_SUBTREE, attrs,
SYSDB_NETGR_TRIPLES_FILTER,
sanitized_netgroup, netgroup_dn);
@@ -841,7 +841,7 @@ done:
}
int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *ctx,
+ struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *netgrname,
const char **attributes,
@@ -862,7 +862,7 @@ int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- base_dn = ldb_dn_new_fmt(tmpctx, ctx->ldb,
+ base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb,
SYSDB_TMPL_NETGROUP_BASE, domain->name);
if (!base_dn) {
ret = ENOMEM;
@@ -874,7 +874,7 @@ int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = ldb_search(ctx->ldb, tmpctx, &result, base_dn,
+ ret = ldb_search(sysdb->ldb, tmpctx, &result, base_dn,
LDB_SCOPE_SUBTREE, attributes,
SYSDB_NETGR_FILTER,
sanitized_netgroup);