|
|
91594d |
autofs-5.1.8 - fix sysconf(3) return handling
|
|
|
91594d |
|
|
|
91594d |
From: Fabian Groffen <grobian@gentoo.org>
|
|
|
91594d |
|
|
|
91594d |
The sysconf(3) return handling doesn't handle a -1 return with errno
|
|
|
91594d |
not changed which indicated a maximum or minimum limit that's not
|
|
|
91594d |
known.
|
|
|
91594d |
|
|
|
91594d |
Add handling of this case.
|
|
|
91594d |
|
|
|
91594d |
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
|
|
|
91594d |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
91594d |
---
|
|
|
91594d |
CHANGELOG | 1 +
|
|
|
91594d |
lib/mounts.c | 13 +++++++++++--
|
|
|
91594d |
2 files changed, 12 insertions(+), 2 deletions(-)
|
|
|
91594d |
|
|
|
91594d |
--- autofs-5.1.7.orig/CHANGELOG
|
|
|
91594d |
+++ autofs-5.1.7/CHANGELOG
|
|
|
91594d |
@@ -93,6 +93,7 @@
|
|
|
91594d |
- fix use after free in tree_mapent_delete_offset_tree().
|
|
|
91594d |
- fix memory leak in xdr_exports().
|
|
|
91594d |
- avoid calling pthread_getspecific() with NULL key_thread_attempt_id.
|
|
|
91594d |
+- fix sysconf(3) return handling.
|
|
|
91594d |
|
|
|
91594d |
25/01/2021 autofs-5.1.7
|
|
|
91594d |
- make bind mounts propagation slave by default.
|
|
|
91594d |
--- autofs-5.1.7.orig/lib/mounts.c
|
|
|
91594d |
+++ autofs-5.1.7/lib/mounts.c
|
|
|
91594d |
@@ -2385,11 +2385,17 @@ void set_tsd_user_vars(unsigned int logo
|
|
|
91594d |
|
|
|
91594d |
/* Try to get passwd info */
|
|
|
91594d |
|
|
|
91594d |
+ /* sysconf may return -1 with unchanged errno to indicate unlimited
|
|
|
91594d |
+ * size, same for the call for _SC_GETGR_R_SIZE_MAX below
|
|
|
91594d |
+ */
|
|
|
91594d |
+ errno = 0;
|
|
|
91594d |
tmplen = sysconf(_SC_GETPW_R_SIZE_MAX);
|
|
|
91594d |
- if (tmplen < 0) {
|
|
|
91594d |
+ if (tmplen < 0 && errno != 0) {
|
|
|
91594d |
error(logopt, "failed to get buffer size for getpwuid_r");
|
|
|
91594d |
goto free_tsv;
|
|
|
91594d |
}
|
|
|
91594d |
+ if (tmplen < 0)
|
|
|
91594d |
+ tmplen = 1024; /* assume something reasonable */
|
|
|
91594d |
|
|
|
91594d |
pw_tmp = malloc(tmplen + 1);
|
|
|
91594d |
if (!pw_tmp) {
|
|
|
91594d |
@@ -2422,11 +2428,14 @@ void set_tsd_user_vars(unsigned int logo
|
|
|
91594d |
|
|
|
91594d |
/* Try to get group info */
|
|
|
91594d |
|
|
|
91594d |
+ errno = 0;
|
|
|
91594d |
grplen = sysconf(_SC_GETGR_R_SIZE_MAX);
|
|
|
91594d |
- if (grplen < 0) {
|
|
|
91594d |
+ if (grplen < 0 && errno != 0) {
|
|
|
91594d |
error(logopt, "failed to get buffer size for getgrgid_r");
|
|
|
91594d |
goto free_tsv_home;
|
|
|
91594d |
}
|
|
|
91594d |
+ if (grplen < 0)
|
|
|
91594d |
+ grplen = 1024;
|
|
|
91594d |
|
|
|
91594d |
gr_tmp = NULL;
|
|
|
91594d |
status = ERANGE;
|