1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

lib:util: Remove NIS support from string_match()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Andreas Schneider 2021-04-20 17:53:49 +02:00 committed by Jeremy Allison
parent e1a321e8a4
commit 620de975f1
2 changed files with 1 additions and 55 deletions

View File

@ -23,10 +23,6 @@
#include "lib/util/unix_match.h"
#include "lib/util/smb_strtox.h"
#if defined(HAVE_NETGROUP)
#include "system/nis.h"
#endif
#define NAME_INDEX 0
#define ADDR_INDEX 1
@ -118,56 +114,6 @@ static bool string_match(const char *tok,const char *s)
&& strequal_m(tok, s + str_len - tok_len)) {
return true;
}
} else if (tok[0] == '@') { /* netgroup: look it up */
#ifdef HAVE_NETGROUP
DATA_BLOB tmp;
char *mydomain = NULL;
char *hostname = NULL;
bool netgroup_ok = false;
if (memcache_lookup(
NULL, SINGLETON_CACHE,
data_blob_string_const_null("yp_default_domain"),
&tmp)) {
SMB_ASSERT(tmp.length > 0);
mydomain = (tmp.data[0] == '\0')
? NULL : (char *)tmp.data;
}
else {
yp_get_default_domain(&mydomain);
memcache_add(
NULL, SINGLETON_CACHE,
data_blob_string_const_null("yp_default_domain"),
data_blob_string_const_null(mydomain?mydomain:""));
}
if (!mydomain) {
DEBUG(0,("Unable to get default yp domain. "
"Try without it.\n"));
}
if (!(hostname = smb_xstrdup(s))) {
DEBUG(1,("out of memory for strdup!\n"));
return false;
}
netgroup_ok = innetgr(tok + 1, hostname, (char *) 0, mydomain);
DBG_INFO("%s %s of domain %s in netgroup %s\n",
netgroup_ok ? "Found" : "Could not find",
hostname,
mydomain?mydomain:"(ANY)",
tok+1);
SAFE_FREE(hostname);
if (netgroup_ok)
return true;
#else
DEBUG(0,("access: netgroup support is not configured\n"));
return false;
#endif
} else if (strequal_m(tok, "ALL")) { /* all: match any */
return true;
} else if (strequal_m(tok, "FAIL")) { /* fail: match any */

View File

@ -290,7 +290,7 @@ else:
bld.SAMBA_SUBSYSTEM('access',
source='access.c',
deps='interfaces samba-util tirpc nsl',
deps='interfaces samba-util',
local_include=False)
bld.SAMBA_SUBSYSTEM('util_str_escape',