summaryrefslogtreecommitdiffstats
path: root/src/spf.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-20 17:12:32 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-20 17:12:32 +0400
commit8dc9f3bed874f0944c4120fd9ec0c65eff0b2359 (patch)
treebdaef3ae47bc17dd0a06e4b532ceb77d77d2de4b /src/spf.c
parent8e67a34fc8f36d529c2efc140e5a9da523da5af4 (diff)
downloadrspamd-8dc9f3bed874f0944c4120fd9ec0c65eff0b2359.tar.gz
rspamd-8dc9f3bed874f0944c4120fd9ec0c65eff0b2359.zip
* Fix expanding spf macros that may fail in rare cases
Diffstat (limited to 'src/spf.c')
-rw-r--r--src/spf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/spf.c b/src/spf.c
index 3f735457a..79a0855ea 100644
--- a/src/spf.c
+++ b/src/spf.c
@@ -630,6 +630,7 @@ expand_spf_macro (struct worker_task *task, struct spf_record *rec, char *begin)
{
char *p, *c, *new, *tmp;
int len = 0, slen = 0, state = 0;
+ gboolean need_expand = FALSE;
p = begin;
/* Calculate length */
@@ -706,6 +707,7 @@ expand_spf_macro (struct worker_task *task, struct spf_record *rec, char *begin)
/* Read modifier */
if (*p == '}') {
state = 0;
+ need_expand = TRUE;
}
else if (*p != 'r' && !g_ascii_isdigit (*p)) {
msg_info ("unknown or unsupported spf modifier %c in %s", *p, begin);
@@ -717,7 +719,7 @@ expand_spf_macro (struct worker_task *task, struct spf_record *rec, char *begin)
}
}
- if (slen == len) {
+ if (!need_expand) {
/* No expansion needed */
return begin;
}