#include <h/netsec.h>
#include <sys/socket.h>
+#include "sbr/base64.h"
/*
* This module implements an interface to SendMail very similar
static int sm_addrs = 0;
static int sm_child = NOTOK;
static int sm_debug = 0;
-static int sm_nl = TRUE;
+static bool sm_nl = true;
static int sm_verbose = 0;
static netsec_context *nsc = NULL;
char *errstr, *chosen_server;
if (watch)
- verbose = TRUE;
+ verbose = true;
sm_verbose = verbose;
sm_debug = debug;
char *vec[15], *errstr;
if (watch)
- verbose = TRUE;
+ verbose = true;
sm_verbose = verbose;
sm_debug = debug;
return sm_ierror ("no pipes");
}
- for (i = 0; (sm_child = fork ()) == NOTOK && i < 5; i++)
- sleep (5);
-
+ sm_child = fork();
switch (sm_child) {
case NOTOK:
close (pdo[0]);
close (pdi[1]);
close (pdo[0]);
- netsec_set_fd(nsc, pdi[i], pdo[1]);
+ netsec_set_fd(nsc, pdi[0], pdo[1]);
netsec_set_timeout(nsc, SM_OPEN);
result = smhear ();
switch (result) {
{
switch (smtalk (SM_DATA, "DATA")) {
case 354:
- sm_nl = TRUE;
+ sm_nl = true;
return RP_OK;
case 451:
result = sm_wstream (buffer, len);
- return (result == NOTOK ? RP_BHST : RP_OK);
+ return result == NOTOK ? RP_BHST : RP_OK;
}
int
sm_wtend (void)
{
- if (sm_wstream ((char *) NULL, 0) == NOTOK)
+ if (sm_wstream(NULL, 0) == NOTOK)
return RP_BHST;
switch (smtalk (SM_DOT + 3 * sm_addrs, ".")) {
status = OK;
}
- return (status ? RP_BHST : RP_OK);
+ return status ? RP_BHST : RP_OK;
}
for (bp = buffer; bp && len > 0; bp++, len--) {
switch (*bp) {
case '\n':
- sm_nl = TRUE;
+ sm_nl = true;
if (netsec_write(nsc, "\r", 1, &errstr) != OK) {
sm_nerror(errstr);
return NOTOK;
/* FALLTHRU */
default:
- sm_nl = FALSE;
+ sm_nl = false;
}
if (netsec_write(nsc, bp, 1, &errstr) != OK) {
sm_nerror(errstr);
static int
smhear (void)
{
- int i, code, cont, more;
+ int i, code;
+ bool cont, more;
size_t buflen, rc;
unsigned char *bp;
char *rp;
rp = sm_reply.text;
rc = sizeof(sm_reply.text) - 1;
- for (more = FALSE; (buffer = netsec_readline(nsc, &buflen,
+ for (more = false; (buffer = netsec_readline(nsc, &buflen,
&errstr)) != NULL ; ) {
if (doingEHLO
for (; buflen > 0 && (!isascii (*bp) || !isdigit (*bp)); bp++, buflen--)
continue;
- cont = FALSE;
+ cont = false;
code = atoi ((char *) bp);
bp += 3, buflen -= 3;
for (; buflen > 0 && isspace (*bp); bp++, buflen--)
continue;
if (buflen > 0 && *bp == '-') {
- cont = TRUE;
+ cont = true;
bp++, buflen--;
for (; buflen > 0 && isspace (*bp); bp++, buflen--)
continue;
if (more) {
if (code != sm_reply.code || cont)
continue;
- more = FALSE;
+ more = false;
} else {
sm_reply.code = code;
more = cont;