]> source.dussan.org Git - rspamd.git/commitdiff
Add test for signature checking in rcl.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 22 Aug 2013 14:36:04 +0000 (15:36 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 22 Aug 2013 14:36:04 +0000 (15:36 +0100)
src/main.c
test/rspamd_rcl_test.c
test/test.cfg.sig [new file with mode: 0644]

index 4d6adbce12d69780338dd8c3a82ce423dba18778..cab81c10e6cae1f86a30e42d411d9114b7160fb1 100644 (file)
@@ -997,6 +997,7 @@ perform_configs_sign (void)
        }
 
        /* Cleanup */
+       EVP_MD_CTX_destroy (sign_ctx);
        EVP_PKEY_CTX_free (key_ctx);
        EVP_PKEY_free (key);
        BIO_free (fbio);
index c4e1144099a0b4e49536ace80d0e834ffe72ba81..e5112cd594d17d38bf9656bca887705b75dd2197 100644 (file)
@@ -55,10 +55,18 @@ const gchar *rcl_test_valid[] = {
                "param = \"value\";\n"
         "param2 = value\n"
         "array = [          1, 1mb, test]}\n"
-        ".include \"./test.cfg\"}",
+        ".includes \"./test.cfg\"}",
                NULL
 };
 
+static const gchar test_pubkey[] = ""
+"-----BEGIN PUBLIC KEY-----\n"
+"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlhk2u5nbTVgEskmS+qZcAj339\n"
+"bLwEK/TXdd0G3d4BVKpF712frw+YwetRdmRRYL5EdjiF01Bv3s6QmsThAJX/li/c\n"
+"Q15YFxhvq9DZ0qJmL7e1NzORo6m/WLRK9wxWA+PXSvSUKrlZ3kt9ygD4z5QZ3/td\n"
+"qil9VM6Mz7P1HJ0KywIDAQAB\n"
+"-----END PUBLIC KEY-----\n";
+
 void
 rspamd_rcl_test_func (void)
 {
@@ -71,6 +79,8 @@ rspamd_rcl_test_func (void)
        cur = rcl_test_valid;
        while (*cur != NULL) {
                parser = rspamd_cl_parser_new ();
+               rspamd_cl_pubkey_add (parser, test_pubkey, sizeof (test_pubkey) - 1, &err);
+               g_assert_no_error (err);
                g_assert (parser != NULL);
                rspamd_cl_parser_add_chunk (parser, *cur, strlen (*cur), &err);
                g_assert_no_error (err);
diff --git a/test/test.cfg.sig b/test/test.cfg.sig
new file mode 100644 (file)
index 0000000..de849d5
--- /dev/null
@@ -0,0 +1 @@
+\10\92éBúDü æ%j\9f\18Ë|æ"ìõïr{ªv>ú:óL\83¹\88\19É\13WáíÄ\ 2\ 5(dL4¹{ñlÝÑOEé\8aåç\1fÈ\7fÓÛ5ߥ]\9d&S°¤­/¶P\9a·\95M\1eÕ\81É\94l,\89@ä%.Ïû@Ì­®V<\f^\a%8\879_\8fM:ørl«¯¯F!\1a2(ì\83\19í1
\ No newline at end of file