Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame^] | 1 | From 1c0b0b70a276280f431d72319109a0bbc0267970 Mon Sep 17 00:00:00 2001 |
| 2 | From: Fabian Groffen <grobian@gentoo.org> |
| 3 | Date: Wed, 2 Feb 2022 10:15:22 +0800 |
| 4 | Subject: [PATCH 2/2] autofs-5.1.8 - handle innetgr() not present in musl |
| 5 | |
| 6 | The function innetgr(3) may not be present in musl libc, add a check |
| 7 | for this. |
| 8 | |
| 9 | Originally contributed by Fabian, modified by me. |
| 10 | |
| 11 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/storage/autofs/autofs.git/commit/?id=f60e40af3c038b8955325a11b7294ad38c15c9e8] |
| 12 | Signed-off-by: Fabian Groffen <grobian@gentoo.org> |
| 13 | Signed-off-by: Ian Kent <raven@themaw.net> |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 15 | --- |
| 16 | configure | 6 ++++++ |
| 17 | configure.in | 2 +- |
| 18 | include/config.h.in | 3 +++ |
| 19 | modules/parse_amd.c | 7 +++++++ |
| 20 | 4 files changed, 17 insertions(+), 1 deletion(-) |
| 21 | |
| 22 | --- a/configure.in |
| 23 | +++ b/configure.in |
| 24 | @@ -169,7 +169,7 @@ AF_CHECK_SSS_LIB(SSS_AUTOFS, libsss_auto |
| 25 | AC_SUBST(HAVE_SSS_AUTOFS) |
| 26 | AC_SUBST(sssldir) |
| 27 | |
| 28 | -AC_CHECK_FUNCS(pipe2) |
| 29 | +AC_CHECK_FUNCS(pipe2 innetgr) |
| 30 | |
| 31 | # |
| 32 | # Newer mounts have the -s (sloppy) option to ignore unknown options, |
| 33 | --- a/include/config.h.in |
| 34 | +++ b/include/config.h.in |
| 35 | @@ -30,6 +30,9 @@ |
| 36 | /* Define to 1 if you have the `getservbyname' function. */ |
| 37 | #undef HAVE_GETSERVBYNAME |
| 38 | |
| 39 | +/* Define to 1 if you have the `innetgr' function. */ |
| 40 | +#undef HAVE_INNETGR |
| 41 | + |
| 42 | /* Define to 1 if you have the <inttypes.h> header file. */ |
| 43 | #undef HAVE_INTTYPES_H |
| 44 | |
| 45 | @@ -45,9 +48,6 @@ |
| 46 | /* Define if you have the Linux /proc filesystem. */ |
| 47 | #undef HAVE_LINUX_PROCFS |
| 48 | |
| 49 | -/* Define to 1 if you have the <memory.h> header file. */ |
| 50 | -#undef HAVE_MEMORY_H |
| 51 | - |
| 52 | /* define if you have MOUNT */ |
| 53 | #undef HAVE_MOUNT |
| 54 | |
| 55 | @@ -69,6 +69,9 @@ |
| 56 | /* Define to 1 if you have the <stdint.h> header file. */ |
| 57 | #undef HAVE_STDINT_H |
| 58 | |
| 59 | +/* Define to 1 if you have the <stdio.h> header file. */ |
| 60 | +#undef HAVE_STDIO_H |
| 61 | + |
| 62 | /* Define to 1 if you have the <stdlib.h> header file. */ |
| 63 | #undef HAVE_STDLIB_H |
| 64 | |
| 65 | @@ -141,7 +144,9 @@ |
| 66 | /* define if you have YACC */ |
| 67 | #undef PATH_YACC |
| 68 | |
| 69 | -/* Define to 1 if you have the ANSI C header files. */ |
| 70 | +/* Define to 1 if all of the C90 standard headers exist (not just the ones |
| 71 | + required in a freestanding environment). This macro is provided for |
| 72 | + backward compatibility; new code need not use it. */ |
| 73 | #undef STDC_HEADERS |
| 74 | |
| 75 | /* Define to 1 to use the libtirpc tsd usage workaround */ |
| 76 | --- a/modules/parse_amd.c |
| 77 | +++ b/modules/parse_amd.c |
| 78 | @@ -424,6 +424,7 @@ static int sel_in_network(struct autofs_ |
| 79 | return ret; |
| 80 | } |
| 81 | |
| 82 | +#ifdef HAVE_INNETGR |
| 83 | static int sel_netgrp(struct autofs_point *ap, |
| 84 | struct selector *s, struct substvar *sv) |
| 85 | { |
| 86 | @@ -488,6 +489,7 @@ out: |
| 87 | |
| 88 | return ret; |
| 89 | } |
| 90 | +#endif |
| 91 | |
| 92 | static int eval_selector(struct autofs_point *ap, |
| 93 | struct amd_entry *this, struct substvar *sv) |
| 94 | @@ -627,7 +629,12 @@ static int eval_selector(struct autofs_p |
| 95 | switch (s->sel->selector) { |
| 96 | case SEL_NETGRP: |
| 97 | case SEL_NETGRPD: |
| 98 | +#ifndef HAVE_INNETGR |
| 99 | + error(logopt, MODPREFIX |
| 100 | + "netgroups not available, function innetgr(3) not available"); |
| 101 | +#else |
| 102 | ret = sel_netgrp(ap, s, sv); |
| 103 | +#endif |
| 104 | break; |
| 105 | |
| 106 | default: |