From 157782da6638501baed2e0cf4999115816efb352 Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 2 Nov 2024 04:51:46 +0100 Subject: [PATCH] Improve Purge rule backwards compatibility (v2) --- src/rp.c | 4 ++++ src/rp_cpu.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rp.c b/src/rp.c index bdeaa4e65..a5153cefd 100644 --- a/src/rp.c +++ b/src/rp.c @@ -398,6 +398,10 @@ int cpu_rule_to_kernel_rule (char *rule_buf, u32 rule_len, kernel_rule_t *rule) } switch (rule_buf[rule_pos+2]) { + case '\'': + SET_NAME (rule, rule_buf[rule_pos]); + SET_P0 (rule, rule_buf[rule_pos]); + break; case ' ': case '?': SET_NAME (rule, rule_buf[rule_pos]); diff --git a/src/rp_cpu.c b/src/rp_cpu.c index da4fd38c0..05d54df3e 100644 --- a/src/rp_cpu.c +++ b/src/rp_cpu.c @@ -822,7 +822,7 @@ int _old_apply_rule (const char *rule, int rule_len, char in[RP_PASSWORD_SIZE], if (rule_new[rule_pos] == '?') { - if ((rule_pos + 1) == rule_len_new) + if ((rule_pos + 1) == rule_len_new || ((rule_pos + 1) < rule_len_new && rule_new[rule_pos+1] == '\'')) { out_len = mangle_purgechar (out, out_len, rule_new[rule_pos]); break;