View | Details | Raw Unified | Return to bug 246922
Collapse All | Expand All

(-)Makefile (-2 / +2 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	exim
4
PORTNAME=	exim
5
PORTVERSION?=	${EXIM_VERSION}
5
PORTVERSION?=	${EXIM_VERSION}
6
PORTREVISION?=	3
6
PORTREVISION?=	0
7
CATEGORIES=	mail
7
CATEGORIES=	mail
8
MASTER_SITES=	EXIM:exim
8
MASTER_SITES=	EXIM:exim
9
MASTER_SITE_SUBDIR=	/exim4/:exim \
9
MASTER_SITE_SUBDIR=	/exim4/:exim \
Lines 103-109 Link Here
103
EXTRA_PATCHES+=	${FILESDIR}/extra-patch-Local-sa-exim.conf
103
EXTRA_PATCHES+=	${FILESDIR}/extra-patch-Local-sa-exim.conf
104
.endif
104
.endif
105
105
106
EXIM_VERSION=	4.93.0.4
106
EXIM_VERSION=	4.94
107
SA_EXIM_VERSION=4.2.1
107
SA_EXIM_VERSION=4.2.1
108
EXIM_INSTALL_ARG+=	"-no_chown" "-no_symlink"
108
EXIM_INSTALL_ARG+=	"-no_chown" "-no_symlink"
109
EXTRA_PATCHES+=	`${FIND} ${PATCHDIR} -name '74_*.patch'|${SORT} -h`
109
EXTRA_PATCHES+=	`${FIND} ${PATCHDIR} -name '74_*.patch'|${SORT} -h`
(-)distinfo (-3 / +3 lines)
Lines 1-5 Link Here
1
TIMESTAMP = 1582564322
1
TIMESTAMP = 1591032067
2
SHA256 (exim/exim-4.93.0.4.tar.bz2) = b67336ba06f8d8233060de073d6082d75a378faaafad660c5f124bb13d75e4d9
2
SHA256 (exim/exim-4.94.tar.bz2) = 73feeaa5ddb43363782db0c307b593aacb49542dd7e4b795a2880779595affe5
3
SIZE (exim/exim-4.93.0.4.tar.bz2) = 1974190
3
SIZE (exim/exim-4.94.tar.bz2) = 1997217
4
SHA256 (exim/sa-exim-4.2.1.tar.gz) = 24d4bf7b0fdddaea11f132981cebb6a86a4ab20ef54111a8ebd481b421c6e2c1
4
SHA256 (exim/sa-exim-4.2.1.tar.gz) = 24d4bf7b0fdddaea11f132981cebb6a86a4ab20ef54111a8ebd481b421c6e2c1
5
SIZE (exim/sa-exim-4.2.1.tar.gz) = 68933
5
SIZE (exim/sa-exim-4.2.1.tar.gz) = 68933
(-)files/74_19-SPF-fix-result-for-case-of-only-non-spf-TXT-RRs.patch (-34 lines)
Lines 1-34 Link Here
1
From dfb8f72b2237627b26767d1e803e8ed95ad659d2 Mon Sep 17 00:00:00 2001
2
From: Wolfgang Breyha <wbreyha@gmx.net>
3
Date: Tue, 7 Jan 2020 13:03:18 +0000
4
Subject: [PATCH 19/21] SPF: fix result for case of only non-spf TXT RRs.  Bug
5
 2499
6
7
(cherry picked from commit 67794d2b830fc580f87b0635718d95e32b467be1)
8
---
9
 src/spf.c              |  7 ++++++-
10
 test/scripts/4600-SPF/4601 | 17 ++++++++---------
11
 test/stdout/4601           | 11 ++++++-----
12
 3 files changed, 20 insertions(+), 15 deletions(-)
13
14
diff --git src/spf.c src/spf.c
15
index 8ead817b9..12b756b46 100644
16
--- src/spf.c
17
+++ src/spf.c
18
@@ -139,7 +139,12 @@ for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr;
19
     srr.rr[found++] = (void *) s;
20
     }
21
 
22
-srr.num_rr = found;
23
+/* Did we filter out all TXT RRs? Return NO_DATA instead of SUCCESS with
24
+empty ANSWER section. */
25
+
26
+if (!(srr.num_rr = found))
27
+  srr.herrno = NO_DATA;
28
+
29
 /* spfrr->rr must have been malloc()d for this */
30
 SPF_dns_rr_dup(&spfrr, &srr);
31
 return spfrr;
32
-- 
33
2.24.1
34
(-)files/74_20-Fix-error-logging-for-dynamically-loaded-modules.patch (-70 lines)
Lines 1-70 Link Here
1
From 338f36842f10ef84e684dddf59819837fd7792a3 Mon Sep 17 00:00:00 2001
2
From: Jeremy Harris <jgh146exb@wizmail.org>
3
Date: Wed, 15 Jan 2020 10:40:20 +0000
4
Subject: [PATCH 20/21] Fix error logging for dynamically-loaded modules.  Bug
5
 2507
6
7
(cherry picked from commits b1c673ddfa, 3fc07bd570)
8
---
9
 doc/ChangeLog |  5 +++++
10
 src/drtables.c    | 13 +++++++------
11
 2 files changed, 12 insertions(+), 6 deletions(-)
12
13
diff --git doc/ChangeLog doc/ChangeLog
14
index 32febe1f3..6e26e2f11 100644
15
--- doc/ChangeLog
16
+++ doc/ChangeLog
17
@@ -49,6 +49,11 @@ JH/16 Fix the variables set by the gsasl authenticator.  Previously a pointer to
18
       library live data was being used, so the results became garbage.  Make
19
       copies while it is still usable.
20
 
21
+JH/19 Bug 2507: Modules: on handling a dynamic-module (lookups) open failure,
22
+      only retrieve the errormessage once.  Previously two calls to dlerror()
23
+      were used, and the second one (for mainlog/paniclog) retrieved null
24
+      information.
25
+
26
 
27
 Exim version 4.93
28
 -----------------
29
diff --git src/drtables.c src/drtables.c
30
index 059756284..ca051bd20 100644
31
--- src/drtables.c
32
+++ src/drtables.c
33
@@ -740,10 +740,11 @@ init_lookup_list(void)
34
 
35
         dl = dlopen(CS big_buffer, RTLD_NOW);// TJ was LAZY
36
         if (dl == NULL) {
37
-          fprintf(stderr, "Error loading %s: %s\n", name, dlerror());
38
-          moduleerrors++;
39
-          log_write(0, LOG_MAIN|LOG_PANIC, "Error loading lookup module %s: %s\n", name, dlerror());
40
-          continue;
41
+	  errormessage = dlerror();
42
+	  fprintf(stderr, "Error loading %s: %s\n", name, errormessage);
43
+	  log_write(0, LOG_MAIN|LOG_PANIC, "Error loading lookup module %s: %s\n", name, errormessage);
44
+	  moduleerrors++;
45
+	  continue;
46
         }
47
 
48
         /* FreeBSD nsdispatch() can trigger dlerror() errors about
49
@@ -756,16 +757,16 @@ init_lookup_list(void)
50
         info = (struct lookup_module_info*) dlsym(dl, "_lookup_module_info");
51
         if ((errormsg = dlerror()) != NULL) {
52
           fprintf(stderr, "%s does not appear to be a lookup module (%s)\n", name, errormsg);
53
+          log_write(0, LOG_MAIN|LOG_PANIC, "%s does not appear to be a lookup module (%s)\n", name, errormsg);
54
           dlclose(dl);
55
           moduleerrors++;
56
-          log_write(0, LOG_MAIN|LOG_PANIC, "%s does not appear to be a lookup module (%s)\n", name, errormsg);
57
           continue;
58
         }
59
         if (info->magic != LOOKUP_MODULE_INFO_MAGIC) {
60
           fprintf(stderr, "Lookup module %s is not compatible with this version of Exim\n", name);
61
+          log_write(0, LOG_MAIN|LOG_PANIC, "Lookup module %s is not compatible with this version of Exim\n", name);
62
           dlclose(dl);
63
           moduleerrors++;
64
-          log_write(0, LOG_MAIN|LOG_PANIC, "Lookup module %s is not compatible with this version of Exim\n", name);
65
           continue;
66
         }
67
 
68
-- 
69
2.24.1
70
(-)files/74_21-heimdal-auth-fix-the-increase-of-big_buffer-size.patch (-116 lines)
Lines 1-116 Link Here
1
From bbeab68df3b3c2d5507b1fdca07509fdbb3ec5a1 Mon Sep 17 00:00:00 2001
2
From: Jeremy Harris <jgh146exb@wizmail.org>
3
Date: Tue, 14 Jan 2020 17:48:57 +0000
4
Subject: [PATCH 21/21] heimdal auth: fix the increase of big_buffer size.  Bug
5
 2501
6
7
(cherry picked from commit 7a66b3afa11a70021297c176acf56831692be89a)
8
---
9
 doc/ChangeLog          |  7 ++++++-
10
 src/auths/README           |  2 +-
11
 src/auths/heimdal_gssapi.c | 10 ----------
12
 src/macros.h               | 13 ++++++++++---
13
 src/readconf.c             |  1 +
14
 5 files changed, 18 insertions(+), 15 deletions(-)
15
16
diff --git doc/ChangeLog doc/ChangeLog
17
index 6e26e2f11..f112fc9bf 100644
18
--- doc/ChangeLog
19
+++ doc/ChangeLog
20
@@ -9,7 +9,7 @@ This is not an official release. It is just a branch, collecting
21
 proposed bugfixes. Depending on your environment the fixes may be
22
 necessary to build and/or run Exim successfully.
23
 
24
-JH/05 Regard command-line receipients as tainted.
25
+JH/05 Regard command-line recipients as tainted.
26
 
27
 JH/07 Bug 2489: Fix crash in the "pam" expansion condition.  It seems that the
28
       PAM library frees one of the arguments given to it, despite the
29
@@ -54,6 +54,11 @@ JH/19 Bug 2507: Modules: on handling a dynamic-module (lookups) open failure,
30
       were used, and the second one (for mainlog/paniclog) retrieved null
31
       information.
32
 
33
+JH/21 Bug 2501: Fix init call in the heimdal authenticator.  Previously it
34
+      adjusted the size of a major service buffer; this failed because the
35
+      buffer was in use at the time.  Change to a compile-time increase in the
36
+      buffer size, when this authenticator is compiled into exim.
37
+
38
 
39
 Exim version 4.93
40
 -----------------
41
diff --git src/auths/README src/auths/README
42
index d4f125c30..66bdcdcf8 100644
43
--- src/auths/README
44
+++ src/auths/README
45
@@ -34,7 +34,7 @@ instance block for this configured mechanism. It must set the flags called
46
 the server and/or client functions are available for this authenticator.
47
 Typically this depends on whether server or client configuration options have
48
 been set, but it is also possible to have an authenticator that has only one of
49
-the server or client functions.
50
+the server or client functions.  The function may not touch big_buffer.
51
 
52
 SERVER AUTHENTICATION
53
 
54
diff --git src/auths/heimdal_gssapi.c src/auths/heimdal_gssapi.c
55
index 3dfcb8c6a..523f7c69a 100644
56
--- src/auths/heimdal_gssapi.c
57
+++ src/auths/heimdal_gssapi.c
58
@@ -200,16 +200,6 @@ if (krc)
59
 
60
 krb5_free_context(context);
61
 
62
-/* RFC 4121 section 5.2, SHOULD support 64K input buffers */
63
-if (big_buffer_size < (64 * 1024))
64
-  {
65
-  uschar *newbuf;
66
-  big_buffer_size = 64 * 1024;
67
-  newbuf = store_malloc(big_buffer_size);
68
-  store_free(big_buffer);
69
-  big_buffer = newbuf;
70
-  }
71
-
72
 ablock->server = TRUE;
73
 }
74
 
75
diff --git src/macros.h src/macros.h
76
index 76913d64e..4e6b1b8a9 100644
77
--- src/macros.h
78
+++ src/macros.h
79
@@ -152,12 +152,19 @@ enough to hold all the headers from a normal kind of message. */
80
 into big_buffer_size and in some circumstances increased. It should be at least
81
 as long as the maximum path length. */
82
 
83
-#if defined PATH_MAX && PATH_MAX > 16384
84
+#ifdef AUTH_HEIMDAL_GSSAPI
85
+		/* RFC 4121 section 5.2, SHOULD support 64K input buffers */
86
+# define __BIG_BUFFER_SIZE 65536
87
+#else
88
+# define __BIG_BUFFER_SIZE 16384
89
+#endif
90
+
91
+#if defined PATH_MAX && PATH_MAX > __BIG_BUFFER_SIZE
92
 # define BIG_BUFFER_SIZE PATH_MAX
93
-#elif defined MAXPATHLEN && MAXPATHLEN > 16384
94
+#elif defined MAXPATHLEN && MAXPATHLEN > __BIG_BUFFER_SIZE
95
 # define BIG_BUFFER_SIZE MAXPATHLEN
96
 #else
97
-# define BIG_BUFFER_SIZE 16384
98
+# define BIG_BUFFER_SIZE __BIG_BUFFER_SIZE
99
 #endif
100
 
101
 /* header size of pipe content
102
diff --git src/readconf.c src/readconf.c
103
index 0233019cf..62cfcfbf9 100644
104
--- src/readconf.c
105
+++ src/readconf.c
106
@@ -3788,6 +3788,7 @@ while ((buffer = get_config_line()) != NULL)
107
       if (!d->driver_name)
108
         log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
109
           "no driver defined for %s \"%s\"", class, d->name);
110
+      /* s is using big_buffer, so this call had better not */
111
       (d->info->init)(d);
112
       d = NULL;
113
       }
114
-- 
115
2.24.1
116
(-)files/74_22-Taint-hybrid-checking-mode.patch (-330 lines)
Lines 1-330 Link Here
1
From 1ccd26e24267ffa0c40b70c2c3282481fe4977c7 Mon Sep 17 00:00:00 2001
2
From: Jeremy Harris <jgh146exb@wizmail.org>
3
Date: Thu, 16 Jan 2020 14:12:56 +0000
4
Subject: [PATCH 22/22] Taint: hybrid checking mode
5
6
(cherry picked from commit 36eb5d3d77426d8cbf4243ea752f8d8cd1d5c682)
7
---
8
 doc/ChangeLog         |  8 +++++
9
 exim_monitor/em_version.c |  2 ++
10
 src/functions.h           | 58 +++++++++++++++++++++++++++++++-
11
 src/globals.c             |  1 +
12
 src/globals.h             |  1 +
13
 src/mytypes.h             | 62 +++++------------------------------
14
 src/store.c               | 40 +++++++++++++++-------
15
 7 files changed, 107 insertions(+), 65 deletions(-)
16
17
diff --git doc/ChangeLog doc/ChangeLog
18
index f112fc9bf..508b8fa49 100644
19
--- doc/ChangeLog
20
+++ doc/ChangeLog
21
@@ -59,6 +59,14 @@ JH/21 Bug 2501: Fix init call in the heimdal authenticator.  Previously it
22
       buffer was in use at the time.  Change to a compile-time increase in the
23
       buffer size, when this authenticator is compiled into exim.
24
 
25
+JH/22 Taint checking: move to a hybrid approach for checking.  Previously, one
26
+      of two ways was used, depending on a build-time flag.  The fast method
27
+      relied on assumptions about the OS and libc malloc, which were known to
28
+      not hold for the BSD-derived platforms, and discovered to not hold for
29
+      32-bit Linux either.  In fact the glibc documentation describes cases
30
+      where these assumptions do not hold.  The new implementation tests for
31
+      the situation arising and actively switches over from fast to safe mode.
32
+
33
 
34
 Exim version 4.93
35
 -----------------
36
diff --git exim_monitor/em_version.c exim_monitor/em_version.c
37
index 52c55a4a3..9b9c7d417 100644
38
--- exim_monitor/em_version.c
39
+++ exim_monitor/em_version.c
40
@@ -5,6 +5,8 @@
41
 /* Copyright (c) University of Cambridge 1995 - 2018 */
42
 /* See the file NOTICE for conditions of use and distribution. */
43
 
44
+#define EM_VERSION_C
45
+
46
 #include "mytypes.h"
47
 #include "store.h"
48
 #include "macros.h"
49
diff --git src/functions.h src/functions.h
50
index 87d1a04d8..0b5905562 100644
51
--- src/functions.h
52
+++ src/functions.h
53
@@ -187,6 +187,7 @@ extern void    deliver_succeeded(address_item *);
54
 extern uschar *deliver_get_sender_address (uschar *id);
55
 extern void    delivery_re_exec(int);
56
 
57
+extern void    die_tainted(const uschar *, const uschar *, int);
58
 extern BOOL    directory_make(const uschar *, const uschar *, int, BOOL);
59
 #ifndef DISABLE_DKIM
60
 extern uschar *dkim_exim_query_dns_txt(const uschar *);
61
@@ -602,6 +603,61 @@ extern BOOL    write_chunk(transport_ctx *, uschar *, int);
62
 extern ssize_t write_to_fd_buf(int, const uschar *, size_t);
63
 
64
 
65
+/******************************************************************************/
66
+/* Predicate: if an address is in a tainted pool.
67
+By extension, a variable pointing to this address is tainted.
68
+*/
69
+
70
+static inline BOOL
71
+is_tainted(const void * p)
72
+{
73
+#if defined(COMPILE_UTILITY) || defined(MACRO_PREDEF) || defined(EM_VERSION_C)
74
+return FALSE;
75
+
76
+#else
77
+extern BOOL is_tainted_fn(const void *);
78
+extern void * tainted_base, * tainted_top;
79
+
80
+return f.taint_check_slow
81
+  ? is_tainted_fn(p) : p >= tainted_base && p < tainted_top;
82
+#endif
83
+}
84
+
85
+/******************************************************************************/
86
+/* String functions */
87
+static inline uschar * __Ustrcat(uschar * dst, const uschar * src, const char * func, int line)
88
+{
89
+#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
90
+if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrcat", CUS func, line);
91
+#endif
92
+return US strcat(CS dst, CCS src);
93
+}
94
+static inline uschar * __Ustrcpy(uschar * dst, const uschar * src, const char * func, int line)
95
+{
96
+#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
97
+if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrcpy", CUS func, line);
98
+#endif
99
+return US strcpy(CS dst, CCS src);
100
+}
101
+static inline uschar * __Ustrncat(uschar * dst, const uschar * src, size_t n, const char * func, int line)
102
+{
103
+#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
104
+if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrncat", CUS func, line);
105
+#endif
106
+return US strncat(CS dst, CCS src, n);
107
+}
108
+static inline uschar * __Ustrncpy(uschar * dst, const uschar * src, size_t n, const char * func, int line)
109
+{
110
+#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
111
+if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrncpy", CUS func, line);
112
+#endif
113
+return US strncpy(CS dst, CCS src, n);
114
+}
115
+/*XXX will likely need unchecked copy also */
116
+
117
+
118
+/******************************************************************************/
119
+
120
 #if !defined(MACRO_PREDEF) && !defined(COMPILE_UTILITY)
121
 /* exim_chown - in some NFSv4 setups *seemes* to be an issue with
122
 chown(<exim-uid>, <exim-gid>).
123
@@ -634,8 +690,8 @@ exim_chown(const uschar *name, uid_t owner, gid_t group)
124
 return chown(CCS name, owner, group)
125
   ? exim_chown_failure(-1, name, owner, group) : 0;
126
 }
127
-
128
 #endif	/* !MACRO_PREDEF && !COMPILE_UTILITY */
129
+
130
 /******************************************************************************/
131
 /* String functions */
132
 
133
diff --git src/globals.c src/globals.c
134
index 85a25a7f2..72449229e 100644
135
--- src/globals.c
136
+++ src/globals.c
137
@@ -311,6 +311,7 @@ struct global_flags f =
138
 	.synchronous_delivery   = FALSE,
139
 	.system_filtering       = FALSE,
140
 
141
+	.taint_check_slow       = FALSE,
142
 	.tcp_fastopen_ok        = FALSE,
143
 	.tcp_in_fastopen        = FALSE,
144
 	.tcp_in_fastopen_data   = FALSE,
145
diff --git src/globals.h src/globals.h
146
index ca342acc2..ac7bb8ef3 100644
147
--- src/globals.h
148
+++ src/globals.h
149
@@ -272,6 +272,7 @@ extern struct global_flags {
150
  BOOL   synchronous_delivery		:1; /* TRUE if -odi is set */
151
  BOOL   system_filtering		:1; /* TRUE when running system filter */
152
 
153
+ BOOL   taint_check_slow		:1; /* malloc/mmap are not returning distinct ranges */
154
  BOOL   tcp_fastopen_ok			:1; /* appears to be supported by kernel */
155
  BOOL   tcp_in_fastopen			:1; /* conn usefully used fastopen */
156
  BOOL   tcp_in_fastopen_data		:1; /* fastopen carried data */
157
diff --git src/mytypes.h src/mytypes.h
158
index ceb9f1b55..e31ee8c1a 100644
159
--- src/mytypes.h
160
+++ src/mytypes.h
161
@@ -100,19 +100,15 @@ functions that are called quite often; for other calls to external libraries
162
 #define Uread(f,b,l)       read(f,CS(b),l)
163
 #define Urename(s,t)       rename(CCS(s),CCS(t))
164
 #define Ustat(s,t)         stat(CCS(s),t)
165
-#define Ustrcat(s,t)       __Ustrcat(s, CUS(t), __FUNCTION__, __LINE__)
166
 #define Ustrchr(s,n)       US strchr(CCS(s),n)
167
 #define CUstrchr(s,n)      CUS strchr(CCS(s),n)
168
 #define CUstrerror(n)      CUS strerror(n)
169
 #define Ustrcmp(s,t)       strcmp(CCS(s),CCS(t))
170
-#define Ustrcpy(s,t)       __Ustrcpy(s, CUS(t), __FUNCTION__, __LINE__)
171
 #define Ustrcpy_nt(s,t)    strcpy(CS s, CCS t)		/* no taint check */
172
 #define Ustrcspn(s,t)      strcspn(CCS(s),CCS(t))
173
 #define Ustrftime(s,m,f,t) strftime(CS(s),m,f,t)
174
 #define Ustrlen(s)         (int)strlen(CCS(s))
175
-#define Ustrncat(s,t,n)    __Ustrncat(s, CUS(t),n, __FUNCTION__, __LINE__)
176
 #define Ustrncmp(s,t,n)    strncmp(CCS(s),CCS(t),n)
177
-#define Ustrncpy(s,t,n)    __Ustrncpy(s, CUS(t),n, __FUNCTION__, __LINE__)
178
 #define Ustrncpy_nt(s,t,n) strncpy(CS s, CCS t, n)	/* no taint check */
179
 #define Ustrpbrk(s,t)      strpbrk(CCS(s),CCS(t))
180
 #define Ustrrchr(s,n)      US strrchr(CCS(s),n)
181
@@ -125,57 +121,17 @@ functions that are called quite often; for other calls to external libraries
182
 #define Ustrtoul(s,t,b)    strtoul(CCS(s),CSS(t),b)
183
 #define Uunlink(s)         unlink(CCS(s))
184
 
185
-extern void die_tainted(const uschar *, const uschar *, int);
186
-
187
-/* Predicate: if an address is in a tainted pool.
188
-By extension, a variable pointing to this address is tainted.
189
-*/
190
-
191
-static inline BOOL
192
-is_tainted(const void * p)
193
-{
194
-#if defined(COMPILE_UTILITY) || defined(MACRO_PREDEF)
195
-return FALSE;
196
-
197
-#elif defined(TAINT_CHECK_SLOW)
198
-extern BOOL is_tainted_fn(const void *);
199
-return is_tainted_fn(p);
200
-
201
+#ifdef EM_VERSION_C
202
+# define Ustrcat(s,t)       strcat(CS(s), CCS(t))
203
+# define Ustrcpy(s,t)       strcpy(CS(s), CCS(t))
204
+# define Ustrncat(s,t,n)    strncat(CS(s), CCS(t), n)
205
+# define Ustrncpy(s,t,n)    strncpy(CS(s), CCS(t), n)
206
 #else
207
-extern void * tainted_base, * tainted_top;
208
-return p >= tainted_base && p < tainted_top;
209
-#endif
210
-}
211
-
212
-static inline uschar * __Ustrcat(uschar * dst, const uschar * src, const char * func, int line)
213
-{
214
-#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
215
-if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrcat", CUS func, line);
216
-#endif
217
-return US strcat(CS dst, CCS src);
218
-}
219
-static inline uschar * __Ustrcpy(uschar * dst, const uschar * src, const char * func, int line)
220
-{
221
-#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
222
-if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrcpy", CUS func, line);
223
-#endif
224
-return US strcpy(CS dst, CCS src);
225
-}
226
-static inline uschar * __Ustrncat(uschar * dst, const uschar * src, size_t n, const char * func, int line)
227
-{
228
-#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
229
-if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrncat", CUS func, line);
230
-#endif
231
-return US strncat(CS dst, CCS src, n);
232
-}
233
-static inline uschar * __Ustrncpy(uschar * dst, const uschar * src, size_t n, const char * func, int line)
234
-{
235
-#if !defined(COMPILE_UTILITY) && !defined(MACRO_PREDEF)
236
-if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrncpy", CUS func, line);
237
+# define Ustrcat(s,t)       __Ustrcat(s, CUS(t), __FUNCTION__, __LINE__)
238
+# define Ustrcpy(s,t)       __Ustrcpy(s, CUS(t), __FUNCTION__, __LINE__)
239
+# define Ustrncat(s,t,n)    __Ustrncat(s, CUS(t), n, __FUNCTION__, __LINE__)
240
+# define Ustrncpy(s,t,n)    __Ustrncpy(s, CUS(t), n, __FUNCTION__, __LINE__)
241
 #endif
242
-return US strncpy(CS dst, CCS src, n);
243
-}
244
-/*XXX will likely need unchecked copy also */
245
 
246
 #endif
247
 /* End of mytypes.h */
248
diff --git src/store.c src/store.c
249
index a06e1c19a..692a993e9 100644
250
--- src/store.c
251
+++ src/store.c
252
@@ -162,8 +162,14 @@ static void   internal_tainted_free(storeblock *, const char *, int linenumber);
253
 
254
 /******************************************************************************/
255
 
256
-/* Slower version check, for use when platform intermixes malloc and mmap area
257
-addresses. */
258
+/* Test if a pointer refers to tainted memory.
259
+
260
+Slower version check, for use when platform intermixes malloc and mmap area
261
+addresses. Test against the current-block of all tainted pools first, then all
262
+blocks of all tainted pools.
263
+
264
+Return: TRUE iff tainted
265
+*/
266
 
267
 BOOL
268
 is_tainted_fn(const void * p)
269
@@ -171,23 +177,20 @@ is_tainted_fn(const void * p)
270
 storeblock * b;
271
 int pool;
272
 
273
-for (pool = 0; pool < nelem(chainbase); pool++)
274
+for (pool = POOL_TAINT_BASE; pool < nelem(chainbase); pool++)
275
   if ((b = current_block[pool]))
276
     {
277
-    char * bc = CS b + ALIGNED_SIZEOF_STOREBLOCK;
278
-    if (CS p >= bc && CS p <= bc + b->length) goto hit;
279
+    uschar * bc = US b + ALIGNED_SIZEOF_STOREBLOCK;
280
+    if (US p >= bc && US p <= bc + b->length) return TRUE;
281
     }
282
 
283
-for (pool = 0; pool < nelem(chainbase); pool++)
284
+for (pool = POOL_TAINT_BASE; pool < nelem(chainbase); pool++)
285
   for (b = chainbase[pool]; b; b = b->next)
286
     {
287
-    char * bc = CS b + ALIGNED_SIZEOF_STOREBLOCK;
288
-    if (CS p >= bc && CS p <= bc + b->length) goto hit;
289
+    uschar * bc = US b + ALIGNED_SIZEOF_STOREBLOCK;
290
+    if (US p >= bc && US p <= bc + b->length) return TRUE;
291
     }
292
 return FALSE;
293
-
294
-hit:
295
-return pool >= POOL_TAINT_BASE;
296
 }
297
 
298
 
299
@@ -198,6 +201,13 @@ log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Taint mismatch, %s: %s %d\n",
300
 	msg, func, line);
301
 }
302
 
303
+static void
304
+use_slow_taint_check(void)
305
+{
306
+DEBUG(D_any) debug_printf("switching to slow-mode taint checking\n");
307
+f.taint_check_slow = TRUE;
308
+}
309
+
310
 
311
 /*************************************************
312
 *       Get a block from the current pool        *
313
@@ -820,6 +830,14 @@ if (!(yield = malloc((size_t)size)))
314
   log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to malloc %d bytes of memory: "
315
     "called from line %d in %s", size, linenumber, func);
316
 
317
+/* If malloc ever returns apparently tainted memory, which glibc
318
+malloc will as it uses mmap for larger requests, we must switch to
319
+the slower checking for tainting (checking an address against all
320
+the tainted pool block spans, rather than just the mmap span) */
321
+
322
+if (!f.taint_check_slow && is_tainted(yield))
323
+  use_slow_taint_check();
324
+
325
 return store_alloc_tail(yield, size, func, linenumber, US"Malloc");
326
 }
327
 
328
-- 
329
2.24.1
330
(-)files/74_23-Fix-taint-hybrid-checking-on-BSD.patch (-83 lines)
Lines 1-83 Link Here
1
From ccf4e2396b27b519174aa79552e61d11aafbdc36 Mon Sep 17 00:00:00 2001
2
From: Jeremy Harris <jgh146exb@wizmail.org>
3
Date: Fri, 17 Jan 2020 21:55:11 +0000
4
Subject: [PATCH 23/23] Fix taint hybrid-checking on BSD
5
6
(cherry-picked from commit 677481d4fc)
7
Broken-by: 1ccd26e242
8
---
9
 src/store.c | 26 ++++++++++++++++++++++----
10
 1 file changed, 22 insertions(+), 4 deletions(-)
11
12
diff --git src/store.c src/store.c
13
index 692a993e9..6118ef28d 100644
14
--- src/store.c
15
+++ src/store.c
16
@@ -175,16 +175,15 @@ BOOL
17
 is_tainted_fn(const void * p)
18
 {
19
 storeblock * b;
20
-int pool;
21
 
22
-for (pool = POOL_TAINT_BASE; pool < nelem(chainbase); pool++)
23
+for (int pool = POOL_TAINT_BASE; pool < nelem(chainbase); pool++)
24
   if ((b = current_block[pool]))
25
     {
26
     uschar * bc = US b + ALIGNED_SIZEOF_STOREBLOCK;
27
     if (US p >= bc && US p <= bc + b->length) return TRUE;
28
     }
29
 
30
-for (pool = POOL_TAINT_BASE; pool < nelem(chainbase); pool++)
31
+for (int pool = POOL_TAINT_BASE; pool < nelem(chainbase); pool++)
32
   for (b = chainbase[pool]; b; b = b->next)
33
     {
34
     uschar * bc = US b + ALIGNED_SIZEOF_STOREBLOCK;
35
@@ -204,10 +203,28 @@ log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Taint mismatch, %s: %s %d\n",
36
 static void
37
 use_slow_taint_check(void)
38
 {
39
+#ifndef COMPILE_UTILITY
40
 DEBUG(D_any) debug_printf("switching to slow-mode taint checking\n");
41
+#endif
42
 f.taint_check_slow = TRUE;
43
 }
44
 
45
+static void
46
+verify_all_untainted(void)
47
+{
48
+for (int pool = 0; pool < POOL_TAINT_BASE; pool++)
49
+  for (storeblock * b = chainbase[pool]; b; b = b->next)
50
+    {
51
+    uschar * bc = US b + ALIGNED_SIZEOF_STOREBLOCK;
52
+    if (is_tainted(bc))
53
+      {
54
+      use_slow_taint_check();
55
+      return;
56
+      }
57
+    }
58
+}
59
+
60
+
61
 
62
 /*************************************************
63
 *       Get a block from the current pool        *
64
@@ -740,7 +757,7 @@ int pool = tainted ? store_pool + POOL_TAINT_BASE : store_pool;
65
 BOOL release_ok = !tainted && store_last_get[pool] == block;
66
 uschar * newtext;
67
 
68
-#ifndef MACRO_PREDEF
69
+#if !defined(MACRO_PREDEF) && !defined(COMPILE_UTILITY)
70
 if (is_tainted(block) != tainted)
71
   die_tainted(US"store_newblock", CUS func, linenumber);
72
 #endif
73
@@ -799,6 +816,7 @@ if (!(yield = mmap(NULL, (size_t)size,
74
 
75
 if (yield < tainted_base) tainted_base = yield;
76
 if ((top = US yield + size) > tainted_top) tainted_top = top;
77
+if (!f.taint_check_slow) use_slow_taint_check();
78
 
79
 return store_alloc_tail(yield, size, func, line, US"Mmap");
80
 }
81
-- 
82
2.24.1
83
(-)files/74_24-TFO-even-in-binary-built-for-modern-Linux-handle-err.patch (-70 lines)
Lines 1-70 Link Here
1
From 4ce411ffa737df738e18e1e7b008ad3d3ac5c398 Mon Sep 17 00:00:00 2001
2
From: Brian Foley <bpfoley@google.com>
3
Date: Sat, 25 Jan 2020 15:27:49 +0000
4
Subject: [PATCH 24/25] TFO: even in binary built for modern Linux, handle
5
 error returned by old Linux kernel.  Bug 2518
6
7
(cherry picked from commit c3da38a12a2372a7f6a48be97ebfd80aeceda828)
8
---
9
 src/ip.c | 40 +++++++++++++++++++++++-----------------
10
 1 file changed, 23 insertions(+), 17 deletions(-)
11
12
diff --git src/ip.c src/ip.c
13
index 70e3e2064..43ca6a1c9 100644
14
--- src/ip.c
15
+++ src/ip.c
16
@@ -269,28 +269,34 @@ if (fastopen_blob && f.tcp_fastopen_ok)
17
     /*XXX also seen on successful TFO, sigh */
18
     tcp_out_fastopen = fastopen_blob->len > 0 ?  TFO_ATTEMPTED_DATA : TFO_ATTEMPTED_NODATA;
19
     }
20
-  else if (errno == EINPROGRESS)	/* expected if we had no cookie for peer */
21
+  else switch (errno)
22
+    {
23
+    case EINPROGRESS:	/* expected if we had no cookie for peer */
24
 	/* seen for no-data, proper TFO option, both cookie-request and with-cookie cases */
25
 	/*  apparently no visibility of the diffference at this point */
26
 	/* seen for with-data, proper TFO opt, cookie-req */
27
 	/*   with netwk delay, post-conn tcp_info sees unacked 1 for R, 2 for C; code in smtp_out.c */
28
 	/* ? older Experimental TFO option behaviour ? */
29
-    {					/* queue unsent data */
30
-    DEBUG(D_transport|D_v) debug_printf(" TFO mode sendto, %s data: EINPROGRESS\n",
31
-      fastopen_blob->len > 0 ? "with"  : "no");
32
-    if (!fastopen_blob->data)
33
-      {
34
-      tcp_out_fastopen = TFO_ATTEMPTED_NODATA;		/* we tried; unknown if useful yet */
35
-      rc = 0;
36
-      }
37
-    else
38
-      rc = send(sock, fastopen_blob->data, fastopen_blob->len, 0);
39
-    }
40
-  else if(errno == EOPNOTSUPP)
41
-    {
42
-    DEBUG(D_transport)
43
-      debug_printf("Tried TCP Fast Open but apparently not enabled by sysctl\n");
44
-    goto legacy_connect;
45
+      DEBUG(D_transport|D_v) debug_printf(" TFO mode sendto, %s data: EINPROGRESS\n",
46
+	fastopen_blob->len > 0 ? "with"  : "no");
47
+      if (!fastopen_blob->data)
48
+	{
49
+	tcp_out_fastopen = TFO_ATTEMPTED_NODATA;		/* we tried; unknown if useful yet */
50
+	rc = 0;
51
+	}
52
+      else					/* queue unsent data */
53
+	rc = send(sock, fastopen_blob->data, fastopen_blob->len, 0);
54
+      break;
55
+
56
+    case EOPNOTSUPP:
57
+      DEBUG(D_transport)
58
+	debug_printf("Tried TCP Fast Open but apparently not enabled by sysctl\n");
59
+      goto legacy_connect;
60
+
61
+    case EPIPE:
62
+      DEBUG(D_transport)
63
+	debug_printf("Tried TCP Fast Open but kernel too old to support it\n");
64
+      goto legacy_connect;
65
     }
66
 # endif
67
 # ifdef EXIM_TFO_CONNECTX
68
-- 
69
2.24.1
70
(-)files/74_25-Taint-slow-mode-checking-only.patch (-127 lines)
Lines 1-127 Link Here
1
From 69b2f92c0b5da548eaafe4813319f4647fa9c19a Mon Sep 17 00:00:00 2001
2
From: Jeremy Harris <jgh146exb@wizmail.org>
3
Date: Thu, 30 Jan 2020 11:38:30 +0000
4
Subject: [PATCH 25/25] Taint: slow-mode checking only
5
6
(cherry-picked from 4381d60bc9)
7
---
8
 doc/ChangeLog | 10 +++-------
9
 src/functions.h   |  5 +----
10
 src/store.c       | 43 -------------------------------------------
11
 3 files changed, 4 insertions(+), 54 deletions(-)
12
13
diff --git doc/ChangeLog doc/ChangeLog
14
index 508b8fa49..be7ec2a8e 100644
15
--- doc/ChangeLog
16
+++ doc/ChangeLog
17
@@ -59,13 +59,9 @@ JH/21 Bug 2501: Fix init call in the heimdal authenticator.  Previously it
18
       buffer was in use at the time.  Change to a compile-time increase in the
19
       buffer size, when this authenticator is compiled into exim.
20
 
21
-JH/22 Taint checking: move to a hybrid approach for checking.  Previously, one
22
-      of two ways was used, depending on a build-time flag.  The fast method
23
-      relied on assumptions about the OS and libc malloc, which were known to
24
-      not hold for the BSD-derived platforms, and discovered to not hold for
25
-      32-bit Linux either.  In fact the glibc documentation describes cases
26
-      where these assumptions do not hold.  The new implementation tests for
27
-      the situation arising and actively switches over from fast to safe mode.
28
+JH/22 Taint-checking: move to safe-mode taint checking on all platforms.  The
29
+      previous fast-mode was untenable in the face of glibs using mmap to
30
+      support larger malloc requests.
31
 
32
 
33
 Exim version 4.93
34
diff --git src/functions.h src/functions.h
35
index 0b5905562..af633851b 100644
36
--- src/functions.h
37
+++ src/functions.h
38
@@ -616,10 +616,7 @@ return FALSE;
39
 
40
 #else
41
 extern BOOL is_tainted_fn(const void *);
42
-extern void * tainted_base, * tainted_top;
43
-
44
-return f.taint_check_slow
45
-  ? is_tainted_fn(p) : p >= tainted_base && p < tainted_top;
46
+return is_tainted_fn(p);
47
 #endif
48
 }
49
 
50
diff --git src/store.c src/store.c
51
index 6118ef28d..c81744a7b 100644
52
--- src/store.c
53
+++ src/store.c
54
@@ -102,13 +102,6 @@ static storeblock *current_block[NPOOLS];
55
 static void *next_yield[NPOOLS];
56
 static int yield_length[NPOOLS] = { -1, -1, -1,  -1, -1, -1 };
57
 
58
-/* The limits of the tainted pools.  Tracking these on new allocations enables
59
-a fast is_tainted implementation. We assume the kernel only allocates mmaps using
60
-one side or the other of data+heap, not both. */
61
-
62
-void * tainted_base = (void *)-1;
63
-void * tainted_top = (void *)0;
64
-
65
 /* pool_malloc holds the amount of memory used by the store pools; this goes up
66
 and down as store is reset or released. nonpool_malloc is the total got by
67
 malloc from other calls; this doesn't go down because it is just freed by
68
@@ -200,30 +193,6 @@ log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Taint mismatch, %s: %s %d\n",
69
 	msg, func, line);
70
 }
71
 
72
-static void
73
-use_slow_taint_check(void)
74
-{
75
-#ifndef COMPILE_UTILITY
76
-DEBUG(D_any) debug_printf("switching to slow-mode taint checking\n");
77
-#endif
78
-f.taint_check_slow = TRUE;
79
-}
80
-
81
-static void
82
-verify_all_untainted(void)
83
-{
84
-for (int pool = 0; pool < POOL_TAINT_BASE; pool++)
85
-  for (storeblock * b = chainbase[pool]; b; b = b->next)
86
-    {
87
-    uschar * bc = US b + ALIGNED_SIZEOF_STOREBLOCK;
88
-    if (is_tainted(bc))
89
-      {
90
-      use_slow_taint_check();
91
-      return;
92
-      }
93
-    }
94
-}
95
-
96
 
97
 
98
 /*************************************************
99
@@ -814,10 +783,6 @@ if (!(yield = mmap(NULL, (size_t)size,
100
   log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to mmap %d bytes of memory: "
101
     "called from line %d of %s", size, line, func);
102
 
103
-if (yield < tainted_base) tainted_base = yield;
104
-if ((top = US yield + size) > tainted_top) tainted_top = top;
105
-if (!f.taint_check_slow) use_slow_taint_check();
106
-
107
 return store_alloc_tail(yield, size, func, line, US"Mmap");
108
 }
109
 
110
@@ -848,14 +813,6 @@ if (!(yield = malloc((size_t)size)))
111
   log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to malloc %d bytes of memory: "
112
     "called from line %d in %s", size, linenumber, func);
113
 
114
-/* If malloc ever returns apparently tainted memory, which glibc
115
-malloc will as it uses mmap for larger requests, we must switch to
116
-the slower checking for tainting (checking an address against all
117
-the tainted pool block spans, rather than just the mmap span) */
118
-
119
-if (!f.taint_check_slow && is_tainted(yield))
120
-  use_slow_taint_check();
121
-
122
 return store_alloc_tail(yield, size, func, linenumber, US"Malloc");
123
 }
124
 
125
-- 
126
2.24.1
127
(-)files/74_26-Auths-fix-cyrus-sasl-driver-for-gssapi-use.patch (-50 lines)
Lines 1-50 Link Here
1
From 59bcc75f56ffeb9fa220f1eb53d45bf254258ac7 Mon Sep 17 00:00:00 2001
2
From: Jeremy Harris <jgh146exb@wizmail.org>
3
Date: Thu, 13 Feb 2020 14:08:31 +0000
4
Subject: [PATCH 26/27] Auths: fix cyrus-sasl driver for gssapi use.  Bug 2524
5
6
Broken-by: c0fb53b74e
7
Cherry-picked from: 5c329a4388
8
---
9
 doc/ChangeLog      | 6 ++++++
10
 src/auths/cyrus_sasl.c | 6 +++---
11
 2 files changed, 9 insertions(+), 3 deletions(-)
12
13
diff --git doc/ChangeLog doc/ChangeLog
14
index be7ec2a8e..97fe878dc 100644
15
--- doc/ChangeLog
16
+++ doc/ChangeLog
17
@@ -63,6 +63,12 @@ JH/22 Taint-checking: move to safe-mode taint checking on all platforms.  The
18
       previous fast-mode was untenable in the face of glibs using mmap to
19
       support larger malloc requests.
20
 
21
+JH/24 Bug 2524: fix the cyrus_sasl auth driver gssapi usage.  A previous fix
22
+      had introduced a string-copy (for ensuring NUL-termination) which was not
23
+      appropriate for that case, which can include embedded NUL bytes in the
24
+      block of data.  Investigation showed the copy to actually be needless, the
25
+      data being length-specified.
26
+
27
 
28
 Exim version 4.93
29
 -----------------
30
diff --git src/auths/cyrus_sasl.c src/auths/cyrus_sasl.c
31
index 480010bab..19416a1bb 100644
32
--- src/auths/cyrus_sasl.c
33
+++ src/auths/cyrus_sasl.c
34
@@ -347,10 +347,10 @@ for (rc = SASL_CONTINUE; rc == SASL_CONTINUE; )
35
     }
36
   else
37
     {
38
-    /* make sure that we have a null-terminated string */
39
-    out2 = string_copyn(output, outlen);
40
+    /* auth_get_data() takes a length-specfied block of binary
41
+    which can include zeroes; no terminating NUL is needed */
42
 
43
-    if ((rc = auth_get_data(&input, out2, outlen)) != OK)
44
+    if ((rc = auth_get_data(&input, output, outlen)) != OK)
45
       {
46
       /* we couldn't get the data, so free up the library before
47
        * returning whatever error we get */
48
-- 
49
2.24.1
50
(-)files/74_27-GnuTLS-fix-hanging-callout-connections.patch (-70 lines)
Lines 1-70 Link Here
1
From 26b045604bd574a6d93868ed437c08503c67d289 Mon Sep 17 00:00:00 2001
2
From: Jeremy Harris <jgh146exb@wizmail.org>
3
Date: Thu, 13 Feb 2020 16:52:52 +0000
4
Subject: [PATCH 27/27] GnuTLS: fix hanging callout connections
5
6
Broken-by: 925ac8e4f1
7
Cherry-picked from: bd95ffc2ba
8
---
9
 doc/ChangeLog |  5 +++++
10
 src/tls-gnu.c     | 11 +++++++----
11
 2 files changed, 12 insertions(+), 4 deletions(-)
12
13
diff --git doc/ChangeLog doc/ChangeLog
14
index 97fe878dc..d9833c8e1 100644
15
--- doc/ChangeLog
16
+++ doc/ChangeLog
17
@@ -69,6 +69,11 @@ JH/24 Bug 2524: fix the cyrus_sasl auth driver gssapi usage.  A previous fix
18
       block of data.  Investigation showed the copy to actually be needless, the
19
       data being length-specified.
20
 
21
+JH/25 Fix use of concurrent TLS connections under GnuTLS.  When a callout was
22
+      done during a receiving connection, and both used TLS, global info was
23
+      used rather than per-connection info for tracking the state of data
24
+      queued for transmission.  This could result in a connection hang.
25
+
26
 
27
 Exim version 4.93
28
 -----------------
29
diff --git src/tls-gnu.c src/tls-gnu.c
30
index fc426a251..574dcafd9 100644
31
--- src/tls-gnu.c
32
+++ src/tls-gnu.c
33
@@ -181,6 +181,10 @@ typedef struct exim_gnutls_state {
34
   BOOL			peer_dane_verified;
35
   BOOL			trigger_sni_changes;
36
   BOOL			have_set_peerdn;
37
+#ifdef SUPPORT_CORK
38
+  BOOL			corked:1;
39
+#endif
40
+
41
   const struct host_item *host;		/* NULL if server */
42
   gnutls_x509_crt_t	peercert;
43
   uschar		*peerdn;
44
@@ -3309,9 +3313,8 @@ ssize_t outbytes;
45
 size_t left = len;
46
 exim_gnutls_state_st * state = ct_ctx ? ct_ctx : &state_server;
47
 #ifdef SUPPORT_CORK
48
-static BOOL corked = FALSE;
49
 
50
-if (more && !corked) gnutls_record_cork(state->session);
51
+if (more && !state->corked) gnutls_record_cork(state->session);
52
 #endif
53
 
54
 DEBUG(D_tls) debug_printf("%s(%p, " SIZE_T_FMT "%s)\n", __FUNCTION__,
55
@@ -3352,10 +3355,10 @@ if (len > INT_MAX)
56
   }
57
 
58
 #ifdef SUPPORT_CORK
59
-if (more != corked)
60
+if (more != state->corked)
61
   {
62
   if (!more) (void) gnutls_record_uncork(state->session, 0);
63
-  corked = more;
64
+  state->corked = more;
65
   }
66
 #endif
67
 
68
-- 
69
2.24.1
70
(-)files/patch-src-auths-call_radius.c (-38 / +38 lines)
Lines 1-6 Link Here
1
--- src/auths/call_radius.c.orig	2019-12-08 12:53:48 UTC
1
--- src/auths/call_radius.c.orig	2020-05-30 22:35:38.000000000 +0200
2
+++ src/auths/call_radius.c
2
+++ src/auths/call_radius.c	2020-06-01 19:54:14.402105000 +0200
3
@@ -112,37 +112,37 @@ rc_openlog("exim");
3
@@ -113,37 +113,37 @@
4
 
4
 
5
 #ifdef RADIUS_LIB_RADIUSCLIENT
5
 #ifdef RADIUS_LIB_RADIUSCLIENT
6
 if (rc_read_config(RADIUS_CONFIG_FILE) != 0)
6
 if (rc_read_config(RADIUS_CONFIG_FILE) != 0)
Lines 8-65 Link Here
8
+  *errptr = string_sprintf("%s", "RADIUS: can't open %s", RADIUS_CONFIG_FILE);
8
+  *errptr = string_sprintf("%s", "RADIUS: can't open %s", RADIUS_CONFIG_FILE);
9
 
9
 
10
 else if (rc_read_dictionary(rc_conf_str("dictionary")) != 0)
10
 else if (rc_read_dictionary(rc_conf_str("dictionary")) != 0)
11
-  *errptr = string_sprintf("RADIUS: can't read dictionary");
11
-  *errptr = US"RADIUS: can't read dictionary";
12
+  *errptr = string_sprintf("%s", "RADIUS: can't read dictionary");
12
+  *errptr = string_sprintf("%s", "RADIUS: can't read dictionary");
13
 
13
 
14
 else if (rc_avpair_add(&send, PW_USER_NAME, user, 0) == NULL)
14
 else if (!rc_avpair_add(&send, PW_USER_NAME, user, 0))
15
-  *errptr = string_sprintf("RADIUS: add user name failed\n");
15
-  *errptr = US"RADIUS: add user name failed";
16
+  *errptr = string_sprintf("%s", "RADIUS: add user name failed\n");
16
+  *errptr = string_sprintf("%s", "RADIUS: add user name failed\n");
17
 
17
 
18
 else if (rc_avpair_add(&send, PW_USER_PASSWORD, CS radius_args, 0) == NULL)
18
 else if (!rc_avpair_add(&send, PW_USER_PASSWORD, CS radius_args, 0))
19
-  *errptr = string_sprintf("RADIUS: add password failed\n");
19
-  *errptr = US"RADIUS: add password failed");
20
+  *errptr = string_sprintf("%s", "RADIUS: add password failed\n");
20
+  *errptr = string_sprintf("%s", "RADIUS: add password failed\n");
21
 
21
 
22
 else if (rc_avpair_add(&send, PW_SERVICE_TYPE, &service, 0) == NULL)
22
 else if (!rc_avpair_add(&send, PW_SERVICE_TYPE, &service, 0))
23
-  *errptr = string_sprintf("RADIUS: add service type failed\n");
23
-  *errptr = US"RADIUS: add service type failed";
24
+  *errptr = string_sprintf("%s", "RADIUS: add service type failed\n");
24
+  *errptr = string_sprintf("%s", "RADIUS: add service type failed\n");
25
 
25
 
26
 #else  /* RADIUS_LIB_RADIUSCLIENT unset => RADIUS_LIB_RADIUSCLIENT2 */
26
 #else  /* RADIUS_LIB_RADIUSCLIENT unset => RADIUS_LIB_RADIUSCLIENT2 */
27
 
27
 
28
 if ((h = rc_read_config(RADIUS_CONFIG_FILE)) == NULL)
28
 if (!(h = rc_read_config(RADIUS_CONFIG_FILE)))
29
-  *errptr = string_sprintf("RADIUS: can't open %s", RADIUS_CONFIG_FILE);
29
-  *errptr = string_sprintf("RADIUS: can't open %s", RADIUS_CONFIG_FILE);
30
+  *errptr = string_sprintf("%s", "RADIUS: can't open %s", RADIUS_CONFIG_FILE);
30
+  *errptr = string_sprintf("%s", "RADIUS: can't open %s", RADIUS_CONFIG_FILE);
31
 
31
 
32
 else if (rc_read_dictionary(h, rc_conf_str(h, "dictionary")) != 0)
32
 else if (rc_read_dictionary(h, rc_conf_str(h, "dictionary")) != 0)
33
-  *errptr = string_sprintf("RADIUS: can't read dictionary");
33
-  *errptr = US"RADIUS: can't read dictionary";
34
+  *errptr = string_sprintf("%s", "RADIUS: can't read dictionary");
34
+  *errptr = string_sprintf("%s", "RADIUS: can't read dictionary");
35
 
35
 
36
 else if (rc_avpair_add(h, &send, PW_USER_NAME, user, Ustrlen(user), 0) == NULL)
36
 else if (!rc_avpair_add(h, &send, PW_USER_NAME, user, Ustrlen(user), 0))
37
-  *errptr = string_sprintf("RADIUS: add user name failed\n");
37
-  *errptr = US"RADIUS: add user name failed";
38
+  *errptr = string_sprintf("%s", "RADIUS: add user name failed\n");
38
+  *errptr = string_sprintf("%s", "RADIUS: add user name failed\n");
39
 
39
 
40
 else if (rc_avpair_add(h, &send, PW_USER_PASSWORD, CS radius_args,
40
 else if (!rc_avpair_add(h, &send, PW_USER_PASSWORD, CS radius_args,
41
     Ustrlen(radius_args), 0) == NULL)
41
     Ustrlen(radius_args), 0))
42
-  *errptr = string_sprintf("RADIUS: add password failed\n");
42
-  *errptr = US"RADIUS: add password failed";
43
+  *errptr = string_sprintf("%s", "RADIUS: add password failed\n");
43
+  *errptr = string_sprintf("%s", "RADIUS: add password failed\n");
44
 
44
 
45
 else if (rc_avpair_add(h, &send, PW_SERVICE_TYPE, &service, 0, 0) == NULL)
45
 else if (!rc_avpair_add(h, &send, PW_SERVICE_TYPE, &service, 0, 0))
46
-  *errptr = string_sprintf("RADIUS: add service type failed\n");
46
-  *errptr = US"RADIUS: add service type failed";
47
+  *errptr = string_sprintf("%s", "RADIUS: add service type failed\n");
47
+  *errptr = string_sprintf("%s", "RADIUS: add service type failed\n");
48
 
48
 
49
 #endif  /* RADIUS_LIB_RADIUSCLIENT */
49
 #endif  /* RADIUS_LIB_RADIUSCLIENT */
50
 
50
 
51
@@ -175,7 +175,7 @@ switch (result)
51
@@ -176,7 +176,7 @@
52
 
52
 
53
   case BADRESP_RC:
53
   default:
54
   default:
54
   case BADRESP_RC:
55
-    *errptr = string_sprintf("RADIUS: unexpected response (%d)", result);
55
-  *errptr = string_sprintf("RADIUS: unexpected response (%d)", result);
56
+    *errptr = string_sprintf("%s", "RADIUS: unexpected response (%d)", result);
56
+  *errptr = string_sprintf("%s", "RADIUS: unexpected response (%d)", result);
57
     return ERROR;
57
   return ERROR;
58
   }
58
   }
59
 
59
 
60
@@ -186,7 +186,7 @@ switch (result)
60
@@ -186,7 +186,7 @@
61
 h = rad_auth_open();
61
 
62
 if (h == NULL)
62
 if (!(h = rad_auth_open()))
63
   {
63
   {
64
-  *errptr = string_sprintf("RADIUS: can't initialise libradius");
64
-  *errptr = string_sprintf("RADIUS: can't initialise libradius");
65
+  *errptr = string_sprintf("%s", "RADIUS: can't initialise libradius");
65
+  *errptr = string_sprintf("%s", "RADIUS: can't initialise libradius");
Lines 66-72 Link Here
66
   return ERROR;
66
   return ERROR;
67
   }
67
   }
68
 if (rad_config(h, RADIUS_CONFIG_FILE) != 0 ||
68
 if (rad_config(h, RADIUS_CONFIG_FILE) != 0 ||
69
@@ -196,7 +196,7 @@ if (rad_config(h, RADIUS_CONFIG_FILE) != 0 ||
69
@@ -196,7 +196,7 @@
70
     rad_put_int(h, RAD_SERVICE_TYPE, RAD_AUTHENTICATE_ONLY) != 0 ||
70
     rad_put_int(h, RAD_SERVICE_TYPE, RAD_AUTHENTICATE_ONLY) != 0 ||
71
     rad_put_string(h, RAD_NAS_IDENTIFIER, CS primary_hostname) != 0)
71
     rad_put_string(h, RAD_NAS_IDENTIFIER, CS primary_hostname) != 0)
72
   {
72
   {
Lines 75-92 Link Here
75
   result = ERROR;
75
   result = ERROR;
76
   }
76
   }
77
 else
77
 else
78
@@ -214,12 +214,12 @@ else
78
@@ -211,12 +211,12 @@
79
     break;
79
       break;
80
 
80
 
81
     case -1:
81
     case -1:
82
-    *errptr = string_sprintf("RADIUS: %s", rad_strerror(h));
82
-      *errptr = string_sprintf("RADIUS: %s", rad_strerror(h));
83
+    *errptr = string_sprintf("%s", "RADIUS: %s", rad_strerror(h));
83
+      *errptr = string_sprintf("%s", "RADIUS: %s", rad_strerror(h));
84
     result = ERROR;
84
       result = ERROR;
85
     break;
85
       break;
86
 
86
 
87
     default:
87
     default:
88
-    *errptr = string_sprintf("RADIUS: unexpected response (%d)", result);
88
-      *errptr = string_sprintf("RADIUS: unexpected response (%d)", result);
89
+    *errptr = string_sprintf("%s", "RADIUS: unexpected response (%d)", result);
89
+      *errptr = string_sprintf("%s", "RADIUS: unexpected response (%d)", result);
90
     result= ERROR;
90
       result= ERROR;
91
     break;
91
       break;
92
     }
92
     }

Return to bug 246922