exit(0);
}
close(mypipe[1]);
- mygetline(mypipe[0]);
+ atf_utils_readline(mypipe[0]);
int sock;
do {
init_sockfd(&sock, "127.0.0.1", 25678);
int s = fakesmtp(smtppipe[1]);
int c;
struct sockaddr_in cl;
- char *reply;
socklen_t clsize = 0;
c = accept(s, (struct sockaddr *) &cl, &clsize);
if (c == -1)
err(5, "accept()");
dprintf(c, "220 me fake smtp\n");
- reply = mygetline(c);
- printf("%s", reply);
- dprintf(c,
+ const char *replies[] = {
"250-hostname.net\n"
"250-PIPELINEING\n"
"250-SIZE 20480000\n"
"250-8BITMIME\n"
"250-DSN\n"
"250-SMTPUTF8\n"
- "250 CHUNKING\n");
- reply = mygetline(c);
- printf("%s", reply);
- dprintf(c, "221 2.0.0 bye\n");
+ "250 CHUNKING\n",
+ "221 2.0.0 bye\n",
+ };
+ read_print_reply(c, replies, NELEM(replies));
exit(0);
}
close(smtppipe[1]);
- mygetline(smtppipe[0]);
+ atf_utils_readline(smtppipe[0]);
int sockfd;
int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname");
ATF_REQUIRE_EQ(ret, 0);
exit(0);
}
close(smtppipe[1]);
- mygetline(smtppipe[0]);
+ atf_utils_readline(smtppipe[0]);
int sockfd;
int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname");
ATF_REQUIRE_EQ(ret, MLMMJ_CONNECT);
int s = fakesmtp(smtppipe[1]);
int c;
struct sockaddr_in cl;
- char *reply;
socklen_t clsize = 0;
c = accept(s, (struct sockaddr *) &cl, &clsize);
if (c == -1)
err(5, "accept()");
dprintf(c, "220 me fake smtp\n");
- reply = mygetline(c);
- printf("%s", reply);
- dprintf(c, "501 nop nope\n");
+ const char *rep = "501 nop nope\n";
+ read_print_reply(c, &rep, 1);
exit(0);
}
close(smtppipe[1]);
- mygetline(smtppipe[0]);
+ atf_utils_readline(smtppipe[0]);
int sockfd;
int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname");
ATF_REQUIRE_EQ(ret, MLMMJ_EHLO);
int s = fakesmtp(smtppipe[1]);
int c;
struct sockaddr_in cl;
- char *reply;
socklen_t clsize = 0;
c = accept(s, (struct sockaddr *) &cl, &clsize);
if (c == -1)
err(5, "accept()");
dprintf(c, "220 me fake smtp\n");
- reply = mygetline(c);
- printf("%s", reply);
- dprintf(c, "801 meh\n");
- reply = mygetline(c);
- printf("%s", reply);
+ const char *replies [] = {
+ "801 meh\n",
+ NULL,
+ };
+ read_print_reply(c, replies, NELEM(replies));
close(c);
c = accept(s, (struct sockaddr *) &cl, &clsize);
if (c == -1)
err(5, "accept()");
dprintf(c, "220 me fake smtp\n");
- reply = mygetline(c);
- printf("%s", reply);
- dprintf(c, "250 OK\n");
+ const char *rep = "250 OK\n";
+ read_print_reply(c, &rep, 1);
exit(0);
}
close(smtppipe[1]);
- mygetline(smtppipe[0]);
+ atf_utils_readline(smtppipe[0]);
int sockfd;
int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname");
ATF_REQUIRE_EQ(ret, 0);
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
- char *reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- /* nope */
- dprintf(smtppipe[0], "550 2.1.0 kO\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
+ const char *replies [] = {
+ "550 2.1.0 kO\n",
+ NULL,
+ };
+ read_print_reply(smtppipe[0], replies, NELEM(replies));
exit(0);
}
close(smtppipe[0]);
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
- char *reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 Ok\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "550 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
+ const char *replies [] = {
+ "250 2.1.0 Ok\n",
+ "550 2.1.0 OK\n",
+ NULL,
+ };
+ read_print_reply(smtppipe[0], replies, NELEM(replies));
exit(0);
}
close(smtppipe[0]);
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
- char *reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 Ok\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "550 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
+ const char *replies [] = {
+ "250 2.1.0 Ok\n",
+ "250 2.1.0 OK\n",
+ "550 2.1.0 OK\n",
+ NULL,
+ };
+ read_print_reply(smtppipe[0], replies, NELEM(replies));
exit(0);
}
close(smtppipe[0]);
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
- char *reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 Ok\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "550 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
+ const char *replies [] = {
+ "250 2.1.0 Ok\n",
+ "250 2.1.0 OK\n",
+ "550 2.1.0 OK\n",
+ NULL,
+ };
+ read_print_reply(smtppipe[0], replies, NELEM(replies));
exit(0);
}
close(smtppipe[0]);
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
- char *reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 Ok\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
+ const char *replies [] = {
+ "250 2.1.0 OK\n",
+ "250 2.1.0 OK\n",
+ "250 2.1.0 OK\n",
+ NULL,
+ };
+ read_print_reply(smtppipe[0], replies, NELEM(replies));
exit(0);
}
close(smtppipe[0]);
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
- char *reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 Ok\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "350 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "350 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
+ const char *replies [] = {
+ "250 2.1.0 OK\n",
+ "250 2.1.0 OK\n",
+ "350 2.1.0 OK\n",
+ NULL,
+ NULL,
+ NULL,
+ "350 2.1.0 OK\n",
+ NULL,
+ };
+ read_print_reply(smtppipe[0], replies, NELEM(replies));
exit(0);
}
close(smtppipe[0]);
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
- char *reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 Ok\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "350 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
+ const char *replies [] = {
+ "250 2.1.0 OK\n",
+ "250 2.1.0 OK\n",
+ "350 2.1.0 OK\n",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ "250 2.1.0 OK\n",
+ };
+ read_print_reply(smtppipe[0], replies, NELEM(replies));
exit(0);
}
close(smtppipe[0]);
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
- char *reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 Ok\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "350 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
+ const char *replies [] = {
+ "250 2.1.0 OK\n",
+ "250 2.1.0 OK\n",
+ "350 2.1.0 OK\n",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ "250 2.1.0 OK\n",
+ };
+ read_print_reply(smtppipe[0], replies, NELEM(replies));
exit(0);
}
close(smtppipe[0]);
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p = atf_utils_fork();
if (p == 0) {
- char *reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 Ok\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "350 2.1.0 OK\n");
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- reply = mygetline(smtppipe[0]);
- printf("%s", reply);
- dprintf(smtppipe[0], "250 2.1.0 OK\n");
+ const char *replies [] = {
+ "250 2.1.0 OK\n",
+ "250 2.1.0 OK\n",
+ "350 2.1.0 OK\n",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ "250 2.1.0 OK\n",
+ };
+ read_print_reply(smtppipe[0], replies, NELEM(replies));
exit(0);
}
close(smtppipe[0]);