From: Wietse Venema Date: Wed, 15 Mar 2006 05:00:00 +0000 (-0500) Subject: postfix-2.3-20060315 X-Git-Tag: v2.3-RC1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ea736c8a72eb3fd5b84ace410a9c620b8e1c2db;p=thirdparty%2Fpostfix.git postfix-2.3-20060315 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 5ab5e8a0b..49ea1850c 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -12043,6 +12043,13 @@ Apologies for any names omitted. longer manipulate the mail expiration schedule, so that mail "on hold" could expire too soon. +20060315 + + Workaround. the PCRE library reports an inappropriate error + code (invalid substring) when $number refers to a valid () + expression that matches the null string. This caused fatal + run-time errors. File: dict_pcre.c. + Wish list: The sendmail command should not return non-std exit status diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 7b3dd946c..7b62eb05d 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20060313" +#define MAIL_RELEASE_DATE "20060315" #define MAIL_VERSION_NUMBER "2.3" #ifdef SNAPSHOT diff --git a/postfix/src/util/dict_pcre.c b/postfix/src/util/dict_pcre.c index 8a4d9ae62..dd9f0c547 100644 --- a/postfix/src/util/dict_pcre.c +++ b/postfix/src/util/dict_pcre.c @@ -178,8 +178,7 @@ static int dict_pcre_expand(int type, VSTRING *buf, char *ptr) ctxt->matches, n, &pp); if (ret < 0) { if (ret == PCRE_ERROR_NOSUBSTRING) - msg_fatal("regexp %s, line %d: replace index out of range", - dict_pcre->dict.name, match_rule->rule.lineno); + return (MAC_PARSE_UNDEF); else msg_fatal("regexp %s, line %d: pcre_get_substring error: %d", dict_pcre->dict.name, match_rule->rule.lineno, ret); @@ -591,6 +590,7 @@ static DICT_PCRE_RULE *dict_pcre_parse_rule(const char *mapname, int lineno, int dict_flags) { char *p; + int actual_sub; p = line; @@ -662,6 +662,23 @@ static DICT_PCRE_RULE *dict_pcre_parse_rule(const char *mapname, int lineno, */ if (dict_pcre_compile(mapname, lineno, ®exp, &engine) == 0) CREATE_MATCHOP_ERROR_RETURN(0); +#ifdef PCRE_INFO_CAPTURECOUNT + if (pcre_fullinfo(engine.pattern, engine.hints, + PCRE_INFO_CAPTURECOUNT, + (void *) &actual_sub) != 0) + msg_panic("pcre map %s, line %d: pcre_fullinfo failed", + mapname, lineno); + if (prescan_context.max_sub > actual_sub) { + msg_warn("regexp map %s, line %d: out of range replacement index \"%d\": " + "skipping this rule", mapname, lineno, + (int) prescan_context.max_sub); + if (engine.pattern) + myfree((char *) engine.pattern); + if (engine.hints) + myfree((char *) engine.hints); + CREATE_MATCHOP_ERROR_RETURN(0); + } +#endif /* * Save the result. diff --git a/postfix/src/util/dict_pcre.ref b/postfix/src/util/dict_pcre.ref index 8b2b89448..e7c04227d 100644 --- a/postfix/src/util/dict_pcre.ref +++ b/postfix/src/util/dict_pcre.ref @@ -2,6 +2,7 @@ ./dict_open: warning: pcre map dict_pcre.map, line 5: ignoring extra text after ENDIF ./dict_open: warning: pcre map dict_pcre.map, line 8: unknown regexp option "!": skipping this rule ./dict_open: warning: dict_pcre.map, line 9: no replacement text: using empty string +./dict_open: warning: regexp map dict_pcre.map, line 10: out of range replacement index "5": skipping this rule ./dict_open: warning: pcre map dict_pcre.map, line 17: $number found in negative match replacement text: skipping this rule ./dict_open: warning: pcre map dict_pcre.map, line 22: no regexp: skipping this rule > get true