[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
smtp command-line arguments and illegal hostnames
This scheduler file makes smtp very upset:
i 246527-2
o 75
l <92Oct19.115648edt.246527-2@descartes.uwaterloo.ca>
e <mjlebing>
s local - @descartes.uwaterloo.ca:mjlebing@undergrad.math.uwaterloo.ca 3470
r smtp -node.gts.org dbstmars@-node.gts.org 3470
m
Received: by descartes.uwaterloo.ca id <246527-2>; Mon, 19 Oct 1992 11:56:48 -0400
From: <mjlebing@undergrad.math.uwaterloo.ca>
To: dbstmars@-node.gts.org
Subject: Poland (??)
Message-Id: <92Oct19.115648edt.246527-2@descartes.uwaterloo.ca>
Date: Mon, 19 Oct 1992 10:22:56 -0400
This appears in the scheduler log:
/software/zmailer/distribution/mailbin/ta/smtp: unknown option -n
/software/zmailer/distribution/mailbin/ta/smtp: unknown option -o
/software/zmailer/distribution/mailbin/ta/smtp: unknown option -.
/software/zmailer/distribution/mailbin/ta/smtp: unknown option -g
/software/zmailer/distribution/mailbin/ta/smtp: unknown option -t
/software/zmailer/distribution/mailbin/ta/smtp: unknown option -.
/software/zmailer/distribution/mailbin/ta/smtp: unknown option -o
/software/zmailer/distribution/mailbin/ta/smtp: unknown option -g
Usage: /software/zmailer/distribution/mailbin/ta/smtp [-c channel] host
The problem is that any hostname starting with a "-" is interpreted by
the smtp program as a set of arguments. Such hostnames are illegal, but
that is no reason to generate megabytes of error output in the log file.
This patch to smtp.c lets one do "smtp -t host" instead of "smtp host".
You need to change scheduler.conf as well.
*** 1.1 1992/11/03 18:22:16
--- smtp.c 1992/11/03 19:00:42
***************
*** 114,120 ****
char *argv[];
{
char file[MAXPATHLEN+1];
! char *channel, *host;
int i, fd, errflg, c, smtpstatus;
FILE *smtpfp[2];
struct ctldesc *dp;
--- 114,120 ----
char *argv[];
{
char file[MAXPATHLEN+1];
! char *channel, *host = NULL;
int i, fd, errflg, c, smtpstatus;
FILE *smtpfp[2];
struct ctldesc *dp;
***************
*** 164,170 ****
myhostname[0] = '\0';
remotemsg[0] = '\0';
remotehost[0] = '\0';
! while ((c = getopt(argc, argv, "c:deh:l:rsxDT:V")) != EOF) {
switch (c) {
case 'c': /* specify channel scanned for */
channel = emalloc(strlen(optarg)+1);
--- 164,170 ----
myhostname[0] = '\0';
remotemsg[0] = '\0';
remotehost[0] = '\0';
! while ((c = getopt(argc, argv, "c:deh:l:rst:xDT:V")) != EOF) {
switch (c) {
case 'c': /* specify channel scanned for */
channel = emalloc(strlen(optarg)+1);
***************
*** 196,201 ****
--- 196,205 ----
case 's': /* report status to command line */
statusreport = 1;
break;
+ case 't':
+ host = emalloc(strlen(optarg) + 1);
+ (void) strcpy(host, optarg);
+ break;
case 'x': /* don't use MX records lookups */
noMX = 1;
break;
***************
*** 219,231 ****
break;
}
}
! if (errflg || optind != argc - 1) {
(void) fprintf(stderr,
! "Usage: %s [-c channel] host\n", argv[0]);
exit(EX_USAGE);
}
! host = emalloc(strlen(argv[optind]) + 1);
! (void) strcpy(host, argv[optind]);
if (conndebug && !debug) {
(void) smtpconn(host, smtpfp);
--- 223,237 ----
break;
}
}
! if (errflg || optind != argc - (host ? 0 : 1)) {
(void) fprintf(stderr,
! "Usage: %s [-c channel] [-t] host\n", argv[0]);
exit(EX_USAGE);
}
! if (!host) {
! host = emalloc(strlen(argv[optind]) + 1);
! (void) strcpy(host, argv[optind]);
! }
if (conndebug && !debug) {
(void) smtpconn(host, smtpfp);