1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

winbind: move "winbind:ignore domain" logic to a seperate function

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14602

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 894caca794)
This commit is contained in:
Ralph Boehme 2021-01-11 16:15:15 +01:00 committed by Karolin Seeger
parent bee8a1cb9e
commit 4f69adab43
3 changed files with 23 additions and 8 deletions

View File

@ -304,6 +304,7 @@ struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
/* The following definitions come from lib/util_names.c */
const char *get_global_sam_name(void);
const char *my_sam_name(void);
bool is_allowed_domain(const char *domain_name);
/* The following definitions come from lib/util.c */

View File

@ -182,3 +182,23 @@ const char *my_sam_name(void)
return lp_workgroup();
}
bool is_allowed_domain(const char *domain_name)
{
const char **ignored_domains = NULL;
const char **dom = NULL;
ignored_domains = lp_parm_string_list(-1,
"winbind",
"ignore domains",
NULL);
for (dom = ignored_domains; dom != NULL && *dom != NULL; dom++) {
if (gen_fnmatch(*dom, domain_name) == 0) {
DBG_NOTICE("Ignoring domain '%s'\n", domain_name);
return false;
}
}
return true;
}

View File

@ -126,8 +126,6 @@ static NTSTATUS add_trusted_domain(const char *domain_name,
struct winbindd_domain **_d)
{
struct winbindd_domain *domain = NULL;
const char **ignored_domains = NULL;
const char **dom = NULL;
int role = lp_server_role();
struct dom_sid_buf buf;
@ -136,12 +134,8 @@ static NTSTATUS add_trusted_domain(const char *domain_name,
return NT_STATUS_INVALID_PARAMETER;
}
ignored_domains = lp_parm_string_list(-1, "winbind", "ignore domains", NULL);
for (dom=ignored_domains; dom && *dom; dom++) {
if (gen_fnmatch(*dom, domain_name) == 0) {
DEBUG(2,("Ignoring domain '%s'\n", domain_name));
return NT_STATUS_NO_SUCH_DOMAIN;
}
if (!is_allowed_domain(domain_name)) {
return NT_STATUS_NO_SUCH_DOMAIN;
}
/*