summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/db/sysdb.c33
-rw-r--r--src/db/sysdb.h17
-rw-r--r--src/db/sysdb_autofs.c3
-rw-r--r--src/db/sysdb_ops.c78
-rw-r--r--src/db/sysdb_sudo.c3
-rw-r--r--src/providers/ipa/ipa_access.c1
-rw-r--r--src/providers/ipa/ipa_hbac_common.c8
-rw-r--r--src/providers/ipa/ipa_selinux.c5
-rw-r--r--src/providers/ldap/sdap_async_groups.c2
-rw-r--r--src/providers/ldap/sdap_async_netgroups.c2
-rw-r--r--src/responder/pac/pacsrv_cmd.c3
-rw-r--r--src/responder/pac/pacsrv_utils.c5
-rw-r--r--src/tests/sysdb-tests.c15
-rw-r--r--src/tools/sss_groupshow.c2
-rw-r--r--src/tools/sss_sync_ops.c17
15 files changed, 79 insertions, 115 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index e949cafd..1e5e8ada 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -93,7 +93,6 @@ errno_t sysdb_dn_sanitize(TALLOC_CTX *mem_ctx, const char *input,
struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb,
TALLOC_CTX *mem_ctx,
- const char *domain,
const char *subtree_name)
{
errno_t ret;
@@ -111,7 +110,7 @@ struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb,
}
dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_CUSTOM_SUBTREE,
- clean_subtree, domain);
+ clean_subtree, sysdb->domain->name);
if (dn) {
talloc_steal(mem_ctx, dn);
}
@@ -119,9 +118,10 @@ struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb,
return dn;
}
+
struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
- const char *domain, const char *object_name,
- const char *subtree_name)
+ const char *object_name,
+ const char *subtree_name)
{
errno_t ret;
TALLOC_CTX *tmp_ctx;
@@ -145,7 +145,7 @@ struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
}
dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_CUSTOM, clean_name,
- clean_subtree, domain);
+ clean_subtree, sysdb->domain->name);
done:
talloc_free(tmp_ctx);
@@ -153,7 +153,7 @@ done:
}
struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
- const char *domain, const char *name)
+ const char *name)
{
errno_t ret;
char *clean_name;
@@ -165,14 +165,14 @@ 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, domain);
+ clean_name, sysdb->domain->name);
talloc_free(clean_name);
return dn;
}
struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
- const char *domain, const char *name)
+ const char *name)
{
errno_t ret;
char *clean_name;
@@ -184,14 +184,14 @@ struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
}
dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_GROUP,
- clean_name, domain);
+ clean_name, sysdb->domain->name);
talloc_free(clean_name);
return dn;
}
struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
- const char *domain, const char *name)
+ const char *name)
{
errno_t ret;
char *clean_name;
@@ -203,16 +203,16 @@ struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
}
dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_NETGROUP,
- clean_name, domain);
+ clean_name, sysdb->domain->name);
talloc_free(clean_name);
return dn;
}
-struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
- const char *domain)
+struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx)
{
- return ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_NETGROUP_BASE, domain);
+ return ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_NETGROUP_BASE,
+ sysdb->domain->name);
}
errno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
@@ -279,10 +279,9 @@ errno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
return sysdb_get_rdn(sysdb, mem_ctx, _dn, NULL, _name);
}
-struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
- const char *domain)
+struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx)
{
- return ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_DOM_BASE, domain);
+ return ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_DOM_BASE, sysdb->domain->name);
}
struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *sysdb)
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index f74fceec..b53b9880 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -319,22 +319,19 @@ int sysdb_error_to_errno(int ldberr);
errno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, void *mem_ctx,
const char *_dn, char **_name, char **_val);
struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
- const char *domain, const char *name);
+ const char *name);
struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
- const char *domain, const char *name);
+ const char *name);
struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
- const char *domain, const char *name);
-struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
- const char *domain);
+ const char *name);
+struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, void *mem_ctx);
errno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, void *mem_ctx,
const char *dn_str, char **name);
-struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
- const char *domain);
+struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, void *mem_ctx);
struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
- const char *domain, const char *object_name,
- const char *subtree_name);
+ const char *object_name,
+ const char *subtree_name);
struct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
- const char *domain,
const char *subtree_name);
char *sysdb_user_strdn(TALLOC_CTX *mem_ctx,
diff --git a/src/db/sysdb_autofs.c b/src/db/sysdb_autofs.c
index bf4e9b17..c5ec4c8c 100644
--- a/src/db/sysdb_autofs.c
+++ b/src/db/sysdb_autofs.c
@@ -31,8 +31,7 @@ sysdb_autofsmap_dn(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
const char *map_name)
{
- return sysdb_custom_dn(sysdb, mem_ctx, sysdb->domain->name,
- map_name, AUTOFS_MAP_SUBDIR);
+ return sysdb_custom_dn(sysdb, mem_ctx, map_name, AUTOFS_MAP_SUBDIR);
}
static struct ldb_dn *
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 52da27d3..52f0cef5 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -217,7 +217,7 @@ int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain->name, name);
+ basedn = sysdb_user_dn(sysdb, tmp_ctx, name);
if (!basedn) {
ret = ENOMEM;
goto done;
@@ -319,7 +319,7 @@ int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain->name, name);
+ basedn = sysdb_group_dn(sysdb, tmp_ctx, name);
if (!basedn) {
ret = ENOMEM;
goto done;
@@ -421,7 +421,7 @@ int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_netgroup_dn(sysdb, tmp_ctx, sysdb->domain->name, name);
+ basedn = sysdb_netgroup_dn(sysdb, tmp_ctx, name);
if (!basedn) {
ret = ENOMEM;
goto done;
@@ -525,7 +525,7 @@ int sysdb_set_user_attr(struct sysdb_ctx *sysdb,
return ENOMEM;
}
- dn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain->name, name);
+ dn = sysdb_user_dn(sysdb, tmp_ctx, name);
if (!dn) {
ret = ENOMEM;
goto done;
@@ -560,7 +560,7 @@ int sysdb_set_group_attr(struct sysdb_ctx *sysdb,
goto done;
}
- dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain->name, name);
+ dn = sysdb_group_dn(sysdb, tmp_ctx, name);
if (!dn) {
ret = ENOMEM;
goto done;
@@ -593,7 +593,7 @@ int sysdb_set_netgroup_attr(struct sysdb_ctx *sysdb,
return ENOMEM;
}
- dn = sysdb_netgroup_dn(sysdb, tmp_ctx, sysdb->domain->name, name);
+ dn = sysdb_netgroup_dn(sysdb, tmp_ctx, name);
if (!dn) {
ret = ENOMEM;
goto done;
@@ -631,7 +631,7 @@ int sysdb_get_new_id(struct sysdb_ctx *sysdb,
return ENOMEM;
}
- base_dn = sysdb_domain_dn(sysdb, tmp_ctx, domain->name);
+ base_dn = sysdb_domain_dn(sysdb, tmp_ctx);
if (!base_dn) {
talloc_zfree(tmp_ctx);
return ENOMEM;
@@ -797,7 +797,7 @@ int sysdb_add_basic_user(struct sysdb_ctx *sysdb,
}
/* user dn */
- msg->dn = sysdb_user_dn(sysdb, msg, sysdb->domain->name, name);
+ msg->dn = sysdb_user_dn(sysdb, msg, name);
if (!msg->dn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -1011,7 +1011,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
goto done;
}
- tmpdn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain->name, name);
+ tmpdn = sysdb_user_dn(sysdb, tmp_ctx, name);
if (!tmpdn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -1117,7 +1117,7 @@ int sysdb_add_basic_group(struct sysdb_ctx *sysdb,
}
/* group dn */
- msg->dn = sysdb_group_dn(sysdb, msg, sysdb->domain->name, name);
+ msg->dn = sysdb_group_dn(sysdb, msg, name);
if (!msg->dn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -1375,7 +1375,7 @@ int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb,
}
/* netgroup dn */
- msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain->name, name);
+ msg->dn = sysdb_netgroup_dn(sysdb, msg, name);
if (!msg->dn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -1767,34 +1767,25 @@ sysdb_group_membership_mod(struct sysdb_ctx *sysdb,
}
if (type == SYSDB_MEMBER_USER) {
- member_dn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain->name, member);
- if (!member_dn) {
- ret = ENOMEM;
- goto done;
- }
-
- group_dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain->name, group);
- if (!group_dn) {
- ret = ENOMEM;
- goto done;
- }
+ member_dn = sysdb_user_dn(sysdb, tmp_ctx, member);
} else if (type == SYSDB_MEMBER_GROUP) {
- member_dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain->name, member);
- if (!member_dn) {
- ret = ENOMEM;
- goto done;
- }
-
- group_dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain->name, group);
- if (!group_dn) {
- ret = ENOMEM;
- goto done;
- }
+ member_dn = sysdb_group_dn(sysdb, tmp_ctx, member);
} else {
ret = EINVAL;
goto done;
}
+ if (!member_dn) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ group_dn = sysdb_group_dn(sysdb, tmp_ctx, group);
+ if (!group_dn) {
+ ret = ENOMEM;
+ goto done;
+ }
+
ret = sysdb_mod_group_member(sysdb, member_dn, group_dn, modify_op);
done:
@@ -1900,8 +1891,7 @@ int sysdb_search_custom(TALLOC_CTX *mem_ctx,
return EINVAL;
}
- basedn = sysdb_custom_subtree_dn(sysdb, mem_ctx,
- sysdb->domain->name, subtree_name);
+ basedn = sysdb_custom_subtree_dn(sysdb, mem_ctx, subtree_name);
if (basedn == NULL) {
DEBUG(1, ("sysdb_custom_subtree_dn failed.\n"));
return ENOMEM;
@@ -1940,8 +1930,7 @@ int sysdb_search_custom_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_custom_dn(sysdb, tmp_ctx,
- sysdb->domain->name, object_name, subtree_name);
+ basedn = sysdb_custom_dn(sysdb, tmp_ctx, object_name, subtree_name);
if (basedn == NULL) {
DEBUG(1, ("sysdb_custom_dn failed.\n"));
ret = ENOMEM;
@@ -2023,8 +2012,7 @@ int sysdb_store_custom(struct sysdb_ctx *sysdb,
goto done;
}
- msg->dn = sysdb_custom_dn(sysdb, tmp_ctx,
- sysdb->domain->name, object_name, subtree_name);
+ msg->dn = sysdb_custom_dn(sysdb, tmp_ctx, object_name, subtree_name);
if (!msg->dn) {
DEBUG(1, ("sysdb_custom_dn failed.\n"));
ret = ENOMEM;
@@ -2094,7 +2082,7 @@ int sysdb_delete_custom(struct sysdb_ctx *sysdb,
return ENOMEM;
}
- dn = sysdb_custom_dn(sysdb, tmp_ctx, sysdb->domain->name, object_name, subtree_name);
+ dn = sysdb_custom_dn(sysdb, tmp_ctx, object_name, subtree_name);
if (dn == NULL) {
DEBUG(1, ("sysdb_custom_dn failed.\n"));
ret = ENOMEM;
@@ -2985,7 +2973,7 @@ errno_t sysdb_mod_netgroup_tuple(struct sysdb_ctx *sysdb,
ERROR_OUT(ret, ENOMEM, done);
}
- msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain->name, netgroup);
+ msg->dn = sysdb_netgroup_dn(sysdb, msg, netgroup);
if (!msg->dn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -3043,7 +3031,7 @@ errno_t sysdb_mod_netgroup_member(struct sysdb_ctx *sysdb,
ERROR_OUT(ret, ENOMEM, done);
}
- msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain->name, netgroup);
+ msg->dn = sysdb_netgroup_dn(sysdb, msg, netgroup);
if (!msg->dn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -3088,15 +3076,15 @@ errno_t sysdb_remove_attrs(struct sysdb_ctx *sysdb,
switch(type) {
case SYSDB_MEMBER_USER:
- msg->dn = sysdb_user_dn(sysdb, msg, sysdb->domain->name, name);
+ msg->dn = sysdb_user_dn(sysdb, msg, name);
break;
case SYSDB_MEMBER_GROUP:
- msg->dn = sysdb_group_dn(sysdb, msg, sysdb->domain->name, name);
+ msg->dn = sysdb_group_dn(sysdb, msg, name);
break;
case SYSDB_MEMBER_NETGROUP:
- msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain->name, name);
+ msg->dn = sysdb_netgroup_dn(sysdb, msg, name);
break;
case SYSDB_MEMBER_SERVICE:
diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c
index e1434e25..39b1504d 100644
--- a/src/db/sysdb_sudo.c
+++ b/src/db/sysdb_sudo.c
@@ -545,8 +545,7 @@ errno_t sysdb_sudo_purge_all(struct sysdb_ctx *sysdb)
tmp_ctx = talloc_new(NULL);
NULL_CHECK(tmp_ctx, ret, done);
- base_dn = sysdb_custom_subtree_dn(sysdb, tmp_ctx, sysdb->domain->name,
- SUDORULE_SUBDIR);
+ base_dn = sysdb_custom_subtree_dn(sysdb, tmp_ctx, SUDORULE_SUBDIR);
NULL_CHECK(base_dn, ret, done);
ret = sysdb_delete_recursive(sysdb, base_dn, true);
diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c
index d3fb158f..5c97575f 100644
--- a/src/providers/ipa/ipa_access.c
+++ b/src/providers/ipa/ipa_access.c
@@ -501,7 +501,6 @@ static void hbac_sysdb_save(struct tevent_req *req)
* are also denied.
*/
base_dn = sysdb_custom_subtree_dn(sysdb, tmp_ctx,
- domain->name,
HBAC_RULES_SUBDIR);
if (base_dn == NULL) {
talloc_free(tmp_ctx);
diff --git a/src/providers/ipa/ipa_hbac_common.c b/src/providers/ipa/ipa_hbac_common.c
index 341b5622..54628d80 100644
--- a/src/providers/ipa/ipa_hbac_common.c
+++ b/src/providers/ipa/ipa_hbac_common.c
@@ -44,7 +44,7 @@ ipa_hbac_save_list(struct sysdb_ctx *sysdb, bool delete_subdir,
}
if (delete_subdir) {
- base_dn = sysdb_custom_subtree_dn(sysdb, tmp_ctx, domain->name, subdir);
+ base_dn = sysdb_custom_subtree_dn(sysdb, tmp_ctx, subdir);
if (base_dn == NULL) {
ret = ENOMEM;
goto done;
@@ -617,8 +617,7 @@ hbac_eval_service_element(TALLOC_CTX *mem_ctx,
svc->name = servicename;
- svc_dn = sysdb_custom_dn(sysdb, tmp_ctx, domain->name,
- svc->name, HBAC_SERVICES_SUBDIR);
+ svc_dn = sysdb_custom_dn(sysdb, tmp_ctx, svc->name, HBAC_SERVICES_SUBDIR);
if (svc_dn == NULL) {
ret = ENOMEM;
goto done;
@@ -725,8 +724,7 @@ hbac_eval_host_element(TALLOC_CTX *mem_ctx,
goto done;
}
- host_dn = sysdb_custom_dn(sysdb, tmp_ctx, domain->name,
- host->name, HBAC_HOSTS_SUBDIR);
+ host_dn = sysdb_custom_dn(sysdb, tmp_ctx, host->name, HBAC_HOSTS_SUBDIR);
if (host_dn == NULL) {
ret = ENOMEM;
goto done;
diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c
index 0adc0fd0..b64de90b 100644
--- a/src/providers/ipa/ipa_selinux.c
+++ b/src/providers/ipa/ipa_selinux.c
@@ -255,7 +255,6 @@ static void ipa_get_selinux_connect_done(struct tevent_req *subreq)
size_t count;
struct ldb_message **msgs;
struct sysdb_attrs **hosts;
- struct sss_domain_info *domain;
ret = sdap_id_op_connect_recv(subreq, &dp_error);
talloc_zfree(subreq);
@@ -275,9 +274,7 @@ static void ipa_get_selinux_connect_done(struct tevent_req *subreq)
access_name = state->be_req->be_ctx->bet_info[BET_ACCESS].mod_name;
selinux_name = state->be_req->be_ctx->bet_info[BET_SELINUX].mod_name;
if (strcasecmp(access_name, selinux_name) == 0) {
- domain = sysdb_ctx_get_domain(bctx->sysdb);
- host_dn = sysdb_custom_dn(bctx->sysdb, state, domain->name,
- state->hostname, HBAC_HOSTS_SUBDIR);
+ host_dn = sysdb_custom_dn(bctx->sysdb, state, state->hostname, HBAC_HOSTS_SUBDIR);
if (host_dn == NULL) {
ret = ENOMEM;
goto fail;
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index ac5057e8..525de674 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -61,7 +61,7 @@ static int sdap_find_entry_by_origDN(TALLOC_CTX *memctx,
goto done;
}
- base_dn = sysdb_domain_dn(ctx, tmpctx, domain->name);
+ base_dn = sysdb_domain_dn(ctx, tmpctx);
if (!base_dn) {
ret = ENOMEM;
goto done;
diff --git a/src/providers/ldap/sdap_async_netgroups.c b/src/providers/ldap/sdap_async_netgroups.c
index 2262db51..12715d49 100644
--- a/src/providers/ldap/sdap_async_netgroups.c
+++ b/src/providers/ldap/sdap_async_netgroups.c
@@ -324,7 +324,7 @@ struct tevent_req *netgr_translate_members_send(TALLOC_CTX *memctx,
goto fail;
}
- netgr_basedn = sysdb_netgroup_base_dn(sysdb, state, dom->name);
+ netgr_basedn = sysdb_netgroup_base_dn(sysdb, state);
if (netgr_basedn == NULL) {
ret = ENOMEM;
goto fail;
diff --git a/src/responder/pac/pacsrv_cmd.c b/src/responder/pac/pacsrv_cmd.c
index 0696caca..b7edf81d 100644
--- a/src/responder/pac/pacsrv_cmd.c
+++ b/src/responder/pac/pacsrv_cmd.c
@@ -293,8 +293,7 @@ struct tevent_req *pac_save_memberships_send(struct pac_req_ctx *pr_ctx)
}
state->gid_iter = 0;
- state->user_dn = sysdb_user_dn(dom->sysdb, state, dom->name,
- pr_ctx->user_name);
+ state->user_dn = sysdb_user_dn(dom->sysdb, state, pr_ctx->user_name);
if (state->user_dn == NULL) {
ret = ENOMEM;
goto done;
diff --git a/src/responder/pac/pacsrv_utils.c b/src/responder/pac/pacsrv_utils.c
index d4df5b16..7d375873 100644
--- a/src/responder/pac/pacsrv_utils.c
+++ b/src/responder/pac/pacsrv_utils.c
@@ -225,7 +225,6 @@ errno_t get_my_domain_data(struct pac_ctx *pac_ctx,
struct ldb_message **msgs;
TALLOC_CTX *tmp_ctx = NULL;
struct dom_sid *sid = NULL;
- char *dom_name;
enum idmap_error_code err;
size_t range_count;
struct range_info **range_list;
@@ -235,10 +234,8 @@ errno_t get_my_domain_data(struct pac_ctx *pac_ctx,
if (pac_ctx->my_dom_sid == NULL || pac_ctx->range_map == NULL) {
if (dom->parent != NULL) {
sysdb = dom->parent->sysdb;
- dom_name = dom->parent->name;
} else {
sysdb = dom->sysdb;
- dom_name = dom->name;
}
if (sysdb == NULL) {
@@ -254,7 +251,7 @@ errno_t get_my_domain_data(struct pac_ctx *pac_ctx,
goto done;
}
- basedn = sysdb_domain_dn(sysdb, tmp_ctx, dom_name);
+ basedn = sysdb_domain_dn(sysdb, tmp_ctx);
if (basedn == NULL) {
ret = ENOMEM;
goto done;
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 83628af8..d9afe7b8 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -216,7 +216,7 @@ 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, "LOCAL", data->username);
+ user_dn = sysdb_user_dn(data->ctx->sysdb, data, data->username);
if (!user_dn) return ENOMEM;
ret = sysdb_delete_entry(data->ctx->sysdb, user_dn, true);
@@ -279,7 +279,7 @@ static int test_remove_group(struct test_data *data)
struct ldb_dn *group_dn;
int ret;
- group_dn = sysdb_group_dn(data->ctx->sysdb, data, "LOCAL", data->groupname);
+ group_dn = sysdb_group_dn(data->ctx->sysdb, data, data->groupname);
if (!group_dn) return ENOMEM;
ret = sysdb_delete_entry(data->ctx->sysdb, group_dn, true);
@@ -440,7 +440,7 @@ static int test_remove_netgroup_entry(struct test_data *data)
struct ldb_dn *netgroup_dn;
int ret;
- netgroup_dn = sysdb_netgroup_dn(data->ctx->sysdb, data, "LOCAL", data->netgrname);
+ netgroup_dn = sysdb_netgroup_dn(data->ctx->sysdb, data, data->netgrname);
if (!netgroup_dn) return ENOMEM;
ret = sysdb_delete_entry(data->ctx->sysdb, netgroup_dn, true);
@@ -1680,7 +1680,7 @@ START_TEST (test_sysdb_asq_search)
data->attrlist[0] = "gidNumber";
data->attrlist[1] = NULL;
- user_dn = sysdb_user_dn(data->ctx->sysdb, data, "LOCAL", ASQ_TEST_USER);
+ user_dn = sysdb_user_dn(data->ctx->sysdb, data, ASQ_TEST_USER);
fail_unless(user_dn != NULL, "sysdb_user_dn failed");
ret = sysdb_asq_search(data, test_ctx->sysdb,
@@ -2383,7 +2383,7 @@ START_TEST (test_sysdb_group_dn_name)
}
groupname = talloc_asprintf(test_ctx, "testgroup%d", _i);
- group_dn = sysdb_group_dn(test_ctx->sysdb, test_ctx, "LOCAL", groupname);
+ group_dn = sysdb_group_dn(test_ctx->sysdb, test_ctx, groupname);
if (!group_dn || !groupname) {
fail("Out of memory");
return;
@@ -2446,8 +2446,7 @@ START_TEST (test_sysdb_search_netgroup_by_name)
netgrname, NULL, &msg);
fail_if(ret != EOK, "Could not find netgroup with name %s", netgrname);
- netgroup_dn = sysdb_netgroup_dn(test_ctx->sysdb, test_ctx,
- test_ctx->domain->name, netgrname);
+ netgroup_dn = sysdb_netgroup_dn(test_ctx->sysdb, test_ctx, netgrname);
fail_if(netgroup_dn == NULL);
fail_if(ldb_dn_compare(msg->dn, netgroup_dn) != 0, "Found wrong netgroup!\n");
talloc_free(test_ctx);
@@ -3382,7 +3381,7 @@ START_TEST(test_sysdb_original_dn_case_insensitive)
"cn=case_sensitive_group1,cn=example,cn=com");
fail_if(filter == NULL, "Cannot construct filter\n");
- base_dn = sysdb_domain_dn(test_ctx->sysdb, test_ctx, test_ctx->domain->name);
+ base_dn = sysdb_domain_dn(test_ctx->sysdb, test_ctx);
fail_if(base_dn == NULL, "Cannot construct basedn\n");
ret = sysdb_search_entry(test_ctx, test_ctx->sysdb,
diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c
index 1bc5d308..2ba495c1 100644
--- a/src/tools/sss_groupshow.c
+++ b/src/tools/sss_groupshow.c
@@ -423,7 +423,7 @@ static int group_show_trim_memberof(TALLOC_CTX *mem_ctx,
int ret;
int i;
- dn = sysdb_group_dn(sysdb, mem_ctx, domain->name, name);
+ dn = sysdb_group_dn(sysdb, mem_ctx, name);
if (!dn) {
return ENOMEM;
}
diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c
index 380e6127..7183eb3e 100644
--- a/src/tools/sss_sync_ops.c
+++ b/src/tools/sss_sync_ops.c
@@ -61,7 +61,6 @@ static int mod_groups_member(struct sysdb_ctx *sysdb,
struct ldb_dn *parent_dn;
int ret;
int i;
- struct sss_domain_info *domain = sysdb_ctx_get_domain(sysdb);
tmpctx = talloc_new(NULL);
if (!tmpctx) {
@@ -72,7 +71,6 @@ static int mod_groups_member(struct sysdb_ctx *sysdb,
for (i = 0; grouplist[i]; i++) {
parent_dn = sysdb_group_dn(sysdb, tmpctx,
- domain->name,
grouplist[i]);
if (!parent_dn) {
ret = ENOMEM;
@@ -201,8 +199,7 @@ int usermod(TALLOC_CTX *mem_ctx,
int ret;
if (data->addgroups || data->rmgroups) {
- member_dn = sysdb_user_dn(sysdb, mem_ctx,
- data->domain->name, data->name);
+ member_dn = sysdb_user_dn(sysdb, mem_ctx, data->name);
if (!member_dn) {
return ENOMEM;
}
@@ -259,8 +256,7 @@ int groupmod(TALLOC_CTX *mem_ctx,
int ret;
if (data->addgroups || data->rmgroups) {
- member_dn = sysdb_group_dn(sysdb, mem_ctx,
- data->domain->name, data->name);
+ member_dn = sysdb_group_dn(sysdb, mem_ctx, data->name);
if (!member_dn) {
return ENOMEM;
}
@@ -479,8 +475,7 @@ int useradd(TALLOC_CTX *mem_ctx,
if (data->addgroups) {
struct ldb_dn *member_dn;
- member_dn = sysdb_user_dn(sysdb, mem_ctx,
- data->domain->name, data->name);
+ member_dn = sysdb_user_dn(sysdb, mem_ctx, data->name);
if (!member_dn) {
ret = ENOMEM;
goto done;
@@ -509,8 +504,7 @@ int userdel(TALLOC_CTX *mem_ctx,
struct ldb_dn *user_dn;
int ret;
- user_dn = sysdb_user_dn(sysdb, mem_ctx,
- data->domain->name, data->name);
+ user_dn = sysdb_user_dn(sysdb, mem_ctx, data->name);
if (!user_dn) {
DEBUG(1, ("Could not construct a user DN\n"));
return ENOMEM;
@@ -552,8 +546,7 @@ int groupdel(TALLOC_CTX *mem_ctx,
struct ldb_dn *group_dn;
int ret;
- group_dn = sysdb_group_dn(sysdb, mem_ctx,
- data->domain->name, data->name);
+ group_dn = sysdb_group_dn(sysdb, mem_ctx, data->name);
if (group_dn == NULL) {
DEBUG(1, ("Could not construct a group DN\n"));
return ENOMEM;