- add fix for RHEL-32639.

This commit is contained in:
Ian Kent 2024-07-25 07:27:11 +08:00
parent 22e3f7dca3
commit 1d53b2fcd9
6 changed files with 464 additions and 32 deletions

View File

@ -1,15 +1,30 @@
autofs-5.1.9 - Fix incompatible function pointer types in cyrus-sasl module
From: Florian Weimer <fweimer@redhat.com>
Add casts to SASL callbacks to avoid incompatible-pointer-types
errors.
errors. Avoids a build failure with stricter compilers.
Submitted upstream:
Signed-off-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 2 ++
modules/cyrus-sasl.c | 14 +++++++-------
2 files changed, 9 insertions(+), 7 deletions(-)
<https://lore.kernel.org/autofs/878r5r4qy5.fsf@oldenburg.str.redhat.com/>
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 **);
--- autofs-5.1.9.orig/CHANGELOG
+++ autofs-5.1.9/CHANGELOG
@@ -2,6 +2,7 @@
- Update configure script.
- fix ldap_parse_page_control() check.
- fix crash in make_options_string().
+- Fix incompatible function pointer types in cyrus-sasl module.
02/11/2023 autofs-5.1.9
- fix kernel mount status notification.
--- autofs-5.1.9.orig/modules/cyrus-sasl.c
+++ autofs-5.1.9/modules/cyrus-sasl.c
@@ -109,17 +109,17 @@ static int getpass_func(sasl_conn_t *, v
static int getuser_func(void *, int, const char **, unsigned *);
static sasl_callback_t callbacks[] = {

View File

@ -0,0 +1,107 @@
autofs-5.1.9 - fix crash in make_options_string()
From: Ian Kent <raven@themaw.net>
glibc reports a memory overflow when make_options_string() in snprintf()
As described by Andreas Hasenack on the autofs mailing list this is due
to my incorrect use of max_len in snprintf(), it should in fact be
max_len - <length of buffer already used>.
Anyway looking at the calculated maximum options string length there's
no actual overflow possible.
To fix this use strcat(3) instead of snprintf(), in this case there's
probably less overhead anyway. While we are at it drop the useless error
checks because we know it won't overflow.
Signed-off-by: Ian Kent <raven@themaw.net>
---
lib/mounts.c | 35 +++++++++--------------------------
1 file changed, 9 insertions(+), 26 deletions(-)
--- autofs-5.1.9.orig/lib/mounts.c
+++ autofs-5.1.9/lib/mounts.c
@@ -695,10 +695,11 @@ static int cacl_max_options_len(unsigned
unsigned int kver_minor = get_kver_minor();
int max_len;
- /* %d and %u are maximum lenght of 10 and mount type is maximum
- * length of 9 (e. ",indirect").
+ /* %d and %u are maximum length of 10 and mount type is maximum
+ * length of 9 (ie. ",indirect").
* The base temaplate is "fd=%d,pgrp=%u,minproto=5,maxproto=%d"
- * plus the length of mount type plus 1 for the NULL.
+ * plus the length of mount type plus 1 for the NULL (and an
+ * additional 10 characters for good measure!).
*/
max_len = 79 + 1;
@@ -728,7 +729,7 @@ char *make_options_string(char *path, in
unsigned int kver_major = get_kver_major();
unsigned int kver_minor = get_kver_minor();
char *options;
- int max_len, len, new;
+ int max_len, len;
max_len = cacl_max_options_len(flags);
@@ -751,21 +752,13 @@ char *make_options_string(char *path, in
if (len < 0)
goto error_out;
- if (len >= max_len)
- goto truncated;
-
if (kver_major < 5 || (kver_major == 5 && kver_minor < 4))
goto out;
/* maybe add ",strictexpire" */
if (flags & MOUNT_FLAG_STRICTEXPIRE) {
- new = snprintf(options + len,
- max_len, "%s", ",strictexpire");
- if (new < 0)
- goto error_out;
- len += new;
- if (len >= max_len)
- goto truncated;
+ strcat(options, ",strictexpire");
+ len += 13;
}
if (kver_major == 5 && kver_minor < 5)
@@ -773,23 +766,13 @@ char *make_options_string(char *path, in
/* maybe add ",ignore" */
if (flags & MOUNT_FLAG_IGNORE) {
- new = snprintf(options + len,
- max_len, "%s", ",ignore");
- if (new < 0)
- goto error_out;
- len += new;
- if (len >= max_len)
- goto truncated;
+ strcat(options, ",ignore");
+ len += 7;
}
out:
options[len] = '\0';
return options;
-truncated:
- logerr("buffer to small for options - truncated");
- len = max_len -1;
- goto out;
-
error_out:
logerr("error constructing mount options string for %s", path);
free(options);
--- autofs-5.1.9.orig/CHANGELOG
+++ autofs-5.1.9/CHANGELOG
@@ -1,6 +1,7 @@
- Update configure script.
- fix ldap_parse_page_control() check.
+- fix crash in make_options_string().
02/11/2023 autofs-5.1.9
- fix kernel mount status notification.

View File

@ -0,0 +1,59 @@
autofs-5.1.9 - fix ldap_parse_page_control() check
From: David Disseldorp <ddiss@suse.de>
The final @cookie parameter should be a struct berval ** type. The
check currently fails when -Werror=incompatible-pointer-types is set:
conftest.c: In function 'main':
conftest.c:54:47: error: passing argument 4 of 'ldap_parse_page_control'
from incompatible pointer type [-Werror=incompatible-pointer-types]
54 | ret = ldap_parse_page_control(ld,clp,ct,c);
| ^
| |
| struct berval *
In file included from /usr/include/lber_types.h:24,
from /usr/include/lber.h:29,
from /usr/include/ldap.h:30,
from conftest.c:45:
/usr/include/ldap.h:2155:25: note: expected 'struct berval **' but
argument is of type 'struct berval *'
2155 | ldap_parse_page_control LDAP_P((
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
aclocal.m4 | 2 +-
configure | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- autofs-5.1.9.orig/aclocal.m4
+++ autofs-5.1.9/aclocal.m4
@@ -424,7 +424,7 @@ AC_LINK_IFELSE(
#include <ldap.h> ]],
[[ LDAP *ld;
ber_int_t *ct;
- struct berval *c;
+ struct berval **c;
int ret;
LDAPControl **clp;
ret = ldap_parse_page_control(ld,clp,ct,c); ]])],
--- autofs-5.1.9.orig/configure
+++ autofs-5.1.9/configure
@@ -5653,7 +5653,7 @@ main (void)
{
LDAP *ld;
ber_int_t *ct;
- struct berval *c;
+ struct berval **c;
int ret;
LDAPControl **clp;
ret = ldap_parse_page_control(ld,clp,ct,c);
--- autofs-5.1.9.orig/CHANGELOG
+++ autofs-5.1.9/CHANGELOG
@@ -1,5 +1,6 @@
- Update configure script.
+- fix ldap_parse_page_control() check.
02/11/2023 autofs-5.1.9
- fix kernel mount status notification.

View File

@ -0,0 +1,259 @@
Update configure script.
From: Ian Kent <raven@themaw.net>
Signed-off-by: Ian Kent <raven@themaw.net>
---
configure | 92 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 46 insertions(+), 46 deletions(-)
--- autofs-5.1.9.orig/configure
+++ autofs-5.1.9/configure
@@ -2437,8 +2437,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# for pkg-config macros
-# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-# serial 11 (pkg-config-0.29.1)
+# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
@@ -3706,8 +3706,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
pkg_failed=no
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for systemd" >&5
-printf %s "checking for systemd... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsystemd" >&5
+printf %s "checking for libsystemd... " >&6; }
if test -n "$systemd_CFLAGS"; then
pkg_cv_systemd_CFLAGS="$systemd_CFLAGS"
@@ -3747,7 +3747,7 @@ fi
if test $pkg_failed = yes; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -3756,12 +3756,12 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- systemd_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1`
+ systemd_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1`
else
- systemd_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1`
+ systemd_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1`
fi
- # Put the nasty error message in config.log where it belongs
- echo "$systemd_PKG_ERRORS" >&5
+ # Put the nasty error message in config.log where it belongs
+ echo "$systemd_PKG_ERRORS" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sm_notify in -lsystemd" >&5
@@ -3807,7 +3807,7 @@ fi
elif test $pkg_failed = untried; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sm_notify in -lsystemd" >&5
@@ -3853,8 +3853,8 @@ fi
else
- systemd_CFLAGS=$pkg_cv_systemd_CFLAGS
- systemd_LIBS=$pkg_cv_systemd_LIBS
+ systemd_CFLAGS=$pkg_cv_systemd_CFLAGS
+ systemd_LIBS=$pkg_cv_systemd_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
@@ -3997,8 +3997,8 @@ fi
if test "x$with_libtirpc" = "xyes"; then
pkg_failed=no
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TIRPC" >&5
-printf %s "checking for TIRPC... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libtirpc" >&5
+printf %s "checking for libtirpc... " >&6; }
if test -n "$TIRPC_CFLAGS"; then
pkg_cv_TIRPC_CFLAGS="$TIRPC_CFLAGS"
@@ -4038,7 +4038,7 @@ fi
if test $pkg_failed = yes; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -4047,14 +4047,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- TIRPC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtirpc" 2>&1`
+ TIRPC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtirpc" 2>&1`
else
- TIRPC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtirpc" 2>&1`
+ TIRPC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtirpc" 2>&1`
fi
- # Put the nasty error message in config.log where it belongs
- echo "$TIRPC_PKG_ERRORS" >&5
+ # Put the nasty error message in config.log where it belongs
+ echo "$TIRPC_PKG_ERRORS" >&5
- as_fn_error $? "Package requirements (libtirpc) were not met:
+ as_fn_error $? "Package requirements (libtirpc) were not met:
$TIRPC_PKG_ERRORS
@@ -4065,9 +4065,9 @@ Alternatively, you may set the environme
and TIRPC_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
- { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -4080,8 +4080,8 @@ See the pkg-config man page for more det
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
- TIRPC_CFLAGS=$pkg_cv_TIRPC_CFLAGS
- TIRPC_LIBS=$pkg_cv_TIRPC_LIBS
+ TIRPC_CFLAGS=$pkg_cv_TIRPC_CFLAGS
+ TIRPC_LIBS=$pkg_cv_TIRPC_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
@@ -4812,8 +4812,8 @@ fi
# LDAP SASL auth needs libxml and Kerberos
pkg_failed=no
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XML" >&5
-printf %s "checking for XML... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0" >&5
+printf %s "checking for libxml-2.0... " >&6; }
if test -n "$XML_CFLAGS"; then
pkg_cv_XML_CFLAGS="$XML_CFLAGS"
@@ -4853,7 +4853,7 @@ fi
if test $pkg_failed = yes; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -4862,21 +4862,21 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- XML_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0" 2>&1`
+ XML_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0" 2>&1`
else
- XML_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0" 2>&1`
+ XML_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0" 2>&1`
fi
- # Put the nasty error message in config.log where it belongs
- echo "$XML_PKG_ERRORS" >&5
+ # Put the nasty error message in config.log where it belongs
+ echo "$XML_PKG_ERRORS" >&5
- HAVE_LIBXML=0
+ HAVE_LIBXML=0
elif test $pkg_failed = untried; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
- HAVE_LIBXML=0
+ HAVE_LIBXML=0
else
- XML_CFLAGS=$pkg_cv_XML_CFLAGS
- XML_LIBS=$pkg_cv_XML_LIBS
+ XML_CFLAGS=$pkg_cv_XML_CFLAGS
+ XML_LIBS=$pkg_cv_XML_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
@@ -5079,8 +5079,8 @@ fi
pkg_failed=no
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for NSL" >&5
-printf %s "checking for NSL... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libnsl" >&5
+printf %s "checking for libnsl... " >&6; }
if test -n "$NSL_CFLAGS"; then
pkg_cv_NSL_CFLAGS="$NSL_CFLAGS"
@@ -5120,7 +5120,7 @@ fi
if test $pkg_failed = yes; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -5129,12 +5129,12 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- NSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnsl" 2>&1`
+ NSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnsl" 2>&1`
else
- NSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnsl" 2>&1`
+ NSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnsl" 2>&1`
fi
- # Put the nasty error message in config.log where it belongs
- echo "$NSL_PKG_ERRORS" >&5
+ # Put the nasty error message in config.log where it belongs
+ echo "$NSL_PKG_ERRORS" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for yp_match in -lnsl" >&5
@@ -5181,7 +5181,7 @@ fi
NSL_CFLAGS=""
elif test $pkg_failed = untried; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for yp_match in -lnsl" >&5
@@ -5228,8 +5228,8 @@ fi
NSL_CFLAGS=""
else
- NSL_CFLAGS=$pkg_cv_NSL_CFLAGS
- NSL_LIBS=$pkg_cv_NSL_LIBS
+ NSL_CFLAGS=$pkg_cv_NSL_CFLAGS
+ NSL_LIBS=$pkg_cv_NSL_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
--- autofs-5.1.9.orig/CHANGELOG
+++ autofs-5.1.9/CHANGELOG
@@ -1,4 +1,6 @@
+- Update configure script.
+
02/11/2023 autofs-5.1.9
- fix kernel mount status notification.
- fix fedfs build flags.

View File

@ -1,20 +0,0 @@
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.fsf@oldenburg.str.redhat.com/>
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) ])

View File

@ -12,12 +12,14 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.9
Release: 8%{?dist}
Release: 9%{?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
Patch0: autofs-5.1.9-update-configure.patch
Patch1: autofs-5.1.9-fix-ldap_parse_page_control-check.patch
Patch2: autofs-5.1.9-fix-crash-in-make_options_string.patch
Patch3: autofs-5.1.9-Fix-incompatible-function-pointer-types-in-cyrus-sasl-module.patch
%if %{with_systemd}
BuildRequires: systemd-units
@ -190,6 +192,16 @@ fi
%dir /etc/auto.master.d
%changelog
* Mon Jul 22 2024 Ian Kent <ikent@redhat.com> - 1:5.1.9-9
- RHEL-32639 - [10.0-beta] starting autofs leads to core dump
- bring the existing patches up to date with upstream.
- update the configure script.
- the two existing patches were renamed upstream.
autofs-configure-c99.patch => autofs-5.1.9-fix-ldap_parse_page_control-check.patch.
autofs-c99.patch => autofs-5.1.9-Fix-incompatible-function-pointer-types-in-cyrus-sasl-module.patch
- fix crash in make_options_string().
- Resolves: RHEL-32639
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1:5.1.9-8
- Bump release for June 2024 mass rebuild