From 1c0b0b70a276280f431d72319109a0bbc0267970 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Wed, 2 Feb 2022 10:15:22 +0800 Subject: [PATCH 2/2] autofs-5.1.8 - handle innetgr() not present in musl The function innetgr(3) may not be present in musl libc, add a check for this. Originally contributed by Fabian, modified by me. Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/storage/autofs/autofs.git/commit/?id=f60e40af3c038b8955325a11b7294ad38c15c9e8] Signed-off-by: Fabian Groffen Signed-off-by: Ian Kent Signed-off-by: Khem Raj --- configure | 6 ++++++ configure.in | 2 +- include/config.h.in | 3 +++ modules/parse_amd.c | 7 +++++++ 4 files changed, 17 insertions(+), 1 deletion(-) --- a/configure.in +++ b/configure.in @@ -169,7 +169,7 @@ AF_CHECK_SSS_LIB(SSS_AUTOFS, libsss_auto AC_SUBST(HAVE_SSS_AUTOFS) AC_SUBST(sssldir) -AC_CHECK_FUNCS(pipe2) +AC_CHECK_FUNCS(pipe2 innetgr) # # Newer mounts have the -s (sloppy) option to ignore unknown options, --- a/include/config.h.in +++ b/include/config.h.in @@ -30,6 +30,9 @@ /* Define to 1 if you have the `getservbyname' function. */ #undef HAVE_GETSERVBYNAME +/* Define to 1 if you have the `innetgr' function. */ +#undef HAVE_INNETGR + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@ -45,9 +48,6 @@ /* Define if you have the Linux /proc filesystem. */ #undef HAVE_LINUX_PROCFS -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* define if you have MOUNT */ #undef HAVE_MOUNT @@ -69,6 +69,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -141,7 +144,9 @@ /* define if you have YACC */ #undef PATH_YACC -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define to 1 to use the libtirpc tsd usage workaround */ --- a/modules/parse_amd.c +++ b/modules/parse_amd.c @@ -424,6 +424,7 @@ static int sel_in_network(struct autofs_ return ret; } +#ifdef HAVE_INNETGR static int sel_netgrp(struct autofs_point *ap, struct selector *s, struct substvar *sv) { @@ -488,6 +489,7 @@ out: return ret; } +#endif static int eval_selector(struct autofs_point *ap, struct amd_entry *this, struct substvar *sv) @@ -627,7 +629,12 @@ static int eval_selector(struct autofs_p switch (s->sel->selector) { case SEL_NETGRP: case SEL_NETGRPD: +#ifndef HAVE_INNETGR + error(logopt, MODPREFIX + "netgroups not available, function innetgr(3) not available"); +#else ret = sel_netgrp(ap, s, sv); +#endif break; default: