Back to index

courier  0.68.2
Classes | Functions | Variables
testspf.c File Reference
#include "config.h"
#include "rfc1035.h"
#include "spf.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  testsuite_s

Functions

static int testspf (const char *mailfrom, const char *tcpremoteip, const char *tcpremotehost, const char *helodomain, const char *mydomain)
int main (int argc, char **argv)

Variables

static struct testsuite_s testsuite []

Class Documentation

struct testsuite_s

Definition at line 14 of file testspf.c.

Class Members
const char * helodomain
const char * mailfrom
const char * mydomain
const char * tcpremotehost
const char * tcpremoteip

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 89 of file testspf.c.

{
       if (argc == 2 && strncmp(argv[1], "-test=", 6) == 0)
       {
              int loop_cnt=atoi(argv[1]+6);
              int i;

              for (i=0;i<loop_cnt;i++)
              {
                     int j;

                     for (j=0; j<sizeof(testsuite)/sizeof(testsuite[0]);
                          j++)
                            testspf(testsuite[j].mailfrom,
                                   testsuite[j].tcpremoteip,
                                   testsuite[j].tcpremotehost,
                                   testsuite[j].helodomain,
                                   testsuite[j].mydomain);
              }
              return 0;
       }

       if (argc < 6)
       {
              printf("Usage: %s mailfrom remoteip remotehost helo me\n",
                     argv[0]);
              exit(1);
       }

       return testspf(argv[1], argv[2], argv[3], argv[4], argv[5]);
}

Here is the call graph for this function:

static int testspf ( const char *  mailfrom,
const char *  tcpremoteip,
const char *  tcpremotehost,
const char *  helodomain,
const char *  mydomain 
) [static]

Definition at line 55 of file testspf.c.

{
       char buf[256];

       switch (rfc1035_spf_lookup(mailfrom, tcpremoteip, tcpremotehost,
                               helodomain, mydomain, buf, sizeof(buf))) {
       case SPF_NONE:
              printf("none\n");
              break;
       case SPF_NEUTRAL:
              printf("neutral\n");
              break;
       case SPF_PASS:
              printf("pass\n");
              break;
       case SPF_FAIL:
              printf("fail: %s\n", buf);
              break;
       case SPF_SOFTFAIL:
              printf("softfail\n");
              break;
       case SPF_ERROR:
              printf("error\n");
              break;
       default:
              printf("unknown\n");
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

struct testsuite_s testsuite[] [static]