diff options
author | joshua stein <jcs@cvs.openbsd.org> | 2006-05-15 16:47:49 +0000 |
---|---|---|
committer | joshua stein <jcs@cvs.openbsd.org> | 2006-05-15 16:47:49 +0000 |
commit | c4df224909d72da0dc573104f68a27980d15affa (patch) | |
tree | d4873e0365bba109a274f69ce495febf076274e1 | |
parent | abd851016b74505bf9c1efd01856ad44a5d77a3d (diff) |
add an -h option to override the hostname that is reported in the
SMTP banner
ok beck@
-rw-r--r-- | libexec/spamd/spamd.8 | 5 | ||||
-rw-r--r-- | libexec/spamd/spamd.c | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/libexec/spamd/spamd.8 b/libexec/spamd/spamd.8 index 41ded1b36cb..527297ed1cf 100644 --- a/libexec/spamd/spamd.8 +++ b/libexec/spamd/spamd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: spamd.8,v 1.59 2005/12/01 15:21:16 tom Exp $ +.\" $OpenBSD: spamd.8,v 1.60 2006/05/15 16:47:48 jcs Exp $ .\" .\" Copyright (c) 2002 Theo de Raadt. All rights reserved. .\" @@ -36,6 +36,7 @@ .Op Fl b Ar address .Op Fl c Ar maxcon .Op Fl G Ar passtime:greyexp:whiteexp +.Op Fl h Ar hostname .Op Fl n Ar name .Op Fl p Ar port .Op Fl r Ar reply @@ -96,6 +97,8 @@ to 864 (hours, approximately 36 days). Greylisting mode; see .Sx GREYLISTING below. +.It Fl h Ar hostname +The hostname that is reported in the SMTP banner. .It Fl n Ar name The SMTP version banner that is reported upon initial connection. .It Fl p Ar port diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c index 50817fe6c0e..799458de338 100644 --- a/libexec/spamd/spamd.c +++ b/libexec/spamd/spamd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spamd.c,v 1.82 2006/03/14 22:49:41 beck Exp $ */ +/* $OpenBSD: spamd.c,v 1.83 2006/05/15 16:47:48 jcs Exp $ */ /* * Copyright (c) 2002 Theo de Raadt. All rights reserved. @@ -144,7 +144,7 @@ usage(void) fprintf(stderr, "usage: spamd [-45dgv] [-B maxblack] [-b address] [-c maxcon]\n"); fprintf(stderr, - " [-G mins:hours:hours] [-n name] [-p port]\n"); + " [-G mins:hours:hours] [-h host] [-n name] [-p port]\n"); fprintf(stderr, " [-r reply] [-S secs] [-s secs] [-w window]\n"); exit(1); @@ -957,7 +957,7 @@ main(int argc, char *argv[]) if (gethostname(hostname, sizeof hostname) == -1) err(1, "gethostname"); - while ((ch = getopt(argc, argv, "45b:c:B:p:dgG:r:s:S:n:vw:")) != -1) { + while ((ch = getopt(argc, argv, "45b:c:B:p:dgG:h:r:s:S:n:vw:")) != -1) { switch (ch) { case '4': nreply = "450"; @@ -999,6 +999,12 @@ main(int argc, char *argv[]) /* convert to seconds from hours */ greyexp *= (60 * 60); break; + case 'h': + bzero(&hostname, sizeof(hostname)); + if (strlcpy(hostname, optarg, sizeof(hostname)) >= + sizeof(hostname)) + errx(1, "-h arg too long"); + break; case 'r': reply = optarg; break; |