From: Florent Bruneau Date: Mon, 29 Sep 2008 21:10:27 +0000 (+0200) Subject: More testcases. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=033f9c56012ade3ac28fa598901f7c61d24c13fa;p=apps%2Fpfixtools.git More testcases. Signed-off-by: Florent Bruneau --- diff --git a/postlicyd/data/test.conf b/postlicyd/data/test.conf index 3fc0503..7c88a75 100644 --- a/postlicyd/data/test.conf +++ b/postlicyd/data/test.conf @@ -1,11 +1,28 @@ match1 { type = match; + match_all = false; condition = stress #=; + condtion = stress != yes; on_match = postfix:OK; on_fail = postfix:OK; } +match2 { + type = match; + + match_all = true; + condition = stress >= y; + condition = stress >i e; + condition = size i rsa; + condition = encryption_cipher >i sha; + condition = sasl_method == plain; + + on_match = postfix:OK; + on_fail = postfix:OK; +} + hostnames1 { type = strlist; diff --git a/postlicyd/data/testcase_1 b/postlicyd/data/testcase_1 index e4801ce..5aeb385 100644 --- a/postlicyd/data/testcase_1 +++ b/postlicyd/data/testcase_1 @@ -24,6 +24,7 @@ etrn_domain= stress= match1=match +match2=fail hostnames1=fail hostnames2=fail emails1=fail diff --git a/postlicyd/data/testcase_2 b/postlicyd/data/testcase_2 index cfad1a6..8fabe54 100644 --- a/postlicyd/data/testcase_2 +++ b/postlicyd/data/testcase_2 @@ -24,6 +24,7 @@ etrn_domain= stress=yes match1=fail +match2=match hostnames1=soft_match hostnames2=hard_match emails1=soft_match diff --git a/postlicyd/data/testcase_3 b/postlicyd/data/testcase_3 new file mode 100644 index 0000000..b0a7d01 --- /dev/null +++ b/postlicyd/data/testcase_3 @@ -0,0 +1,31 @@ +request=smtpd_access_policy +protocol_state=RCPT +protocol_name=SMTP +helo_name=tata.example.org +queue_id=8045F2AB23 +sender=contact@exemple.com +recipient=contact@exemple.org +recipient_count=0 +client_address=1.2.3.4 +client_name=kikoo.example.net +reverse_client_name=example.net +instance=123.456.7 +sasl_method=plain +sasl_username=you +sasl_sender= +size=12345 +ccert_subject=solaris9.porcupine.org +ccert_issuer=Wietse+20Venema +ccert_fingerprint=C2:9D:F4:87:71:73:73:D9:18:E7:C2:F3:C1:DA:6E:04 +encryption_protocol=TLSv1/SSLv3 +encryption_cipher=DHE-RSA-AES256-sha +encryption_keysize=256 +etrn_domain= +stress=yEs + +match1=fail +match2=match +hostnames1=fail +hostnames2=hard_match +emails1=fail +emails2=fail diff --git a/postlicyd/data/testcase_4 b/postlicyd/data/testcase_4 new file mode 100644 index 0000000..3a9b547 --- /dev/null +++ b/postlicyd/data/testcase_4 @@ -0,0 +1,31 @@ +request=smtpd_access_policy +protocol_state=RCPT +protocol_name=SMTP +helo_name=tata.example.org +queue_id=8045F2AB23 +sender=contact@exemple.com +recipient=contact@exemple.org +recipient_count=0 +client_address=1.2.3.4 +client_name=kikoo.example.net +reverse_client_name=example.net +instance=123.456.7 +sasl_method=plain +sasl_username=you +sasl_sender= +size=12345 +ccert_subject=solaris9.porcupine.org +ccert_issuer=Wietse+20Venema +ccert_fingerprint=C2:9D:F4:87:71:73:73:D9:18:E7:C2:F3:C1:DA:6E:04 +encryption_protocol=TLSv1/SSLv3 +encryption_cipher=DHE-RSA-AES256-sha +encryption_keysize=256 +etrn_domain= +stress=YEs + +match1=fail +match2=fail +hostnames1=fail +hostnames2=hard_match +emails1=fail +emails2=fail diff --git a/postlicyd/data/testcase_5 b/postlicyd/data/testcase_5 new file mode 100644 index 0000000..d964404 --- /dev/null +++ b/postlicyd/data/testcase_5 @@ -0,0 +1,31 @@ +request=smtpd_access_policy +protocol_state=RCPT +protocol_name=SMTP +helo_name=tata.example.org +queue_id=8045F2AB23 +sender=contact@exemple.com +recipient=contact@exemple.org +recipient_count=0 +client_address=1.2.3.4 +client_name=kikoo.example.net +reverse_client_name=example.net +instance=123.456.7 +sasl_method=plain +sasl_username=you +sasl_sender= +size=12345 +ccert_subject=solaris9.porcupine.org +ccert_issuer=Wietse+20Venema +ccert_fingerprint=C2:9D:F4:87:71:73:73:D9:18:E7:C2:F3:C1:DA:6E:04 +encryption_protocol=TLSv1/SSLv3 +encryption_cipher=DHE-RSA-AES256-sha +encryption_keysize=256 +etrn_domain= +stress=ys + +match1=fail +match2=fail +hostnames1=fail +hostnames2=hard_match +emails1=fail +emails2=fail diff --git a/postlicyd/data/testcase_6 b/postlicyd/data/testcase_6 new file mode 100644 index 0000000..3431172 --- /dev/null +++ b/postlicyd/data/testcase_6 @@ -0,0 +1,31 @@ +request=smtpd_access_policy +protocol_state=RCPT +protocol_name=SMTP +helo_name=tata.example.org +queue_id=8045F2AB23 +sender=contact@exemple.com +recipient=contact@exemple.org +recipient_count=0 +client_address=1.2.3.4 +client_name=kikoo.example.net +reverse_client_name=example.net +instance=123.456.7 +sasl_method=plain +sasl_username=you +sasl_sender= +size=122345 +ccert_subject=solaris9.porcupine.org +ccert_issuer=Wietse+20Venema +ccert_fingerprint=C2:9D:F4:87:71:73:73:D9:18:E7:C2:F3:C1:DA:6E:04 +encryption_protocol=TLSv1/SSLv3 +encryption_cipher=DHE-RSA-AES256-sha +encryption_keysize=256 +etrn_domain= +stress=yEs + +match1=fail +match2=fail +hostnames1=fail +hostnames2=hard_match +emails1=fail +emails2=fail diff --git a/postlicyd/data/testcase_7 b/postlicyd/data/testcase_7 new file mode 100644 index 0000000..871f09a --- /dev/null +++ b/postlicyd/data/testcase_7 @@ -0,0 +1,31 @@ +request=smtpd_access_policy +protocol_state=RCPT +protocol_name=SMTP +helo_name=tata.example.org +queue_id=8045F2AB23 +sender=contact@exemple.com +recipient=contact@exemple.org +recipient_count=0 +client_address=1.2.3.4 +client_name=kikoo.example.net +reverse_client_name=example.net +instance=123.456.7 +sasl_method=plain +sasl_username=you +sasl_sender= +size=12345 +ccert_subject=solaris9.porcupine.org +ccert_issuer=Wietse+20Venema +ccert_fingerprint=C2:9D:F4:87:71:73:73:D9:18:E7:C2:F3:C1:DA:6E:04 +encryption_protocol=TLSv1/SSLv3 +encryption_cipher=DHE-RSA-AES256-shb +encryption_keysize=256 +etrn_domain= +stress=yEs + +match1=fail +match2=fail +hostnames1=fail +hostnames2=hard_match +emails1=fail +emails2=fail diff --git a/postlicyd/data/testcase_8 b/postlicyd/data/testcase_8 new file mode 100644 index 0000000..c6b60b1 --- /dev/null +++ b/postlicyd/data/testcase_8 @@ -0,0 +1,31 @@ +request=smtpd_access_policy +protocol_state=RCPT +protocol_name=SMTP +helo_name=tata.example.org +queue_id=8045F2AB23 +sender=contact@exemple.com +recipient=contact@exemple.org +recipient_count=0 +client_address=1.2.3.4 +client_name=kikoo.example.net +reverse_client_name=example.net +instance=123.456.7 +sasl_method=plaineuh +sasl_username=you +sasl_sender= +size=12345 +ccert_subject=solaris9.porcupine.org +ccert_issuer=Wietse+20Venema +ccert_fingerprint=C2:9D:F4:87:71:73:73:D9:18:E7:C2:F3:C1:DA:6E:04 +encryption_protocol=TLSv1/SSLv3 +encryption_cipher=DHE-RSA-AES256-sha +encryption_keysize=256 +etrn_domain= +stress=yEs + +match1=fail +match2=fail +hostnames1=fail +hostnames2=hard_match +emails1=fail +emails2=fail diff --git a/postlicyd/match.c b/postlicyd/match.c index 2ec5e03..41ce317 100644 --- a/postlicyd/match.c +++ b/postlicyd/match.c @@ -146,7 +146,7 @@ static bool match_filter_constructor(filter_t *filter) PARSE_CHECK(condition.condition != MATCH_UNKNOWN, "invalid operator"); if (condition.condition != MATCH_EMPTY) { - p = m_strnextsp(n + 1); + p = skipspaces(n + 1); PARSE_CHECK(*p, "no value defined to check the condition"); condition.value_len = param->value_len - (p - param->value); condition.value = p_dupstr(p, condition.value_len);