aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--NEWS7
-rw-r--r--configure.ac2
-rw-r--r--src/bi_sieve.m42
-rw-r--r--src/bi_sprintf.m419
-rw-r--r--src/prog.c276
-rw-r--r--src/prog.h4
-rw-r--r--src/snarf.m470
8 files changed, 270 insertions, 120 deletions
diff --git a/ChangeLog b/ChangeLog
index 3602649b..5ab79460 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
12008-09-08 Sergey Poznyakoff <gray@gnu.org.ua>
2
3 * src/snarf.m4, src/bi_sprintf.m4, src/prog.h, src/bi_sieve.m4,
4 Ported r1655 from trunk.
5
6 * src/prog.c: Ported r1655 and r1660 from trunk.
7
8 * NEWS: Update, set version number 4.4.1.
9 * configure.ac: set version number 4.4.1.
10
12008-03-10 Sergey Poznyakoff <gray@gnu.org.ua> 112008-03-10 Sergey Poznyakoff <gray@gnu.org.ua>
2 12
3 * doc/mailfromd.texi: Spell check. Add missing acknowledgments. 13 * doc/mailfromd.texi: Spell check. Add missing acknowledgments.
diff --git a/NEWS b/NEWS
index 674dbae4..a212fcc2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,15 @@
1Mailfromd NEWS -- history of user-visible changes. 2008-03-10 1Mailfromd NEWS -- history of user-visible changes. 2008-09-09
2Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff 2Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff
3See the end of file for copying conditions. 3See the end of file for copying conditions.
4 4
5Please send mailfromd bug reports to <bug-mailfromd@gnu.org.ua> 5Please send mailfromd bug reports to <bug-mailfromd@gnu.org.ua>
6 6
7 7
8Version 4.4.1
9
10* Fix stack reallocation.
11
12
8Version 4.4, 2008-03-10 13Version 4.4, 2008-03-10
9 14
10* The --domain option is withdrawn. 15* The --domain option is withdrawn.
diff --git a/configure.ac b/configure.ac
index 5a146171..5a6e224c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@
17AC_PREREQ(2.59) 17AC_PREREQ(2.59)
18m4_define([MF_VERSION_MAJOR], 4) 18m4_define([MF_VERSION_MAJOR], 4)
19m4_define([MF_VERSION_MINOR], 4) 19m4_define([MF_VERSION_MINOR], 4)
20dnl m4_define([MF_VERSION_PATCH], 0) 20m4_define([MF_VERSION_PATCH], 1)
21AC_INIT([mailfromd], 21AC_INIT([mailfromd],
22 MF_VERSION_MAJOR.MF_VERSION_MINOR[]m4_ifdef([MF_VERSION_PATCH],.MF_VERSION_PATCH), 22 MF_VERSION_MAJOR.MF_VERSION_MINOR[]m4_ifdef([MF_VERSION_PATCH],.MF_VERSION_PATCH),
23 [bug-mailfromd@gnu.org.ua]) 23 [bug-mailfromd@gnu.org.ua])
diff --git a/src/bi_sieve.m4 b/src/bi_sieve.m4
index 04ae8f95..0c5af274 100644
--- a/src/bi_sieve.m4
+++ b/src/bi_sieve.m4
@@ -151,7 +151,7 @@ MF_DEFUN(sieve, NUMBER, STRING script, OPTIONAL, NUMBER dbg)
151 mu_sieve_set_logger(mach, _sieve_action_log); 151 mu_sieve_set_logger(mach, _sieve_action_log);
152 152
153 rc = mu_sieve_compile(mach, script); 153 rc = mu_sieve_compile(mach, script);
154 if (rc == 0){ 154 if (rc == 0) {
155 mu_stream_t mstr = env_get_stream(env); 155 mu_stream_t mstr = env_get_stream(env);
156 mu_attribute_t attr; 156 mu_attribute_t attr;
157 mu_message_t msg; 157 mu_message_t msg;
diff --git a/src/bi_sprintf.m4 b/src/bi_sprintf.m4
index afd63d32..051d2dc4 100644
--- a/src/bi_sprintf.m4
+++ b/src/bi_sprintf.m4
@@ -150,8 +150,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
150 if (isdigit(*p)) { 150 if (isdigit(*p)) {
151 char *q = get_num(p, &n); 151 char *q = get_num(p, &n);
152 if (*q == '$') { 152 if (*q == '$') {
153 num = (unsigned) MF_VA_ARG(n-1, 153 MF_VA_ARG(n-1, NUMBER, num);
154 NUMBER);
155 p = q + 1; 154 p = q + 1;
156 if (num < 0) { 155 if (num < 0) {
157 flags |= FMT_SPACEPFX; 156 flags |= FMT_SPACEPFX;
@@ -161,7 +160,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
161 break; 160 break;
162 } 161 }
163 } 162 }
164 num = MF_VA_ARG(i, NUMBER); 163 MF_VA_ARG(i, NUMBER, num);
165 i++; 164 i++;
166 if (num < 0) { 165 if (num < 0) {
167 /* A negative field width is taken 166 /* A negative field width is taken
@@ -193,14 +192,14 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
193 if (isdigit(*p)) { 192 if (isdigit(*p)) {
194 char *q = get_num(p, &n); 193 char *q = get_num(p, &n);
195 if (*q == '$') { 194 if (*q == '$') {
196 num = MF_VA_ARG(n-1, NUMBER); 195 MF_VA_ARG(n-1, NUMBER, num);
197 if (num > 0) 196 if (num > 0)
198 prec = (unsigned) num; 197 prec = (unsigned) num;
199 p = q + 1; 198 p = q + 1;
200 break; 199 break;
201 } 200 }
202 } 201 }
203 num = MF_VA_ARG(i, NUMBER); 202 MF_VA_ARG(i, NUMBER, num);
204 i++; 203 i++;
205 if (num > 0) 204 if (num > 0)
206 prec = (unsigned) num; 205 prec = (unsigned) num;
@@ -211,7 +210,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
211 argnum = i++; 210 argnum = i++;
212 switch (*p) { 211 switch (*p) {
213 case 's': 212 case 's':
214 str = MF_VA_ARG(argnum,STRING); 213 MF_VA_ARG(argnum, STRING, str);
215 n = strlen(str); 214 n = strlen(str);
216 if (prec && prec < n) 215 if (prec && prec < n)
217 n = prec; 216 n = prec;
@@ -235,7 +234,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
235 234
236 case 'i': 235 case 'i':
237 case 'd': 236 case 'd':
238 num = MF_VA_ARG(argnum,NUMBER); 237 MF_VA_ARG(argnum, NUMBER, num);
239 if (num < 0) { 238 if (num < 0) {
240 negative = 1; 239 negative = 1;
241 num = - num; 240 num = - num;
@@ -290,7 +289,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
290 break; 289 break;
291 290
292 case 'u': 291 case 'u':
293 num = MF_VA_ARG(argnum,NUMBER); 292 MF_VA_ARG(argnum, NUMBER, num);
294 /* If a precision is given with a 293 /* If a precision is given with a
295 numeric conversion, the 0 flag is ignored. 294 numeric conversion, the 0 flag is ignored.
296 */ 295 */
@@ -323,7 +322,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
323 322
324 case 'x': 323 case 'x':
325 case 'X': 324 case 'X':
326 num = MF_VA_ARG(argnum,NUMBER); 325 MF_VA_ARG(argnum, NUMBER, num);
327 /* If a precision is given with a 326 /* If a precision is given with a
328 numeric conversion, the 0 flag is ignored. 327 numeric conversion, the 0 flag is ignored.
329 */ 328 */
@@ -369,7 +368,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
369 break; 368 break;
370 369
371 case 'o': 370 case 'o':
372 num = MF_VA_ARG(argnum,NUMBER); 371 MF_VA_ARG(argnum, NUMBER, num);
373 /* If a precision is given with a 372 /* If a precision is given with a
374 numeric conversion, the 0 flag is ignored. 373 numeric conversion, the 0 flag is ignored.
375 */ 374 */
diff --git a/src/prog.c b/src/prog.c
index 26621102..9dc17daa 100644
--- a/src/prog.c
+++ b/src/prog.c
@@ -235,6 +235,10 @@ disable_prog_trace(const char *modlist)
235 235
236/* Run-time evaluation */ 236/* Run-time evaluation */
237 237
238/* Max. number of C locals to save in struct eval_environ for eventual fixups.
239 See comment to env_fixup_autos, below. */
240#define MAX_AUTO_PTR 128
241
238struct eval_environ { 242struct eval_environ {
239 prog_counter_t pc; /* Program counter */ 243 prog_counter_t pc; /* Program counter */
240 244
@@ -253,6 +257,10 @@ struct eval_environ {
253 /* Temporary heap space */ 257 /* Temporary heap space */
254 size_t temp_start; 258 size_t temp_start;
255 size_t temp_size; 259 size_t temp_size;
260
261 STKVAL *auto_ptr[MAX_AUTO_PTR]; /* Pointers to C automatic variables
262 referring to dataseg. */
263 size_t numautos; /* Number of entries in auto_ptr. */
256 264
257 /* Sendmail interaction data: */ 265 /* Sendmail interaction data: */
258 SMFICTX *ctx; /* Milter Context */ 266 SMFICTX *ctx; /* Milter Context */
@@ -328,12 +336,52 @@ env_get_stream(eval_environ_t env)
328 return env->stream; 336 return env->stream;
329} 337}
330 338
339
340/* A call to expand_dataseg (see below) invalidates any C variables that
341 pointed to dataseg before the call. To avoid dereferencing invalid memory
342 pointers, the addresses of such C variables are stored in env->auto_ptr
343 using env_register_auto (it is done by get_string_arg). When
344 expand_dataseg is called, it calls env_fixup_autos and passes it the
345 offset of new dataseg from old one. env_fixup_autos adds this value to
346 every address in auto_ptr, thereby fixing them.
347
348 The auto_ptr array is cleared (by calling env_unregister_autos) after
349 executing each instruction (see eval_environment).