]> code.citadel.org Git - citadel.git/blobdiff - citadel/tests/dkimtester/dkimtester.c
final touches on dkim test harness
[citadel.git] / citadel / tests / dkimtester / dkimtester.c
index c923bd5d3e5519d05f7259ffbef623eabb19584e..b54c9047a81381870d3b710a1fcb10d81d899e31 100644 (file)
@@ -2,21 +2,25 @@
 // This contains a private key that, at the time of writing, matches the DKIM public key for dev.citadel.org
 // We can use the attached test message to validate a signature against that.
 
-#include <stdlib.h>
-#include <unistd.h>
 #include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <time.h>
-#include <assert.h>
 #include <syslog.h>
 #include <libcitadel.h>
 
-// oof, a prototype where one does not belong hehe
+// This was easier than trying to figure out the header situation
 void dkim_sign(StrBuf *email, char *pkey_in, char *domain, char *selector);
 
 int main(int argc, char *argv[]) {
 
+       // display the greeting
+       fprintf(stderr,
+               "\033[44m\033[1m╔════════════════════════════════════════════════════════════════════════╗\033[0m\n"
+               "\033[44m\033[1m║ DKIM signature test program for Citadel                                ║\033[0m\n"
+               "\033[44m\033[1m║ Copyright (c) 2024 by citadel.org et al.                               ║\033[0m\n"
+               "\033[44m\033[1m║ This program is open source software.  Use, duplication, or disclosure ║\033[0m\n"
+               "\033[44m\033[1m║ is subject to the terms of the GNU General Public license v3.          ║\033[0m\n"
+               "\033[44m\033[1m╚════════════════════════════════════════════════════════════════════════╝\033[0m\n"
+       );
+
        openlog("dkim", LOG_PERROR, LOG_USER);
 
        char *private_key =
@@ -50,7 +54,6 @@ int main(int argc, char *argv[]) {
                "-----END PRIVATE KEY-----\n"
        ;
 
-       // These elements are identical to the ones from previous revisions.  Don't change them; we need to compare.
        char *domain = "dev.citadel.org";
        char *selector = "foo";
 
@@ -77,12 +80,12 @@ int main(int argc, char *argv[]) {
 
        FILE *fp;
        printf("\033[34m-----\033[0m\n");
-       printf("Piping original version to test program...\n");
+       printf("Piping original version to test program (this should pass)\n");
        fp = popen("./tester.pl | sed s/pass/\033[32mpass\033[0m/g | sed s/fail/\033[31mfail\033[0m/g", "w");
        fwrite((char *)ChrPtr(email), StrLength(email), 1, fp);
        pclose(fp);
        printf("\033[34m-----\033[0m\n");
-       printf("Piping altered version to test program...\n");
+       printf("Piping altered version to test program (this should fail)\n");
        fp = popen("sed s/oggs/argh/g | ./tester.pl | sed s/pass/\033[32mpass\033[0m/g | sed s/fail/\033[31mfail\033[0m/g", "w");
        fwrite((char *)ChrPtr(email), StrLength(email), 1, fp);
        pclose(fp);