More testcases.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 29 Sep 2008 21:10:27 +0000 (23:10 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 29 Sep 2008 21:10:27 +0000 (23:10 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
postlicyd/data/test.conf
postlicyd/data/testcase_1
postlicyd/data/testcase_2
postlicyd/data/testcase_3 [new file with mode: 0644]
postlicyd/data/testcase_4 [new file with mode: 0644]
postlicyd/data/testcase_5 [new file with mode: 0644]
postlicyd/data/testcase_6 [new file with mode: 0644]
postlicyd/data/testcase_7 [new file with mode: 0644]
postlicyd/data/testcase_8 [new file with mode: 0644]
postlicyd/match.c

index 3fc0503..7c88a75 100644 (file)
@@ -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 12345678;
+  condition = encryption_cipher >i rsa;
+  condition = encryption_cipher >i sha;
+  condition = sasl_method == plain;
+
+  on_match = postfix:OK;
+  on_fail  = postfix:OK;
+}
+
 hostnames1 {
   type = strlist;
 
index e4801ce..5aeb385 100644 (file)
@@ -24,6 +24,7 @@ etrn_domain=
 stress=
 
 match1=match
+match2=fail
 hostnames1=fail
 hostnames2=fail
 emails1=fail
index cfad1a6..8fabe54 100644 (file)
@@ -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 (file)
index 0000000..b0a7d01
--- /dev/null
@@ -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 (file)
index 0000000..3a9b547
--- /dev/null
@@ -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 (file)
index 0000000..d964404
--- /dev/null
@@ -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 (file)
index 0000000..3431172
--- /dev/null
@@ -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 (file)
index 0000000..871f09a
--- /dev/null
@@ -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 (file)
index 0000000..c6b60b1
--- /dev/null
@@ -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
index 2ec5e03..41ce317 100644 (file)
@@ -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);