From: Jeremy Harris Date: Tue, 14 Jan 2020 17:48:57 +0000 (+0000) Subject: heimdal auth: fix the increase of big_buffer size. Bug 2501 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/7a66b3afa11a70021297c176acf56831692be89a?hp=ba5120a469a78ca316916e7be98c5fcb0ddd0d33 heimdal auth: fix the increase of big_buffer size. Bug 2501 --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 29059ffa5..a15e5b4a0 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -95,6 +95,11 @@ JH/20 Taint checking: disallow use of tainted data for - named-queue names Previously this was permitted. +JH/21 Bug 2501: Fix init call in the heimdal authenticator. Previously it + adjusted the size of a major service buffer; this failed because the + buffer was in use at the time. Change to a compile-time increase in the + buffer size, when this authenticator is compiled into exim. + Exim version 4.93 ----------------- diff --git a/src/src/auths/README b/src/src/auths/README index d4f125c30..66bdcdcf8 100644 --- a/src/src/auths/README +++ b/src/src/auths/README @@ -34,7 +34,7 @@ instance block for this configured mechanism. It must set the flags called the server and/or client functions are available for this authenticator. Typically this depends on whether server or client configuration options have been set, but it is also possible to have an authenticator that has only one of -the server or client functions. +the server or client functions. The function may not touch big_buffer. SERVER AUTHENTICATION diff --git a/src/src/auths/heimdal_gssapi.c b/src/src/auths/heimdal_gssapi.c index 3dfcb8c6a..523f7c69a 100644 --- a/src/src/auths/heimdal_gssapi.c +++ b/src/src/auths/heimdal_gssapi.c @@ -200,16 +200,6 @@ if (krc) krb5_free_context(context); -/* RFC 4121 section 5.2, SHOULD support 64K input buffers */ -if (big_buffer_size < (64 * 1024)) - { - uschar *newbuf; - big_buffer_size = 64 * 1024; - newbuf = store_malloc(big_buffer_size); - store_free(big_buffer); - big_buffer = newbuf; - } - ablock->server = TRUE; } diff --git a/src/src/macros.h b/src/src/macros.h index cc96c8516..c99b152d5 100644 --- a/src/src/macros.h +++ b/src/src/macros.h @@ -152,12 +152,19 @@ enough to hold all the headers from a normal kind of message. */ into big_buffer_size and in some circumstances increased. It should be at least as long as the maximum path length. */ -#if defined PATH_MAX && PATH_MAX > 16384 +#ifdef AUTH_HEIMDAL_GSSAPI + /* RFC 4121 section 5.2, SHOULD support 64K input buffers */ +# define __BIG_BUFFER_SIZE 65536 +#else +# define __BIG_BUFFER_SIZE 16384 +#endif + +#if defined PATH_MAX && PATH_MAX > __BIG_BUFFER_SIZE # define BIG_BUFFER_SIZE PATH_MAX -#elif defined MAXPATHLEN && MAXPATHLEN > 16384 +#elif defined MAXPATHLEN && MAXPATHLEN > __BIG_BUFFER_SIZE # define BIG_BUFFER_SIZE MAXPATHLEN #else -# define BIG_BUFFER_SIZE 16384 +# define BIG_BUFFER_SIZE __BIG_BUFFER_SIZE #endif /* header size of pipe content diff --git a/src/src/readconf.c b/src/src/readconf.c index 65dffe10a..05afb2464 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -3690,7 +3690,7 @@ driver_instance **p = anchor; driver_instance *d = NULL; uschar *buffer; -while ((buffer = get_config_line()) != NULL) +while ((buffer = get_config_line())) { uschar name[64]; uschar *s; @@ -3711,6 +3711,7 @@ while ((buffer = get_config_line()) != NULL) if (!d->driver_name) log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "no driver defined for %s \"%s\"", class, d->name); + /* s is using big_buffer, so this call had better not */ (d->info->init)(d); d = NULL; }