{ "saslmech", SASLminc(-5) },
#define USERSW 39
{ "user", SASLminc(-4) },
+#define PORTSW 40
+ { "port server port name/number", 4 },
{ NULL, 0 }
};
static int sasl=0; /* Use SASL auth for SMTP */
static char *saslmech=NULL; /* Force use of particular SASL mech */
static char *user=NULL; /* Authenticate as this user */
+static char *port="smtp"; /* Name of server port for SMTP */
static unsigned msgflags = 0; /* what we've seen */
if (!(user = *argp++) || *user == '-')
adios (NULL, "missing argument to %s", argp[-2]);
continue;
+
+ case PORTSW:
+ if (!(port = *argp++) || *port == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ continue;
}
}
if (msg)
if ((out = fopen (fill_in ? fill_in : "/dev/null", "w")) == NULL)
adios ("/dev/null", "unable to open");
} else {
- strncpy (tmpfil, m_scratch ("", m_maildir (invo_name)),
- sizeof(tmpfil));
- if ((out = fopen (tmpfil, "w")) == NULL) {
- strncpy (tmpfil, m_tmpfil (invo_name), sizeof(tmpfil));
- if ((out = fopen (tmpfil, "w")) == NULL)
- adios (tmpfil, "unable to create");
- }
+ char *cp = m_mktemp(m_maildir(invo_name), NULL, &out);
+ if (cp == NULL) {
+ cp = m_mktemp2(NULL, invo_name, NULL, &out);
+ if (cp == NULL) {
+ adios ("post", "unable to create temporary file");
+ }
+ }
+ strncpy(tmpfil, cp, sizeof(tmpfil));
chmod (tmpfil, 0600);
}
}
if (verbose)
printf (partno ? "Partial Message #%s Processed\n" : "Message Processed\n",
partno);
- return done (0);
+ done (0);
+ return 1;
}
int count, grp, i, keep;
char *cp, *pp, *qp;
char namep[BUFSIZ];
- struct mailname *mp, *np;
+ struct mailname *mp = NULL, *np = NULL;
struct headers *hdr;
while (*str == ' ' || *str == '\t')
pid_t child_id;
char *vec[6];
FILE *out;
+ char *tfile = NULL;
- strncpy (bccfil, m_tmpfil ("bccs"), sizeof(bccfil));
- if ((out = fopen (bccfil, "w")) == NULL)
- adios (bccfil, "unable to create");
+ tfile = m_mktemp2(NULL, "bccs", NULL, &out);
+ if (tfile == NULL) adios("bcc", "unable to create temporary file");
chmod (bccfil, 0600);
+ strncpy (bccfil, tfile, sizeof(bccfil));
fprintf (out, "Date: %s\n", dtime (&tclock, 0));
if (msgid)
find_prefix (void)
{
int len, result;
- char buffer[BUFSIZ];
+ unsigned char buffer[BUFSIZ];
FILE *in;
if ((in = fopen (tmpfil, "r")) == NULL)
sigon ();
- if (rp_isbad (retval = sm_init (clientsw, serversw, watch, verbose,
+ if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch, verbose,
snoop, onex, queued, sasl, saslmech,
user))
|| rp_isbad (retval = sm_winit (smtpmode, from)))
sigon ();
if (!whomsw || checksw)
- if (rp_isbad (retval = sm_init (clientsw, serversw, watch, verbose, snoop, 0,
- queued, sasl, saslmech, user))
+ if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch,
+ verbose, snoop, 0, queued, sasl,
+ saslmech, user))
|| rp_isbad (retval = sm_winit (smtpmode, from)))
die (NULL, "problem initializing server; %s", rp_string (retval));