Ejemplo n.º 1
0
END_TEST

START_TEST(test_build_hostname)
{
	char data[256];
	char buf[1024];
	char *topdomain = "a.c";
	int buflen;
	int i;

	for (i = 0; i < sizeof(data); i++) {
		data[i] = i & 0xFF;
	}

	buflen = sizeof(buf);

	for (i = 1; i < sizeof(data); i++) {
		int len = build_hostname(buf, buflen, data, i, topdomain, get_base32_encoder(), sizeof(buf));

		fail_if(len > i);
		fail_if(strstr(buf, ".."), "Found double dots when encoding data len %d! buf: %s", i, buf);
	}
}
Ejemplo n.º 2
0
int smtp_start(int notify)
{
    char hostname[BIG_BUF];

    clean_var("smtp-last-error", VAR_TEMP);
    notify_type = notify;

    my_socket = -1;
    servercaps = 0;
    receipients = 0;

    build_hostname(hostname,sizeof(hostname));

    if(!try_connect_EHLO(hostname)) {
        if(!try_connect_HELO(hostname)) {
            if(my_socket != -1)
                sock_close(my_socket);
            my_socket = -1;
            set_var("smtp-last-error", "Error connecting to SMTP server.", VAR_TEMP);
            return 0;
        }
    }
    return 1;
}