diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/bi_sieve.m4 | 0 | ||||
-rw-r--r-- | src/bi_sprintf.m4 | 19 | ||||
-rw-r--r-- | src/prog.c | 272 | ||||
-rw-r--r-- | src/prog.h | 4 | ||||
-rw-r--r-- | src/snarf.m4 | 70 |
8 files changed, 267 insertions, 117 deletions
@@ -1,3 +1,13 @@ | |||
1 | 2008-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 | |||
1 | 2008-03-10 Sergey Poznyakoff <gray@gnu.org.ua> | 11 | 2008-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. |
@@ -1,10 +1,15 @@ | |||
1 | Mailfromd NEWS -- history of user-visible changes. 2008-03-10 | 1 | Mailfromd NEWS -- history of user-visible changes. 2008-09-09 |
2 | Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff | 2 | Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff |
3 | See the end of file for copying conditions. | 3 | See the end of file for copying conditions. |
4 | 4 | ||
5 | Please send mailfromd bug reports to <bug-mailfromd@gnu.org.ua> | 5 | Please send mailfromd bug reports to <bug-mailfromd@gnu.org.ua> |
6 | 6 | ||
7 | 7 | ||
8 | Version 4.4.1 | ||
9 | |||
10 | * Fix stack reallocation. | ||
11 | |||
12 | |||
8 | Version 4.4, 2008-03-10 | 13 | Version 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 @@ | |||
17 | AC_PREREQ(2.59) | 17 | AC_PREREQ(2.59) |
18 | m4_define([MF_VERSION_MAJOR], 4) | 18 | m4_define([MF_VERSION_MAJOR], 4) |
19 | m4_define([MF_VERSION_MINOR], 4) | 19 | m4_define([MF_VERSION_MINOR], 4) |
20 | dnl m4_define([MF_VERSION_PATCH], 0) | 20 | m4_define([MF_VERSION_PATCH], 1) |
21 | AC_INIT([mailfromd], | 21 | AC_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 | |||
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 | */ |
@@ -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 | |||
238 | struct eval_environ { | 242 | struct eval_environ { |
239 | prog_counter_t pc; /* Program counter */ | 243 | prog_counter_t pc; /* Program counter */ |
240 | 244 | ||
@@ -254,6 +258,10 @@ struct eval_environ { | |||
254 | size_t temp_start; | 258 | size_t temp_start; |
255 | size_t temp_size; | 259 | size_t temp_size; |
256 | 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. */ | ||
264 | |||
257 | /* Sendmail interaction data: */ | 265 | /* Sendmail interaction data: */ |
258 | SMFICTX *ctx; /* Milter Context */ | 266 | SMFICTX *ctx; /* Milter Context */ |
259 | void *data; /* MTA symbol table */ | 267 | void *data; /* MTA symbol table */ |
@@ -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). | ||
350 | */ | ||
351 | void | ||
352 | env_register_auto(eval_environ_t env, void *ptr) | ||
353 | { | ||
354 | if (env->numautos == MAX_AUTO_PTR) | ||
355 | runtime_error(env, "INTERNAL ERROR at %s:%d, please report", | ||
356 | __FILE__, __LINE__); | ||
357 | env->auto_ptr[env->numautos++] = ptr; | ||
358 | } | ||
359 | |||
360 | void | ||
361 | env_unregister_autos(eval_environ_t env) | ||
362 | { | ||
363 | env->numautos = 0; | ||
364 | } | ||
365 | |||