diff options
author | Jan Zeleny <jzeleny@redhat.com> | 2011-05-18 10:06:19 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-08-15 09:16:38 -0400 |
commit | 8a1738f9379a1b8fb5c95c3df649e014ff5a1434 (patch) | |
tree | dd5a59e95b88d1edb7b21a5035692571422b454c | |
parent | 237ade4114ae88f87c814d447dfd5aebdbdf72ef (diff) | |
download | sssd-8a1738f9379a1b8fb5c95c3df649e014ff5a1434.tar.gz sssd-8a1738f9379a1b8fb5c95c3df649e014ff5a1434.tar.xz sssd-8a1738f9379a1b8fb5c95c3df649e014ff5a1434.zip |
sysdb refactoring: deleted domain variables in sysdb API
The patch also updates code using modified functions. Tests have also
been adjusted.
42 files changed, 254 insertions, 538 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c index d07f27df6..dd7ce7ecc 100644 --- a/src/db/sysdb.c +++ b/src/db/sysdb.c @@ -27,7 +27,7 @@ #define LDB_MODULES_PATH "LDB_MODULES_PATH" -static errno_t sysdb_ldb_connect(TALLOC_CTX *mem_ctx, const char *filename, +static errno_t sysdb_ldb_connect(TALLOC_CTX *mem_ctx, const char *filename, struct ldb_context **_ldb) { int ret; @@ -2199,7 +2199,6 @@ errno_t sysdb_attrs_to_list(TALLOC_CTX *memctx, } errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb, - struct sss_domain_info *dom, bool *has_enumerated) { errno_t ret; @@ -2219,7 +2218,7 @@ errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb, base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, SYSDB_DOM_BASE, - dom->name); + sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; @@ -2263,7 +2262,6 @@ done: } errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb, - struct sss_domain_info *dom, bool enumerated) { errno_t ret; @@ -2281,7 +2279,7 @@ errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb, dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_DOM_BASE, - dom->name); + sysdb->domain->name); if (!dn) { ret = ENOMEM; goto done; @@ -2303,7 +2301,7 @@ errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb, msg->dn = dn; if (res->count == 0) { - lret = ldb_msg_add_string(msg, "cn", dom->name); + lret = ldb_msg_add_string(msg, "cn", sysdb->domain->name); if (lret != LDB_SUCCESS) { ret = sysdb_error_to_errno(lret); goto done; diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 86caa5ceb..da078ea9b 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -307,36 +307,30 @@ int sysdb_get_ctx_from_list(struct sysdb_ctx_list *ctx_list, * therefore they cannot be called within a transaction */ int sysdb_getpwnam(TALLOC_CTX *mem_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 *sysdb, - struct sss_domain_info *domain, uid_t uid, struct ldb_result **res); int sysdb_enumpwent(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, struct ldb_result **res); int sysdb_getgrnam(TALLOC_CTX *mem_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 *sysdb, - struct sss_domain_info *domain, gid_t gid, struct ldb_result **res); int sysdb_enumgrent(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, struct ldb_result **res); struct sysdb_netgroup_ctx { @@ -353,26 +347,22 @@ struct sysdb_netgroup_ctx { errno_t sysdb_getnetgr(TALLOC_CTX *mem_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 *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 *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 *sysdb, - struct sss_domain_info *domain, const char *netgrname, const char **attributes, struct ldb_result **res); @@ -405,14 +395,12 @@ 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 *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); @@ -420,14 +408,12 @@ 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 *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); @@ -435,7 +421,6 @@ 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 *sysdb, - struct sss_domain_info *domain, const char *name, const char **attrs, struct ldb_message **msg); @@ -450,7 +435,6 @@ int sysdb_set_entry_attr(TALLOC_CTX *mem_ctx, /* Replace user attrs */ int sysdb_set_user_attr(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, struct sysdb_attrs *attrs, int mod_op); @@ -458,14 +442,12 @@ int sysdb_set_user_attr(TALLOC_CTX *mem_ctx, /* Replace group attrs */ int sysdb_set_group_attr(TALLOC_CTX *mem_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 *sysdb, - struct sss_domain_info *domain, const char *name, struct sysdb_attrs *attrs, int mod_op); @@ -473,13 +455,11 @@ int sysdb_set_netgroup_attr(struct sysdb_ctx *sysdb, /* Allocate a new id */ int sysdb_get_new_id(TALLOC_CTX *mem_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 *sysdb, - struct sss_domain_info *domain, const char *name, uid_t uid, gid_t gid, const char *gecos, @@ -489,7 +469,6 @@ int sysdb_add_basic_user(TALLOC_CTX *mem_ctx, /* Add user (all checks) */ int sysdb_add_user(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, uid_t uid, gid_t gid, const char *gecos, @@ -499,37 +478,31 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx, int cache_timeout); 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 *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 *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 *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 *sysdb, - struct sss_domain_info *domain, const char *name, const char *description); int sysdb_add_netgroup(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, const char *description, struct sysdb_attrs *attrs, @@ -544,7 +517,6 @@ int sysdb_mod_group_member(TALLOC_CTX *mem_ctx, int sysdb_store_user(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, const char *pwd, uid_t uid, gid_t gid, @@ -557,7 +529,6 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx, int sysdb_store_group(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, gid_t gid, struct sysdb_attrs *attrs, @@ -569,40 +540,34 @@ enum sysdb_member_type { }; 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 *sysdb, - struct sss_domain_info *domain, const char *group, const char *member, enum sysdb_member_type type); errno_t sysdb_update_members(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *member, enum sysdb_member_type type, const char *const *add_groups, const char *const *del_groups); errno_t sysdb_add_netgroup_tuple(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *hostname, const char *username, const char *domainname); errno_t sysdb_remove_netgroup_tuple(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *hostname, const char *username, const char *domainname); errno_t sysdb_mod_netgroup_tuple(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *hostname, const char *username, @@ -610,17 +575,14 @@ errno_t sysdb_mod_netgroup_tuple(struct sysdb_ctx *sysdb, int mod_op); errno_t sysdb_add_netgroup_member(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *member_netgroup); errno_t sysdb_remove_netgroup_member(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *member_netgroup); errno_t sysdb_mod_netgroup_member(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *member_netgroup, int mod_op); @@ -632,7 +594,6 @@ errno_t sysdb_mod_netgroup_member(struct sysdb_ctx *sysdb, * function will be completely wrapped in it's own sysdb transaction */ int sysdb_cache_password(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *username, const char *password); @@ -643,7 +604,6 @@ errno_t check_failed_login_attempts(TALLOC_CTX *mem_ctx, time_t *delayed_until); int sysdb_cache_auth(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, const uint8_t *authtok, size_t authtok_size, @@ -654,14 +614,12 @@ int sysdb_cache_auth(TALLOC_CTX *mem_ctx, int sysdb_store_custom(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *object_name, const char *subtree_name, struct sysdb_attrs *attrs); int sysdb_search_custom(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *filter, const char *subtree_name, const char **attrs, @@ -670,7 +628,6 @@ int sysdb_search_custom(TALLOC_CTX *mem_ctx, int sysdb_search_custom_by_name(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *object_name, const char *subtree_name, const char **attrs, @@ -679,13 +636,11 @@ int sysdb_search_custom_by_name(TALLOC_CTX *mem_ctx, int sysdb_delete_custom(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *object_name, const char *subtree_name); int sysdb_asq_search(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, struct ldb_dn *base_dn, const char *expression, const char *asq_attribute, @@ -695,7 +650,6 @@ int sysdb_asq_search(TALLOC_CTX *mem_ctx, int sysdb_search_users(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, @@ -703,12 +657,10 @@ int sysdb_search_users(TALLOC_CTX *mem_ctx, int sysdb_delete_user(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, uid_t uid); int sysdb_search_groups(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, @@ -716,19 +668,16 @@ int sysdb_search_groups(TALLOC_CTX *mem_ctx, int sysdb_delete_group(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, gid_t gid); int sysdb_search_netgroups(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, struct ldb_message ***msgs); int sysdb_delete_netgroup(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name); errno_t sysdb_attrs_to_list(TALLOC_CTX *memctx, @@ -745,15 +694,12 @@ errno_t sysdb_dn_sanitize(void *mem_ctx, const char *input, char **sanitized); 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 *sysdb, - struct sss_domain_info *dom, bool enumerated); errno_t sysdb_remove_attrs(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, enum sysdb_member_type type, char **remove_attrs); diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index a998b1001..375548078 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -193,7 +193,6 @@ int sysdb_search_entry(TALLOC_CTX *mem_ctx, 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) @@ -210,7 +209,7 @@ int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx, return ENOMEM; } - basedn = sysdb_user_dn(sysdb, tmpctx, domain->name, name); + basedn = sysdb_user_dn(sysdb, tmpctx, sysdb->domain->name, name); if (!basedn) { ret = ENOMEM; goto done; @@ -234,7 +233,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, struct ldb_message **msg) @@ -253,7 +251,7 @@ int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx, } basedn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_USER_BASE, domain->name); + SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!basedn) { ret = ENOMEM; goto done; @@ -291,7 +289,6 @@ done: 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) @@ -308,7 +305,7 @@ int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx, return ENOMEM; } - basedn = sysdb_group_dn(sysdb, tmpctx, domain->name, name); + basedn = sysdb_group_dn(sysdb, tmpctx, sysdb->domain->name, name); if (!basedn) { ret = ENOMEM; goto done; @@ -332,7 +329,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, struct ldb_message **msg) @@ -351,7 +347,7 @@ int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx, } basedn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_GROUP_BASE, domain->name); + SYSDB_TMPL_GROUP_BASE, sysdb->domain->name); if (!basedn) { ret = ENOMEM; goto done; @@ -389,7 +385,6 @@ done: 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, struct ldb_message **msg) @@ -406,7 +401,7 @@ int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx, return ENOMEM; } - basedn = sysdb_netgroup_dn(sysdb, tmpctx, domain->name, name); + basedn = sysdb_netgroup_dn(sysdb, tmpctx, sysdb->domain->name, name); if (!basedn) { ret = ENOMEM; goto done; @@ -479,18 +474,13 @@ fail: int sysdb_set_user_attr(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, struct sysdb_attrs *attrs, int mod_op) { struct ldb_dn *dn; - if (!domain) { - domain = sysdb->domain; - } - - dn = sysdb_user_dn(sysdb, mem_ctx, domain->name, name); + dn = sysdb_user_dn(sysdb, mem_ctx, sysdb->domain->name, name); if (!dn) { return ENOMEM; } @@ -503,14 +493,13 @@ int sysdb_set_user_attr(TALLOC_CTX *mem_ctx, int sysdb_set_group_attr(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, struct sysdb_attrs *attrs, int mod_op) { struct ldb_dn *dn; - dn = sysdb_group_dn(sysdb, mem_ctx, domain->name, name); + dn = sysdb_group_dn(sysdb, mem_ctx, sysdb->domain->name, name); if (!dn) { return ENOMEM; } @@ -521,7 +510,6 @@ int sysdb_set_group_attr(TALLOC_CTX *mem_ctx, /* =Replace-Attributes-On-Netgroup=========================================== */ int sysdb_set_netgroup_attr(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, struct sysdb_attrs *attrs, int mod_op) @@ -535,11 +523,7 @@ int sysdb_set_netgroup_attr(struct sysdb_ctx *sysdb, return ENOMEM; } - if (domain == NULL) { - domain = sysdb->domain; - } - - dn = sysdb_netgroup_dn(sysdb, tmp_ctx, domain->name, name); + dn = sysdb_netgroup_dn(sysdb, tmp_ctx, sysdb->domain->name, name); if (!dn) { ret = ENOMEM; goto done; @@ -556,7 +540,6 @@ done: int sysdb_get_new_id(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, uint32_t *_id) { TALLOC_CTX *tmpctx; @@ -572,6 +555,8 @@ int sysdb_get_new_id(TALLOC_CTX *mem_ctx, int ret; int i; + struct sss_domain_info *domain = sysdb->domain; + tmpctx = talloc_new(mem_ctx); if (!tmpctx) { return ENOMEM; @@ -722,7 +707,6 @@ done: int sysdb_add_basic_user(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, uid_t uid, gid_t gid, const char *gecos, @@ -738,7 +722,7 @@ int sysdb_add_basic_user(TALLOC_CTX *mem_ctx, } /* user dn */ - msg->dn = sysdb_user_dn(sysdb, msg, domain->name, name); + msg->dn = sysdb_user_dn(sysdb, msg, sysdb->domain->name, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -797,7 +781,6 @@ done: int sysdb_add_user(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, uid_t uid, gid_t gid, const char *gecos, @@ -813,6 +796,8 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx, time_t now; int ret; + struct sss_domain_info *domain = sysdb->domain; + if (sysdb->mpg) { if (gid != 0) { DEBUG(0, ("Cannot add user with arbitrary GID in MPG domain!\n")); @@ -854,7 +839,7 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx, * name the operation will fail */ ret = sysdb_search_group_by_name(tmpctx, sysdb, - domain, name, NULL, &msg); + name, NULL, &msg); if (ret != ENOENT) { if (ret == EOK) ret = EEXIST; goto done; @@ -864,7 +849,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, sysdb, - domain, uid, NULL, &msg); + uid, NULL, &msg); if (ret != ENOENT) { if (ret == EOK) ret = EEXIST; goto done; @@ -873,12 +858,12 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx, /* try to add the user */ ret = sysdb_add_basic_user(tmpctx, sysdb, - domain, name, uid, gid, + name, uid, gid, gecos, homedir, shell); if (ret) goto done; if (uid == 0) { - ret = sysdb_get_new_id(tmpctx, sysdb, domain, &id); + ret = sysdb_get_new_id(tmpctx, sysdb, &id); if (ret) goto done; id_attrs = sysdb_new_attrs(tmpctx); @@ -895,7 +880,7 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx, } ret = sysdb_set_user_attr(tmpctx, sysdb, - domain, name, id_attrs, SYSDB_MOD_REP); + name, id_attrs, SYSDB_MOD_REP); goto done; } @@ -918,7 +903,7 @@ int sysdb_add_user(TALLOC_CTX *mem_ctx, if (ret) goto done; ret = sysdb_set_user_attr(tmpctx, sysdb, - domain, name, attrs, SYSDB_MOD_REP); + name, attrs, SYSDB_MOD_REP); done: if (ret == EOK) { @@ -933,7 +918,6 @@ done: } int sysdb_add_fake_user(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, const char *original_dn) { @@ -953,7 +937,7 @@ int sysdb_add_fake_user(struct sysdb_ctx *sysdb, } /* user dn */ - msg->dn = sysdb_user_dn(sysdb, msg, domain->name, name); + msg->dn = sysdb_user_dn(sysdb, msg, sysdb->domain->name, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1005,7 +989,6 @@ done: int sysdb_add_basic_group(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, gid_t gid) { struct ldb_message *msg; @@ -1017,7 +1000,7 @@ int sysdb_add_basic_group(TALLOC_CTX *mem_ctx, } /* group dn */ - msg->dn = sysdb_group_dn(sysdb, msg, domain->name, name); + msg->dn = sysdb_group_dn(sysdb, msg, sysdb->domain->name, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1052,7 +1035,6 @@ done: int sysdb_add_group(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, gid_t gid, struct sysdb_attrs *attrs, int cache_timeout) @@ -1064,6 +1046,8 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx, int ret; bool posix; + struct sss_domain_info *domain = sysdb->domain; + if (domain->id_max != 0 && gid != 0 && (gid < domain->id_min || gid > domain->id_max)) { DEBUG(2, ("Supplied gid [%d] is not in the allowed range [%d-%d].\n", @@ -1090,7 +1074,7 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx, * name the operation will fail */ ret = sysdb_search_user_by_name(tmpctx, sysdb, - domain, name, NULL, &msg); + name, NULL, &msg); if (ret != ENOENT) { if (ret == EOK) ret = EEXIST; goto done; @@ -1100,7 +1084,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, sysdb, - domain, gid, NULL, &msg); + gid, NULL, &msg); if (ret != ENOENT) { if (ret == EOK) ret = EEXIST; goto done; @@ -1108,7 +1092,7 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx, } /* try to add the group */ - ret = sysdb_add_basic_group(tmpctx, sysdb, domain, name, gid); + ret = sysdb_add_basic_group(tmpctx, sysdb, name, gid); if (ret) goto done; if (!attrs) { @@ -1129,7 +1113,7 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx, } if (posix && gid == 0) { - ret = sysdb_get_new_id(tmpctx, sysdb, domain, &id); + ret = sysdb_get_new_id(tmpctx, sysdb, &id); if (ret) goto done; ret = sysdb_attrs_add_uint32(attrs, SYSDB_GIDNUM, id); @@ -1147,7 +1131,7 @@ int sysdb_add_group(TALLOC_CTX *mem_ctx, if (ret) goto done; ret = sysdb_set_group_attr(tmpctx, sysdb, - domain, name, attrs, SYSDB_MOD_REP); + name, attrs, SYSDB_MOD_REP); done: if (ret == EOK) { @@ -1162,7 +1146,6 @@ done: } int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, gid_t gid, const char *original_dn, @@ -1179,7 +1162,7 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb, } /* try to add the group */ - ret = sysdb_add_basic_group(tmpctx, sysdb, domain, name, gid); + ret = sysdb_add_basic_group(tmpctx, sysdb, name, gid); if (ret) goto done; attrs = sysdb_new_attrs(tmpctx); @@ -1206,7 +1189,7 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb, } ret = sysdb_set_group_attr(tmpctx, sysdb, - domain, name, attrs, SYSDB_MOD_REP); + name, attrs, SYSDB_MOD_REP); done: if (ret != EOK) { @@ -1264,7 +1247,6 @@ fail: /* =Add-Basic-Netgroup-NO-CHECKS============================================= */ int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, const char *description) { struct ldb_message *msg; @@ -1276,7 +1258,7 @@ int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb, } /* netgroup dn */ - msg->dn = sysdb_netgroup_dn(sysdb, msg, domain->name, name); + msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain->name, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1314,7 +1296,6 @@ done: /* =Add-Netgroup-Function==================================================== */ int sysdb_add_netgroup(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, const char *description, struct sysdb_attrs *attrs, @@ -1337,7 +1318,7 @@ int sysdb_add_netgroup(struct sysdb_ctx *sysdb, } /* try to add the netgroup */ - ret = sysdb_add_basic_netgroup(sysdb, domain, name, description); + ret = sysdb_add_basic_netgroup(sysdb, name, description); if (ret && ret != EEXIST) goto done; if (!attrs) { @@ -1358,7 +1339,7 @@ int sysdb_add_netgroup(struct sysdb_ctx *sysdb, (now + cache_timeout) : 0)); if (ret) goto done; - ret = sysdb_set_netgroup_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP); + ret = sysdb_set_netgroup_attr(sysdb, name, attrs, SYSDB_MOD_REP); done: if (ret == EOK) { @@ -1381,7 +1362,6 @@ done: int sysdb_store_user(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, const char *pwd, uid_t uid, gid_t gid, @@ -1404,10 +1384,6 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx, return ENOMEM; } - if (!domain) { - domain = sysdb->domain; - } - if (!attrs) { attrs = sysdb_new_attrs(tmpctx); if (!attrs) { @@ -1416,7 +1392,7 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx, } } - if (pwd && (domain->legacy_passwords || !*pwd)) { + if (pwd && (sysdb->domain->legacy_passwords || !*pwd)) { ret = sysdb_attrs_add_string(attrs, SYSDB_PWD, pwd); if (ret) goto done; } @@ -1427,14 +1403,14 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx, in_transaction = true; ret = sysdb_search_user_by_name(tmpctx, sysdb, - domain, name, NULL, &msg); + name, NULL, &msg); if (ret && ret != ENOENT) { goto done; } if (ret == ENOENT) { /* users doesn't exist, turn into adding a user */ - ret = sysdb_add_user(tmpctx, sysdb, domain, name, uid, gid, + ret = sysdb_add_user(tmpctx, sysdb, name, uid, gid, gecos, homedir, shell, attrs, cache_timeout); goto done; } @@ -1481,11 +1457,11 @@ int sysdb_store_user(TALLOC_CTX *mem_ctx, if (ret) goto done; ret = sysdb_set_user_attr(tmpctx, sysdb, - domain, name, attrs, SYSDB_MOD_REP); + name, attrs, SYSDB_MOD_REP); if (ret != EOK) goto done; if (remove_attrs) { - ret = sysdb_remove_attrs(sysdb, domain, name, + ret = sysdb_remove_attrs(sysdb, name, SYSDB_MEMBER_USER, remove_attrs); if (ret != EOK) { @@ -1522,7 +1498,6 @@ done: int sysdb_store_group(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, gid_t gid, struct sysdb_attrs *attrs, @@ -1541,12 +1516,8 @@ int sysdb_store_group(TALLOC_CTX *mem_ctx, return ENOMEM; } - if (!domain) { - domain = sysdb->domain; - } - ret = sysdb_search_group_by_name(tmpctx, sysdb, - domain, name, src_attrs, &msg); + name, src_attrs, &msg); if (ret && ret != ENOENT) { goto done; } @@ -1568,7 +1539,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, sysdb, - domain, name, gid, attrs, cache_timeout); + name, gid, attrs, cache_timeout); goto done; } @@ -1589,8 +1560,7 @@ int sysdb_store_group(TALLOC_CTX *mem_ctx, if (ret) goto done; ret = sysdb_set_group_attr(tmpctx, sysdb, - domain, name, - attrs, SYSDB_MOD_REP); + name, attrs, SYSDB_MOD_REP); done: if (ret) { @@ -1605,7 +1575,6 @@ done: 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) @@ -1618,20 +1587,20 @@ int sysdb_add_group_member(struct sysdb_ctx *sysdb, return ENOMEM; } - group_dn = sysdb_group_dn(sysdb, tmp_ctx, domain->name, group); + group_dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain->name, group); if (!group_dn) { ret = ENOMEM; goto done; } if (type == SYSDB_MEMBER_USER) { - member_dn = sysdb_user_dn(sysdb, tmp_ctx, domain->name, member); + member_dn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain->name, member); if (!member_dn) { ret = ENOMEM; goto done; } } else if (type == SYSDB_MEMBER_GROUP) { - member_dn = sysdb_group_dn(sysdb, tmp_ctx, domain->name, member); + member_dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain->name, member); if (!member_dn) { ret = ENOMEM; goto done; @@ -1654,7 +1623,6 @@ done: int sysdb_remove_group_member(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *group, const char *member, enum sysdb_member_type type) @@ -1667,20 +1635,20 @@ int sysdb_remove_group_member(struct sysdb_ctx *sysdb, return ENOMEM; } - group_dn = sysdb_group_dn(sysdb, tmp_ctx, domain->name, group); + group_dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain->name, group); if (!group_dn) { ret = ENOMEM; goto done; } if (type == SYSDB_MEMBER_USER) { - member_dn = sysdb_user_dn(sysdb, tmp_ctx, domain->name, member); + member_dn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain->name, member); if (!member_dn) { ret = ENOMEM; goto done; } } else if (type == SYSDB_MEMBER_GROUP) { - member_dn = sysdb_group_dn(sysdb, tmp_ctx, domain->name, member); + member_dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain->name, member); if (!member_dn) { ret = ENOMEM; goto done; @@ -1702,7 +1670,6 @@ done: int sysdb_cache_password(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *username, const char *password) { @@ -1747,7 +1714,7 @@ int sysdb_cache_password(TALLOC_CTX *mem_ctx, ret = sysdb_set_user_attr(tmpctx, sysdb, - domain, username, attrs, SYSDB_MOD_REP); + username, attrs, SYSDB_MOD_REP); if (ret) { goto fail; } @@ -1766,7 +1733,6 @@ fail: int sysdb_search_custom(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *filter, const char *subtree_name, const char **attrs, @@ -1781,7 +1747,7 @@ int sysdb_search_custom(TALLOC_CTX *mem_ctx, } basedn = sysdb_custom_subtree_dn(sysdb, mem_ctx, - domain->name, subtree_name); + sysdb->domain->name, subtree_name); if (basedn == NULL) { DEBUG(1, ("sysdb_custom_subtree_dn failed.\n")); return ENOMEM; @@ -1799,7 +1765,6 @@ int sysdb_search_custom(TALLOC_CTX *mem_ctx, int sysdb_search_custom_by_name(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *object_name, const char *subtree_name, const char **attrs, @@ -1822,7 +1787,7 @@ int sysdb_search_custom_by_name(TALLOC_CTX *mem_ctx, } basedn = sysdb_custom_dn(sysdb, tmpctx, - domain->name, object_name, subtree_name); + sysdb->domain->name, object_name, subtree_name); if (basedn == NULL) { DEBUG(1, ("sysdb_custom_dn failed.\n")); ret = ENOMEM; @@ -1859,7 +1824,6 @@ done: int sysdb_store_custom(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *object_name, const char *subtree_name, struct sysdb_attrs *attrs) @@ -1890,7 +1854,7 @@ int sysdb_store_custom(TALLOC_CTX *mem_ctx, } ret = sysdb_search_custom_by_name(tmpctx, sysdb, - domain, object_name, subtree_name, + object_name, subtree_name, search_attrs, &resp_count, &resp); if (ret != EOK && ret != ENOENT) { goto done; @@ -1907,7 +1871,7 @@ int sysdb_store_custom(TALLOC_CTX *mem_ctx, } msg->dn = sysdb_custom_dn(sysdb, tmpctx, - domain->name, object_name, subtree_name); + sysdb->domain->name, object_name, subtree_name); if (!msg->dn) { DEBUG(1, ("sysdb_custom_dn failed.\n")); ret = ENOMEM; @@ -1962,7 +1926,6 @@ done: int sysdb_delete_custom(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *object_name, const char *subtree_name) { @@ -1979,7 +1942,7 @@ int sysdb_delete_custom(TALLOC_CTX *mem_ctx, return ENOMEM; } - dn = sysdb_custom_dn(sysdb, tmpctx, domain->name, object_name, subtree_name); + dn = sysdb_custom_dn(sysdb, tmpctx, sysdb->domain->name, object_name, subtree_name); if (dn == NULL) { DEBUG(1, ("sysdb_custom_dn failed.\n")); ret = ENOMEM; @@ -2010,7 +1973,6 @@ done: int sysdb_asq_search(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, struct ldb_dn *base_dn, const char *expression, const char *asq_attribute, @@ -2100,7 +2062,6 @@ fail: int sysdb_search_users(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, @@ -2116,12 +2077,8 @@ int sysdb_search_users(TALLOC_CTX *mem_ctx, return ENOMEM; } - if (!domain) { - domain = sysdb->domain; - } - basedn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_USER_BASE, domain->name); + SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!basedn) { DEBUG(2, ("Failed to build base dn\n")); ret = ENOMEM; @@ -2157,7 +2114,6 @@ fail: int sysdb_delete_user(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, uid_t uid) { TALLOC_CTX *tmpctx; @@ -2171,10 +2127,10 @@ int sysdb_delete_user(TALLOC_CTX *mem_ctx, if (name) { ret = sysdb_search_user_by_name(tmpctx, sysdb, - domain, name, NULL, &msg); + name, NULL, &msg); } else { ret = sysdb_search_user_by_uid(tmpctx, sysdb, - domain, uid, NULL, &msg); + uid, NULL, &msg); } if (ret) { goto fail; @@ -2218,7 +2174,6 @@ fail: int sysdb_search_groups(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, @@ -2234,12 +2189,8 @@ int sysdb_search_groups(TALLOC_CTX *mem_ctx, return ENOMEM; } - if (!domain) { - domain = sysdb->domain; - } - basedn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_GROUP_BASE, domain->name); + SYSDB_TMPL_GROUP_BASE, sysdb->domain->name); if (!basedn) { DEBUG(2, ("Failed to build base dn\n")); ret = ENOMEM; @@ -2275,7 +2226,6 @@ fail: int sysdb_delete_group(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, gid_t gid) { TALLOC_CTX *tmpctx; @@ -2289,10 +2239,10 @@ int sysdb_delete_group(TALLOC_CTX *mem_ctx, if (name) { ret = sysdb_search_group_by_name(tmpctx, sysdb, - domain, name, NULL, &msg); + name, NULL, &msg); } else { ret = sysdb_search_group_by_gid(tmpctx, sysdb, - domain, gid, NULL, &msg); + gid, NULL, &msg); } if (ret) { goto fail; @@ -2335,7 +2285,6 @@ fail: int sysdb_search_netgroups(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, @@ -2351,12 +2300,8 @@ int sysdb_search_netgroups(TALLOC_CTX *mem_ctx, return ENOMEM; } - if (domain == NULL) { - domain = sysdb->domain; - } - basedn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_NETGROUP_BASE, domain->name); + SYSDB_TMPL_NETGROUP_BASE, sysdb->domain->name); if (!basedn) { DEBUG(2, ("Failed to build base dn\n")); ret = ENOMEM; @@ -2391,7 +2336,6 @@ fail: /* =Delete-Netgroup-by-Name============================================== */ int sysdb_delete_netgroup(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name) { TALLOC_CTX *tmp_ctx; @@ -2406,7 +2350,7 @@ int sysdb_delete_netgroup(struct sysdb_ctx *sysdb, } ret = sysdb_search_netgroup_by_name(tmp_ctx, sysdb, - domain, name, NULL, &msg); + name, NULL, &msg); if (ret != EOK && ret != ENOENT) { DEBUG(6, ("sysdb_search_netgroup_by_name failed: %d (%s)\n", ret, strerror(ret))); @@ -2495,7 +2439,6 @@ errno_t check_failed_login_attempts(TALLOC_CTX *mem_ctx, int sysdb_cache_auth(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, const uint8_t *authtok, size_t authtok_size, @@ -2539,7 +2482,7 @@ int sysdb_cache_auth(TALLOC_CTX *mem_ctx, return EINVAL; } - if (!domain->cache_credentials) { + if (!sysdb->domain->cache_credentials) { DEBUG(3, ("Cached credentials not available.\n")); return EINVAL; } @@ -2557,7 +2500,7 @@ int sysdb_cache_auth(TALLOC_CTX *mem_ctx, } ret = sysdb_search_user_by_name(tmpctx, sysdb, - domain, name, attrs, &ldb_msg); + name, attrs, &ldb_msg); if (ret != EOK) { DEBUG(1, ("sysdb_search_user_by_name failed [%d][%s].\n", ret, strerror(ret))); @@ -2679,7 +2622,7 @@ int sysdb_cache_auth(TALLOC_CTX *mem_ctx, } ret = sysdb_set_user_attr(tmpctx, sysdb, - domain, name, update_attrs, + name, update_attrs, LDB_FLAG_MOD_REPLACE); if (ret) { DEBUG(1, ("Failed to update Login attempt information!\n")); @@ -2713,7 +2656,6 @@ done: } errno_t sysdb_update_members(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *member, enum sysdb_member_type type, const char *const *add_groups, @@ -2736,8 +2678,7 @@ errno_t sysdb_update_members(struct sysdb_ctx *sysdb, if (add_groups) { /* Add the user to all add_groups */ for (i = 0; add_groups[i]; i++) { - ret = sysdb_add_group_member(sysdb, domain, - add_groups[i], member, + ret = sysdb_add_group_member(sysdb, add_groups[i], member, type); if (ret != EOK) { DEBUG(1, ("Could not add member [%s] to group [%s]. " @@ -2750,8 +2691,7 @@ errno_t sysdb_update_members(struct sysdb_ctx *sysdb, if (del_groups) { /* Remove the user from all del_groups */ for (i = 0; del_groups[i]; i++) { - ret = sysdb_remove_group_member(sysdb, domain, - del_groups[i], member, + ret = sysdb_remove_group_member(sysdb, del_groups[i], member, type); if (ret != EOK) { DEBUG(1, ("Could not remove member [%s] from group [%s]. " @@ -2772,29 +2712,26 @@ done: } errno_t sysdb_add_netgroup_tuple(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *hostname, const char *username, const char *domainname) { - return sysdb_mod_netgroup_tuple(sysdb, domain, netgroup, hostname, + return sysdb_mod_netgroup_tuple(sysdb, netgroup, hostname, username, domainname, SYSDB_MOD_ADD); } errno_t sysdb_remove_netgroup_tuple(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *hostname, const char *username, const char *domainname) { - return sysdb_mod_netgroup_tuple(sysdb, domain, netgroup, hostname, + return sysdb_mod_netgroup_tuple(sysdb, netgroup, hostname, username, domainname, SYSDB_MOD_DEL); } errno_t sysdb_mod_netgroup_tuple(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *hostname, const char *username, @@ -2811,7 +2748,7 @@ errno_t sysdb_mod_netgroup_tuple(struct sysdb_ctx *sysdb, ERROR_OUT(ret, ENOMEM, done); } - msg->dn = sysdb_netgroup_dn(sysdb, msg, domain->name, netgroup); + msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain->name, netgroup); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -2839,25 +2776,22 @@ done: } errno_t sysdb_add_netgroup_member(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *member_netgroup) { - return sysdb_mod_netgroup_member(sysdb, domain, netgroup, + return sysdb_mod_netgroup_member(sysdb, netgroup, member_netgroup, SYSDB_MOD_ADD); } errno_t sysdb_remove_netgroup_member(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *member_netgroup) { - return sysdb_mod_netgroup_member(sysdb, domain, netgroup, + return sysdb_mod_netgroup_member(sysdb, netgroup, member_netgroup, SYSDB_MOD_DEL); } errno_t sysdb_mod_netgroup_member(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, const char *member_netgroup, int mod_op) @@ -2872,13 +2806,13 @@ errno_t sysdb_mod_netgroup_member(struct sysdb_ctx *sysdb, ERROR_OUT(ret, ENOMEM, done); } - msg->dn = sysdb_netgroup_dn(sysdb, msg, domain->name, netgroup); + msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain->name, netgroup); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } member = talloc_asprintf(msg, SYSDB_TMPL_NETGROUP, - member_netgroup, domain->name); + member_netgroup, sysdb->domain->name); if (!member) { ret = ENOMEM; goto done; @@ -2901,7 +2835,6 @@ done: } errno_t sysdb_remove_attrs(struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, enum sysdb_member_type type, char **remove_attrs) @@ -2917,13 +2850,13 @@ errno_t sysdb_remove_attrs(struct sysdb_ctx *sysdb, if (!msg) return ENOMEM; if (type == SYSDB_MEMBER_USER) { - msg->dn = sysdb_user_dn(sysdb, msg, domain->name, name); + msg->dn = sysdb_user_dn(sysdb, msg, sysdb->domain->name, name); if (!msg->dn) { ret = ENOMEM; goto done; } } else if (type == SYSDB_MEMBER_GROUP) { - msg->dn = sysdb_group_dn(sysdb, msg, domain->name, name); + msg->dn = sysdb_group_dn(sysdb, msg, sysdb->domain->name, name); if (!msg->dn) { ret = ENOMEM; goto done; diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c index 8705b83d7..85ef8aefc 100644 --- a/src/db/sysdb_search.c +++ b/src/db/sysdb_search.c @@ -29,7 +29,6 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, struct ldb_result **_res) { @@ -40,17 +39,13 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx, char *sanitized_name; int ret; - if (!domain) { - return EINVAL; - } - tmpctx = talloc_new(mem_ctx); if (!tmpctx) { return ENOMEM; } base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_USER_BASE, domain->name); + SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; @@ -78,7 +73,6 @@ done: int sysdb_getpwuid(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, uid_t uid, struct ldb_result **_res) { @@ -89,17 +83,13 @@ int sysdb_getpwuid(TALLOC_CTX *mem_ctx, struct ldb_result *res; int ret; - if (!domain) { - return EINVAL; - } - tmpctx = talloc_new(mem_ctx); if (!tmpctx) { return ENOMEM; } base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_USER_BASE, domain->name); + SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; @@ -121,7 +111,6 @@ done: int sysdb_enumpwent(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, struct ldb_result **_res) { TALLOC_CTX *tmpctx; @@ -130,17 +119,13 @@ int sysdb_enumpwent(TALLOC_CTX *mem_ctx, struct ldb_result *res; int ret; - if (!domain) { - return EINVAL; - } - tmpctx = talloc_new(mem_ctx); if (!tmpctx) { return ENOMEM; } base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_USER_BASE, domain->name); + SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; @@ -206,7 +191,6 @@ static int mpg_res_convert(struct ldb_result *res) int sysdb_getgrnam(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, struct ldb_result **_res) { @@ -218,10 +202,6 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx, struct ldb_result *res; int ret; - if (!domain) { - return EINVAL; - } - tmpctx = talloc_new(mem_ctx); if (!tmpctx) { return ENOMEM; @@ -230,11 +210,11 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx, if (sysdb->mpg) { fmt_filter = SYSDB_GRNAM_MPG_FILTER; base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_DOM_BASE, domain->name); + SYSDB_DOM_BASE, sysdb->domain->name); } else { fmt_filter = SYSDB_GRNAM_FILTER; base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_GROUP_BASE, domain->name); + SYSDB_TMPL_GROUP_BASE, sysdb->domain->name); } if (!base_dn) { ret = ENOMEM; @@ -268,7 +248,6 @@ done: int sysdb_getgrgid(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, gid_t gid, struct ldb_result **_res) { @@ -280,10 +259,6 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx, struct ldb_result *res; int ret; - if (!domain) { - return EINVAL; - } - tmpctx = talloc_new(mem_ctx); if (!tmpctx) { return ENOMEM; @@ -292,11 +267,11 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx, if (sysdb->mpg) { fmt_filter = SYSDB_GRGID_MPG_FILTER; base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_DOM_BASE, domain->name); + SYSDB_DOM_BASE, sysdb->domain->name); } else { fmt_filter = SYSDB_GRGID_FILTER; base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_GROUP_BASE, domain->name); + SYSDB_TMPL_GROUP_BASE, sysdb->domain->name); } if (!base_dn) { ret = ENOMEM; @@ -324,7 +299,6 @@ done: int sysdb_enumgrent(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, struct ldb_result **_res) { TALLOC_CTX *tmpctx; @@ -334,10 +308,6 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx, struct ldb_result *res; int ret; - if (!domain) { - return EINVAL; - } - tmpctx = talloc_new(mem_ctx); if (!tmpctx) { return ENOMEM; @@ -346,11 +316,11 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx, if (sysdb->mpg) { fmt_filter = SYSDB_GRENT_MPG_FILTER; base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_DOM_BASE, domain->name); + SYSDB_DOM_BASE, sysdb->domain->name); } else { fmt_filter = SYSDB_GRENT_FILTER; base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_GROUP_BASE, domain->name); + SYSDB_TMPL_GROUP_BASE, sysdb->domain->name); } if (!base_dn) { ret = ENOMEM; @@ -378,7 +348,6 @@ done: int sysdb_initgroups(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, struct ldb_result **_res) { @@ -396,7 +365,7 @@ int sysdb_initgroups(TALLOC_CTX *mem_ctx, return ENOMEM; } - ret = sysdb_getpwnam(tmpctx, sysdb, domain, name, &res); + ret = sysdb_getpwnam(tmpctx, sysdb, name, &res); if (ret != EOK) { DEBUG(1, ("sysdb_getpwnam failed: [%d][%s]\n", ret, strerror(ret))); @@ -478,7 +447,6 @@ done: int sysdb_get_user_attr(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *name, const char **attributes, struct ldb_result **_res) @@ -489,17 +457,13 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx, char *sanitized_name; int ret; - if (!domain) { - return EINVAL; - } - tmpctx = talloc_new(mem_ctx); if (!tmpctx) { return ENOMEM; } base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_USER_BASE, domain->name); + SYSDB_TMPL_USER_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; @@ -781,7 +745,6 @@ done: errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgroup, struct ldb_result **res) { @@ -794,10 +757,6 @@ errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx, int lret; errno_t ret; - if (!domain) { - return EINVAL; - } - tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { return ENOMEM; @@ -805,7 +764,7 @@ errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx, base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_NETGROUP_BASE, - domain->name); + sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; @@ -817,7 +776,7 @@ errno_t sysdb_getnetgr(TALLOC_CTX *mem_ctx, } netgroup_dn = talloc_asprintf(tmp_ctx, SYSDB_TMPL_NETGROUP, - sanitized_netgroup, domain->name); + sanitized_netgroup, sysdb->domain->name); if (!netgroup_dn) { ret = ENOMEM; goto done; @@ -842,7 +801,6 @@ done: int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, const char *netgrname, const char **attributes, struct ldb_result **res) @@ -853,17 +811,13 @@ int sysdb_get_netgroup_attr(TALLOC_CTX *mem_ctx, char *sanitized_netgroup; int ret; - if (!domain) { - return EINVAL; - } - tmpctx = talloc_new(mem_ctx); if (!tmpctx) { return ENOMEM; } base_dn = ldb_dn_new_fmt(tmpctx, sysdb->ldb, - SYSDB_TMPL_NETGROUP_BASE, domain->name); + SYSDB_TMPL_NETGROUP_BASE, sysdb->domain->name); if (!base_dn) { ret = ENOMEM; goto done; diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c index 3bd377320..74136d31c 100644 --- a/src/providers/ipa/ipa_access.c +++ b/src/providers/ipa/ipa_access.c @@ -605,7 +605,6 @@ static errno_t hbac_get_cached_rules(TALLOC_CTX *mem_ctx, { errno_t ret; struct sysdb_ctx *sysdb = hbac_ctx_sysdb(hbac_ctx); - struct sss_domain_info *domain = hbac_ctx_be(hbac_ctx)->domain; size_t count; struct ldb_message **msgs; TALLOC_CTX *tmp_ctx; @@ -635,7 +634,7 @@ static errno_t hbac_get_cached_rules(TALLOC_CTX *mem_ctx, goto done; } - ret = sysdb_search_custom(mem_ctx, sysdb, domain, filter, + ret = sysdb_search_custom(mem_ctx, sysdb, filter, HBAC_RULES_SUBDIR, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) { diff --git a/src/providers/ipa/ipa_auth.c b/src/providers/ipa/ipa_auth.c index d8d8ad5ae..f0bdd429e 100644 --- a/src/providers/ipa/ipa_auth.c +++ b/src/providers/ipa/ipa_auth.c @@ -363,7 +363,6 @@ static void ipa_get_migration_flag_done(struct tevent_req *req) attrs[1] = NULL; ret = sysdb_search_user_by_name(state, state->be_req->be_ctx->sysdb, - state->be_req->be_ctx->domain, state->pd->user, attrs, &user_msg); if (ret != EOK) { DEBUG(1, ("sysdb_search_user_by_name failed.\n")); diff --git a/src/providers/ipa/ipa_hbac_common.c b/src/providers/ipa/ipa_hbac_common.c index 4633f2f9e..36c67e492 100644 --- a/src/providers/ipa/ipa_hbac_common.c +++ b/src/providers/ipa/ipa_hbac_common.c @@ -77,8 +77,7 @@ ipa_hbac_save_list(struct sysdb_ctx *sysdb, bool delete_subdir, } DEBUG(9, ("Object name: [%s].\n", object_name)); - ret = sysdb_store_custom(tmp_ctx, sysdb, domain, object_name, subdir, - list[c]); + ret = sysdb_store_custom(tmp_ctx, sysdb, object_name, subdir, list[c]); if (ret != EOK) { DEBUG(1, ("sysdb_store_custom failed.\n")); goto done; @@ -210,7 +209,7 @@ ipa_hbac_sysdb_save(struct sysdb_ctx *sysdb, struct sss_domain_info *domain, goto done; } - ret = sysdb_search_custom(tmp_ctx, sysdb, domain, + ret = sysdb_search_custom(tmp_ctx, sysdb, member_filter, primary_subdir, NULL, &member_count, &members); talloc_zfree(member_filter); @@ -625,8 +624,7 @@ 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, sysdb, users->name, attrs, &msg); if (ret != EOK) { DEBUG(1, ("Could not determine user memberships for [%s]\n", users->name)); @@ -734,7 +732,7 @@ hbac_eval_service_element(TALLOC_CTX *mem_ctx, } /* Find the service groups */ - ret = sysdb_asq_search(tmp_ctx, sysdb, domain, svc_dn, + ret = sysdb_asq_search(tmp_ctx, sysdb, svc_dn, service_filter, SYSDB_MEMBEROF, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) { @@ -835,7 +833,7 @@ hbac_eval_host_element(TALLOC_CTX *mem_ctx, } /* Find the host groups */ - ret = sysdb_asq_search(tmp_ctx, sysdb, domain, host_dn, + ret = sysdb_asq_search(tmp_ctx, sysdb, host_dn, host_filter, SYSDB_MEMBEROF, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) { diff --git a/src/providers/ipa/ipa_hbac_hosts.c b/src/providers/ipa/ipa_hbac_hosts.c index 4e753f374..15522f49f 100644 --- a/src/providers/ipa/ipa_hbac_hosts.c +++ b/src/providers/ipa/ipa_hbac_hosts.c @@ -331,7 +331,7 @@ static errno_t hbac_host_attrs_to_rule(TALLOC_CTX *mem_ctx, } /* First check if this is a specific host */ - ret = sysdb_search_custom(tmp_ctx, sysdb, domain, filter, + ret = sysdb_search_custom(tmp_ctx, sysdb, filter, HBAC_HOSTS_SUBDIR, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) goto done; @@ -367,7 +367,7 @@ static errno_t hbac_host_attrs_to_rule(TALLOC_CTX *mem_ctx, num_hosts++; } else { /* ret == ENOENT */ /* Check if this is a hostgroup */ - ret = sysdb_search_custom(tmp_ctx, sysdb, domain, filter, + ret = sysdb_search_custom(tmp_ctx, sysdb, filter, HBAC_HOSTGROUPS_SUBDIR, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) goto done; diff --git a/src/providers/ipa/ipa_hbac_services.c b/src/providers/ipa/ipa_hbac_services.c index df276b86c..fa580977c 100644 --- a/src/providers/ipa/ipa_hbac_services.c +++ b/src/providers/ipa/ipa_hbac_services.c @@ -345,7 +345,7 @@ hbac_service_attrs_to_rule(TALLOC_CTX *mem_ctx, } /* First check if this is a specific service */ - ret = sysdb_search_custom(tmp_ctx, sysdb, domain, filter, + ret = sysdb_search_custom(tmp_ctx, sysdb, filter, HBAC_SERVICES_SUBDIR, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) goto done; @@ -380,7 +380,7 @@ hbac_service_attrs_to_rule(TALLOC_CTX *mem_ctx, num_services++; } else { /* ret == ENOENT */ /* Check if this is a service group */ - ret = sysdb_search_custom(tmp_ctx, sysdb, domain, filter, + ret = sysdb_search_custom(tmp_ctx, sysdb, filter, HBAC_SERVICEGROUPS_SUBDIR, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) goto done; diff --git a/src/providers/ipa/ipa_hbac_users.c b/src/providers/ipa/ipa_hbac_users.c index 9b7cadb2e..888f866d5 100644 --- a/src/providers/ipa/ipa_hbac_users.c +++ b/src/providers/ipa/ipa_hbac_users.c @@ -232,8 +232,7 @@ hbac_user_attrs_to_rule(TALLOC_CTX *mem_ctx, } /* First check if this is a user */ - ret = sysdb_search_users(tmp_ctx, sysdb, domain, - filter, attrs, &count, &msgs); + ret = sysdb_search_users(tmp_ctx, sysdb, filter, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) goto done; if (ret == EOK && count == 0) { ret = ENOENT; @@ -265,7 +264,7 @@ hbac_user_attrs_to_rule(TALLOC_CTX *mem_ctx, num_users++; } else { /* Check if it is a group instead */ - ret = sysdb_search_groups(tmp_ctx, sysdb, domain, + ret = sysdb_search_groups(tmp_ctx, sysdb, filter, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) goto done; if (ret == EOK && count == 0) { diff --git a/src/providers/krb5/krb5_access.c b/src/providers/krb5/krb5_access.c index 4becd03c5..afa3a89df 100644 --- a/src/providers/krb5/krb5_access.c +++ b/src/providers/krb5/krb5_access.c @@ -87,8 +87,8 @@ struct tevent_req *krb5_access_send(TALLOC_CTX *mem_ctx, attrs[2] = SYSDB_GIDNUM; attrs[3] = NULL; - ret = sysdb_get_user_attr(state, be_ctx->sysdb, be_ctx->domain, - state->pd->user, attrs, &res); + ret = sysdb_get_user_attr(state, be_ctx->sysdb, state->pd->user, attrs, + &res); if (ret) { DEBUG(5, ("sysdb search for upn of user [%s] failed.\n", pd->user)); goto done; diff --git a/src/providers/krb5/krb5_auth.c b/src/providers/krb5/krb5_auth.c index a7444d30f..c8dc86526 100644 --- a/src/providers/krb5/krb5_auth.c +++ b/src/providers/krb5/krb5_auth.c @@ -193,8 +193,7 @@ static int krb5_mod_ccname(TALLOC_CTX *mem_ctx, goto done; } - ret = sysdb_set_user_attr(tmpctx, sysdb, - domain, name, attrs, mod_op); + ret = sysdb_set_user_attr(tmpctx, sysdb, name, attrs, mod_op); if (ret != EOK) { DEBUG(6, ("Error: %d (%s)\n", ret, strerror(ret))); sysdb_transaction_cancel(sysdb); @@ -408,8 +407,8 @@ struct tevent_req *krb5_auth_send(TALLOC_CTX *mem_ctx, } kr = state->kr; - ret = sysdb_get_user_attr(state, be_ctx->sysdb, be_ctx->domain, - state->pd->user, attrs, &res); + ret = sysdb_get_user_attr(state, be_ctx->sysdb, state->pd->user, attrs, + &res); if (ret) { DEBUG(5, ("sysdb search for upn of user [%s] failed.\n", pd->user)); state->pam_status = PAM_SYSTEM_ERR; @@ -1084,8 +1083,7 @@ static void krb5_save_ccname_done(struct tevent_req *req) talloc_set_destructor((TALLOC_CTX *)password, password_destructor); - ret = sysdb_cache_password(state, state->be_ctx->sysdb, - state->be_ctx->domain, pd->user, + ret = sysdb_cache_password(state, state->be_ctx->sysdb, pd->user, password); if (ret) { DEBUG(2, ("Failed to cache password, offline auth may not work." @@ -1114,9 +1112,9 @@ static void krb5_pam_handler_cache_auth_step(struct tevent_req *req) struct krb5_ctx *krb5_ctx = state->kr->krb5_ctx; int ret; - ret = sysdb_cache_auth(state, state->be_ctx->sysdb, state->be_ctx->domain, - pd->user, pd->authtok, pd->authtok_size, - state->be_ctx->cdb, true, NULL, NULL); + ret = sysdb_cache_auth(state, state->be_ctx->sysdb, pd->user, pd->authtok, + pd->authtok_size, state->be_ctx->cdb, true, NULL, + NULL); if (ret != EOK) { DEBUG(1, ("Offline authentication failed\n")); state->pam_status = PAM_SYSTEM_ERR; diff --git a/src/providers/krb5/krb5_renew_tgt.c b/src/providers/krb5/krb5_renew_tgt.c index 557ec3e1d..2ad5592e9 100644 --- a/src/providers/krb5/krb5_renew_tgt.c +++ b/src/providers/krb5/krb5_renew_tgt.c @@ -390,8 +390,7 @@ static errno_t check_ccache_files(struct renew_tgt_ctx *renew_tgt_ctx) } ret = sysdb_search_users(tmp_ctx, renew_tgt_ctx->be_ctx->sysdb, - renew_tgt_ctx->be_ctx->domain, ccache_filter, - ccache_attrs, &msgs_count, &msgs); + ccache_filter, ccache_attrs, &msgs_count, &msgs); if (ret != EOK) { DEBUG(1, ("sysdb_search_users failed.\n")); goto done; diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c index 5857e5379..efc9f5278 100644 --- a/src/providers/ldap/ldap_auth.c +++ b/src/providers/ldap/ldap_auth.c @@ -376,7 +376,7 @@ static int get_user_dn(TALLOC_CTX *memctx, attrs[9] = SYSDB_PWD_ATTRIBUTE; attrs[10] = NULL; - ret = sysdb_get_user_attr(tmpctx, sysdb, dom, username, attrs, &res); + ret = sysdb_get_user_attr(tmpctx, sysdb, username, attrs, &res); if (ret) { goto done; } @@ -1100,7 +1100,6 @@ static void sdap_pam_auth_done(struct tevent_req *req) ret = sysdb_cache_password(state, state->breq->be_ctx->sysdb, - state->breq->be_ctx->domain, state->username, password); /* password caching failures are not fatal errors */ diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index 78176ba8a..f26a428df 100644 --- a/src/providers/ldap/ldap_common.c +++ b/src/providers/ldap/ldap_common.c @@ -492,9 +492,7 @@ int sdap_id_setup_tasks(struct sdap_id_ctx *ctx) * clients requesting get*ent information won't get an * immediate reply with no entries */ - ret = sysdb_has_enumerated(ctx->be->sysdb, - ctx->be->domain, - &has_enumerated); + ret = sysdb_has_enumerated(ctx->be->sysdb, &has_enumerated); if (ret != EOK) { return ret; } diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c index be347e178..9525224bf 100644 --- a/src/providers/ldap/ldap_id.c +++ b/src/providers/ldap/ldap_id.c @@ -227,8 +227,7 @@ static void users_get_done(struct tevent_req *subreq) tevent_req_error(req, ret); return; case BE_FILTER_NAME: - ret = sysdb_delete_user(state, state->sysdb, - state->domain, state->name, 0); + ret = sysdb_delete_user(state, state->sysdb, state->name, 0); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; @@ -242,8 +241,7 @@ static void users_get_done(struct tevent_req *subreq) return; } - ret = sysdb_delete_user(state, state->sysdb, - state->domain, NULL, uid); + ret = sysdb_delete_user(state, state->sysdb, NULL, uid); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; @@ -472,8 +470,7 @@ static void groups_get_done(struct tevent_req *subreq) tevent_req_error(req, ret); return; case BE_FILTER_NAME: - ret = sysdb_delete_group(state, state->sysdb, - state->domain, state->name, 0); + ret = sysdb_delete_group(state, state->sysdb, state->name, 0); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; @@ -487,8 +484,7 @@ static void groups_get_done(struct tevent_req *subreq) return; } - ret = sysdb_delete_group(state, state->sysdb, - state->domain, NULL, gid); + ret = sysdb_delete_group(state, state->sysdb, NULL, gid); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; @@ -658,7 +654,6 @@ static void groups_by_user_done(struct tevent_req *subreq) if (ret == ENOENT) { ret = sysdb_delete_user(state, state->ctx->be->sysdb, - state->ctx->be->domain, state->name, 0); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c index d31dace55..fc6592712 100644 --- a/src/providers/ldap/ldap_id_cleanup.c +++ b/src/providers/ldap/ldap_id_cleanup.c @@ -245,7 +245,6 @@ static int cleanup_users(TALLOC_CTX *memctx, struct sdap_id_ctx *ctx) { TALLOC_CTX *tmpctx; struct sysdb_ctx *sysdb = ctx->be->sysdb; - struct sss_domain_info *domain = ctx->be->domain; const char *attrs[] = { SYSDB_NAME, SYSDB_UIDNUM, NULL }; time_t now = time(NULL); char *subfilter = NULL; @@ -291,7 +290,7 @@ static int cleanup_users(TALLOC_CTX *memctx, struct sdap_id_ctx *ctx) } ret = sysdb_search_users(tmpctx, sysdb, - domain, subfilter, attrs, &count, &msgs); + subfilter, attrs, &count, &msgs); if (ret) { if (ret == ENOENT) { ret = EOK; @@ -337,7 +336,7 @@ static int cleanup_users(TALLOC_CTX *memctx, struct sdap_id_ctx *ctx) /* If not logged in or cannot check the table, delete him */ DEBUG(9, ("About to delete user %s\n", name)); - ret = sysdb_delete_user(tmpctx, sysdb, domain, name, 0); + ret = sysdb_delete_user(tmpctx, sysdb, name, 0); if (ret) { goto done; } @@ -412,7 +411,7 @@ static int cleanup_groups(TALLOC_CTX *memctx, } ret = sysdb_search_groups(tmpctx, sysdb, - domain, subfilter, attrs, &count, &msgs); + subfilter, attrs, &count, &msgs); if (ret) { if (ret == ENOENT) { ret = EOK; @@ -453,7 +452,7 @@ static int cleanup_groups(TALLOC_CTX *memctx, } ret = sysdb_search_users(tmpctx, sysdb, - domain, subfilter, NULL, &u_count, &u_msgs); + subfilter, NULL, &u_count, &u_msgs); if (ret == ENOENT) { const char *name; @@ -466,7 +465,7 @@ static int cleanup_groups(TALLOC_CTX *memctx, } DEBUG(8, ("About to delete group %s\n", name)); - ret = sysdb_delete_group(tmpctx, sysdb, domain, name, 0); + ret = sysdb_delete_group(tmpctx, sysdb, name, 0); if (ret) { DEBUG(2, ("Group delete returned %d (%s)\n", ret, strerror(ret))); diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c index 40f3a2b67..eced42a88 100644 --- a/src/providers/ldap/ldap_id_enum.c +++ b/src/providers/ldap/ldap_id_enum.c @@ -147,9 +147,7 @@ static void ldap_id_enumerate_reschedule(struct tevent_req *req) * process on the next SSSD service restart (to avoid * slowing down system boot-up */ - ret = sysdb_set_enumerated(ctx->be->sysdb, - ctx->be->domain, - true); + ret = sysdb_set_enumerated(ctx->be->sysdb, true); if (ret != EOK) { DEBUG(1, ("Could not mark domain as having enumerated.\n")); /* This error is non-fatal, so continue */ diff --git a/src/providers/ldap/ldap_id_netgroup.c b/src/providers/ldap/ldap_id_netgroup.c index 7b9ad0f1c..6e21956df 100644 --- a/src/providers/ldap/ldap_id_netgroup.c +++ b/src/providers/ldap/ldap_id_netgroup.c @@ -203,7 +203,7 @@ static void netgroup_get_done(struct tevent_req *subreq) } if (ret == ENOENT) { - ret = sysdb_delete_netgroup(state->sysdb, state->domain, state->name); + ret = sysdb_delete_netgroup(state->sysdb, state->name); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c index 9bb2f2ef3..0ac0f639b 100644 --- a/src/providers/ldap/sdap_access.c +++ b/src/providers/ldap/sdap_access.c @@ -172,9 +172,7 @@ static struct tevent_req *sdap_access_send(TALLOC_CTX *mem_ctx, } /* Get original user DN */ - ret = sysdb_get_user_attr(state, be_ctx->sysdb, be_ctx->domain, - pd->user, attrs, - &res); + ret = sysdb_get_user_attr(state, be_ctx->sysdb, pd->user, attrs, &res); if (ret != EOK) { if (ret == ENOENT) { /* If we can't find the user, return permission denied */ @@ -1062,7 +1060,6 @@ static void sdap_access_filter_get_access_done(struct tevent_req *subreq) ret = sysdb_set_user_attr(attrs, state->be_ctx->sysdb, - state->be_ctx->domain, state->username, attrs, SYSDB_MOD_REP); if (ret != EOK) { diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c index bea965b47..a6907a34d 100644 --- a/src/providers/ldap/sdap_async_accounts.c +++ b/src/providers/ldap/sdap_async_accounts.c @@ -298,7 +298,7 @@ static int sdap_save_user(TALLOC_CTX *memctx, DEBUG(6, ("Storing info for user %s\n", name)); - ret = sysdb_store_user(user_attrs, ctx, dom, + ret = sysdb_store_user(user_attrs, ctx, name, pwd, uid, gid, gecos, homedir, shell, user_attrs, missing, cache_timeout); if (ret) goto fail; @@ -666,7 +666,6 @@ done: static errno_t sdap_store_group_with_gid(TALLOC_CTX *mem_ctx, struct sysdb_ctx *ctx, - struct sss_domain_info *domain, const char *name, gid_t gid, struct sysdb_attrs *group_attrs, @@ -685,7 +684,7 @@ sdap_store_group_with_gid(TALLOC_CTX *mem_ctx, } } - ret = sysdb_store_group(mem_ctx, ctx, domain, + ret = sysdb_store_group(mem_ctx, ctx, name, gid, group_attrs, cache_timeout); if (ret) { @@ -857,7 +856,7 @@ static int sdap_save_group(TALLOC_CTX *memctx, DEBUG(6, ("Storing info for group %s\n", name)); - ret = sdap_store_group_with_gid(group_attrs, ctx, dom, + ret = sdap_store_group_with_gid(group_attrs, ctx, name, gid, group_attrs, dp_opt_get_int(opts->basic, SDAP_ENTRY_CACHE_TIMEOUT), @@ -929,8 +928,7 @@ static int sdap_save_grpmem(TALLOC_CTX *memctx, DEBUG(6, ("Storing members for group %s\n", name)); - ret = sysdb_store_group(memctx, ctx, dom, - name, 0, group_attrs, + ret = sysdb_store_group(memctx, ctx, name, 0, group_attrs, dp_opt_get_int(opts->basic, SDAP_ENTRY_CACHE_TIMEOUT)); if (ret) goto fail; @@ -1315,8 +1313,7 @@ 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, + ret = sysdb_search_user_by_name(state, state->sysdb, member_name, NULL, &msg); if (ret == EOK) { strdn = sysdb_user_strdn(state->sysdb_dns->values, @@ -1457,7 +1454,7 @@ sdap_process_missing_member_2307(struct sdap_process_group_state *state, *in_transaction = true; } - ret = sysdb_add_fake_user(state->sysdb, state->dom, username, NULL); + ret = sysdb_add_fake_user(state->sysdb, username, NULL); if (ret != EOK) { DEBUG(1, ("Cannot store fake user entry: [%d]: %s\n", ret, strerror(ret))); @@ -2025,7 +2022,7 @@ static errno_t sdap_nested_group_populate_users(struct sysdb_ctx *sysdb, ret = ENOMEM; goto done; } - ret = sysdb_search_users(tmp_ctx, sysdb, dom, filter, + ret = sysdb_search_users(tmp_ctx, sysdb, filter, search_attrs, &count, &msgs); talloc_zfree(filter); talloc_zfree(clean_orig_dn); @@ -2056,12 +2053,12 @@ static errno_t sdap_nested_group_populate_users(struct sysdb_ctx *sysdb, ret = sysdb_attrs_add_string(attrs, SYSDB_NAME, username); if (ret) goto done; ret = sysdb_set_user_attr(tmp_ctx, sysdb, - dom, sysdb_name, attrs, SYSDB_MOD_REP); + sysdb_name, attrs, SYSDB_MOD_REP); if (ret != EOK) goto done; } /* If the entry does not exist add a fake user record */ - ret = sysdb_add_fake_user(sysdb, dom, username, original_dn); + ret = sysdb_add_fake_user(sysdb, username, original_dn); if (ret != EOK) { DEBUG(1, ("Cannot store fake user entry, ignoring: [%d]: %s\n", ret, strerror(ret))); @@ -2130,7 +2127,7 @@ static errno_t sdap_add_incomplete_groups(struct sysdb_ctx *sysdb, in_transaction = true; for (i=0; groupnames[i]; i++) { - ret = sysdb_search_group_by_name(tmp_ctx, sysdb, dom, + ret = sysdb_search_group_by_name(tmp_ctx, sysdb, groupnames[i], NULL, &msg); if (ret == EOK) { continue; @@ -2190,7 +2187,7 @@ static errno_t sdap_add_incomplete_groups(struct sysdb_ctx *sysdb, } DEBUG(8, ("Adding fake group %s to sysdb\n", name)); - ret = sysdb_add_incomplete_group(sysdb, dom, name, + ret = sysdb_add_incomplete_group(sysdb, name, gid, original_dn, posix); if (ret != EOK) { goto fail; @@ -2280,8 +2277,7 @@ static int sdap_initgr_common_store(struct sysdb_ctx *sysdb, } DEBUG(8, ("Updating memberships for %s\n", name)); - ret = sysdb_update_members(sysdb, dom, name, - type, + ret = sysdb_update_members(sysdb, name, type, (const char *const *) add_groups, (const char *const *) del_groups); if (ret != EOK) { @@ -2412,7 +2408,7 @@ static void sdap_initgr_rfc2307_process(struct tevent_req *subreq) /* Search for all groups for which this user is a member */ attrs[0] = SYSDB_MEMBEROF; attrs[1] = NULL; - ret = sysdb_search_user_by_name(state, state->sysdb, state->dom, + ret = sysdb_search_user_by_name(state, state->sysdb, state->name, attrs, &msg); if (ret != EOK) { tevent_req_error(req, ret); @@ -3833,8 +3829,7 @@ sdap_nested_group_check_cache(TALLOC_CTX *mem_ctx, } /* Try users first */ - ret = sysdb_search_users(tmp_ctx, sysdb, domain, filter, - attrs, &count, &msgs); + ret = sysdb_search_users(tmp_ctx, sysdb, filter, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) { ret = EIO; goto fail; @@ -3880,8 +3875,7 @@ sdap_nested_group_check_cache(TALLOC_CTX *mem_ctx, /* It wasn't a user. Check whether it's a group */ if (ret == EOK) talloc_zfree(msgs); - ret = sysdb_search_groups(tmp_ctx, sysdb, domain, - filter, attrs, &count, &msgs); + ret = sysdb_search_groups(tmp_ctx, sysdb, filter, attrs, &count, &msgs); if (ret != EOK && ret != ENOENT) { ret = EIO; goto fail; @@ -4737,8 +4731,8 @@ errno_t save_rfc2307bis_user_memberships( } talloc_free(sanitized_dn); - ret = sysdb_search_groups(tmp_ctx, state->sysdb, state->dom, - filter, attrs, &reply_count, &replies); + ret = sysdb_search_groups(tmp_ctx, state->sysdb, filter, attrs, + &reply_count, &replies); if (ret != EOK && ret != ENOENT) { goto error; } if (ret == ENOENT) { @@ -4802,8 +4796,7 @@ errno_t save_rfc2307bis_user_memberships( } DEBUG(8, ("Updating memberships for %s\n", state->name)); - ret = sysdb_update_members(state->sysdb, state->dom, state->name, - SYSDB_MEMBER_USER, + ret = sysdb_update_members(state->sysdb, state->name, SYSDB_MEMBER_USER, (const char *const *)add_groups, (const char *const *)del_groups); if (ret != EOK) { @@ -5229,8 +5222,7 @@ static errno_t rfc2307bis_nested_groups_update_sysdb( } talloc_free(sanitized_dn); - ret = sysdb_search_groups(tmp_ctx, state->sysdb, state->dom, - filter, attrs, + ret = sysdb_search_groups(tmp_ctx, state->sysdb, filter, attrs, &reply_count, &replies); if (ret != EOK && ret != ENOENT) { goto error; @@ -5296,8 +5288,7 @@ static errno_t rfc2307bis_nested_groups_update_sysdb( talloc_free(sysdb_grouplist); DEBUG(8, ("Updating memberships for %s\n", name)); - ret = sysdb_update_members(state->sysdb, state->dom, name, - SYSDB_MEMBER_GROUP, + ret = sysdb_update_members(state->sysdb, name, SYSDB_MEMBER_GROUP, (const char *const *)add_groups, (const char *const *)del_groups); if (ret != EOK) { diff --git a/src/providers/ldap/sdap_async_netgroups.c b/src/providers/ldap/sdap_async_netgroups.c index 1f6c6d063..ff776289c 100644 --- a/src/providers/ldap/sdap_async_netgroups.c +++ b/src/providers/ldap/sdap_async_netgroups.c @@ -165,7 +165,7 @@ static errno_t sdap_save_netgroup(TALLOC_CTX *memctx, DEBUG(6, ("Storing info for netgroup %s\n", name)); - ret = sysdb_add_netgroup(ctx, dom, name, NULL, netgroup_attrs, + ret = sysdb_add_netgroup(ctx, name, NULL, netgroup_attrs, dp_opt_get_int(opts->basic, SDAP_ENTRY_CACHE_TIMEOUT)); if (ret) goto fail; diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c index b3b878cf6..57eb483c4 100644 --- a/src/providers/proxy/proxy_auth.c +++ b/src/providers/proxy/proxy_auth.c @@ -761,7 +761,6 @@ static void proxy_child_done(struct tevent_req *req) ret = sysdb_cache_password(client_ctx, client_ctx->be_req->be_ctx->sysdb, - client_ctx->be_req->be_ctx->domain, pd->user, password); /* password caching failures are not fatal errors */ diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c index 5ce9095bd..b4dcac7cc 100644 --- a/src/providers/proxy/proxy_id.c +++ b/src/providers/proxy/proxy_id.c @@ -97,7 +97,7 @@ static int get_pw_name(TALLOC_CTX *mem_ctx, break; } - ret = sysdb_store_user(tmpctx, sysdb, dom, + ret = sysdb_store_user(tmpctx, sysdb, pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, @@ -212,7 +212,7 @@ static int get_pw_uid(TALLOC_CTX *mem_ctx, break; } - ret = sysdb_store_user(tmpctx, sysdb, dom, + ret = sysdb_store_user(tmpctx, sysdb, pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, @@ -241,7 +241,7 @@ static int get_pw_uid(TALLOC_CTX *mem_ctx, DEBUG(7, ("User %d does not exist (or is invalid) on remote server," " deleting!\n", uid)); - ret = sysdb_delete_user(tmpctx, sysdb, dom, NULL, uid); + ret = sysdb_delete_user(tmpctx, sysdb, NULL, uid); if (ret) { goto done; } @@ -352,7 +352,7 @@ again: goto again; /* skip */ } - ret = sysdb_store_user(tmpctx, sysdb, dom, + ret = sysdb_store_user(tmpctx, sysdb, pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, @@ -515,7 +515,7 @@ again: members = NULL; } - ret = sysdb_store_group(tmpctx, sysdb, dom, + ret = sysdb_store_group(tmpctx, sysdb, grp->gr_name, grp->gr_gid, members, @@ -666,7 +666,7 @@ again: members = NULL; } - ret = sysdb_store_group(tmpctx, sysdb, dom, + ret = sysdb_store_group(tmpctx, sysdb, grp->gr_name, grp->gr_gid, members, @@ -691,7 +691,7 @@ again: DEBUG(7, ("Group %d does not exist (or is invalid) on remote server," " deleting!\n", gid)); - ret = sysdb_delete_group(tmpctx, sysdb, dom, NULL, gid); + ret = sysdb_delete_group(tmpctx, sysdb, NULL, gid); if (ret) { goto done; } @@ -821,7 +821,7 @@ again: members = NULL; } - ret = sysdb_store_group(tmpctx, sysdb, dom, + ret = sysdb_store_group(tmpctx, sysdb, grp->gr_name, grp->gr_gid, members, @@ -928,7 +928,7 @@ static int get_initgr(TALLOC_CTX *mem_ctx, break; } - ret = sysdb_store_user(tmpctx, sysdb, dom, + ret = sysdb_store_user(tmpctx, sysdb, pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, diff --git a/src/providers/proxy/proxy_netgroup.c b/src/providers/proxy/proxy_netgroup.c index cdcb2a857..5af32ac70 100644 --- a/src/providers/proxy/proxy_netgroup.c +++ b/src/providers/proxy/proxy_netgroup.c @@ -118,7 +118,7 @@ errno_t get_netgroup(struct proxy_id_ctx *ctx, goto done; } - ret = sysdb_add_netgroup(sysdb, dom, name, NULL, attrs, + ret = sysdb_add_netgroup(sysdb, name, NULL, attrs, ctx->entry_cache_timeout); if (ret != EOK) { DEBUG(1, ("sysdb_add_netgroup failed.\n")); diff --git a/src/providers/simple/simple_access.c b/src/providers/simple/simple_access.c index e2fc0755c..4b9c31398 100644 --- a/src/providers/simple/simple_access.c +++ b/src/providers/simple/simple_access.c @@ -105,7 +105,7 @@ errno_t simple_access_check(struct simple_ctx *ctx, const char *username, goto done; } - ret = sysdb_search_user_by_name(tmp_ctx, ctx->sysdb, ctx->domain, + ret = sysdb_search_user_by_name(tmp_ctx, ctx->sysdb, username, user_attrs, &msg); if (ret != EOK) { DEBUG(1, ("Could not look up username [%s]: [%d][%s]\n", @@ -153,7 +153,7 @@ errno_t simple_access_check(struct simple_ctx *ctx, const char *username, } talloc_zfree(msg); - ret = sysdb_search_group_by_gid(tmp_ctx, ctx->sysdb, ctx->domain, + ret = sysdb_search_group_by_gid(tmp_ctx, ctx->sysdb, gid, group_attrs, &msg); if (ret != EOK) { DEBUG(1, ("Could not look up primary group [%lu]: [%d][%s]\n", diff --git a/src/python/pysss.c b/src/python/pysss.c index 02f69644c..bd965fdf1 100644 --- a/src/python/pysss.c +++ b/src/python/pysss.c @@ -257,7 +257,6 @@ static PyObject *py_sss_useradd(PySssLocalObject *self, ret = sysdb_getpwnam_sync(tctx, tctx->sysdb, tctx->octx->name, - tctx->local, tctx->octx); if (ret != EOK) { PyErr_SetSssError(ret); @@ -363,7 +362,6 @@ static PyObject *py_sss_userdel(PySssLocalObject *self, ret = sysdb_getpwnam_sync(tctx, tctx->sysdb, tctx->octx->name, - tctx->local, tctx->octx); if (ret != EOK) { PyErr_SetSssError(ret); diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index 56ebe4815..8f4cb4401 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -744,7 +744,7 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx) return EIO; } - ret = sysdb_getpwnam(cmdctx, sysdb, dom, name, &dctx->res); + ret = sysdb_getpwnam(cmdctx, sysdb, name, &dctx->res); if (ret != EOK) { DEBUG(1, ("Failed to make request to our cache!\n")); return EIO; @@ -966,7 +966,7 @@ static int nss_cmd_getpwuid_search(struct nss_dom_ctx *dctx) return EIO; } - ret = sysdb_getpwuid(cmdctx, sysdb, dom, cmdctx->id, &dctx->res); + ret = sysdb_getpwuid(cmdctx, sysdb, cmdctx->id, &dctx->res); if (ret != EOK) { DEBUG(1, ("Failed to make request to our cache!\n")); return EIO; @@ -1355,7 +1355,7 @@ static errno_t nss_cmd_setpwent_step(struct setent_step_ctx *step_ctx) } } - ret = sysdb_enumpwent(dctx, sysdb, dctx->domain, &res); + ret = sysdb_enumpwent(dctx, sysdb, &res); if (ret != EOK) { DEBUG(1, ("Enum from cache failed, skipping domain [%s]\n", dom->name)); @@ -2011,7 +2011,7 @@ static int nss_cmd_getgrnam_search(struct nss_dom_ctx *dctx) return EIO; } - ret = sysdb_getgrnam(cmdctx, sysdb, dom, name, &dctx->res); + ret = sysdb_getgrnam(cmdctx, sysdb, name, &dctx->res); if (ret != EOK) { DEBUG(1, ("Failed to make request to our cache!\n")); return EIO; @@ -2233,7 +2233,7 @@ static int nss_cmd_getgrgid_search(struct nss_dom_ctx *dctx) return EIO; } - ret = sysdb_getgrgid(cmdctx, sysdb, dom, cmdctx->id, &dctx->res); + ret = sysdb_getgrgid(cmdctx, sysdb, cmdctx->id, &dctx->res); if (ret != EOK) { DEBUG(1, ("Failed to make request to our cache!\n")); return EIO; @@ -2615,7 +2615,7 @@ static errno_t nss_cmd_setgrent_step(struct setent_step_ctx *step_ctx) } } - ret = sysdb_enumgrent(dctx, sysdb, dctx->domain, &res); + ret = sysdb_enumgrent(dctx, sysdb, &res); if (ret != EOK) { DEBUG(1, ("Enum from cache failed, skipping domain [%s]\n", dom->name)); @@ -3059,7 +3059,7 @@ static int nss_cmd_initgroups_search(struct nss_dom_ctx *dctx) return EIO; } - ret = sysdb_initgroups(cmdctx, sysdb, dom, name, &dctx->res); + ret = sysdb_initgroups(cmdctx, sysdb, name, &dctx->res); if (ret != EOK) { DEBUG(1, ("Failed to make request to our cache! [%d][%s]\n", ret, strerror(ret))); diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c index df3823ed2..cd0ba723a 100644 --- a/src/responder/nss/nsssrv_netgroup.c +++ b/src/responder/nss/nsssrv_netgroup.c @@ -402,8 +402,7 @@ static errno_t lookup_netgr_step(struct setent_step_ctx *step_ctx) } /* Look up the netgroup in the cache */ - ret = sysdb_getnetgr(step_ctx->dctx, sysdb, dom, - step_ctx->name, + ret = sysdb_getnetgr(step_ctx->dctx, sysdb, step_ctx->name, &step_ctx->dctx->res); if (ret == ENOENT) { /* This netgroup was not found in this domain */ diff --git a/src/responder/pam/pam_LOCAL_domain.c b/src/responder/pam/pam_LOCAL_domain.c index 6e0631aa8..d636fd33b 100644 --- a/src/responder/pam/pam_LOCAL_domain.c +++ b/src/responder/pam/pam_LOCAL_domain.c @@ -87,7 +87,6 @@ static void do_successful_login(struct LOCAL_request *lreq) lreq->error, ret, done); ret = sysdb_set_user_attr(lreq, lreq->dbctx, - lreq->preq->domain, lreq->preq->pd->user, lreq->mod_attrs, SYSDB_MOD_REP); NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_set_user_attr failed.\n"), @@ -129,7 +128,6 @@ static void do_failed_login(struct LOCAL_request *lreq) lreq->error, ret, done); ret = sysdb_set_user_attr(lreq, lreq->dbctx, - lreq->preq->domain, lreq->preq->pd->user, lreq->mod_attrs, SYSDB_MOD_REP); NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_set_user_attr failed.\n"), @@ -203,7 +201,6 @@ static void do_pam_chauthtok(struct LOCAL_request *lreq) lreq->error, ret, done); ret = sysdb_set_user_attr(lreq, lreq->dbctx, - lreq->preq->domain, lreq->preq->pd->user, lreq->mod_attrs, SYSDB_MOD_REP); NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_set_user_attr failed.\n"), @@ -254,8 +251,7 @@ int LOCAL_pam_handler(struct pam_auth_req *preq) pd->pam_status = PAM_SUCCESS; - ret = sysdb_get_user_attr(lreq, lreq->dbctx, - preq->domain, preq->pd->user, + ret = sysdb_get_user_attr(lreq, lreq->dbctx, preq->pd->user, attrs, &res); if (ret != EOK) { DEBUG(1, ("sysdb_get_user_attr failed.\n")); diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c index 3c9d7600a..48228e97f 100644 --- a/src/responder/pam/pamsrv_cmd.c +++ b/src/responder/pam/pamsrv_cmd.c @@ -310,9 +310,8 @@ static errno_t set_last_login(struct pam_auth_req *preq) goto fail; } - ret = sysdb_set_user_attr(preq, dbctx, - preq->domain, preq->pd->user, - attrs, SYSDB_MOD_REP); + ret = sysdb_set_user_attr(preq, dbctx, preq->pd->user, attrs, + SYSDB_MOD_REP); if (ret != EOK) { DEBUG(2, ("set_last_login failed.\n")); preq->pd->pam_status = PAM_SYSTEM_ERR; @@ -485,8 +484,7 @@ static void pam_reply(struct pam_auth_req *preq) goto done; } - ret = sysdb_cache_auth(preq, sysdb, - preq->domain, pd->user, + ret = sysdb_cache_auth(preq, sysdb, pd->user, pd->authtok, pd->authtok_size, pctx->rctx->cdb, false, &exp_date, &delay_until); @@ -849,7 +847,7 @@ static int pam_check_user_search(struct pam_auth_req *preq) preq->pd->pam_status = PAM_SYSTEM_ERR; return EFAULT; } - ret = sysdb_getpwnam(preq, sysdb, dom, name, &preq->res); + ret = sysdb_getpwnam(preq, sysdb, name, &preq->res); if (ret != EOK) { DEBUG(1, ("Failed to make request to our cache!\n")); return EIO; diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index d0f7ab424..57edeece6 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -190,8 +190,7 @@ static int test_add_user(struct test_data *data) homedir = talloc_asprintf(data, "/home/testuser%d", data->uid); gecos = talloc_asprintf(data, "Test User %d", data->uid); - ret = sysdb_add_user(data, data->ctx->sysdb, - data->ctx->domain, data->username, + ret = sysdb_add_user(data, data->ctx->sysdb, data->username, data->uid, 0, gecos, homedir, "/bin/bash", NULL, 0); return ret; @@ -206,8 +205,7 @@ static int test_store_user(struct test_data *data) homedir = talloc_asprintf(data, "/home/testuser%d", data->uid); gecos = talloc_asprintf(data, "Test User %d", data->uid); - ret = sysdb_store_user(data, data->ctx->sysdb, - data->ctx->domain, data->username, "x", + ret = sysdb_store_user(data, data->ctx->sysdb, data->username, "x", data->uid, 0, gecos, homedir, data->shell ? data->shell : "/bin/bash", NULL, NULL, -1); @@ -230,8 +228,7 @@ static int test_remove_user_by_uid(struct test_data *data) { int ret; - ret = sysdb_delete_user(data, data->ctx->sysdb, - data->ctx->domain, NULL, data->uid); + ret = sysdb_delete_user(data, data->ctx->sysdb, NULL, data->uid); return ret; } @@ -239,8 +236,7 @@ static int test_remove_nonexistent_group(struct test_data *data) { int ret; - ret = sysdb_delete_group(data, data->ctx->sysdb, - data->ctx->domain, NULL, data->uid); + ret = sysdb_delete_group(data, data->ctx->sysdb, NULL, data->uid); return ret; } @@ -248,8 +244,7 @@ static int test_remove_nonexistent_user(struct test_data *data) { int ret; - ret = sysdb_delete_user(data, data->ctx->sysdb, - data->ctx->domain, NULL, data->uid); + ret = sysdb_delete_user(data, data->ctx->sysdb, NULL, data->uid); return ret; } @@ -257,8 +252,7 @@ static int test_add_group(struct test_data *data) { int ret; - ret = sysdb_add_group(data, data->ctx->sysdb, - data->ctx->domain, data->groupname, + ret = sysdb_add_group(data, data->ctx->sysdb, data->groupname, data->gid, NULL, 0); return ret; } @@ -267,8 +261,8 @@ static int test_add_incomplete_group(struct test_data *data) { int ret; - ret = sysdb_add_incomplete_group(data->ctx->sysdb, data->ctx->domain, - data->groupname, data->gid, NULL, true); + ret = sysdb_add_incomplete_group(data->ctx->sysdb, data->groupname, + data->gid, NULL, true); return ret; } @@ -276,8 +270,7 @@ static int test_store_group(struct test_data *data) { int ret; - ret = sysdb_store_group(data, data->ctx->sysdb, - data->ctx->domain, data->groupname, + ret = sysdb_store_group(data, data->ctx->sysdb, data->groupname, data->gid, NULL, -1); return ret; } @@ -298,8 +291,7 @@ static int test_remove_group_by_gid(struct test_data *data) { int ret; - ret = sysdb_delete_group(data, data->ctx->sysdb, - data->ctx->domain, NULL, data->gid); + ret = sysdb_delete_group(data, data->ctx->sysdb, NULL, data->gid); if (ret == ENOENT) { ret = EOK; } @@ -310,8 +302,7 @@ static int test_set_user_attr(struct test_data *data) { int ret; - ret = sysdb_set_user_attr(data, data->ctx->sysdb, - data->ctx->domain, data->username, + ret = sysdb_set_user_attr(data, data->ctx->sysdb, data->username, data->attrs, SYSDB_MOD_REP); return ret; } @@ -327,7 +318,6 @@ static int test_add_group_member(struct test_data *data) } ret = sysdb_add_group_member(data->ctx->sysdb, - data->ctx->domain, data->groupname, username, SYSDB_MEMBER_USER); return ret; @@ -344,7 +334,6 @@ static int test_remove_group_member(struct test_data *data) } ret = sysdb_remove_group_member(data->ctx->sysdb, - data->ctx->domain, data->groupname, username, SYSDB_MEMBER_USER); return ret; @@ -360,8 +349,7 @@ static int test_store_custom(struct test_data *data) return ENOMEM; } - ret = sysdb_store_custom(data, data->ctx->sysdb, - data->ctx->domain, object_name, + ret = sysdb_store_custom(data, data->ctx->sysdb, object_name, CUSTOM_TEST_CONTAINER, data->attrs); return ret; } @@ -370,7 +358,7 @@ static int test_delete_custom(struct test_data *data) { int ret; - ret = sysdb_delete_custom(data, data->ctx->sysdb, data->ctx->domain, + ret = sysdb_delete_custom(data, data->ctx->sysdb, CUSTOM_TEST_OBJECT, CUSTOM_TEST_CONTAINER); return ret; } @@ -431,8 +419,7 @@ static int test_memberof_store_group(struct test_data *data) } } - ret = sysdb_store_group(data, data->ctx->sysdb, - data->ctx->domain, data->groupname, + ret = sysdb_store_group(data, data->ctx->sysdb, data->groupname, data->gid, attrs, -1); return ret; } @@ -444,7 +431,7 @@ static int test_add_basic_netgroup(struct test_data *data) description = talloc_asprintf(data, "Test Netgroup %d", data->uid); - ret = sysdb_add_basic_netgroup(data->ctx->sysdb, data->ctx->domain, + ret = sysdb_add_basic_netgroup(data->ctx->sysdb, data->netgrname, description); return ret; } @@ -465,8 +452,7 @@ static int test_remove_netgroup_by_name(struct test_data *data) { int ret; - ret = sysdb_delete_netgroup(data->ctx->sysdb, data->ctx->domain, - data->netgrname); + ret = sysdb_delete_netgroup(data->ctx->sysdb, data->netgrname); return ret; } @@ -488,7 +474,7 @@ static int test_set_netgroup_attr(struct test_data *data) return ret; } - ret = sysdb_set_netgroup_attr(data->ctx->sysdb, data->ctx->domain, + ret = sysdb_set_netgroup_attr(data->ctx->sysdb, data->netgrname, attrs, SYSDB_MOD_REP); return ret; } @@ -774,7 +760,6 @@ START_TEST (test_sysdb_getpwnam) ret = sysdb_getpwnam(test_ctx, test_ctx->sysdb, - test_ctx->domain, username, &res); if (ret) { fail("sysdb_getpwnam failed for username %s (%d: %s)", @@ -795,7 +780,6 @@ START_TEST (test_sysdb_getpwnam) ret = sysdb_getpwnam(test_ctx, test_ctx->sysdb, - test_ctx->domain, username, &res); if (ret) { fail("sysdb_getpwnam failed for username %s (%d: %s)", @@ -831,7 +815,6 @@ START_TEST (test_sysdb_getgrnam) ret = sysdb_getgrnam(test_ctx, test_ctx->sysdb, - test_ctx->domain, groupname, &res); if (ret) { fail("sysdb_getgrnam failed for groupname %s (%d: %s)", @@ -854,7 +837,6 @@ START_TEST (test_sysdb_getgrnam) ret = sysdb_getgrnam(test_ctx, test_ctx->sysdb, - test_ctx->domain, groupname, &res); if (ret) { fail("sysdb_getgrnam failed for groupname %s (%d: %s)", @@ -888,7 +870,6 @@ START_TEST (test_sysdb_getgrgid) ret = sysdb_getgrgid(test_ctx, test_ctx->sysdb, - test_ctx->domain, _i, &res); if (ret) { fail("sysdb_getgrgid failed for gid %d (%d: %s)", @@ -929,7 +910,6 @@ START_TEST (test_sysdb_getpwuid) ret = sysdb_getpwuid(test_ctx, test_ctx->sysdb, - test_ctx->domain, _i, &res); if (ret) { fail("sysdb_getpwuid failed for uid %d (%d: %s)", @@ -968,7 +948,6 @@ START_TEST (test_sysdb_enumgrent) ret = sysdb_enumgrent(test_ctx, test_ctx->sysdb, - test_ctx->domain, &res); fail_unless(ret == EOK, "sysdb_enumgrent failed (%d: %s)", @@ -996,7 +975,6 @@ START_TEST (test_sysdb_enumpwent) ret = sysdb_enumpwent(test_ctx, test_ctx->sysdb, - test_ctx->domain, &res); fail_unless(ret == EOK, "sysdb_enumpwent failed (%d: %s)", @@ -1068,8 +1046,7 @@ START_TEST (test_sysdb_get_user_attr) username = talloc_asprintf(test_ctx, "testuser%d", _i); ret = sysdb_get_user_attr(test_ctx, test_ctx->sysdb, - test_ctx->domain, username, - attrs, &res); + username, attrs, &res); if (ret) { fail("Could not get attributes for user %s", username); goto done; @@ -1252,7 +1229,6 @@ START_TEST (test_sysdb_search_custom_by_name) fail_unless(object_name != NULL, "talloc_asprintf failed"); ret = sysdb_search_custom_by_name(data, data->ctx->sysdb, - data->ctx->domain, object_name, CUSTOM_TEST_CONTAINER, data->attrlist, @@ -1355,7 +1331,6 @@ START_TEST (test_sysdb_search_custom_update) fail_unless(object_name != NULL, "talloc_asprintf failed"); ret = sysdb_search_custom_by_name(data, data->ctx->sysdb, - data->ctx->domain, object_name, CUSTOM_TEST_CONTAINER, data->attrlist, @@ -1421,7 +1396,6 @@ START_TEST (test_sysdb_search_custom) data->attrlist[2] = NULL; ret = sysdb_search_custom(data, data->ctx->sysdb, - data->ctx->domain, filter, CUSTOM_TEST_CONTAINER, data->attrlist, @@ -1478,8 +1452,7 @@ START_TEST (test_sysdb_cache_password) data->username = talloc_asprintf(data, "testuser%d", _i); ret = sysdb_cache_password(data, test_ctx->sysdb, - test_ctx->domain, data->username, - data->username); + data->username, data->username); fail_unless(ret == EOK, "sysdb_cache_password request failed [%d].", ret); @@ -1517,8 +1490,7 @@ static void cached_authentication_without_expiration(const char *username, return; } - ret = sysdb_cache_auth(data, test_ctx->sysdb, - test_ctx->domain, data->username, + ret = sysdb_cache_auth(data, test_ctx->sysdb, data->username, (const uint8_t *)password, strlen(password), test_ctx->confdb, false, &expire_date, &delayed_until); @@ -1574,13 +1546,11 @@ 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, data->ctx->sysdb, - data->ctx->domain, data->username, + ret = sysdb_set_user_attr(data, data->ctx->sysdb, data->username, data->attrs, SYSDB_MOD_REP); fail_unless(ret == EOK, "Could not modify user %s", data->username); - ret = sysdb_cache_auth(data, test_ctx->sysdb, - test_ctx->domain, data->username, + ret = sysdb_cache_auth(data, test_ctx->sysdb, data->username, (const uint8_t *) password, strlen(password), test_ctx->confdb, false, &expire_date, &delayed_until); @@ -1712,7 +1682,7 @@ START_TEST (test_sysdb_asq_search) fail_unless(user_dn != NULL, "sysdb_user_dn failed"); ret = sysdb_asq_search(data, test_ctx->sysdb, - test_ctx->domain, user_dn, NULL, "memberof", + user_dn, NULL, "memberof", data->attrlist, &msgs_count, &msgs); fail_if(ret != EOK, "Failed to send ASQ search request.\n"); @@ -2009,7 +1979,7 @@ START_TEST (test_sysdb_memberof_check_memberuid_without_group_5) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, - data->ctx->domain, _i + MBO_GROUP_BASE, + _i + MBO_GROUP_BASE, data->attrlist, &data->msg); if (_i == 5) { fail_unless(ret == ENOENT, @@ -2060,7 +2030,7 @@ START_TEST (test_sysdb_memberof_check_memberuid) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, - data->ctx->domain, _i + MBO_GROUP_BASE, + _i + MBO_GROUP_BASE, data->attrlist, &data->msg); fail_if(ret != EOK, "Could not check group %d", data->gid); @@ -2102,7 +2072,7 @@ START_TEST (test_sysdb_memberof_check_memberuid_loop) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, - data->ctx->domain, _i + MBO_GROUP_BASE, + _i + MBO_GROUP_BASE, data->attrlist, &data->msg); fail_if(ret != EOK, "Could not check group %d", data->gid); @@ -2144,7 +2114,7 @@ START_TEST (test_sysdb_memberof_check_memberuid_loop_without_group_5) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, - data->ctx->domain, _i + MBO_GROUP_BASE, + _i + MBO_GROUP_BASE, data->attrlist, &data->msg); if (_i == 5) { @@ -2221,8 +2191,7 @@ START_TEST (test_sysdb_update_members) add_groups[1] = talloc_strdup(add_groups, "testgroup28002"); add_groups[2] = NULL; - ret = sysdb_update_members(test_ctx->sysdb, test_ctx->domain, user, - SYSDB_MEMBER_USER, + ret = sysdb_update_members(test_ctx->sysdb, user, SYSDB_MEMBER_USER, (const char *const *)add_groups, NULL); fail_unless(ret == EOK, "Could not add groups"); talloc_zfree(add_groups); @@ -2235,8 +2204,7 @@ START_TEST (test_sysdb_update_members) add_groups[0] = talloc_strdup(add_groups, "testgroup28003"); add_groups[1] = NULL; - ret = sysdb_update_members(test_ctx->sysdb, test_ctx->domain, user, - SYSDB_MEMBER_USER, + ret = sysdb_update_members(test_ctx->sysdb, user, SYSDB_MEMBER_USER, (const char *const *)add_groups, (const char *const *)del_groups); fail_unless(ret == EOK, "Group replace failed"); @@ -2249,10 +2217,8 @@ START_TEST (test_sysdb_update_members) del_groups[1] = talloc_strdup(del_groups, "testgroup28003"); del_groups[2] = NULL; - ret = sysdb_update_members(test_ctx->sysdb, test_ctx->domain, - user, SYSDB_MEMBER_USER, - NULL, - (const char *const *)del_groups); + ret = sysdb_update_members(test_ctx->sysdb, user, SYSDB_MEMBER_USER, + NULL, (const char *const *)del_groups); fail_unless(ret == EOK, "Could not remove groups"); talloc_zfree(test_ctx); @@ -2336,8 +2302,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, netgrname, - NULL, &msg); + 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, @@ -2445,8 +2410,7 @@ START_TEST (test_sysdb_get_netgroup_attr) netgrname = talloc_asprintf(test_ctx, "testnetgr%d", _i); ret = sysdb_get_netgroup_attr(test_ctx, test_ctx->sysdb, - test_ctx->domain, netgrname, - attrs, &res); + netgrname, attrs, &res); fail_if(ret != EOK, "Could not get netgroup attributes"); fail_if(res->count != 1, @@ -2489,14 +2453,13 @@ START_TEST(test_sysdb_add_netgroup_tuple) domainname = talloc_asprintf(test_ctx, "domainname%d", _i); fail_if(domainname == NULL, "Out of memory"); - ret = sysdb_add_netgroup_tuple(test_ctx->sysdb, test_ctx->domain, + ret = sysdb_add_netgroup_tuple(test_ctx->sysdb, netgrname, hostname, username, domainname); fail_unless(ret == EOK, "Failed to add netgr tuple"); ret = sysdb_getnetgr(test_ctx, test_ctx->sysdb, - test_ctx->domain, netgrname, - &res); + netgrname, &res); fail_unless(ret == EOK, "Failed to retrieve netgr information"); ret = sysdb_netgr_to_entries(test_ctx, res, &entries); @@ -2551,14 +2514,13 @@ START_TEST(test_sysdb_remove_netgroup_tuple) domainname = talloc_asprintf(test_ctx, "domainname%d", _i); fail_if(domainname == NULL, "Out of memory"); - ret = sysdb_remove_netgroup_tuple(test_ctx->sysdb, test_ctx->domain, + ret = sysdb_remove_netgroup_tuple(test_ctx->sysdb, netgrname, hostname, username, domainname); fail_unless(ret == EOK, "Failed to remove netgr tuple"); ret = sysdb_getnetgr(test_ctx, test_ctx->sysdb, - test_ctx->domain, netgrname, - &res); + netgrname, &res); fail_unless(ret == EOK, "Failed to retrieve netgr information"); ret = sysdb_netgr_to_entries(test_ctx, res, &entries); @@ -2609,13 +2571,11 @@ START_TEST(test_sysdb_add_netgroup_member) domainname1 = talloc_asprintf(test_ctx, "domainname%d", _i); domainname2 = talloc_asprintf(test_ctx, "domainname%d", _i+1); - ret = sysdb_add_netgroup_member(test_ctx->sysdb, test_ctx->domain, - netgrname, membername); + ret = sysdb_add_netgroup_member(test_ctx->sysdb, netgrname, membername); fail_unless(ret == EOK, "Failed to add netgr member"); ret = sysdb_getnetgr(test_ctx, test_ctx->sysdb, - test_ctx->domain, netgrname, - &res); + netgrname, &res); fail_unless(ret == EOK, "Failed to retrieve netgr information"); ret = sysdb_netgr_to_entries(test_ctx, res, &entries); @@ -2684,13 +2644,11 @@ START_TEST(test_sysdb_remove_netgroup_member) username = talloc_asprintf(test_ctx, "username%d", _i); domainname = talloc_asprintf(test_ctx, "domainname%d", _i); - ret = sysdb_remove_netgroup_member(test_ctx->sysdb, test_ctx->domain, - netgrname, membername); + ret = sysdb_remove_netgroup_member(test_ctx->sysdb, netgrname, membername); fail_unless(ret == EOK, "Failed to add netgr member"); ret = sysdb_getnetgr(test_ctx, test_ctx->sysdb, - test_ctx->domain, netgrname, - &res); + netgrname, &res); fail_unless(ret == EOK, "Failed to retrieve netgr information"); ret = sysdb_netgr_to_entries(test_ctx, res, &entries); @@ -2742,20 +2700,19 @@ START_TEST(test_odd_characters) /* ===== Groups ===== */ /* Add */ - ret = sysdb_add_incomplete_group(test_ctx->sysdb, test_ctx->domain, + ret = sysdb_add_incomplete_group(test_ctx->sysdb, odd_groupname, 20000, NULL, true); fail_unless(ret == EOK, "sysdb_add_incomplete_group error [%d][%s]", 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->sysdb, odd_groupname, NULL, &msg); fail_unless(ret == EOK, "sysdb_search_group_by_name error [%d][%s]", ret, strerror(ret)); talloc_zfree(msg); - ret = sysdb_getgrnam(test_ctx, test_ctx->sysdb, test_ctx->domain, - odd_groupname, &res); + ret = sysdb_getgrnam(test_ctx, test_ctx->sysdb, odd_groupname, &res); fail_unless(ret == EOK, "sysdb_getgrnam error [%d][%s]", ret, strerror(ret)); fail_unless(res->count == 1, "Received [%d] responses", @@ -2772,7 +2729,6 @@ START_TEST(test_odd_characters) /* Add */ ret = sysdb_add_basic_user(test_ctx, test_ctx->sysdb, - test_ctx->domain, odd_username, 10000, 10000, "","",""); @@ -2780,7 +2736,7 @@ START_TEST(test_odd_characters) ret, strerror(ret)); /* Retrieve */ - ret = sysdb_search_user_by_name(test_ctx, test_ctx->sysdb, test_ctx->domain, + ret = sysdb_search_user_by_name(test_ctx, test_ctx->sysdb, odd_username, NULL, &msg); fail_unless(ret == EOK, "sysdb_search_user_by_name error [%d][%s]", ret, strerror(ret)); @@ -2791,14 +2747,12 @@ START_TEST(test_odd_characters) talloc_zfree(msg); /* Add to the group */ - ret = sysdb_add_group_member(test_ctx->sysdb, test_ctx->domain, - odd_groupname, odd_username, + ret = sysdb_add_group_member(test_ctx->sysdb, odd_groupname, odd_username, SYSDB_MEMBER_USER); fail_unless(ret == EOK, "sysdb_add_group_member error [%d][%s]", ret, strerror(ret)); - ret = sysdb_getpwnam(test_ctx, test_ctx->sysdb, test_ctx->domain, - odd_username, &res); + ret = sysdb_getpwnam(test_ctx, test_ctx->sysdb, odd_username, &res); fail_unless(ret == EOK, "sysdb_getpwnam error [%d][%s]", ret, strerror(ret)); fail_unless(res->count == 1, "Received [%d] responses", @@ -2810,35 +2764,33 @@ START_TEST(test_odd_characters) talloc_zfree(res); /* Attributes */ - ret = sysdb_get_user_attr(test_ctx, test_ctx->sysdb, test_ctx->domain, + ret = sysdb_get_user_attr(test_ctx, test_ctx->sysdb, odd_username, user_attrs, &res); fail_unless(ret == EOK, "sysdb_get_user_attr error [%d][%s]", ret, strerror(ret)); talloc_free(res); /* Delete User */ - ret = sysdb_delete_user(test_ctx, test_ctx->sysdb, test_ctx->domain, - odd_username, 10000); + ret = sysdb_delete_user(test_ctx, test_ctx->sysdb, odd_username, 10000); fail_unless(ret == EOK, "sysdb_delete_user error [%d][%s]", ret, strerror(ret)); /* Delete Group */ - ret = sysdb_delete_group(test_ctx, test_ctx->sysdb, test_ctx->domain, - odd_groupname, 20000); + ret = sysdb_delete_group(test_ctx, test_ctx->sysdb, odd_groupname, 20000); fail_unless(ret == EOK, "sysdb_delete_group error [%d][%s]", ret, strerror(ret)); /* ===== Netgroups ===== */ /* Add */ - ret = sysdb_add_netgroup(test_ctx->sysdb, test_ctx->domain, + ret = sysdb_add_netgroup(test_ctx->sysdb, odd_netgroupname, "No description", NULL, 30); fail_unless(ret == EOK, "sysdb_add_netgroup error [%d][%s]", ret, strerror(ret)); /* Retrieve */ - ret = sysdb_getnetgr(test_ctx, test_ctx->sysdb, test_ctx->domain, + ret = sysdb_getnetgr(test_ctx, test_ctx->sysdb, odd_netgroupname, &res); fail_unless(ret == EOK, "sysdb_getnetgr error [%d][%s]", ret, strerror(ret)); @@ -2846,7 +2798,7 @@ START_TEST(test_odd_characters) res->count); talloc_zfree(res); - ret = sysdb_get_netgroup_attr(test_ctx, test_ctx->sysdb, test_ctx->domain, + ret = sysdb_get_netgroup_attr(test_ctx, test_ctx->sysdb, odd_netgroupname, netgr_attrs, &res); fail_unless(ret == EOK, "sysdb_get_netgroup_attr error [%d][%s]", ret, strerror(ret)); @@ -2870,23 +2822,19 @@ START_TEST(test_sysdb_has_enumerated) ret = setup_sysdb_tests(&test_ctx); fail_if(ret != EOK, "Could not set up the test"); - ret = sysdb_has_enumerated(test_ctx->sysdb, - test_ctx->domain, - &enumerated); + ret = sysdb_has_enumerated(test_ctx->sysdb, &enumerated); fail_if(ret != EOK, "Error [%d][%s] checking enumeration", ret, strerror(ret)); fail_if(enumerated, "Enumeration should default to false"); ret = sysdb_set_enumerated(test_ctx->sysdb, - test_ctx->domain, true); fail_if(ret != EOK, "Error [%d][%s] setting enumeration", ret, strerror(ret)); /* Recheck enumeration status */ ret = sysdb_has_enumerated(test_ctx->sysdb, - test_ctx->domain, &enumerated); fail_if(ret != EOK, "Error [%d][%s] checking enumeration", ret, strerror(ret)); @@ -2911,14 +2859,14 @@ START_TEST(test_sysdb_original_dn_case_insensitive) ret = setup_sysdb_tests(&test_ctx); fail_if(ret != EOK, "Could not set up the test"); - ret = sysdb_add_incomplete_group(test_ctx->sysdb, test_ctx->domain, + ret = sysdb_add_incomplete_group(test_ctx->sysdb, "case_sensitive_group1", 29000, "cn=case_sensitive_group1,cn=example,cn=com", true); fail_unless(ret == EOK, "sysdb_add_incomplete_group error [%d][%s]", ret, strerror(ret)); - ret = sysdb_add_incomplete_group(test_ctx->sysdb, test_ctx->domain, + ret = sysdb_add_incomplete_group(test_ctx->sysdb, "case_sensitive_group2", 29001, "cn=CASE_SENSITIVE_GROUP1,cn=EXAMPLE,cn=COM", true); diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index 0b086523f..67fe2df5c 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -39,7 +39,7 @@ #define TYPE_NETGROUP 2 struct entry_type_t { const char *type_string; - int (* search_fn)(TALLOC_CTX *, struct sysdb_ctx *, struct sss_domain_info *, + int (* search_fn)(TALLOC_CTX *, struct sysdb_ctx *, const char *, const char **, size_t *, struct ldb_message ***); }; static struct entry_type_t entry_types[] = { @@ -116,7 +116,7 @@ void invalidate_entries(TALLOC_CTX *ctx, struct sysdb_ctx *sysdb, type_rec = entry_types[entry_type]; if (filter) { - ret = type_rec.search_fn(ctx, sysdb, NULL, filter, attrs, + ret = type_rec.search_fn(ctx, sysdb, filter, attrs, &msg_count, &msgs); if (ret != EOK) { DEBUG(3, ("Searching for %s with filter %s failed\n", @@ -157,15 +157,15 @@ 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(ctx, sysdb, NULL, name, + ret = sysdb_set_user_attr(ctx, sysdb, name, sys_attrs, SYSDB_MOD_REP); break; case TYPE_GROUP: - ret = sysdb_set_group_attr(ctx, sysdb, NULL, name, + ret = sysdb_set_group_attr(ctx, sysdb, name, sys_attrs, SYSDB_MOD_REP); break; case TYPE_NETGROUP: - ret = sysdb_set_netgroup_attr(sysdb, NULL, name, + ret = sysdb_set_netgroup_attr(sysdb, name, sys_attrs, SYSDB_MOD_REP); break; default: diff --git a/src/tools/sss_groupdel.c b/src/tools/sss_groupdel.c index 99b690869..c9af565c2 100644 --- a/src/tools/sss_groupdel.c +++ b/src/tools/sss_groupdel.c @@ -90,9 +90,7 @@ int main(int argc, const char **argv) goto fini; } - ret = sysdb_getgrnam_sync(tctx, tctx->sysdb, - tctx->octx->name, tctx->local, - tctx->octx); + ret = sysdb_getgrnam_sync(tctx, tctx->sysdb, tctx->octx->name, tctx->octx); if (ret != EOK) { /* Error message will be printed in the switch */ goto done; diff --git a/src/tools/sss_groupmod.c b/src/tools/sss_groupmod.c index 59ec10bab..48701adf6 100644 --- a/src/tools/sss_groupmod.c +++ b/src/tools/sss_groupmod.c @@ -121,9 +121,7 @@ int main(int argc, const char **argv) goto fini; } /* check the username to be able to give sensible error message */ - ret = sysdb_getgrnam_sync(tctx, tctx->sysdb, - tctx->octx->name, tctx->local, - tctx->octx); + ret = sysdb_getgrnam_sync(tctx, tctx->sysdb, tctx->octx->name, tctx->octx); if (ret != EOK) { ERROR("Cannot find group in local domain, " "modifying groups is allowed only in local domain\n"); diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c index 15324855c..a5702b589 100644 --- a/src/tools/sss_groupshow.c +++ b/src/tools/sss_groupshow.c @@ -297,8 +297,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, sysdb, name, attrs, &msg); if (ret) { DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret)); goto done; @@ -402,9 +401,7 @@ static int group_show_trim_memberof(TALLOC_CTX *mem_ctx, return ENOMEM; } - ret = sysdb_search_groups(mem_ctx, sysdb, - domain, filter, NULL, - &count, &msgs); + ret = sysdb_search_groups(mem_ctx, sysdb, filter, NULL, &count, &msgs); /* ENOENT is OK, the group is just not a direct parent */ if (ret != EOK && ret != ENOENT) { return ret; @@ -472,8 +469,7 @@ int group_show_recurse(TALLOC_CTX *mem_ctx, continue; } - ret = sysdb_search_group_by_name(mem_ctx, sysdb, - domain, group_members[i], + ret = sysdb_search_group_by_name(mem_ctx, sysdb, group_members[i], attrs, &msg); if (ret) { DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret)); @@ -527,8 +523,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, sysdb, 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 2553ead8c..d3cbb9d99 100644 --- a/src/tools/sss_sync_ops.c +++ b/src/tools/sss_sync_ops.c @@ -54,7 +54,6 @@ struct sync_op_res { */ static int mod_groups_member(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - struct sss_domain_info *domain, char **grouplist, struct ldb_dn *member_dn, int optype) @@ -63,6 +62,7 @@ static int mod_groups_member(TALLOC_CTX *mem_ctx, 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) { @@ -95,11 +95,11 @@ done: } #define add_to_groups(memctx, sysdb, data, member_dn) \ - mod_groups_member(memctx, sysdb, data->domain, \ - data->addgroups, member_dn, LDB_FLAG_MOD_ADD) + mod_groups_member(memctx, sysdb, data->addgroups, member_dn, \ + LDB_FLAG_MOD_ADD) #define remove_from_groups(memctx, sysdb, data, member_dn) \ - mod_groups_member(memctx, sysdb, data->domain, \ - data->rmgroups, member_dn, LDB_FLAG_MOD_DELETE) + mod_groups_member(memctx, sysdb, data->rmgroups, member_dn, \ + LDB_FLAG_MOD_DELETE) /* * Modify a user @@ -223,8 +223,7 @@ int usermod(TALLOC_CTX *mem_ctx, } if (attrs->num != 0) { - ret = sysdb_set_user_attr(mem_ctx, sysdb, - data->domain, data->name, + ret = sysdb_set_user_attr(mem_ctx, sysdb, data->name, attrs, SYSDB_MOD_REP); if (ret) { return ret; @@ -280,8 +279,7 @@ int groupmod(TALLOC_CTX *mem_ctx, return ret; } - ret = sysdb_set_group_attr(mem_ctx, sysdb, - data->domain, data->name, + ret = sysdb_set_group_attr(mem_ctx, sysdb, data->name, attrs, SYSDB_MOD_REP); if (ret) { return ret; @@ -476,8 +474,7 @@ int useradd(TALLOC_CTX *mem_ctx, { int ret; - ret = sysdb_add_user(mem_ctx, sysdb, - data->domain, data->name, data->uid, data->gid, + ret = sysdb_add_user(mem_ctx, sysdb, data->name, data->uid, data->gid, data->gecos, data->home, data->shell, NULL, 0); if (ret) { goto done; @@ -543,8 +540,7 @@ int groupadd(TALLOC_CTX *mem_ctx, { int ret; - ret = sysdb_add_group(mem_ctx, sysdb, - data->domain, data->name, + ret = sysdb_add_group(mem_ctx, sysdb, data->name, data->gid, NULL, 0); if (ret == EOK) { flush_nscd_cache(mem_ctx, NSCD_DB_GROUP); @@ -585,14 +581,13 @@ int groupdel(TALLOC_CTX *mem_ctx, int sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, const char *name, - struct sss_domain_info *domain, struct ops_ctx *out) { struct ldb_result *res; const char *str; int ret; - ret = sysdb_getpwnam(mem_ctx, sysdb, domain, name, &res); + ret = sysdb_getpwnam(mem_ctx, sysdb, name, &res); if (ret) { return ret; } @@ -659,14 +654,13 @@ int sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx, int sysdb_getgrnam_sync(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, const char *name, - struct sss_domain_info *domain, struct ops_ctx *out) { struct ldb_result *res; const char *str; int ret; - ret = sysdb_getgrnam(mem_ctx, sysdb, domain, name, &res); + ret = sysdb_getgrnam(mem_ctx, sysdb, name, &res); if (ret) { return ret; } diff --git a/src/tools/sss_sync_ops.h b/src/tools/sss_sync_ops.h index f0faae942..fcf7e223e 100644 --- a/src/tools/sss_sync_ops.h +++ b/src/tools/sss_sync_ops.h @@ -95,13 +95,11 @@ int groupmod(TALLOC_CTX *mem_ctx, int sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, const char *name, - struct sss_domain_info *domain, struct ops_ctx *out); int sysdb_getgrnam_sync(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, const char *name, - struct sss_domain_info *domain, struct ops_ctx *out); #endif /* __SSS_OPS_H__ */ diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c index edff6e141..8de4816f6 100644 --- a/src/tools/sss_useradd.c +++ b/src/tools/sss_useradd.c @@ -212,7 +212,6 @@ int main(int argc, const char **argv) ret = sysdb_getpwnam_sync(tctx, tctx->sysdb, tctx->octx->name, - tctx->local, tctx->octx); if (ret != EOK) { ERROR("Cannot get info about the user\n"); diff --git a/src/tools/sss_userdel.c b/src/tools/sss_userdel.c index 1d0cb12b4..c5010e34e 100644 --- a/src/tools/sss_userdel.c +++ b/src/tools/sss_userdel.c @@ -219,7 +219,6 @@ int main(int argc, const char **argv) ret = sysdb_getpwnam_sync(tctx, tctx->sysdb, tctx->octx->name, - tctx->local, tctx->octx); if (ret != EOK) { /* Error message will be printed in the switch */ diff --git a/src/tools/sss_usermod.c b/src/tools/sss_usermod.c index bcf2b3a24..e6d54d586 100644 --- a/src/tools/sss_usermod.c +++ b/src/tools/sss_usermod.c @@ -139,9 +139,7 @@ int main(int argc, const char **argv) goto fini; } /* check the username to be able to give sensible error message */ - ret = sysdb_getpwnam_sync(tctx, tctx->sysdb, - tctx->octx->name, tctx->local, - tctx->octx); + ret = sysdb_getpwnam_sync(tctx, tctx->sysdb, tctx->octx->name, tctx->octx); if (ret != EOK) { ERROR("Cannot find user in local domain, " "modifying users is allowed only in local domain\n"); diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c index 96ca58436..fb4c4ef77 100644 --- a/src/tools/tools_util.c +++ b/src/tools/tools_util.c @@ -211,7 +211,6 @@ int check_group_names(struct tools_ctx *tctx, ret = sysdb_getgrnam_sync(tctx, tctx->sysdb, grouplist[i], - tctx->local, groupinfo); if (ret) { DEBUG(6, ("Cannot find group %s, ret: %d\n", grouplist[i], ret)); |