diff options
author | Simo Sorce <simo@redhat.com> | 2013-01-06 00:59:59 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-15 10:49:20 +0100 |
commit | 3613cc1eba1337256a2d06ba7a84532156139ccd (patch) | |
tree | db6b0b4facb78f7bad5917ffb9dda6c8789cab7b /src | |
parent | 1e6f2180724de4722a5218826c9401181168d9d4 (diff) | |
download | sssd-3613cc1eba1337256a2d06ba7a84532156139ccd.tar.gz sssd-3613cc1eba1337256a2d06ba7a84532156139ccd.tar.bz2 sssd-3613cc1eba1337256a2d06ba7a84532156139ccd.zip |
Make sysdb_user_dn() require a domain explictly.
Diffstat (limited to 'src')
-rw-r--r-- | src/db/sysdb.c | 4 | ||||
-rw-r--r-- | src/db/sysdb.h | 2 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 12 | ||||
-rw-r--r-- | src/responder/pac/pacsrv_cmd.c | 2 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 6 | ||||
-rw-r--r-- | src/tools/sss_sync_ops.c | 6 |
6 files changed, 17 insertions, 15 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c index 479791b7..b7951d32 100644 --- a/src/db/sysdb.c +++ b/src/db/sysdb.c @@ -153,7 +153,7 @@ done: } struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, - const char *name) + struct sss_domain_info *dom, const char *name) { errno_t ret; char *clean_name; @@ -165,7 +165,7 @@ struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, } dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_USER, - clean_name, sysdb->domain->name); + clean_name, dom->name); talloc_free(clean_name); return dn; diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 9c2996ad..5130b06a 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -323,7 +323,7 @@ int sysdb_error_to_errno(int ldberr); errno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, const char *_dn, char **_name, char **_val); struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, - const char *name); + struct sss_domain_info *dom, const char *name); struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, const char *name); struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 9974beb0..108f3b84 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -249,7 +249,7 @@ int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx, return ENOMEM; } - basedn = sysdb_user_dn(sysdb, tmp_ctx, name); + basedn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain, name); if (!basedn) { ret = ENOMEM; goto done; @@ -557,7 +557,7 @@ int sysdb_set_user_attr(struct sysdb_ctx *sysdb, return ENOMEM; } - dn = sysdb_user_dn(sysdb, tmp_ctx, name); + dn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain, name); if (!dn) { ret = ENOMEM; goto done; @@ -829,7 +829,7 @@ int sysdb_add_basic_user(struct sysdb_ctx *sysdb, } /* user dn */ - msg->dn = sysdb_user_dn(sysdb, msg, name); + msg->dn = sysdb_user_dn(sysdb, msg, sysdb->domain, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1018,7 +1018,7 @@ sysdb_remove_ghostattr_from_groups(struct sysdb_ctx *sysdb, goto done; } - tmpdn = sysdb_user_dn(sysdb, tmp_ctx, name); + tmpdn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain, name); if (!tmpdn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1874,7 +1874,7 @@ sysdb_group_membership_mod(struct sysdb_ctx *sysdb, } if (type == SYSDB_MEMBER_USER) { - member_dn = sysdb_user_dn(sysdb, tmp_ctx, member); + member_dn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain, member); } else if (type == SYSDB_MEMBER_GROUP) { member_dn = sysdb_group_dn(sysdb, tmp_ctx, member); } else { @@ -3045,7 +3045,7 @@ errno_t sysdb_remove_attrs(struct sysdb_ctx *sysdb, switch(type) { case SYSDB_MEMBER_USER: - msg->dn = sysdb_user_dn(sysdb, msg, name); + msg->dn = sysdb_user_dn(sysdb, msg, sysdb->domain, name); break; case SYSDB_MEMBER_GROUP: diff --git a/src/responder/pac/pacsrv_cmd.c b/src/responder/pac/pacsrv_cmd.c index bc897446..dc5c4231 100644 --- a/src/responder/pac/pacsrv_cmd.c +++ b/src/responder/pac/pacsrv_cmd.c @@ -443,7 +443,7 @@ struct tevent_req *pac_save_memberships_send(struct pac_req_ctx *pr_ctx) state->gid_iter = 0; state->dom_iter = 0; - state->user_dn = sysdb_user_dn(dom->sysdb, state, pr_ctx->fq_name); + state->user_dn = sysdb_user_dn(dom->sysdb, state, dom, pr_ctx->fq_name); if (state->user_dn == NULL) { ret = ENOMEM; goto done; diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index c2e20c0a..f624ba4d 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -218,7 +218,8 @@ static int test_remove_user(struct test_data *data) struct ldb_dn *user_dn; int ret; - user_dn = sysdb_user_dn(data->ctx->sysdb, data, data->username); + user_dn = sysdb_user_dn(data->ctx->sysdb, data, + data->ctx->domain, data->username); if (!user_dn) return ENOMEM; ret = sysdb_delete_entry(data->ctx->sysdb, user_dn, true); @@ -1762,7 +1763,8 @@ START_TEST (test_sysdb_asq_search) data->attrlist[0] = "gidNumber"; data->attrlist[1] = NULL; - user_dn = sysdb_user_dn(data->ctx->sysdb, data, ASQ_TEST_USER); + user_dn = sysdb_user_dn(data->ctx->sysdb, data, + data->ctx->domain, ASQ_TEST_USER); fail_unless(user_dn != NULL, "sysdb_user_dn failed"); ret = sysdb_asq_search(data, test_ctx->sysdb, diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c index 10a1a127..0e3d326a 100644 --- a/src/tools/sss_sync_ops.c +++ b/src/tools/sss_sync_ops.c @@ -199,7 +199,7 @@ int usermod(TALLOC_CTX *mem_ctx, int ret; if (data->addgroups || data->rmgroups) { - member_dn = sysdb_user_dn(sysdb, mem_ctx, data->name); + member_dn = sysdb_user_dn(sysdb, mem_ctx, data->domain, data->name); if (!member_dn) { return ENOMEM; } @@ -476,7 +476,7 @@ int useradd(TALLOC_CTX *mem_ctx, if (data->addgroups) { struct ldb_dn *member_dn; - member_dn = sysdb_user_dn(sysdb, mem_ctx, data->name); + member_dn = sysdb_user_dn(sysdb, mem_ctx, data->domain, data->name); if (!member_dn) { ret = ENOMEM; goto done; @@ -505,7 +505,7 @@ int userdel(TALLOC_CTX *mem_ctx, struct ldb_dn *user_dn; int ret; - user_dn = sysdb_user_dn(sysdb, mem_ctx, data->name); + user_dn = sysdb_user_dn(sysdb, mem_ctx, data->domain, data->name); if (!user_dn) { DEBUG(1, ("Could not construct a user DN\n")); return ENOMEM; |