Esempio n. 1
0
    int
main( int ac, char *av[ ] )
{
    yastr		test_str;
    struct dmarc	*d;

    if (( ac < 2 ) || ( ac > 5 )) {
	fprintf( stderr, "Usage:\t\t%s hostname [ 5322.From domain ] [ SPF domain ] [ DKIM domain ]\n", av[ 0 ] );
	exit( 1 );
    }

    if ( simta_read_config( SIMTA_FILE_CONFIG ) < 0 ) {
	exit( 1 );
    }

    if ( simta_config( ) != 0 ) {
	exit( 1 );
    }

    simta_openlog( 0, LOG_PERROR );

    dmarc_init( &d );

    dmarc_lookup( d, av[ 1 ] );

    printf( "DMARC lookup result: policy %s, percent %d, result %s\n",
	    dmarc_result_str( d->policy ), d->pct,
	    dmarc_result_str( d->result ));

    if ( ac > 2 ) {
	d->domain = av[ 2 ];
    }

    test_str = yaslauto( d->domain );

    if ( ac > 3 ) {
	dmarc_spf_result( d, av[ 3 ] );
	test_str = yaslcat( test_str, "/" );
	test_str = yaslcat( test_str, av[ 3 ] );
    }
    if ( ac > 4 ) {
	dmarc_dkim_result( d, av[ 4 ] );
	test_str = yaslcat( test_str, "/" );
	test_str = yaslcat( test_str, av[ 4 ] );
    }

    printf( "DMARC policy result for %s: %s\n", test_str,
	    dmarc_result_str( dmarc_result( d )));

    exit( 0 );
}
Esempio n. 2
0
File: simspf.c Progetto: simta/simta
    int
main( int ac, char *av[ ] )
{
    struct addrinfo     *addrinfo;
    struct addrinfo     hints;
    const char          *addrlookup, *ehlo;
    struct spf          *spf;

    if ( ac < 2 ) {
        fprintf( stderr, "Usage:\t\t%s <email> [ip]\n", av[ 0 ] );
        exit( 1 );
    }

    if ( simta_read_config( SIMTA_FILE_CONFIG ) < 0 ) {
        exit( 1 );
    }

    if ( simta_config( ) != 0 ) {
        exit( 1 );
    }

    simta_openlog( 0, LOG_PERROR );

    simta_debug = 8;

    if ( ac < 3 ) {
        addrlookup = "255.255.255.255";
    } else {
        addrlookup = av[ 2 ];
    }

    if ( ac < 4 ) {
        ehlo = "tallis.marwnad.com";
    } else {
        ehlo = av[ 3 ];
    }

    memset( &hints, 0, sizeof( struct addrinfo ));
    hints.ai_family = AF_UNSPEC;
    hints.ai_flags = AI_NUMERICSERV;
    getaddrinfo( addrlookup, NULL, &hints, &addrinfo );

    spf = spf_lookup( ehlo, av[ 1 ], addrinfo->ai_addr );
    printf( "SPF result: %s\n", spf_result_str( spf->spf_result ));

    exit( 0 );
}
Esempio n. 3
0
    int
main( int argc, char *argv[])
{
    struct envelope	*env;

    const char		*sender = "*****@*****.**";
    int			c;
    int			nextargc = 1;
    int			exp_level = 0;
    int			error = 0;

    extern int          optind;
    extern char         *optarg;

    simta_debug 	= 1;
    simta_expand_debug	= 1;

    while ((c = getopt(argc, argv, "f:x:")) != EOF)
    {
	switch (c)
	{
	case 'x':
	    if (( exp_level = atoi( optarg )) < 0 ) {
		error++;
	    }
	    nextargc = nextargc + 2;
	    break;

	case 'f':
	    sender = strdup( optarg );
	    nextargc = nextargc + 2;
	    break;

	default:
	    error++;
	    nextargc++;
	    break;
	}
    }
    if (( argc < 3 ) | ( error )) {
	fprintf( stderr, "Usage: %s [ -x level ] [-f sendermail] conf_file "
		"address\n", argv[ 0 ]);
	exit( EX_USAGE );
    }

    if ( simta_read_config( argv[ nextargc ] ) < 0 ) {
	fprintf( stderr, "simta_read_config error: %s\n", argv[ nextargc ] );
	exit( EX_DATAERR );
    }

    /* init simta config / defaults */
    if ( simta_config( ) != 0 ) {
	fprintf( stderr, "simta_config error\n" );
	exit( EX_DATAERR );
    }

    simta_openlog( 0, 0 );

    env = env_create( NULL, "DEAD60FF", sender, NULL );

    env->e_n_exp_level = exp_level;

    do {
	nextargc++;

	printf( "Original Recipient: %s\n", argv[ nextargc ]);
	env_recipient( env, argv[ nextargc ]);

    } while ( nextargc < argc - 1 );

    if ( expand( env ) != 0 ) {
	return( 1 );
    }
    env_free( env );

    return( 0 );
}