[exim-cvs] heimdal auth: fix the increase of big_buffer size…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] heimdal auth: fix the increase of big_buffer size. Bug 2501
Gitweb: https://git.exim.org/exim.git/commitdiff/7a66b3afa11a70021297c176acf56831692be89a
Commit:     7a66b3afa11a70021297c176acf56831692be89a
Parent:     ba5120a469a78ca316916e7be98c5fcb0ddd0d33
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Jan 14 17:48:57 2020 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Jan 14 17:48:57 2020 +0000


    heimdal auth: fix the increase of big_buffer size.  Bug 2501
---
 doc/doc-txt/ChangeLog          |  5 +++++
 src/src/auths/README           |  2 +-
 src/src/auths/heimdal_gssapi.c | 10 ----------
 src/src/macros.h               | 13 ++++++++++---
 src/src/readconf.c             |  3 ++-
 5 files changed, 18 insertions(+), 15 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 29059ff..a15e5b4 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 d4f125c..66bdcdc 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 3dfcb8c..523f7c6 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 cc96c85..c99b152 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 65dffe1..05afb24 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;
       }