Back to index

opendkim  2.6.4
t-setup.c
Go to the documentation of this file.
00001 /*
00002 **  Copyright (c) 2007, 2008 Sendmail, Inc. and its suppliers.
00003 **    All rights reserved.
00004 **
00005 **  Copyright (c) 2009, 2011, The OpenDKIM Project.  All rights reserved.
00006 */
00007 
00008 #ifndef lint
00009 static char t_setup_c_id[] = "@(#)$Id: t-setup.c,v 1.2 2009/12/08 19:14:26 cm-msk Exp $";
00010 #endif /* !lint */
00011 
00012 #include "build-config.h"
00013 
00014 /* system includes */
00015 #include <sys/types.h>
00016 #include <assert.h>
00017 #include <stdio.h>
00018 
00019 #ifdef USE_GNUTLS
00020 # include <gnutls/gnutls.h>
00021 #endif /* USE_GNUTLS */
00022 
00023 /* libopendkim includes */
00024 #include "../dkim.h"
00025 #include "t-testdata.h"
00026 
00027 /*
00028 **  MAIN -- program mainline
00029 **
00030 **  Parameters:
00031 **     The usual.
00032 **
00033 **  Return value:
00034 **     Exit status.
00035 */
00036 
00037 int
00038 main(int argc, char **argv)
00039 {
00040        char *p;
00041        FILE *f;
00042 
00043        printf("*** test setup\n");
00044 
00045        f = fopen(KEYFILE, "w");
00046        assert(f != NULL);
00047 
00048        fprintf(f, "%s.%s.%s ", SELECTOR, DKIM_DNSKEYNAME, DOMAIN);
00049        for (p = PUBLICKEY; *p != '\0'; p++)
00050        {
00051               if (*p != '\n')
00052                      putc(*p, f);
00053        }
00054        fprintf(f, "\n");
00055 
00056        fprintf(f, "%s.%s.%s ", SELECTOR2, DKIM_DNSKEYNAME, DOMAIN);
00057        for (p = PUBLICKEY2; *p != '\0'; p++)
00058        {
00059               if (*p != '\n')
00060                      putc(*p, f);
00061        }
00062        fprintf(f, "\n");
00063 
00064        fprintf(f, "%s.%s.%s ", SELECTOR, DKIM_DNSKEYNAME, DOMAIN2);
00065        for (p = PUBLICKEYNOS; *p != '\0'; p++)
00066        {
00067               if (*p != '\n')
00068                      putc(*p, f);
00069        }
00070        fprintf(f, "\n");
00071 
00072        fprintf(f, "%s.%s.%s ", SELECTORBADV, DKIM_DNSKEYNAME, DOMAIN);
00073        for (p = PUBLICKEYBADV; *p != '\0'; p++)
00074        {
00075               if (*p != '\n')
00076                      putc(*p, f);
00077        }
00078        fprintf(f, "\n");
00079 
00080        fprintf(f, "%s.%s.%s ", SELECTOR256, DKIM_DNSKEYNAME, DOMAIN);
00081        for (p = PUBLICKEY256; *p != '\0'; p++)
00082        {
00083               if (*p != '\n')
00084                      putc(*p, f);
00085        }
00086        fprintf(f, "\n");
00087 
00088        fprintf(f, "%s.%s.%s ", SELECTORBADH, DKIM_DNSKEYNAME, DOMAIN);
00089        for (p = PUBLICKEYBADH; *p != '\0'; p++)
00090        {
00091               if (*p != '\n')
00092                      putc(*p, f);
00093        }
00094        fprintf(f, "\n");
00095 
00096        fprintf(f, "%s.%s.%s ", SELECTORNOK, DKIM_DNSKEYNAME, DOMAIN);
00097        for (p = PUBLICKEYNOK; *p != '\0'; p++)
00098        {
00099               if (*p != '\n')
00100                      putc(*p, f);
00101        }
00102        fprintf(f, "\n");
00103 
00104        fprintf(f, "%s.%s.%s ", SELECTORBADK, DKIM_DNSKEYNAME, DOMAIN);
00105        for (p = PUBLICKEYBADK; *p != '\0'; p++)
00106        {
00107               if (*p != '\n')
00108                      putc(*p, f);
00109        }
00110        fprintf(f, "\n");
00111 
00112        fprintf(f, "%s.%s.%s ", SELECTOREMPTYP, DKIM_DNSKEYNAME, DOMAIN);
00113        for (p = PUBLICKEYEMPTYP; *p != '\0'; p++)
00114        {
00115               if (*p != '\n')
00116                      putc(*p, f);
00117        }
00118        fprintf(f, "\n");
00119 
00120        fprintf(f, "%s.%s.%s ", SELECTORNOP, DKIM_DNSKEYNAME, DOMAIN);
00121        for (p = PUBLICKEYNOP; *p != '\0'; p++)
00122        {
00123               if (*p != '\n')
00124                      putc(*p, f);
00125        }
00126        fprintf(f, "\n");
00127 
00128        fprintf(f, "%s.%s.%s ", SELECTORCORRUPTP, DKIM_DNSKEYNAME, DOMAIN);
00129        for (p = PUBLICKEYCORRUPTP; *p != '\0'; p++)
00130        {
00131               if (*p != '\n')
00132                      putc(*p, f);
00133        }
00134        fprintf(f, "\n");
00135 
00136        fprintf(f, "%s.%s.%s ", DKIM_DNSPOLICYNAME, DKIM_DNSKEYNAME, DOMAIN2);
00137        fprintf(f, "dkim=all; t=s; r=%s\n", REPLYADDRESS);
00138 
00139        fprintf(f, "%s exists\n", DOMAIN2);
00140 
00141        fclose(f);
00142 
00143        return 0;
00144 }