]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] Refactor multipattern to use per-multipattern TLD flag
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 5 Jan 2026 11:35:05 +0000 (11:35 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 5 Jan 2026 11:35:05 +0000 (11:35 +0000)
commitf80f21167766efeb9b60eab8d33ec61f25051ec1
tree023358d68d442c6669f8bc1352c478137aed1e3a
parentefa11a5317e5c7e99202d6234980bc63e9c88a01
[Fix] Refactor multipattern to use per-multipattern TLD flag

This commit fixes the multipattern implementation to properly support
per-multipattern TLD flag instead of per-pattern flags.

Key changes:
- Remove acism_id_offset field - no longer needed since TLD is now
  per-multipattern, not per-pattern
- Fix hyperscan TLD pattern suffix: use (?:[^a-zA-Z0-9]|$) instead
  of (:?\b|$) because \b requires HS_FLAG_UCP which causes issues
- Initialize pats array in create functions when TLD flag is set
- Add TLD patterns to pats array at start of add_pattern_len for
  ACISM fallback during hyperscan compilation
- Simplify ACISM callback - strnum IS the pattern ID for TLD patterns

For TLD multipatterns, the system now builds BOTH:
- ACISM patterns (for fallback during HS compilation or when unavailable)
- Hyperscan patterns (when available)

At lookup time: use Hyperscan if ready, fall back to ACISM otherwise.
src/libutil/multipattern.c