/* precompile our regexes */
while ((regex_string = string_nextinlist(&list, &sep, NULL, 0)))
if (strcmpic(regex_string, US"false") != 0 && Ustrcmp(regex_string, "0") != 0)
{
/* precompile our regexes */
while ((regex_string = string_nextinlist(&list, &sep, NULL, 0)))
if (strcmpic(regex_string, US"false") != 0 && Ustrcmp(regex_string, "0") != 0)
{
- if (!(re = pcre_compile( CS regex_string,
- 0, &pcre_error, &pcre_erroffset, NULL )))
+ uschar * errstr;
+ const pcre2_code * re = regex_compile(regex_string,
+ cacheable ? MCS_CACHEABLE : MCS_NOFLAGS, &errstr, pcre_gen_cmp_ctx);
+
+ if (!re)
- log_write(0, LOG_MAIN,
- "regex acl condition warning - error in regex '%s': %s at offset %d, skipped.",
- regex_string, pcre_error, pcre_erroffset);
+ log_write(0, LOG_MAIN, "regex acl condition warning - %s, skipped", errstr);
- n = pcre_exec(ri->re, NULL, CS linebuffer, len, 0, 0, ovec, nelem(ovec));
- if (n > 0)
+ if ((n = pcre2_match(ri->re, (PCRE2_SPTR)linebuffer, len, 0, 0, md, pcre_gen_mtc_ctx)) > 0)
{
Ustrncpy(regex_match_string_buffer, ri->pcre_text,
sizeof(regex_match_string_buffer)-1);
regex_match_string = regex_match_string_buffer;
{
Ustrncpy(regex_match_string_buffer, ri->pcre_text,
sizeof(regex_match_string_buffer)-1);
regex_match_string = regex_match_string_buffer;
- for (nn = 1; nn < n; nn++)
- regex_vars[nn-1] =
- string_copyn(linebuffer + ovec[nn*2], ovec[nn*2+1] - ovec[nn*2]);
+ for (int nn = 1; nn < n; nn++)
+ {
+ PCRE2_SIZE * ovec = pcre2_get_ovector_pointer(md);
+ int off = nn * 2;
+ int len = ovec[off + 1] - ovec[off];
+ regex_vars[nn-1] = string_copyn(linebuffer + ovec[off], len);
+ }
{ /* error while spooling */
log_write(0, LOG_MAIN|LOG_PANIC,
"regex acl condition: error while creating mbox spool file");
{ /* error while spooling */
log_write(0, LOG_MAIN|LOG_PANIC,
"regex acl condition: error while creating mbox spool file");
while (fgets(CS linebuffer, 32767, mbox_file))
{
if ( mime_stream && mime_current_boundary /* check boundary */
while (fgets(CS linebuffer, 32767, mbox_file))
{
if ( mime_stream && mime_current_boundary /* check boundary */
mime_subject_len = fread(mime_subject, 1, 32766, f);
mime_subject_len = fread(mime_subject, 1, 32766, f);