commit:     664afcbb2642555a65dad44ff104e31e2f02d6ff
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 19 11:12:13 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 19 11:12:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=664afcbb

net-fs/autofs: further modern C fixes

Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-fs/autofs/autofs-5.1.9-r1.ebuild       | 128 +++++++++++++++++++++++++++++
 net-fs/autofs/files/autofs-5.1.9-c99.patch |  57 +++++++++++++
 2 files changed, 185 insertions(+)

diff --git a/net-fs/autofs/autofs-5.1.9-r1.ebuild 
b/net-fs/autofs/autofs-5.1.9-r1.ebuild
new file mode 100644
index 000000000000..f64950f705e7
--- /dev/null
+++ b/net-fs/autofs/autofs-5.1.9-r1.ebuild
@@ -0,0 +1,128 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit linux-info systemd toolchain-funcs
+
+DESCRIPTION="Kernel based automounter"
+HOMEPAGE="https://web.archive.org/web/*/http://www.linux-consulting.com/Amd_AutoFS/autofs.html
 https://git.kernel.org/pub/scm/linux/storage/autofs/autofs.git";
+SRC_URI="https://www.kernel.org/pub/linux/daemons/${PN}/v5/${P}.tar.xz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv 
~sparc ~x86"
+IUSE="dmalloc ldap +libtirpc mount-locking sasl selinux systemd"
+
+# currently, sasl code assumes the presence of kerberosV
+RDEPEND="
+       net-libs/libnsl:=
+       >=sys-apps/util-linux-2.20
+       dmalloc? ( dev-libs/dmalloc[threads] )
+       ldap? (
+               >=net-nds/openldap-2.0:=
+               sasl? (
+                       dev-libs/cyrus-sasl
+                       dev-libs/libxml2
+                       virtual/krb5
+               )
+       )
+       systemd? ( sys-apps/systemd )
+       libtirpc? ( net-libs/libtirpc:= )
+       !libtirpc? ( elibc_glibc? ( sys-libs/glibc[rpc(-)] ) )
+"
+DEPEND="${RDEPEND}
+       libtirpc? ( net-libs/rpcsvc-proto )
+"
+BDEPEND="
+       sys-devel/flex
+       virtual/pkgconfig
+       app-alternatives/yacc
+"
+RDEPEND+=" selinux? ( sec-policy/selinux-automount )"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-5.1.9-c99.patch
+)
+
+pkg_setup() {
+       linux-info_pkg_setup
+
+       local CONFIG_CHECK
+
+       if kernel_is -ge 4 18; then
+               CONFIG_CHECK="~AUTOFS_FS"
+       else
+               CONFIG_CHECK="~AUTOFS4_FS"
+       fi
+
+       check_extra_config
+}
+
+src_prepare() {
+       sed -i  -e "s:/usr/bin/kill:/bin/kill:" samples/autofs.service.in || 
die # bug #479492
+       sed -i  -e "/^EnvironmentFile/d"        samples/autofs.service.in || 
die # bug #592334
+
+       # Install samples including autofs.service
+       sed -i -e "/^SUBDIRS/s/$/ samples/g" Makefile.rules || die
+
+       default
+}
+
+src_configure() {
+       # bug #483716
+       tc-export AR
+       # --with-confdir is for bug #361481
+       # --with-mapdir is for bug #385113
+       local myeconfargs=(
+               --with-confdir=/etc/conf.d
+               --with-mapdir=/etc/autofs
+               $(use_with dmalloc)
+               $(use_with ldap openldap)
+               $(use_with libtirpc)
+               $(use_with sasl)
+               $(use_enable mount-locking)
+               $(use_with systemd systemd $(systemd_get_systemunitdir)) # bug 
#479492
+               --without-hesiod
+               --disable-ext-env
+               --enable-sloppy-mount # bug #453778
+               --enable-force-shutdown
+               --enable-ignore-busy
+               RANLIB="$(type -P $(tc-getRANLIB))" # bug #483716
+       )
+
+       CONFIG_SHELL="${BROOT}/bin/bash" econf "${myeconfargs[@]}"
+}
+
+src_compile() {
+       emake STRIP=: DONTSTRIP=1
+}
+
+src_install() {
+       default
+       rmdir "${D}"/run
+
+       if kernel_is -lt 2 6 30; then
+               # kernel patches
+               docinto patches
+               dodoc patches/${PN}4-2.6.??{,.?{,?}}-v5-update-????????.patch
+       fi
+       newinitd "${FILESDIR}"/autofs5.initd autofs
+       insinto etc/autofs
+       newins "${FILESDIR}"/autofs5-auto.master auto.master
+}
+
+pkg_postinst() {
+       if kernel_is -lt 2 6 30; then
+               elog "This version of ${PN} requires a kernel with autofs4 
supporting"
+               elog "protocol version 5.00. Patches for kernels older than 
2.6.30 have"
+               elog "been installed into"
+               elog "${EROOT}/usr/share/doc/${P}/patches."
+               elog "For further instructions how to patch the kernel, please 
refer to"
+               elog "${EROOT}/usr/share/doc/${P}/INSTALL."
+               elog
+       fi
+       elog "If you plan on using autofs for automounting remote NFS mounts,"
+       elog "please check that both portmap (or rpcbind) and rpc.statd/lockd"
+       elog "are running."
+}

diff --git a/net-fs/autofs/files/autofs-5.1.9-c99.patch 
b/net-fs/autofs/files/autofs-5.1.9-c99.patch
new file mode 100644
index 000000000000..e218f52a96f1
--- /dev/null
+++ b/net-fs/autofs/files/autofs-5.1.9-c99.patch
@@ -0,0 +1,57 @@
+https://src.fedoraproject.org/rpms/autofs/c/787a553722ec9aecf0c5108065bef9ef110d7639?branch=rawhide
+https://lore.kernel.org/autofs/874jgf4qwu....@oldenburg.str.redhat.com/
+https://lore.kernel.org/autofs/878r5r4qy5....@oldenburg.str.redhat.com/
+
+Fix argument type for ldap_parse_page_control in configure probe,
+to suppress an incompatible-pointer-types error.
+
+Submitted upstream:
+
+  <https://lore.kernel.org/autofs/874jgf4qwu....@oldenburg.str.redhat.com/>
+
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -427,7 +427,7 @@ AC_LINK_IFELSE(
+       struct berval *c;
+       int ret;
+       LDAPControl **clp;
+-      ret = ldap_parse_page_control(ld,clp,ct,c); ]])],
++      ret = ldap_parse_page_control(ld,clp,ct,&c); ]])],
+   [ af_have_ldap_parse_page_control=yes
+     AC_MSG_RESULT(yes) ],
+   [ AC_MSG_RESULT(no) ])
+
+Add casts to SASL callbacks to avoid incompatible-pointer-types
+errors.
+
+Submitted upstream:
+
+  <https://lore.kernel.org/autofs/878r5r4qy5....@oldenburg.str.redhat.com/>
+
+--- a/modules/cyrus-sasl.c
++++ b/modules/cyrus-sasl.c
+@@ -109,17 +109,17 @@ static int getpass_func(sasl_conn_t *, void *, int, 
sasl_secret_t **);
+ static int getuser_func(void *, int, const char **, unsigned *);
+ 
+ static sasl_callback_t callbacks[] = {
+-      { SASL_CB_USER, &getuser_func, NULL },
+-      { SASL_CB_AUTHNAME, &getuser_func, NULL },
+-      { SASL_CB_PASS, &getpass_func, NULL },
++      { SASL_CB_USER, (int(*)(void)) &getuser_func, NULL },
++      { SASL_CB_AUTHNAME, (int(*)(void)) &getuser_func, NULL },
++      { SASL_CB_PASS, (int(*)(void)) &getpass_func, NULL },
+       { SASL_CB_LIST_END, NULL, NULL },
+ };
+ 
+ static sasl_callback_t debug_callbacks[] = {
+-      { SASL_CB_LOG, &sasl_log_func, NULL },
+-      { SASL_CB_USER, &getuser_func, NULL },
+-      { SASL_CB_AUTHNAME, &getuser_func, NULL },
+-      { SASL_CB_PASS, &getpass_func, NULL },
++      { SASL_CB_LOG, (int(*)(void)) &sasl_log_func, NULL },
++      { SASL_CB_USER, (int(*)(void)) &getuser_func, NULL },
++      { SASL_CB_AUTHNAME, (int(*)(void)) &getuser_func, NULL },
++      { SASL_CB_PASS, (int(*)(void)) &getpass_func, NULL },
+       { SASL_CB_LIST_END, NULL, NULL },
+ };
+ 

Reply via email to