From f3f5d5000cd3d9466edad2fbbb6f44cbc473792d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 19 Jan 2018 09:33:21 +0100 Subject: include: Create system/nis.h in libreplace BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238 Pair-Programmed-With: Guenther Deschner Signed-off-by: Andreas Schneider Signed-off-by: Guenther Deschner Reviewed-by: Alexander Bokovoy (cherry picked from commit c29d087e1ea4c92717ef86e372fe80f410580fdc) --- lib/replace/system/nis.h | 83 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/util/access.c | 10 ++++-- 2 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 lib/replace/system/nis.h (limited to 'lib') diff --git a/lib/replace/system/nis.h b/lib/replace/system/nis.h new file mode 100644 index 00000000000..068595a1628 --- /dev/null +++ b/lib/replace/system/nis.h @@ -0,0 +1,83 @@ +/* + Unix SMB/CIFS implementation. + + nis system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + ** NOTE! The following LGPL license applies to the replace + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _nis_passwd_h +#define _nis_passwd_h + +#if defined(HAVE_RPC_RPC_H) +/* + * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h. + */ +#if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT) +#undef AUTH_ERROR +#endif /* HAVE_SYS_SECURITY_H && HAVE_RPC_AUTH_ERROR_CONFLICT */ +/* + * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in which + * was included above. However includes which defines + * them again without checking if they already exsist. This generates + * two "Redefinition of macro" warnings for every single .c file that is + * compiled. + */ +#if defined(HPUX) && defined(TCP_NODELAY) +#undef TCP_NODELAY +#endif /* HPUX && TCP_NODELAY */ + +#if defined(HPUX) && defined(TCP_MAXSEG) +#undef TCP_MAXSEG +#endif /* HPUX && TCP_MAXSEG */ + +#include +#endif /* HAVE_RPC_RPC_H */ + + +#if defined (HAVE_NETGROUP) + +#if defined(HAVE_RPCSVC_YP_PROT_H) +/* + * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in which + * was included above. However includes which defines + * them again without checking if they already exsist. This generates + * two "Redefinition of macro" warnings for every single .c file that is + * compiled. + */ +#if defined(HPUX) && defined(TCP_NODELAY) +#undef TCP_NODELAY +#endif /* HPUX && TCP_MAXSEG */ + +#if defined(HPUX) && defined(TCP_MAXSEG) +#undef TCP_MAXSEG +#endif /* HPUX && TCP_MAXSEG */ + +#include + +#endif /* HAVE_RPCSVC_YP_PROT_H */ + +#if defined(HAVE_RPCSVC_YPCLNT_H) +#include +#endif /* HAVE_RPCSVC_YPCLNT_H */ + +#endif /* HAVE_NETGROUP */ + +#endif /* _nis_passwd_h */ diff --git a/lib/util/access.c b/lib/util/access.c index 6d04a5f622c..7da0573a74d 100644 --- a/lib/util/access.c +++ b/lib/util/access.c @@ -22,6 +22,10 @@ #include "lib/util/access.h" #include "lib/util/unix_match.h" +#if defined(HAVE_NETGROUP) +#include "system/nis.h" +#endif + #define NAME_INDEX 0 #define ADDR_INDEX 1 @@ -143,11 +147,11 @@ static bool string_match(const char *tok,const char *s) netgroup_ok = innetgr(tok + 1, hostname, (char *) 0, mydomain); - DEBUG(5,("looking for %s of domain %s in netgroup %s gave %s\n", + DBG_INFO("%s %s of domain %s in netgroup %s\n", + netgroup_ok ? "Found" : "Could not find", hostname, mydomain?mydomain:"(ANY)", - tok+1, - BOOLSTR(netgroup_ok))); + tok+1); SAFE_FREE(hostname); -- cgit v1.2.1