diff --git a/autofs-c99.patch b/autofs-c99.patch
new file mode 100644
index 0000000..4f19d11
--- /dev/null
+++ b/autofs-c99.patch
@@ -0,0 +1,36 @@
+Add casts to SASL callbacks to avoid incompatible-pointer-types
+errors.
+
+Submitted upstream:
+
+
+
+diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
+index e742eaf8ebe6ce8a..78b77942ba3efd56 100644
+--- 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 },
+ };
+
diff --git a/autofs-configure-c99.patch b/autofs-configure-c99.patch
new file mode 100644
index 0000000..908ff44
--- /dev/null
+++ b/autofs-configure-c99.patch
@@ -0,0 +1,20 @@
+Fix argument type for ldap_parse_page_control in configure probe,
+to suppress an incompatible-pointer-types error.
+
+Submitted upstream:
+
+
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index 1046d72b1560a8ea..8dad987224fe5094 100644
+--- 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) ])
diff --git a/autofs.spec b/autofs.spec
index d3eac97..b33b567 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -12,10 +12,12 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.9
-Release: 3%{?dist}
+Release: 4%{?dist}
Epoch: 1
License: GPL-2.0-or-later
Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.gz
+Patch0: autofs-configure-c99.patch
+Patch1: autofs-c99.patch
%if %{with_systemd}
BuildRequires: systemd-units
@@ -71,7 +73,7 @@ unmountar dem när de har varit oanvända en bestämd tid. Detta kan
inkludera nätfilsystem, CD-ROM, floppydiskar, och så vidare.
%prep
-%setup -q -n %{name}-%{version}
+%autosetup -p1 -n %{name}-%{version}
echo %{version}-%{release} > .version
%if %{with_systemd}
%define unitdir %{?_unitdir:/usr/lib/systemd/system}
@@ -82,6 +84,7 @@ echo %{version}-%{release} > .version
%endif
%build
+autoreconf -iv
LDFLAGS=-Wl,-z,now
%configure \
--disable-mount-locking \
@@ -187,6 +190,9 @@ fi
%dir /etc/auto.master.d
%changelog
+* Mon Dec 18 2023 Florian Weimer - 1:5.1.9-4
+- Further C compatibility fixes, run autoconf
+
* Tue Nov 07 2023 Ian Kent - 1:5.1.9-3
- Also update package revision.