summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2013-10-11 19:58:27 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-11-15 20:20:18 +0100
commit4c08db0fb0dda3d27b1184248ca5c800d7ce23f0 (patch)
tree2e7654f526442657e3f7dbf832cc067d1be2dc80
parent19d8bc19b5b5597427878645644fa354ef6cb54d (diff)
downloadsssd-4c08db0fb0dda3d27b1184248ca5c800d7ce23f0.tar.gz
sssd-4c08db0fb0dda3d27b1184248ca5c800d7ce23f0.tar.xz
sssd-4c08db0fb0dda3d27b1184248ca5c800d7ce23f0.zip
SYSDB: Drop the sysdb_ctx parameter - module sysdb_ops (part 1)
-rw-r--r--src/db/sysdb.h13
-rw-r--r--src/db/sysdb_ops.c120
-rw-r--r--src/db/sysdb_sudo.c7
-rw-r--r--src/providers/ipa/ipa_auth.c5
-rw-r--r--src/providers/ipa/ipa_hbac_common.c4
-rw-r--r--src/providers/krb5/krb5_auth.c2
-rw-r--r--src/providers/ldap/sdap_access.c4
-rw-r--r--src/providers/ldap/sdap_async_groups.c7
-rw-r--r--src/providers/ldap/sdap_async_initgroups.c6
-rw-r--r--src/providers/ldap/sdap_async_initgroups_ad.c4
-rw-r--r--src/providers/proxy/proxy_id.c4
-rw-r--r--src/providers/simple/simple_access_check.c11
-rw-r--r--src/responder/nss/nsssrv_cmd.c12
-rw-r--r--src/responder/pac/pacsrv_cmd.c7
-rw-r--r--src/responder/pam/pam_LOCAL_domain.c6
-rw-r--r--src/responder/pam/pamsrv_cmd.c4
-rw-r--r--src/tests/sysdb-tests.c159
-rw-r--r--src/tools/sss_cache.c4
-rw-r--r--src/tools/sss_groupshow.c8
-rw-r--r--src/tools/sss_sync_ops.c4
-rw-r--r--src/tools/tools_mc_util.c3
-rw-r--r--src/util/sss_selinux.c4
22 files changed, 159 insertions, 239 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index b74fa0824..af5d0a495 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -502,21 +502,18 @@ int sysdb_search_entry(TALLOC_CTX *mem_ctx,
/* Search User (by uid, sid or name) */
int sysdb_search_user_by_name(TALLOC_CTX *mem_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 *sysdb,
struct sss_domain_info *domain,
uid_t uid,
const char **attrs,
struct ldb_message **msg);
int sysdb_search_user_by_sid_str(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *sid_str,
const char **attrs,
@@ -524,21 +521,18 @@ int sysdb_search_user_by_sid_str(TALLOC_CTX *mem_ctx,
/* Search Group (by gid, sid or name) */
int sysdb_search_group_by_name(TALLOC_CTX *mem_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 *sysdb,
struct sss_domain_info *domain,
gid_t gid,
const char **attrs,
struct ldb_message **msg);
int sysdb_search_group_by_sid_str(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *sid_str,
const char **attrs,
@@ -546,7 +540,6 @@ int sysdb_search_group_by_sid_str(TALLOC_CTX *mem_ctx,
/* Search Netgroup (by name) */
int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
@@ -559,15 +552,13 @@ int sysdb_set_entry_attr(struct sysdb_ctx *sysdb,
int mod_op);
/* Replace user attrs */
-int sysdb_set_user_attr(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain,
+int sysdb_set_user_attr(struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
int mod_op);
/* Replace group attrs */
-int sysdb_set_group_attr(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain,
+int sysdb_set_group_attr(struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
int mod_op);
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 094c27b7f..8dc4edf15 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -236,7 +236,6 @@ int sysdb_search_entry(TALLOC_CTX *mem_ctx,
/* =Search-Entry-by-SID-string============================================ */
int sysdb_search_entry_by_sid_str(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *search_base,
const char *filter_str,
@@ -257,7 +256,7 @@ int sysdb_search_entry_by_sid_str(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
+ basedn = ldb_dn_new_fmt(tmp_ctx, domain->sysdb->ldb,
search_base, domain->name);
if (!basedn) {
ret = ENOMEM;
@@ -270,8 +269,9 @@ int sysdb_search_entry_by_sid_str(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sysdb_search_entry(tmp_ctx, sysdb, basedn, LDB_SCOPE_SUBTREE, filter,
- attrs?attrs:def_attrs, &msgs_count, &msgs);
+ ret = sysdb_search_entry(tmp_ctx, domain->sysdb, basedn, LDB_SCOPE_SUBTREE,
+ filter, attrs?attrs:def_attrs, &msgs_count,
+ &msgs);
if (ret) {
goto done;
}
@@ -293,7 +293,6 @@ done:
/* =Search-User-by-[UID/SID/NAME]============================================= */
int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
@@ -313,7 +312,7 @@ int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
+ basedn = ldb_dn_new_fmt(tmp_ctx, domain->sysdb->ldb,
SYSDB_TMPL_USER_BASE, domain->name);
if (!basedn) {
ret = ENOMEM;
@@ -332,8 +331,9 @@ int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sysdb_search_entry(tmp_ctx, sysdb, basedn, LDB_SCOPE_SUBTREE, filter,
- attrs?attrs:def_attrs, &msgs_count, &msgs);
+ ret = sysdb_search_entry(tmp_ctx, domain->sysdb, basedn, LDB_SCOPE_SUBTREE,
+ filter, attrs?attrs:def_attrs,
+ &msgs_count, &msgs);
if (ret) {
goto done;
}
@@ -352,7 +352,6 @@ done:
}
int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
uid_t uid,
const char **attrs,
@@ -371,7 +370,7 @@ int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
+ basedn = ldb_dn_new_fmt(tmp_ctx, domain->sysdb->ldb,
SYSDB_TMPL_USER_BASE, domain->name);
if (!basedn) {
ret = ENOMEM;
@@ -388,7 +387,8 @@ 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(tmp_ctx, sysdb, basedn, LDB_SCOPE_SUBTREE, filter,
+ ret = sysdb_search_entry(tmp_ctx, domain->sysdb, basedn,
+ LDB_SCOPE_SUBTREE, filter,
attrs?attrs:def_attrs, &msgs_count, &msgs);
if (ret) {
goto done;
@@ -409,14 +409,13 @@ done:
}
int sysdb_search_user_by_sid_str(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *sid_str,
const char **attrs,
struct ldb_message **msg)
{
- return sysdb_search_entry_by_sid_str(mem_ctx, sysdb, domain,
+ return sysdb_search_entry_by_sid_str(mem_ctx, domain,
SYSDB_TMPL_USER_BASE,
SYSDB_PWSID_FILTER,
sid_str, attrs, msg);
@@ -425,7 +424,6 @@ int sysdb_search_user_by_sid_str(TALLOC_CTX *mem_ctx,
/* =Search-Group-by-[GID/SID/NAME]============================================ */
int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
@@ -443,14 +441,14 @@ int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_group_dn(sysdb, tmp_ctx, domain, name);
+ basedn = sysdb_group_dn(domain->sysdb, tmp_ctx, domain, name);
if (!basedn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_search_entry(tmp_ctx, sysdb, basedn, LDB_SCOPE_BASE, NULL,
- attrs?attrs:def_attrs, &msgs_count, &msgs);
+ ret = sysdb_search_entry(tmp_ctx, domain->sysdb, basedn, LDB_SCOPE_BASE,
+ NULL, attrs?attrs:def_attrs, &msgs_count, &msgs);
if (ret) {
goto done;
}
@@ -469,7 +467,6 @@ done:
}
int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
gid_t gid,
const char **attrs,
@@ -488,7 +485,7 @@ int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
+ basedn = ldb_dn_new_fmt(tmp_ctx, domain->sysdb->ldb,
SYSDB_TMPL_GROUP_BASE, domain->name);
if (!basedn) {
ret = ENOMEM;
@@ -505,8 +502,9 @@ 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(tmp_ctx, sysdb, basedn, LDB_SCOPE_SUBTREE, filter,
- attrs?attrs:def_attrs, &msgs_count, &msgs);
+ ret = sysdb_search_entry(tmp_ctx, domain->sysdb, basedn, LDB_SCOPE_SUBTREE,
+ filter, attrs?attrs:def_attrs,
+ &msgs_count, &msgs);
if (ret) {
goto done;
}
@@ -526,14 +524,13 @@ done:
}
int sysdb_search_group_by_sid_str(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *sid_str,
const char **attrs,
struct ldb_message **msg)
{
- return sysdb_search_entry_by_sid_str(mem_ctx, sysdb, domain,
+ return sysdb_search_entry_by_sid_str(mem_ctx, domain,
SYSDB_TMPL_GROUP_BASE,
SYSDB_GRSID_FILTER,
sid_str, attrs, msg);
@@ -542,7 +539,6 @@ int sysdb_search_group_by_sid_str(TALLOC_CTX *mem_ctx,
/* =Search-Group-by-Name============================================ */
int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name,
const char **attrs,
@@ -560,14 +556,15 @@ int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_netgroup_dn(sysdb, tmp_ctx, domain, name);
+ basedn = sysdb_netgroup_dn(domain->sysdb, tmp_ctx, domain, name);
if (!basedn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_search_entry(tmp_ctx, sysdb, basedn, LDB_SCOPE_BASE, NULL,
- attrs?attrs:def_attrs, &msgs_count, &msgs);
+ ret = sysdb_search_entry(tmp_ctx, domain->sysdb, basedn, LDB_SCOPE_BASE,
+ NULL, attrs?attrs:def_attrs, &msgs_count,
+ &msgs);
if (ret) {
goto done;
}
@@ -650,8 +647,7 @@ done:
/* =Replace-Attributes-On-User============================================ */
-int sysdb_set_user_attr(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain,
+int sysdb_set_user_attr(struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
int mod_op)
@@ -665,13 +661,13 @@ int sysdb_set_user_attr(struct sysdb_ctx *sysdb,
return ENOMEM;
}
- dn = sysdb_user_dn(sysdb, tmp_ctx, domain, name);
+ dn = sysdb_user_dn(domain->sysdb, tmp_ctx, domain, name);
if (!dn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_set_entry_attr(sysdb, dn, attrs, mod_op);
+ ret = sysdb_set_entry_attr(domain->sysdb, dn, attrs, mod_op);
if (ret != EOK) {
goto done;
}
@@ -685,8 +681,7 @@ done:
/* =Replace-Attributes-On-Group=========================================== */
-int sysdb_set_group_attr(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain,
+int sysdb_set_group_attr(struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs,
int mod_op)
@@ -701,13 +696,13 @@ int sysdb_set_group_attr(struct sysdb_ctx *sysdb,
goto done;
}
- dn = sysdb_group_dn(sysdb, tmp_ctx, domain, name);
+ dn = sysdb_group_dn(domain->sysdb, tmp_ctx, domain, name);
if (!dn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_set_entry_attr(sysdb, dn, attrs, mod_op);
+ ret = sysdb_set_entry_attr(domain->sysdb, dn, attrs, mod_op);
if (ret) {
goto done;
}
@@ -1230,8 +1225,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
* 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(tmp_ctx, sysdb, domain,
- name, NULL, &msg);
+ ret = sysdb_search_group_by_name(tmp_ctx, domain, name, NULL, &msg);
if (ret != ENOENT) {
if (ret == EOK) ret = EEXIST;
goto done;
@@ -1240,8 +1234,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
/* check no other user with the same uid exist */
if (uid != 0) {
- ret = sysdb_search_user_by_uid(tmp_ctx, sysdb, domain,
- uid, NULL, &msg);
+ ret = sysdb_search_user_by_uid(tmp_ctx, domain, uid, NULL, &msg);
if (ret != ENOENT) {
if (ret == EOK) ret = EEXIST;
goto done;
@@ -1270,8 +1263,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
if (ret) goto done;
}
- ret = sysdb_set_user_attr(sysdb, domain, name,
- id_attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_user_attr(domain, name, id_attrs, SYSDB_MOD_REP);
goto done;
}
@@ -1295,7 +1287,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
(now + cache_timeout) : 0));
if (ret) goto done;
- ret = sysdb_set_user_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_user_attr(domain, name, attrs, SYSDB_MOD_REP);
if (ret) goto done;
if (domain->enumerate == false) {
@@ -1416,8 +1408,7 @@ int sysdb_add_group(struct sysdb_ctx *sysdb,
* 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(tmp_ctx, sysdb, domain,
- name, NULL, &msg);
+ ret = sysdb_search_user_by_name(tmp_ctx, domain, name, NULL, &msg);
if (ret != ENOENT) {
if (ret == EOK) ret = EEXIST;
goto done;
@@ -1426,8 +1417,7 @@ int sysdb_add_group(struct sysdb_ctx *sysdb,
/* check no other groups with the same gid exist */
if (gid != 0) {
- ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, domain,
- gid, NULL, &msg);
+ ret = sysdb_search_group_by_gid(tmp_ctx, domain, gid, NULL, &msg);
if (ret != ENOENT) {
if (ret == EOK) ret = EEXIST;
goto done;
@@ -1475,7 +1465,7 @@ int sysdb_add_group(struct sysdb_ctx *sysdb,
(now + cache_timeout) : 0));
if (ret) goto done;
- ret = sysdb_set_group_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_group_attr(domain, name, attrs, SYSDB_MOD_REP);
done:
if (ret == EOK) {
@@ -1541,7 +1531,7 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb,
if (ret) goto done;
}
- ret = sysdb_set_group_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_group_attr(domain, name, attrs, SYSDB_MOD_REP);
done:
if (ret != EOK) {
@@ -1771,7 +1761,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
in_transaction = true;
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain, name, NULL, &msg);
+ ret = sysdb_search_user_by_name(tmp_ctx, domain, name, NULL, &msg);
if (ret && ret != ENOENT) {
goto fail;
}
@@ -1854,7 +1844,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
(now + cache_timeout) : 0));
if (ret) goto fail;
- ret = sysdb_set_user_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_user_attr(domain, name, attrs, SYSDB_MOD_REP);
if (ret != EOK) goto fail;
if (remove_attrs) {
@@ -1914,8 +1904,7 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
return ENOMEM;
}
- ret = sysdb_search_group_by_name(tmp_ctx, sysdb, domain,
- name, src_attrs, &msg);
+ ret = sysdb_search_group_by_name(tmp_ctx, domain, name, src_attrs, &msg);
if (ret && ret != ENOENT) {
goto done;
}
@@ -1979,7 +1968,7 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
(now + cache_timeout) : 0));
if (ret) goto done;
- ret = sysdb_set_group_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_group_attr(domain, name, attrs, SYSDB_MOD_REP);
done:
if (ret) {
@@ -2113,8 +2102,7 @@ int sysdb_cache_password(struct sysdb_ctx *sysdb,
if (ret) goto fail;
- ret = sysdb_set_user_attr(sysdb, domain,
- username, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_user_attr(domain, username, attrs, SYSDB_MOD_REP);
if (ret) {
goto fail;
}
@@ -2546,11 +2534,9 @@ int sysdb_delete_user(struct sysdb_ctx *sysdb,
}
if (name) {
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain,
- name, NULL, &msg);
+ ret = sysdb_search_user_by_name(tmp_ctx, domain, name, NULL, &msg);
} else {
- ret = sysdb_search_user_by_uid(tmp_ctx, sysdb, domain,
- uid, NULL, &msg);
+ ret = sysdb_search_user_by_uid(tmp_ctx, domain, uid, NULL, &msg);
}
if (ret == EOK) {
if (name && uid) {
@@ -2699,11 +2685,9 @@ int sysdb_delete_group(struct sysdb_ctx *sysdb,
}
if (name) {
- ret = sysdb_search_group_by_name(tmp_ctx, sysdb, domain,
- name, NULL, &msg);
+ ret = sysdb_search_group_by_name(tmp_ctx, domain, name, NULL, &msg);
} else {
- ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, domain,
- gid, NULL, &msg);
+ ret = sysdb_search_group_by_gid(tmp_ctx, domain, gid, NULL, &msg);
}
if (ret) {
goto fail;
@@ -2816,8 +2800,7 @@ int sysdb_delete_netgroup(struct sysdb_ctx *sysdb,
return ENOMEM;
}
- ret = sysdb_search_netgroup_by_name(tmp_ctx, sysdb, domain,
- name, NULL, &msg);
+ ret = sysdb_search_netgroup_by_name(tmp_ctx, domain, name, NULL, &msg);
if (ret != EOK && ret != ENOENT) {
DEBUG(6, ("sysdb_search_netgroup_by_name failed: %d (%s)\n",
ret, strerror(ret)));
@@ -3025,8 +3008,7 @@ int sysdb_cache_auth(struct sysdb_ctx *sysdb,
return ret;
}
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain,
- name, attrs, &ldb_msg);
+ ret = sysdb_search_user_by_name(tmp_ctx, domain, name, attrs, &ldb_msg);
if (ret != EOK) {
DEBUG(1, ("sysdb_search_user_by_name failed [%d][%s].\n",
ret, strerror(ret)));
@@ -3140,8 +3122,8 @@ int sysdb_cache_auth(struct sysdb_ctx *sysdb,
}
}
- ret = sysdb_set_user_attr(sysdb, domain,
- name, update_attrs, LDB_FLAG_MOD_REPLACE);
+ ret = sysdb_set_user_attr(domain, name, update_attrs,
+ LDB_FLAG_MOD_REPLACE);
if (ret) {
DEBUG(1, ("Failed to update Login attempt information!\n"));
}
diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c
index 4e98b5b35..6338ed660 100644
--- a/src/db/sysdb_sudo.c
+++ b/src/db/sysdb_sudo.c
@@ -328,8 +328,7 @@ sysdb_get_sudo_user_info(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb,
tmp_ctx = talloc_new(NULL);
NULL_CHECK(tmp_ctx, ret, done);
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain,
- username, attrs, &msg);
+ ret = sysdb_search_user_by_name(tmp_ctx, domain, username, attrs, &msg);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Error looking up user %s\n", username));
goto done;
@@ -374,8 +373,8 @@ sysdb_get_sudo_user_info(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb,
/* resolve primary group */
gid = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0);
if (gid != 0) {
- ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, domain, gid,
- group_attrs, &group_msg);
+ ret = sysdb_search_group_by_gid(tmp_ctx, domain, gid, group_attrs,
+ &group_msg);
if (ret == EOK) {
primary_group = ldb_msg_find_attr_as_string(group_msg, SYSDB_NAME,
NULL);
diff --git a/src/providers/ipa/ipa_auth.c b/src/providers/ipa/ipa_auth.c
index c723fea7f..4bd142726 100644
--- a/src/providers/ipa/ipa_auth.c
+++ b/src/providers/ipa/ipa_auth.c
@@ -353,9 +353,8 @@ static void ipa_migration_flag_connect_done(struct tevent_req *req)
attrs[0] = SYSDB_ORIG_DN;
attrs[1] = NULL;
- ret = sysdb_search_user_by_name(state, be_ctx->domain->sysdb,
- be_ctx->domain,
- state->pd->user, attrs, &user_msg);
+ ret = sysdb_search_user_by_name(state, be_ctx->domain, state->pd->user,
+ attrs, &user_msg);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("sysdb_search_user_by_name failed.\n"));
goto done;
diff --git a/src/providers/ipa/ipa_hbac_common.c b/src/providers/ipa/ipa_hbac_common.c
index 0473a028c..e539b29d2 100644
--- a/src/providers/ipa/ipa_hbac_common.c
+++ b/src/providers/ipa/ipa_hbac_common.c
@@ -536,8 +536,8 @@ hbac_eval_user_element(TALLOC_CTX *mem_ctx,
* This will give us the list of both POSIX and
* non-POSIX groups that this user belongs to.
*/
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain,
- users->name, attrs, &msg);
+ ret = sysdb_search_user_by_name(tmp_ctx, domain, users->name,
+ attrs, &msg);
if (ret != EOK) {
DEBUG(1, ("Could not determine user memberships for [%s]\n",
users->name));
diff --git a/src/providers/krb5/krb5_auth.c b/src/providers/krb5/krb5_auth.c
index f5a6a2c81..a1774ba05 100644
--- a/src/providers/krb5/krb5_auth.c
+++ b/src/providers/krb5/krb5_auth.c
@@ -145,7 +145,7 @@ static int krb5_mod_ccname(TALLOC_CTX *mem_ctx,
}
in_transaction = true;
- ret = sysdb_set_user_attr(sysdb, domain, name, attrs, mod_op);
+ ret = sysdb_set_user_attr(domain, name, attrs, mod_op);
if (ret != EOK) {
DEBUG(6, ("Error: %d (%s)\n", ret, strerror(ret)));
goto done;
diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c
index 1934e4f0f..e93400db1 100644
--- a/src/providers/ldap/sdap_access.c
+++ b/src/providers/ldap/sdap_access.c
@@ -921,8 +921,8 @@ static void sdap_access_filter_get_access_done(struct tevent_req *subreq)
goto done;
}
- tret = sysdb_set_user_attr(state->domain->sysdb, state->domain,
- state->username, attrs, SYSDB_MOD_REP);
+ tret = sysdb_set_user_attr(state->domain, state->username, attrs,
+ SYSDB_MOD_REP);
if (tret != EOK) {
/* Failing to save to the cache is non-fatal.
* Just return the result.
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index 7a8f3e2a5..1f008e20f 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -1315,8 +1315,8 @@ sdap_process_group_members_2307(struct sdap_process_group_state *state,
/* We need to skip over zero-length usernames */
if (member_name[0] == '\0') continue;
- ret = sysdb_search_user_by_name(state, state->sysdb, state->dom,
- member_name, NULL, &msg);
+ ret = sysdb_search_user_by_name(state, state->dom, member_name,
+ NULL, &msg);
if (ret == EOK) {
/*
* User already cached in sysdb. Remember the sysdb DN for later
@@ -2140,8 +2140,7 @@ static errno_t sdap_nested_group_populate_users(TALLOC_CTX *mem_ctx,
ret = sysdb_attrs_add_string(attrs, SYSDB_NAME, username);
if (ret) goto done;
- ret = sysdb_set_user_attr(user_dom->sysdb, user_dom, sysdb_name,
- attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_user_attr(user_dom, sysdb_name, attrs, SYSDB_MOD_REP);
if (ret != EOK) goto done;
} else {
key.type = HASH_KEY_STRING;
diff --git a/src/providers/ldap/sdap_async_initgroups.c b/src/providers/ldap/sdap_async_initgroups.c
index fa69097fa..a3c879f2f 100644
--- a/src/providers/ldap/sdap_async_initgroups.c
+++ b/src/providers/ldap/sdap_async_initgroups.c
@@ -74,8 +74,8 @@ static errno_t sdap_add_incomplete_groups(struct sysdb_ctx *sysdb,
goto done;
}
- ret = sysdb_search_group_by_name(tmp_ctx, sysdb, domain,
- tmp_name, NULL, &msg);
+ ret = sysdb_search_group_by_name(tmp_ctx, domain, tmp_name, NULL,
+ &msg);
if (ret == EOK) {
continue;
} else if (ret == ENOENT) {
@@ -3109,7 +3109,7 @@ static errno_t get_sysdb_grouplist_ex(TALLOC_CTX *mem_ctx,
tmp_ctx = talloc_new(NULL);
if (!tmp_ctx) return ENOMEM;
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain, name,
+ ret = sysdb_search_user_by_name(tmp_ctx, domain, name,
attrs, &msg);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
diff --git a/src/providers/ldap/sdap_async_initgroups_ad.c b/src/providers/ldap/sdap_async_initgroups_ad.c
index e58d93fb2..d23cbd7cd 100644
--- a/src/providers/ldap/sdap_async_initgroups_ad.c
+++ b/src/providers/ldap/sdap_async_initgroups_ad.c
@@ -486,8 +486,8 @@ sdap_get_ad_tokengroups_initgroups_lookup_done(struct tevent_req *subreq)
("Processing membership GID [%"SPRIgid"]\n", gid));
/* Check whether this GID already exists in the sysdb */
- ret = sysdb_search_group_by_gid(tmp_ctx, group_domain->sysdb,
- group_domain, gid, attrs, &msg);
+ ret = sysdb_search_group_by_gid(tmp_ctx, group_domain, gid, attrs,
+ &msg);
if (ret == EOK) {
group_name = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL);
if (!group_name) {
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 625d72bc7..998b161db 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -674,8 +674,8 @@ static errno_t proxy_process_missing_users(struct sysdb_ctx *sysdb,
if (!tmp_ctx) return ENOMEM;
for (i = 0; grp->gr_mem[i]; i++) {
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain,
- grp->gr_mem[i], NULL, &msg);
+ ret = sysdb_search_user_by_name(tmp_ctx, domain, grp->gr_mem[i],
+ NULL, &msg);
if (ret == EOK) {
/* Member already exists in the cache */
DEBUG(SSSDBG_TRACE_INTERNAL,
diff --git a/src/providers/simple/simple_access_check.c b/src/providers/simple/simple_access_check.c
index a36843118..1decbcb98 100644
--- a/src/providers/simple/simple_access_check.c
+++ b/src/providers/simple/simple_access_check.c
@@ -279,8 +279,7 @@ simple_resolve_group_check(struct simple_resolve_group_state *state)
SYSDB_GIDNUM, NULL };
/* Check the cache by GID again and fetch the name */
- ret = sysdb_search_group_by_gid(state, state->domain->sysdb,
- state->domain, state->gid,
+ ret = sysdb_search_group_by_gid(state, state->domain, state->gid,
group_attrs, &group);
if (ret == ENOENT) {
/* The group is missing, we will try to update it. */
@@ -425,8 +424,8 @@ simple_check_get_groups_send(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sysdb_search_user_by_name(state, state->domain->sysdb, state->domain,
- username, attrs, &user);
+ ret = sysdb_search_user_by_name(state, state->domain, username, attrs,
+ &user);
if (ret == ENOENT) {
DEBUG(SSSDBG_MINOR_FAILURE, ("No such user %s\n", username));
ret = ERR_ACCOUNT_UNKNOWN;
@@ -637,8 +636,8 @@ simple_check_get_groups_primary(struct simple_check_groups_state *state,
SYSDB_GIDNUM, SYSDB_SID_STR, NULL };
struct ldb_message *msg;
- ret = sysdb_search_group_by_gid(state, state->domain->sysdb, state->domain,
- gid, group_attrs, &msg);
+ ret = sysdb_search_group_by_gid(state, state->domain, gid, group_attrs,
+ &msg);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
("Could not look up primary group [%"SPRIgid"]: [%d][%s]\n",
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index ddbdbc709..00a67aa9f 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -3816,8 +3816,8 @@ static errno_t nss_cmd_getsidby_search(struct nss_dom_ctx *dctx)
}
if (cmdctx->cmd == SSS_NSS_GETSIDBYID) {
- ret = sysdb_search_user_by_uid(cmdctx, sysdb, dom, cmdctx->id,
- attrs, &msg);
+ ret = sysdb_search_user_by_uid(cmdctx, dom, cmdctx->id, attrs,
+ &msg);
if (ret != EOK && ret != ENOENT) {
DEBUG(SSSDBG_CRIT_FAILURE,
("Failed to make request to our cache!\n"));
@@ -3829,8 +3829,8 @@ static errno_t nss_cmd_getsidby_search(struct nss_dom_ctx *dctx)
user_found = true;
} else {
talloc_free(msg);
- ret = sysdb_search_group_by_gid(cmdctx, sysdb, dom, cmdctx->id,
- attrs, &msg);
+ ret = sysdb_search_group_by_gid(cmdctx, dom, cmdctx->id, attrs,
+ &msg);
if (ret != EOK && ret != ENOENT) {
DEBUG(SSSDBG_CRIT_FAILURE,
("Failed to make request to our cache!\n"));
@@ -3843,7 +3843,7 @@ static errno_t nss_cmd_getsidby_search(struct nss_dom_ctx *dctx)
}
}
} else {
- ret = sysdb_search_user_by_name(cmdctx, sysdb, dom,
+ ret = sysdb_search_user_by_name(cmdctx, dom,
sysdb_name ? sysdb_name : name,
attrs, &msg);
if (ret != EOK && ret != ENOENT) {
@@ -3857,7 +3857,7 @@ static errno_t nss_cmd_getsidby_search(struct nss_dom_ctx *dctx)
user_found = true;
} else {
talloc_free(msg);
- ret = sysdb_search_group_by_name(cmdctx, sysdb, dom,
+ ret = sysdb_search_group_by_name(cmdctx, dom,
sysdb_name ? sysdb_name : name,
attrs, &msg);
if (ret != EOK && ret != ENOENT) {
diff --git a/src/responder/pac/pacsrv_cmd.c b/src/responder/pac/pacsrv_cmd.c
index cf5beaf26..fbfaaafca 100644
--- a/src/responder/pac/pacsrv_cmd.c
+++ b/src/responder/pac/pacsrv_cmd.c
@@ -572,8 +572,8 @@ static errno_t save_pac_user(struct pac_req_ctx *pr_ctx)
goto done;
}
- ret = sysdb_search_user_by_uid(tmp_ctx, sysdb, pr_ctx->dom,
- pwd->pw_uid, attrs, &msg);
+ ret = sysdb_search_user_by_uid(tmp_ctx, pr_ctx->dom, pwd->pw_uid, attrs,
+ &msg);
if (ret == ENOENT) {
if (pwd->pw_gid == 0 && !pr_ctx->dom->mpg) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Primary group RID from the PAC " \
@@ -644,8 +644,7 @@ struct tevent_req *pac_save_memberships_send(struct pac_req_ctx *pr_ctx)
goto done;
}
- ret = sysdb_search_user_by_name(state, dom->sysdb, dom, dom_name, NULL,
- &msg);
+ ret = sysdb_search_user_by_name(state, dom, dom_name, NULL, &msg);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("sysdb_search_user_by_name failed " \
"[%d][%s].\n", ret, strerror(ret)));
diff --git a/src/responder/pam/pam_LOCAL_domain.c b/src/responder/pam/pam_LOCAL_domain.c
index 4c2de626d..bb7378581 100644
--- a/src/responder/pam/pam_LOCAL_domain.c
+++ b/src/responder/pam/pam_LOCAL_domain.c
@@ -87,7 +87,7 @@ static void do_successful_login(struct LOCAL_request *lreq)
NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_attrs_add_long failed.\n"),
lreq->error, ret, done);
- ret = sysdb_set_user_attr(lreq->dbctx, lreq->domain,
+ ret = sysdb_set_user_attr(lreq->domain,
lreq->preq->pd->user,
lreq->mod_attrs, SYSDB_MOD_REP);
NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_set_user_attr failed.\n"),
@@ -128,7 +128,7 @@ static void do_failed_login(struct LOCAL_request *lreq)
NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_attrs_add_long failed.\n"),
lreq->error, ret, done);
- ret = sysdb_set_user_attr(lreq->dbctx, lreq->domain,
+ ret = sysdb_set_user_attr(lreq->domain,
lreq->preq->pd->user,
lreq->mod_attrs, SYSDB_MOD_REP);
NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_set_user_attr failed.\n"),
@@ -197,7 +197,7 @@ static void do_pam_chauthtok(struct LOCAL_request *lreq)
NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_attrs_add_long failed.\n"),
lreq->error, ret, done);
- ret = sysdb_set_user_attr(lreq->dbctx, lreq->domain,
+ ret = sysdb_set_user_attr(lreq->domain,
lreq->preq->pd->user,
lreq->mod_attrs, SYSDB_MOD_REP);
NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_set_user_attr failed.\n"),
diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c
index 006c3e227..f8d7a091a 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -351,8 +351,8 @@ static errno_t set_last_login(struct pam_auth_req *preq)
goto fail;
}
- ret = sysdb_set_user_attr(preq->domain->sysdb, preq->domain,
- preq->pd->user, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_user_attr(preq->domain, preq->pd->user, attrs,
+ SYSDB_MOD_REP);
if (ret != EOK) {
DEBUG(2, ("set_last_login failed.\n"));
preq->pd->pam_status = PAM_SYSTEM_ERR;
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 645908069..67125b7fe 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -313,8 +313,7 @@ static int test_set_user_attr(struct test_data *data)
{
int ret;
- ret = sysdb_set_user_attr(data->ctx->sysdb,
- data->ctx->domain, data->username,
+ ret = sysdb_set_user_attr(data->ctx->domain, data->username,
data->attrs, SYSDB_MOD_REP);
return ret;
}
@@ -1802,8 +1801,8 @@ static void cached_authentication_with_expiration(const char *username,
data->attrs = sysdb_new_attrs(data);
ret = sysdb_attrs_add_time_t(data->attrs, SYSDB_LAST_ONLINE_AUTH, now);
- ret = sysdb_set_user_attr(data->ctx->sysdb, data->ctx->domain,
- data->username, data->attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_user_attr(data->ctx->domain, data->username, data->attrs,
+ SYSDB_MOD_REP);
fail_unless(ret == EOK, "Could not modify user %s", data->username);
ret = sysdb_cache_auth(test_ctx->sysdb,
@@ -2254,9 +2253,7 @@ START_TEST (test_sysdb_memberof_mod_add)
/* Before the add, the groups should not contain the ghost attribute */
for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) {
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- itergid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, itergid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -2277,7 +2274,7 @@ START_TEST (test_sysdb_memberof_mod_add)
}
/* Perform the add operation */
- ret = sysdb_set_group_attr(test_ctx->sysdb, test_ctx->domain,
+ ret = sysdb_set_group_attr(test_ctx->domain,
data->groupname, data->attrs, SYSDB_MOD_ADD);
fail_unless(ret == EOK, "Cannot set group attrs\n");
@@ -2285,9 +2282,7 @@ START_TEST (test_sysdb_memberof_mod_add)
* as a member
*/
for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) {
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- itergid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, itergid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -2353,9 +2348,7 @@ START_TEST (test_sysdb_memberof_mod_replace)
* as a member
*/
for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) {
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- itergid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, itergid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -2371,7 +2364,7 @@ START_TEST (test_sysdb_memberof_mod_replace)
}
/* Perform the replace operation */
- ret = sysdb_set_group_attr(test_ctx->sysdb, test_ctx->domain,
+ ret = sysdb_set_group_attr(test_ctx->domain,
data->groupname, data->attrs, SYSDB_MOD_REP);
fail_unless(ret == EOK, "Cannot set group attrs\n");
@@ -2379,9 +2372,7 @@ START_TEST (test_sysdb_memberof_mod_replace)
* as a member
*/
for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) {
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- itergid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, itergid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -2453,9 +2444,7 @@ START_TEST (test_sysdb_memberof_mod_replace_keep)
* and testuserb as a member
*/
for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) {
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- itergid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, itergid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -2500,7 +2489,7 @@ START_TEST (test_sysdb_memberof_mod_replace_keep)
}
/* Perform the replace operation */
- ret = sysdb_set_group_attr(test_ctx->sysdb, test_ctx->domain,
+ ret = sysdb_set_group_attr(test_ctx->domain,
data->groupname, data->attrs, SYSDB_MOD_REP);
fail_unless(ret == EOK, "Cannot set group attrs\n");
@@ -2508,9 +2497,7 @@ START_TEST (test_sysdb_memberof_mod_replace_keep)
* to keep ghost users inherited from other groups
*/
for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) {
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- itergid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, itergid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -2668,10 +2655,9 @@ START_TEST (test_sysdb_memberof_check_memberuid_without_group_5)
data->attrlist[0] = "memberuid";
data->attrlist[1] = NULL;
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- _i + MBO_GROUP_BASE,
- data->attrlist, &data->msg);
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain,
+ _i + MBO_GROUP_BASE, data->attrlist,
+ &data->msg);
if (_i == 5) {
fail_unless(ret == ENOENT,
"sysdb_search_group_by_gid found "
@@ -2720,10 +2706,9 @@ START_TEST (test_sysdb_memberof_check_memberuid)
data->attrlist[0] = "memberuid";
data->attrlist[1] = NULL;
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- _i + MBO_GROUP_BASE,
- data->attrlist, &data->msg);
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain,
+ _i + MBO_GROUP_BASE, data->attrlist,
+ &data->msg);
fail_if(ret != EOK, "Could not check group %d", data->gid);
@@ -2763,10 +2748,9 @@ START_TEST (test_sysdb_memberof_check_memberuid_loop)
data->attrlist[0] = "memberuid";
data->attrlist[1] = NULL;
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- _i + MBO_GROUP_BASE,
- data->attrlist, &data->msg);
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain,
+ _i + MBO_GROUP_BASE, data->attrlist,
+ &data->msg);
fail_if(ret != EOK, "Could not check group %d", data->gid);
@@ -2806,10 +2790,9 @@ START_TEST (test_sysdb_memberof_check_memberuid_loop_without_group_5)
data->attrlist[0] = "memberuid";
data->attrlist[1] = NULL;
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- _i + MBO_GROUP_BASE,
- data->attrlist, &data->msg);
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain,
+ _i + MBO_GROUP_BASE, data->attrlist,
+ &data->msg);
if (_i == 5) {
fail_unless(ret == ENOENT,
@@ -2858,9 +2841,7 @@ START_TEST (test_sysdb_memberof_check_nested_ghosts)
data->attrlist[0] = SYSDB_GHOST;
data->attrlist[1] = NULL;
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n", (unsigned long long) data->gid);
@@ -2897,9 +2878,7 @@ START_TEST (test_sysdb_memberof_check_nested_double_ghosts)
data->attrlist[0] = SYSDB_GHOST;
data->attrlist[1] = NULL;
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n", (unsigned long long) data->gid);
@@ -2939,9 +2918,7 @@ START_TEST (test_sysdb_memberof_remove_child_group_and_check_ghost)
data->attrlist[0] = SYSDB_GHOST;
data->attrlist[1] = NULL;
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n", (unsigned long long) data->gid);
@@ -2961,9 +2938,8 @@ START_TEST (test_sysdb_memberof_remove_child_group_and_check_ghost)
talloc_free(data->msg);
/* Check the parent again. The inherited ghost user should be gone. */
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid, data->attrlist, &data->msg);
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
+ data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n", (unsigned long long) data->gid);
fail_unless(strcmp(data->msg->elements[0].name, SYSDB_GHOST) == 0,
@@ -3021,9 +2997,7 @@ START_TEST (test_sysdb_memberof_mod_del)
* as a member
*/
for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) {
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- itergid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, itergid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -3039,15 +3013,13 @@ START_TEST (test_sysdb_memberof_mod_del)
}
/* Delete the attribute */
- ret = sysdb_set_group_attr(test_ctx->sysdb, test_ctx->domain,
+ ret = sysdb_set_group_attr(test_ctx->domain,
data->groupname, data->attrs, SYSDB_MOD_DEL);
fail_unless(ret == EOK, "Cannot set group attrs\n");
/* After the delete, we shouldn't be able to find the ghost attribute */
for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) {
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- itergid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, itergid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -3095,9 +3067,7 @@ START_TEST (test_sysdb_memberof_check_ghost)
data->attrlist[0] = SYSDB_GHOST;
data->attrlist[1] = NULL;
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Could not check group %d", data->gid);
@@ -3189,9 +3159,7 @@ START_TEST (test_sysdb_memberof_check_convert)
data->attrlist[1] = SYSDB_MEMBER;
data->attrlist[2] = NULL;
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Could not check group %d", data->gid);
@@ -3273,9 +3241,7 @@ START_TEST (test_sysdb_memberof_ghost_replace)
data->attrlist[1] = NULL;
/* Before the replace, the group has the testghost%_i as a member */
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -3290,14 +3256,12 @@ START_TEST (test_sysdb_memberof_ghost_replace)
fail_if(test_gv == NULL, "Cannot find ghost user %s\n", ghostname_del);
/* Perform the replace operation */
- ret = sysdb_set_group_attr(test_ctx->sysdb, test_ctx->domain,
+ ret = sysdb_set_group_attr(test_ctx->domain,
data->groupname, data->attrs, SYSDB_MOD_REP);
fail_unless(ret == EOK, "Cannot set group attrs\n");
/* After the replace, the group has the testghost%_i as a member */
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -3357,9 +3321,7 @@ START_TEST (test_sysdb_memberof_ghost_replace_noop)
data->attrlist[1] = NULL;
/* Before the replace, the group has the testghost%_i as a member */
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -3374,14 +3336,12 @@ START_TEST (test_sysdb_memberof_ghost_replace_noop)
fail_if(test_gv == NULL, "Cannot find ghost user %s\n", ghostname_del);
/* Perform the replace operation */
- ret = sysdb_set_group_attr(test_ctx->sysdb, test_ctx->domain,
+ ret = sysdb_set_group_attr(test_ctx->domain,
data->groupname, data->attrs, SYSDB_MOD_REP);
fail_unless(ret == EOK, "Cannot set group attrs\n");
/* After the replace, the group has the testghost%_i as a member */
- ret = sysdb_search_group_by_gid(data, test_ctx->sysdb,
- test_ctx->domain,
- data->gid,
+ ret = sysdb_search_group_by_gid(data, test_ctx->domain, data->gid,
data->attrlist, &data->msg);
fail_if(ret != EOK, "Cannot retrieve group %llu\n",
(unsigned long long) data->gid);
@@ -3731,8 +3691,7 @@ START_TEST (test_sysdb_search_netgroup_by_name)
netgrname = talloc_asprintf(test_ctx, "testnetgr%d", _i);
- ret = sysdb_search_netgroup_by_name(test_ctx, test_ctx->sysdb,
- test_ctx->domain,
+ ret = sysdb_search_netgroup_by_name(test_ctx, test_ctx->domain,
netgrname, NULL, &msg);
fail_if(ret != EOK, "Could not find netgroup with name %s", netgrname);
@@ -3906,8 +3865,7 @@ START_TEST(test_odd_characters)
ret, strerror(ret));
/* Retrieve */
- ret = sysdb_search_group_by_name(test_ctx, test_ctx->sysdb,
- test_ctx->domain,
+ ret = sysdb_search_group_by_name(test_ctx, test_ctx->domain,
odd_groupname, NULL, &msg);
fail_unless(ret == EOK, "sysdb_search_group_by_name error [%d][%s]",
ret, strerror(ret));
@@ -3938,7 +3896,7 @@ START_TEST(test_odd_characters)
/* Retrieve */
ret = sysdb_search_user_by_name(test_ctx,
- test_ctx->sysdb, test_ctx->domain,
+ test_ctx->domain,
odd_username, NULL, &msg);
fail_unless(ret == EOK, "sysdb_search_user_by_name error [%d][%s]",
ret, strerror(ret));
@@ -4470,9 +4428,8 @@ START_TEST(test_sysdb_search_sid_str)
fail_unless(ret == EOK, "sysdb_add_incomplete_group error [%d][%s]",
ret, strerror(ret));
- ret = sysdb_search_group_by_sid_str(test_ctx, test_ctx->sysdb,
- test_ctx->domain, "S-1-2-3-4",
- NULL, &msg);
+ ret = sysdb_search_group_by_sid_str(test_ctx, test_ctx->domain,
+ "S-1-2-3-4", NULL, &msg);
fail_unless(ret == EOK, "sysdb_search_group_by_sid_str failed with [%d][%s].",
ret, strerror(ret));
@@ -4482,8 +4439,7 @@ START_TEST(test_sysdb_search_sid_str)
ret, strerror(ret));
/* Verify it's gone */
- ret = sysdb_search_group_by_sid_str(test_ctx, test_ctx->sysdb,
- test_ctx->domain, "S-1-2-3-4",
+ ret = sysdb_search_group_by_sid_str(test_ctx, test_ctx->domain, "S-1-2-3-4",
NULL, &msg);
fail_unless(ret == ENOENT, "sysdb_search_group_by_sid_str failed with [%d][%s].",
ret, strerror(ret));
@@ -4504,9 +4460,8 @@ START_TEST(test_sysdb_search_sid_str)
fail_unless(ret == EOK, "sysdb_add_user failed with [%d][%s].",
ret, strerror(ret));
- ret = sysdb_search_user_by_sid_str(test_ctx, test_ctx->sysdb,
- test_ctx->domain, "S-1-2-3-4-5",
- NULL, &msg);
+ ret = sysdb_search_user_by_sid_str(test_ctx, test_ctx->domain,
+ "S-1-2-3-4-5", NULL, &msg);
fail_unless(ret == EOK, "sysdb_search_user_by_sid_str failed with [%d][%s].",
ret, strerror(ret));
@@ -4627,8 +4582,8 @@ START_TEST(test_sysdb_subdomain_store_user)
/* Subdomains are case-insensitive. Test that the lowercased name
* can be found, too */
- ret = sysdb_search_user_by_name(test_ctx, test_ctx->sysdb, subdomain,
- "subdomuser", attrs, &msg);
+ ret = sysdb_search_user_by_name(test_ctx, subdomain, "subdomuser", attrs,
+ &msg);
fail_unless(ret == EOK, "sysdb_search_user_by_name failed.");
ret = sysdb_delete_user(subdomain->sysdb, subdomain, "subdomuser", 0);
@@ -4678,15 +4633,14 @@ START_TEST(test_sysdb_subdomain_user_ops)
"name=subdomuser,cn=users,cn=test.sub,cn=sysdb");
fail_unless(check_dn != NULL);
- ret = sysdb_search_user_by_name(test_ctx, subdomain->sysdb, subdomain,
- "subdomuser", NULL, &msg);
+ ret = sysdb_search_user_by_name(test_ctx, subdomain, "subdomuser", NULL,
+ &msg);
fail_unless(ret == EOK, "sysdb_search_user_by_name failed with [%d][%s].",
ret, strerror(ret));
fail_unless(ldb_dn_compare(msg->dn, check_dn) == 0,
"Unexpedted DN returned");
- ret = sysdb_search_user_by_uid(test_ctx, subdomain->sysdb, subdomain,
- 12345, NULL, &msg);
+ ret = sysdb_search_user_by_uid(test_ctx, subdomain, 12345, NULL, &msg);
fail_unless(ret == EOK, "sysdb_search_domuser_by_uid failed with [%d][%s].",
ret, strerror(ret));
fail_unless(ldb_dn_compare(msg->dn, check_dn) == 0,
@@ -4731,15 +4685,14 @@ START_TEST(test_sysdb_subdomain_group_ops)
"name=subdomgroup,cn=groups,cn=test.sub,cn=sysdb");
fail_unless(check_dn != NULL);
- ret = sysdb_search_group_by_name(test_ctx, subdomain->sysdb, subdomain,
- "subdomgroup", NULL, &msg);
+ ret = sysdb_search_group_by_name(test_ctx, subdomain, "subdomgroup", NULL,
+ &msg);
fail_unless(ret == EOK, "sysdb_search_domgroup_by_name failed with [%d][%s].",
ret, strerror(ret));
fail_unless(ldb_dn_compare(msg->dn, check_dn) == 0,
"Unexpedted DN returned");
- ret = sysdb_search_group_by_gid(test_ctx, subdomain->sysdb, subdomain,
- 12345, NULL, &msg);
+ ret = sysdb_search_group_by_gid(test_ctx, subdomain, 12345, NULL, &msg);
fail_unless(ret == EOK, "sysdb_search_domgroup_by_gid failed with [%d][%s].",
ret, strerror(ret));
fail_unless(ldb_dn_compare(msg->dn, check_dn) == 0,
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index a28a5e935..c6d2508ce 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -427,11 +427,11 @@ static errno_t invalidate_entry(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb,
if (ret == EOK) {
switch (entry_type) {
case TYPE_USER:
- ret = sysdb_set_user_attr(sysdb, domain, name, sys_attrs,
+ ret = sysdb_set_user_attr(domain, name, sys_attrs,
SYSDB_MOD_REP);
break;
case TYPE_GROUP:
- ret = sysdb_set_group_attr(sysdb, domain, name, sys_attrs,
+ ret = sysdb_set_group_attr(domain, name, sys_attrs,
SYSDB_MOD_REP);
break;
case TYPE_NETGROUP:
diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c
index 56adf2a06..d52f800c5 100644
--- a/src/tools/sss_groupshow.c
+++ b/src/tools/sss_groupshow.c
@@ -333,7 +333,7 @@ int group_show(TALLOC_CTX *mem_ctx,
int i;
/* First, search for the root group */
- ret = sysdb_search_group_by_name(mem_ctx, sysdb, domain, name, attrs, &msg);
+ ret = sysdb_search_group_by_name(mem_ctx, domain, name, attrs, &msg);
if (ret) {
DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret));
goto done;
@@ -506,8 +506,8 @@ int group_show_recurse(TALLOC_CTX *mem_ctx,
continue;
}
- ret = sysdb_search_group_by_name(mem_ctx, sysdb, domain,
- group_members[i], attrs, &msg);
+ ret = sysdb_search_group_by_name(mem_ctx, domain, group_members[i],
+ attrs, &msg);
if (ret) {
DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret));
return EIO;
@@ -560,7 +560,7 @@ static int group_show_mpg(TALLOC_CTX *mem_ctx,
goto fail;
}
- ret = sysdb_search_user_by_name(info, sysdb, domain, name, attrs, &msg);
+ ret = sysdb_search_user_by_name(info, domain, name, attrs, &msg);
if (ret) {
DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret));
goto fail;
diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c
index 8cae996a2..1c93efcaf 100644
--- a/src/tools/sss_sync_ops.c
+++ b/src/tools/sss_sync_ops.c
@@ -218,7 +218,7 @@ int usermod(TALLOC_CTX *mem_ctx,
}
if (attrs->num != 0) {
- ret = sysdb_set_user_attr(sysdb, data->domain, data->name,
+ ret = sysdb_set_user_attr(data->domain, data->name,
attrs, SYSDB_MOD_REP);
if (ret) {
return ret;
@@ -273,7 +273,7 @@ int groupmod(TALLOC_CTX *mem_ctx,
return ret;
}
- ret = sysdb_set_group_attr(sysdb, data->domain, data->name,
+ ret = sysdb_set_group_attr(data->domain, data->name,
attrs, SYSDB_MOD_REP);
if (ret) {
return ret;
diff --git a/src/tools/tools_mc_util.c b/src/tools/tools_mc_util.c
index 5d4300fbe..841547147 100644
--- a/src/tools/tools_mc_util.c
+++ b/src/tools/tools_mc_util.c
@@ -265,8 +265,7 @@ errno_t sss_mc_refresh_nested_group(struct tools_ctx *tctx,
/* try to carry on */
}
- ret = sysdb_search_group_by_name(tctx, tctx->sysdb, tctx->local,
- name, attrs, &msg);
+ ret = sysdb_search_group_by_name(tctx, tctx->local, name, attrs, &msg);
if (ret) {
DEBUG(SSSDBG_OP_FAILURE,
("Search failed: %s (%d)\n", strerror(ret), ret));
diff --git a/src/util/sss_selinux.c b/src/util/sss_selinux.c
index dcac9ee60..5315c9c03 100644
--- a/src/util/sss_selinux.c
+++ b/src/util/sss_selinux.c
@@ -216,8 +216,8 @@ errno_t sss_selinux_extract_user(TALLOC_CTX *mem_ctx,
attrs[1] = SYSDB_ORIG_MEMBEROF;
attrs[2] = NULL;
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain, username,
- attrs, &user_msg);
+ ret = sysdb_search_user_by_name(tmp_ctx, domain, username, attrs,
+ &user_msg);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("sysdb_search_user_by_name failed.\n"));
goto done;