From: Florent Bruneau Date: Sat, 4 Oct 2008 10:39:46 +0000 (+0200) Subject: Add query->(recipient|sender)_domain X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=909ec25baf2070c99d812698727943f19c900ee5;p=apps%2Fpfixtools.git Add query->(recipient|sender)_domain Signed-off-by: Florent Bruneau --- diff --git a/postlicyd/query.c b/postlicyd/query.c index 26b590a..327c2b7 100644 --- a/postlicyd/query.c +++ b/postlicyd/query.c @@ -72,8 +72,6 @@ bool query_parse(query_t *query, char *p) #define CASE(up, low) case PTK_##up: query->low = v; v[vlen] = '\0'; break; CASE(HELO_NAME, helo_name); CASE(QUEUE_ID, queue_id); - CASE(SENDER, sender); - CASE(RECIPIENT, recipient); CASE(RECIPIENT_COUNT, recipient_count); CASE(CLIENT_ADDRESS, client_address); CASE(CLIENT_NAME, client_name); @@ -93,6 +91,24 @@ bool query_parse(query_t *query, char *p) CASE(STRESS, stress); #undef CASE + case PTK_SENDER: + query->sender = v; + v[vlen] = '\0'; + query->sender_domain = memchr(query->sender, '@', vlen); + if (query->sender_domain != NULL) { + ++query->sender_domain; + } + break; + + case PTK_RECIPIENT: + query->recipient = v; + v[vlen] = '\0'; + query->recipient_domain = memchr(query->recipient, '@', vlen); + if (query->recipient_domain != NULL) { + ++query->recipient_domain; + } + break; + case PTK_REQUEST: PARSE_CHECK(vtk == PTK_SMTPD_ACCESS_POLICY, "unexpected `request' value: %.*s", vlen, v); diff --git a/postlicyd/query.h b/postlicyd/query.h index f9cd0b6..87ee01e 100644 --- a/postlicyd/query.h +++ b/postlicyd/query.h @@ -69,6 +69,10 @@ typedef struct query_t { const char *reverse_client_name; const char *instance; + /* useful data extracted from previous ones */ + const char *sender_domain; + const char *recipient_domain; + /* postfix 2.2+ */ const char *sasl_method; const char *sasl_username;