summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2001-01-21 22:17:06 +0000
committergshapiro <gshapiro@FreeBSD.org>2001-01-21 22:17:06 +0000
commit167a83e7b8733416154f871e39e86ba77eb1554d (patch)
tree4f725bdbff499cf7343d2eaeec15f8a0f0926140 /contrib
parentf84ac9120cb7d9f087e5dcb863c4bf25ba2985e6 (diff)
downloadFreeBSD-src-167a83e7b8733416154f871e39e86ba77eb1554d.zip
FreeBSD-src-167a83e7b8733416154f871e39e86ba77eb1554d.tar.gz
Import sendmail 8.11.2
Diffstat (limited to 'contrib')
-rw-r--r--contrib/sendmail/INSTALL7
-rw-r--r--contrib/sendmail/PGPKEYS145
-rw-r--r--contrib/sendmail/RELEASE_NOTES137
-rw-r--r--contrib/sendmail/cf/README106
-rw-r--r--contrib/sendmail/cf/cf/Makefile6
-rw-r--r--contrib/sendmail/cf/feature/dnsbl.m44
-rw-r--r--contrib/sendmail/cf/m4/proto.m418
-rw-r--r--contrib/sendmail/cf/m4/version.m44
-rw-r--r--contrib/sendmail/cf/ostype/aix5.m418
-rwxr-xr-xcontrib/sendmail/contrib/buildvirtuser167
-rw-r--r--contrib/sendmail/contrib/domainmap.m418
-rw-r--r--contrib/sendmail/contrib/qtool.86
-rwxr-xr-xcontrib/sendmail/contrib/qtool.pl7
-rw-r--r--contrib/sendmail/doc/op/op.me37
-rw-r--r--contrib/sendmail/include/libsmdb/smdb.h20
-rw-r--r--contrib/sendmail/include/sendmail/pathnames.h2
-rw-r--r--contrib/sendmail/include/sendmail/sendmail.h5
-rw-r--r--contrib/sendmail/libmilter/Makefile.m49
-rw-r--r--contrib/sendmail/libmilter/README6
-rw-r--r--contrib/sendmail/libmilter/comm.c4
-rw-r--r--contrib/sendmail/libmilter/engine.c6
-rw-r--r--contrib/sendmail/libmilter/handler.c8
-rw-r--r--contrib/sendmail/libmilter/libmilter.h9
-rw-r--r--contrib/sendmail/libmilter/listener.c44
-rw-r--r--contrib/sendmail/libmilter/signal.c9
-rw-r--r--contrib/sendmail/libmilter/sm_gethost.c16
-rw-r--r--contrib/sendmail/libsmdb/smdb1.c50
-rw-r--r--contrib/sendmail/libsmdb/smdb2.c50
-rw-r--r--contrib/sendmail/libsmdb/smndbm.c52
-rw-r--r--contrib/sendmail/libsmutil/lockfile.c5
-rw-r--r--contrib/sendmail/mail.local/mail.local.810
-rw-r--r--contrib/sendmail/mail.local/mail.local.c6
-rw-r--r--contrib/sendmail/mailstats/mailstats.812
-rw-r--r--contrib/sendmail/makemap/makemap.811
-rw-r--r--contrib/sendmail/makemap/makemap.c43
-rw-r--r--contrib/sendmail/praliases/praliases.86
-rw-r--r--contrib/sendmail/praliases/praliases.c43
-rw-r--r--contrib/sendmail/rmail/rmail.818
-rw-r--r--contrib/sendmail/rmail/rmail.c5
-rw-r--r--contrib/sendmail/smrsh/README6
-rw-r--r--contrib/sendmail/smrsh/smrsh.811
-rw-r--r--contrib/sendmail/smrsh/smrsh.c8
-rw-r--r--contrib/sendmail/src/README59
-rw-r--r--contrib/sendmail/src/alias.c6
-rw-r--r--contrib/sendmail/src/aliases23
-rw-r--r--contrib/sendmail/src/aliases.56
-rw-r--r--contrib/sendmail/src/collect.c11
-rw-r--r--contrib/sendmail/src/conf.c114
-rw-r--r--contrib/sendmail/src/conf.h16
-rw-r--r--contrib/sendmail/src/control.c28
-rw-r--r--contrib/sendmail/src/daemon.c558
-rw-r--r--contrib/sendmail/src/deliver.c165
-rw-r--r--contrib/sendmail/src/domain.c35
-rw-r--r--contrib/sendmail/src/envelope.c10
-rw-r--r--contrib/sendmail/src/headers.c69
-rw-r--r--contrib/sendmail/src/macro.c34
-rw-r--r--contrib/sendmail/src/mailq.16
-rw-r--r--contrib/sendmail/src/main.c61
-rw-r--r--contrib/sendmail/src/map.c64
-rw-r--r--contrib/sendmail/src/mci.c16
-rw-r--r--contrib/sendmail/src/milter.c158
-rw-r--r--contrib/sendmail/src/mime.c14
-rw-r--r--contrib/sendmail/src/newaliases.16
-rw-r--r--contrib/sendmail/src/parseaddr.c15
-rw-r--r--contrib/sendmail/src/queue.c60
-rw-r--r--contrib/sendmail/src/readcf.c81
-rw-r--r--contrib/sendmail/src/savemail.c14
-rw-r--r--contrib/sendmail/src/sendmail.86
-rw-r--r--contrib/sendmail/src/sendmail.h27
-rw-r--r--contrib/sendmail/src/sfsasl.c70
-rw-r--r--contrib/sendmail/src/srvrsmtp.c50
-rw-r--r--contrib/sendmail/src/stab.c11
-rw-r--r--contrib/sendmail/src/timers.c7
-rw-r--r--contrib/sendmail/src/usersmtp.c18
-rw-r--r--contrib/sendmail/src/util.c76
-rw-r--r--contrib/sendmail/src/version.c4
-rw-r--r--contrib/sendmail/vacation/vacation.126
-rw-r--r--contrib/sendmail/vacation/vacation.c252
78 files changed, 2405 insertions, 925 deletions
diff --git a/contrib/sendmail/INSTALL b/contrib/sendmail/INSTALL
index 90c919a..3286207 100644
--- a/contrib/sendmail/INSTALL
+++ b/contrib/sendmail/INSTALL
@@ -30,4 +30,9 @@ On many environments this will do everything for you, no fuss, no muss.
read the README in the utility's directory. When you are ready to install
it, back up your installed version and type "sh Build install".
-$Revision: 8.3.16.1 $, Last updated $Date: 2000/05/09 20:20:44 $
+8. If you are upgrading from an older version of sendmail and are using any
+ database maps, be sure to rebuild them with the new version of makemap,
+ in case you are now using a different (and thereby incompatible) version
+ of Berkeley DB.
+
+$Revision: 8.3.16.2 $, Last updated $Date: 2000/12/30 06:24:03 $
diff --git a/contrib/sendmail/PGPKEYS b/contrib/sendmail/PGPKEYS
index c0db3d7..dc83764 100644
--- a/contrib/sendmail/PGPKEYS
+++ b/contrib/sendmail/PGPKEYS
@@ -62,6 +62,149 @@ FrAdFBf1y33xWo58zRsg2u2h
-----END PGP PUBLIC KEY BLOCK-----
Type Bits KeyID Created Expires Algorithm Use
+pub 1024 0xCC374F2D 2000-12-14 ---------- RSA Sign & Encrypt
+f16 Fingerprint16 = 59 AF DC 3E A2 7D 29 56 89 FA 25 70 90 0D 7E C1
+uid Sendmail Signing Key/2001 <sendmail@Sendmail.ORG>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: PGPfreeware 5.0i for non-commercial use
+
+mQCNAzo5SykAAAEEANNKa1jxgODYsmC5w2FJj14JFX3MnF9yt+NblOrqXvjzs8fp
+l4qWCoEOsN6tueeNRAytrGTUFe5M+fJ/ddx9yRKuzjv6WxSeYsWHzXxMD2M6WWyn
+eCK43LhCAd1uuNoYrTdJFnADOrz7YiMu/N8+8IvBhM5ozEH7pzgi20fMN08tAAUR
+tDFTZW5kbWFpbCBTaWduaW5nIEtleS8yMDAxIDxzZW5kbWFpbEBTZW5kbWFpbC5P
+Ukc+iQCVAwUQOjlLKTgi20fMN08tAQF1YgP7BmBeA8wCY8sNlENCgMbYcgkqrmtO
+aDzCRwALiIDEC63i317iiopRq8wH8ZQcJewvmQDQKWgdZnpJbpAONLR8gzk0t995
+0wKHRgtGtzR8x8RtSXZ9yiC4AjxkLXogaOYtJk+ZXayX1VFCJ0lMoxRsNtTfXyHK
+RN0lMnJwaRPE3FqJAJUDBRA6OU38nBy94uNcVjUBARTzA/9rapch15EjSgZIywSY
+e53l0EfoqsUqKzCSoRGZqv+hJzpRVQ+R+D037pSV07OItK2q0nYGLZqH5ApLgXAG
+/SPlEYPnUzCooijIr/RsLU954lp1HDNuqUZfUs1ukk/f7wHmshsP3LS6zyvqnHR+
+va9fzU3wo5ZRv1ItWIL3b68+uIkAlQMFEDo5TglvUpPYo5umVQEBbqAD/Aj63aIn
+4f6W57E7APvhkP0FhWcrCp9sGu0+EdUP2lnn7KEn02D1hwx4mDLcJcFxikfXXVvh
++Cfpr54oP0CWNpcpXVssS5CZoYoC8e8W0YoVkvYnxmHFDjnGRzwKDT88FdZYnbiS
+JWxlUkcOs45bOdOTE7pIeBwe9MJK/zCwrbmYiQCVAwUQOjlOGO9YlmTUMuGdAQGy
+YwP/fVIA/Y7SH+MxlALWNHOVOiPF6KdrZxOoB/Ya1G8uNCS5PttePZm/ZSoyVLSX
+QsJG1Xe/3YPXDobuPdRuC+Kpzli6upCHG0jbsH7/m/EPyATxPP6GvpU/eVK1a3el
+8aLl7J0m6NSEh349AbFAzCRhrRl9N/jIPt7rys61ELIMp/GJAJUDBRA6OU4wfEtn
+baAOFWMBAYELBACtu0kG7v4QYs2lJXIpdw7Bwl2/WNyH8mFhrqNgbAE9+Fsh4HAP
+nCBHf3qbjH4/Q3j4QNkDLor2HYIhnW8Hz21At//5/eEm/uJj2vsOjfKFYpGtwf/L
+VHQCQDbNFrxi8pLtwQARNL8M0ONT1rxNg5xyv0/3IWeo9GblkV3hdKO1sYkAlQMF
+EDo5TlnAKcpAFvTM6QEB9s4D/23DDLInFj4NoaO0MI+ZLWo1M8SXd/sWC32IYY+P
+dqABtONUNvVnaz2wSZxb2tKXcuju4DtsMrZFttcEQ6W4zaaGpcg6Hq6UqHGL0UAE
+2tkcJePvkIhJ/FokoEQnoAlj8IdxjK56gCT4Z7OOSmQEcNTcjmH5Z1AZUnTkIImT
+hFRuiQCVAwUQOjlOqNbgof5PvirdAQGzAQP7BtqC0bhCybf+P4ESP7XwSYVuSZvM
+LLrpkA017MQgf5BCHfh6x/r7NxGH4OOTnZwcKQJHJ0NzAxtmWCe3YjxLHMUlfRcK
+MIBQF5UhPTOkCo2XFDNIuQ/Tayj1D3Go1JHSRqfxe8et2U1SZi74JMMo+B7o+utX
+dUNzbv5QbD7yydGJAJUDBRA6OWaRmAfmW9hLWSEBAegOBACgsFNvkidMRX08xGEN
+oX3elJj5Ib/zYYvR7Ui/b27haw9KtuUNct0aRtb+MAb9sXb+0hphDR2W//AxSDgG
+Qh6ZiEO9c0xw74XX7MrSpwcgom4jJLxGN0fEx1YGmMF1LGmmlE8UWC+FJdVVnW8v
+m98v3zEmRaHvDnklGvFsgItw3okAlQMFEDo5anTObntw7cbX6wEBKGUD/0aIxmvb
+kwPlV27sCl6QGy+C3hIJTtz0go6wRh+X0wrP0G5c5OBlg12GqOYP/WlGEs7Qy8GU
+exXFZxF5kBtFgUiHLq5XxWsAv4DVyrtu3wtpFu9P+smKuMQWvUah5x2R5AdsyH2/
+/nn2tMcHqwsgwK/l2cd7ObtfZXoYyH4ZU+3SiQCVAwUQOjrpa88etQMiMnoBAQHp
+JgP9ENhWpB1jv9xrUDy6XCIEdx8hoSVFT/+PaiPhyRwEY1+sW6L68NeTPWnDAcuF
+y95sZlBl6xKIykf5sG0Cb8/Y8HMIIjuiet3nYTd4ehKE6/byOwwVNwe4zu65+kGz
+YT0NF8CaZ2zBFV9wM8JnM+BHshxu1X+4u57oTbenXCNBOmGJAEYEEBECAAYFAjo6
+70YACgkQAm4U2qPreYrl9QCfRFB0hJDrDCWjuVTFXdEg7/R7uKYAn2Aqn2DJ5eai
+Q5JHhAnY4uS8iOiciQCVAwUQOjt6hV8eyG+IDJ5VAQEMlAQAiMUmNGEmYcX74SLE
+LD46olA0CxMlOBARFCFd7SOG3vY8IKshHNr8D9fYhz6MulGOfJl0XXrcWWDW8KwS
+LPsJMIAB3NSe2h/ZEqnOp4A4E+AlNZJyGrmPwhBoNs4jsXSzlZTeOxh3GTJrCiMY
+qe9v9NJkntmjrubyUe0HZrM5tkmJAJUDBRA6Ovq+4dT8FObQdHEBAfO9A/9dP1q1
+bpbYRT23pqJLPWjXDKqld5dwaJy6SDyqi3kD+jtzWsmA6rRTWuA5Ykq/Ugj1CENl
+s/bgptFd38uMDh6F4WHpOGMcXx7OKqTzwlm87MBnuZ/rjqJDf+HwJWcwqebh9ADE
+k2acJjQBPOsOOmPatbnOSKGh8JbK/Xng7ZGHBYkAPwMFEDo7lA/OwoiMv2pMoREC
+uxoAoPrizznbyWF1kFGSzWOjPWdIkdMmAJ9xXra4pgV1uAKrRYE1zIOCp6TDcokA
+dQMFEDo7lwes4VzBBNt7HQEBivUC/iRk6/XsetmOW2RPqEIvOvleZSyNtmgkeMva
++Q57Js1jDNA6DZTperfbl6Mwt0eVnZxH59l7apSWwl7ZGsum5AjZr0cuWyX+gMg3
+wBLI6dG1a0+y4tCnBKfPHDSTqqMKGYkARgQQEQIABgUCOjuApgAKCRDbzEgBadC1
+viYIAJ90YPSCIMcIhcyzzdqwVSlpIMSp+wCdFZH4YnjW1eFfzfym5tSbxiRVWCaJ
+AJUDBRA6POfsAPLZCeu7G0EBAUUoBACQdVkXeAia2QuOD0J0OH5lSILg3xTam1Vp
+JXpj70m/kmlzAR71BIgCFTeTsg1IhY/08cLBqEwksv7nLt+1FSxHCNt8o+SLkA24
+iMIBb7JeOHxkP8QZdiBbLSEvEE+4Dak9LaxqlLvw+u+fxCmw9er610OTr5zUq5cb
+POpMdl91r4kAlQMFEDo9NvgGfl7Yv7VlaQEBdJ0EALPhVgdb1IkNKgd5QCM1rHz1
+SqXVH40tOrMuSx6g1eW5Sv1Eg+xwYsCx9jICzVFntXZic11oWUqEVV6icvKZ207z
+aWTVQneBGEBZXa1q+8WxaxPTfBgxhuxF7iKVBQ2JOzjPo8K43wHfZVP90iwFVJHm
+jJ6uIUj4EdMVJ1WwHbfG
+=XS0J
+-----END PGP PUBLIC KEY BLOCK-----
+
+Type Bits KeyID Created Expires Algorithm Use
+pub 1024 0xE35C5635 1999-12-13 ---------- RSA Sign & Encrypt
+f16 Fingerprint16 = 81 8C 58 EA 7A 9D 7C 1B 09 78 AC 5E EB 99 08 5D
+uid Sendmail Signing Key/2000 <sendmail@Sendmail.ORG>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: PGPfreeware 5.0i for non-commercial use
+
+mQCNAzhVRnYAAAEEALjBKz/mDHemTNA+hNjGcruAJm6Blc9ZIGHPthQWkFt0ca70
+w0U8TBbK/m03WdMvq+PaZAb8EG5uqXctZKwmWIIGB7nRBLLnj42er8XwUfAT8KNJ
+PQ1p9x9zFWZc3byC8ekg8l+CK/hJLFhGTSGjx8nHv+LvPis/mpwcveLjXFY1AAUR
+tDFTZW5kbWFpbCBTaWduaW5nIEtleS8yMDAwIDxzZW5kbWFpbEBTZW5kbWFpbC5P
+Ukc+iQCVAwUQOFVGdpwcveLjXFY1AQG2vgP/QRG6TqsmJgixf27F2IFgoJLUU+7C
+ZmD1qNT9yL/1JMbE8pnzxOk64w8D47ZiDwr9dp3EzH8EpmV/eIpxLNYV7/Y+W59J
+8+EY2T9mzVmp0YGOMFYt8lLVw6NKqya19adQ80dDzkkmwRHfY514+9+DPbc6TvHR
+jNzo0SuetBiWW+2JAJUDBRA4VUa8b1KT2KObplUBAbtYA/491EG5lsbr09oV0g/e
+RSfxliLj+lCJdQiicwYeqHX5dZeB04yz3wUFovIff8dY01KcITXBL9TtDfarz5Pl
+nelUg5cIlKn7kxCeUP0ggA/tz6Zlg3v/LkoIqsUqrodqscjLPt2JTWPJYWYaVjM9
+fqXiXRXlVcy2urx6uEucvkjYY4kAlQMFEDhVRs3vWJZk1DLhnQEBwoYD/1zxfMMP
+pqj3HV3d9q1esyvZdPACiAH+1CJVmtcIV8TjO5qYulxz2TEtd/JLqdYsgUgf2N8T
+/ClMtfEReSTmVNWIsINAA75P16uIkDYZ8Tmo4XYOf80voeOhWlAwpyLQGIN3GVX+
+gLmC/9Fw2wo0E3LsCrUfXREZQTSXMqIe3YPJiQCVAwUQOFVG8XxLZ22gDhVjAQEA
+SwQAuIEC9CZfKcxAImFBvwqfJYrnKtWPorEV3QtqAN4WaCLFvI8jZJEPJJEf61N9
+aucpO/qj6x/iwu2k92E/T5FRVUiFKzXZb5bWm+qI5c+ynBZq34s+qvAq7Sx0gXxJ
+qimu4ZekACORdeRsILzgRYwGHA45SRONvTY5t9xGoRrsQcuJAJUDBRA4VUm8zx61
+AyIyegEBAczRA/0UjYKC81NSK+a9XNl83ANI/o0TZfqpsjotHl+Gagb3NWQTFe/3
+AjkDovLk24fB7cPEwcj7Y4oX0g61pH3DAyPK+Zo1VbYTPSEU9ljVB042YLz12EMe
+c+eD6k2yC//vVK8BJ6Iefh/gXg7Mb+Dis1YBMg9d+23p901DJi6OeZqJK4kAlQMF
+EDhVTYtuAhsP7LmozwEBBGgEAIVaUCZ3hplEkX5yBBPOccaTV4uioK/8tzahAC9h
+kN8slolrnvj9fQFMFEltDZSzIqn2855JCT8+ZoIdmGsJ6SyIfv2vlunMIsNfZiy1
+jE3jTJ3KEX98fg1h0SBGyzsaMHJd/NzdRiXbmqC/yQOj8eO/RRK3okAPdliVzNx1
+BjpaiQCVAwUQOFVRDAx2JIpOldm1AQFRvQP/RquJhO+TZJI2nZPUiGsjwHVe/WNT
+SQM3nIVyO/mwCFqIPmzywqwn3OsC50S68Bif7PwMToFQKcgNUOwQtZNyp4aico2v
+VLkxjbpAorqdNDkALdwFWziWIHZRZQ1BVEQDXj5sRoHpsQCmNjrYHh8mFYeVcMv/
+QMRebEt4BRQDXgaJAJUDBRA4VVFnXx7Ib4gMnlUBAXANA/9tmgZGCOUtMC2Xwa1W
+iLhYPiq1aSKOuErkalryTUg98qEOQuRxGyunJOZ5cR6ynfJcZwV1N5CXlb7kv1el
+M4iixtcBcytgauH/hgmBOt3oG5jhDoVTaFhFwCXaKOLQJueKeV4AslohDRY4oRhk
+WIVt3oue1nGpNxzSNRIRE3Mgi4kAPwMFEDhVUa0EgEc5fjtIOhECFNwAoKOO0KUW
+ehHMvIkketv0s9213ojkAKCpp6gMpNRbz90FH6zoM9nsXd3H2okAlQMFEDhVUy8S
+pjY8FSuHJQEBsscD/3/P1dO/DohAsUx6e024AIoAqj+PFZXwhj1hkN6UoRRgD0Is
+x81+oDSrukhBlMvhRcGMEAnUltHk6FBXgIXaOPc8dbFyTEd4Gwyo0HH1aFxiS3LO
+cs74huxWaJGzWY8o5hHGItZ/sLRhrC5t3Rza87tMXRqBUNGmFeJbIkaJi4TdiQCV
+AwUQOFVV1wDy2QnruxtBAQFKUgP/Su59Zw7pmtq9vqaxYT2JFP0PBlSRpM4dA6hZ
+MfkZzXTLQtUM4xZ/CTdMeLdzB4hhuY1ZFXsA0FGxrmfp1YBYEQCvShFQBXafMtKU
+goifwJjf2rOkcg/aW15ZscJilM1SXm+VFM0DR1LT3nSeFucwRhq9i29tQgTuWtvj
+KRLDRDmJAJUDBRA4VV4TAPze7UgudY0BARa8BACvWUEN7KFh74rnGf+OVBM/4q0i
+revTdp45qmMtoR7UA1rU9e+fucv3o9tW1RLjz60eMCXqCEsVfMhqiSokszCIENU/
+n0VJQv2/8bqUkilvJD4L6vyixCUt7KiISIJjvc5mSaeRRiuOPda6IhrBJArU+Dkv
+qlCdM78H4XEgGPoAsokAlQMFEDhVZDctWQ7R0tKsjQEBWowD/RqAe7GBmSt3bio/
+wNKbxfTPNQYJW5scK2XkA+6iSlBmM9kVxVLd9/hYrovWWHAaVjt2mmA60K98xuX5
+r9oLtsAV2CWw2+zAMeCicKqSx+4Qn8Cl/lujj/KIdEHphr1gDai0HBczeCwsQKX1
+z8n1YWzztBrGuFfpWexFuchR/KnHiQCVAwUQOFVn+ncdkq6JcsfBAQGXnAQAkF57
+i8b59pIlxqJ98waDtmyFPebj+otP9HEGqUdin2EqZaF0D3wKpemJU5CPvQiE7+8Q
+FllVn3DQT1FkbmSmFAu6o/T1AYxNlJUs6lts+3RBNB2pgW2Kg/jgDI8TadEt40nV
+sWualuu3wwv4/1EuRArmChZZYw48uEs1Sd7JVrKJAD8DBRA4VWhegwKhoT7fAuoR
+AlsxAJ4rOAUIdCCTGy7vLm0jrkIQBsgb3ACghD7HPZATPu9dEWN9u+iIesRQcq+J
+AJUDBRA4VWsRmAfmW9hLWSEBAfO1A/0cQkcmiObBST7kMokcLaVoV4agrBUcSgt4
+sfEYjZD2Jwa/yTcD/Q5iPEBvsU82vuSxMgznQQzQ5a/iQ4zo3aC4pCJdYWLd7Hsf
+Nb5YGZW8Qk2wwABIfaH8p047Akcfg6QyohSGCDi+XtKyYc0aV/qsyedSNrrIwut+
+O8BQFL2RTIkARgQQEQIABgUCOFV7rgAKCRBBmwi5FiBlLDWSAJ4nAq0EdKIqZ9bX
+hmaMODm9mIDlDwCcDskeOGPiG8JQXPquafgc/PucTUqJAJUDBRA4VX174dT8FObQ
+dHEBARU5A/9O/D/OGOqH/mn4kZT1qIEh/jBMvTvHov0NhBq1HlPplhe5iZcG8hM9
+N94zP1hZmsYJg4dn+DFw21LVEWQ8y0TbygA4YyxbLq4El40GXAN9/LvVuelY4Luc
+CNoqJKUrRR2Pd+PLEvZEcIqeDu0+dVS0uuXptMPqHYD2UMoNbl7q14kBFQMFEDhV
+YDaDyJl8YW+H3QEBuFMH+wRYTwfWgXJDQJ4v7T9zOvkdAVfZs0AgZUPSRKowwcV7
+rKUazJ9CwmdKUCVBpMPgePYy8x5Wc8tkScvAxlCV+wPhyn/V5cbDdL80QduMLVFW
+BILNwAkviNFPpEdjxZvCpBxG9pQIp/8YI7fRaCkJR5Q5bp++/2VbWa7YHGiWjLVW
+6T2z8dCxAplxC517qzQlo7i4pX34W7qNz0b89+RAgwWJXaFjXPQDv0sTwnRZBwrV
+q/V9TA/LY7qmVspylvu0w64NdtiUqnTa5jS/9BZtFf3eyOezqSIEwRkQC6My/JQx
+BKvXspdbJDnrJxD0D0B2eTWa3MQD7BK+WC1RRkTjvyqJAJUDBRA4Vt0jBn5e2L+1
+ZWkBAekjA/47X/leujEhaUEjj9hMyDY6/8HbgxwNyUd+Sx6i9FK+vhAGq8s07dTt
+y9brozqixmHCGYPyvvVkcsVpeQlEWoXc750hbj5a/Et1m3C1J6vGn979f0do144Z
+iiVpzTCh1LZHH5rALd5tuaNcD5MbOYQeP0vDVcJm2GQzm+IdjGtzPw==
+=RnIu
+-----END PGP PUBLIC KEY BLOCK-----
+
+Type Bits KeyID Created Expires Algorithm Use
pub 1024 0xA39BA655 1999-01-04 ---------- RSA Sign & Encrypt
f16 Fingerprint16 = 25 73 4C 8E 94 B1 E8 EA EA 9B A4 D6 00 51 C3 71
uid Sendmail Signing Key/1999 <sendmail@Sendmail.ORG>
@@ -389,4 +532,4 @@ BLK2NtITxxAIKQwj79xNqzgsfm3cpti32t+C/kGkYbONonZHz5uhAG+N0jQ=
=idnw
-----END PGP PUBLIC KEY BLOCK-----
-$Revision: 8.5 $, Last updated $Date: 1999/11/23 19:08:03 $
+$Revision: 8.5.16.3 $, Last updated $Date: 2000/12/19 22:33:12 $
diff --git a/contrib/sendmail/RELEASE_NOTES b/contrib/sendmail/RELEASE_NOTES
index 629979f..0875150 100644
--- a/contrib/sendmail/RELEASE_NOTES
+++ b/contrib/sendmail/RELEASE_NOTES
@@ -1,11 +1,130 @@
SENDMAIL RELEASE NOTES
- $Id: RELEASE_NOTES,v 8.561.2.5.2.125 2000/09/27 06:25:28 gshapiro Exp $
+ $Id: RELEASE_NOTES,v 8.561.2.5.2.181 2000/12/28 23:56:46 gshapiro Exp $
This listing shows the version of the sendmail binary, the version
of the sendmail configuration files, the date of release, and a
summary of the changes in that release.
+8.11.2/8.11.2 2000/12/29
+ Prevent a segmentation fault when trying to set a class in
+ address test mode due to a negative array index. Audit
+ other array indexing. This bug is not believed to be
+ exploitable. Noted by Michal Zalewski of the "Internet for
+ Schools" project (IdS).
+ Add an FFR (for future release) to drop privileges when using
+ address test mode. This will be turned on in 8.12. It can
+ be enabled by compiling with:
+ APPENDDEF(`conf_sendmail_ENVDEF', `-D_FFR_TESTMODE_DROP_PRIVS')
+ in your devtools/Site/site.config.m4 file. Suggested by
+ Michal Zalewski of the "Internet for Schools" project (IdS).
+ Fix potential problem with Cyrus-SASL security layer which may have
+ caused I/O errors, especially for mechanism DIGEST-MD5.
+ When QueueSortOrder was set to host, sendmail might not read
+ enough of the queue file to determine the host, making the
+ sort sub-optimal. Problem noted by Jeff Earickson of
+ Colby College.
+ Don't issue DSNs for addresses which use the NOTIFY parameter (per
+ RFC 1891) but don't have FAILURE as value.
+ Initialize Cyrus-SASL library before the SMTP daemon is started.
+ This implies that every change to SASL related files requires
+ a restart of the daemon, e.g., Sendmail.conf, new SASL
+ mechanisms (in form of shared libraries).
+ Properly set the STARTTLS related macros during a queue run for
+ a cached connection. Bug reported by Michael Kellen of
+ NxNetworks, Inc.
+ Log the server name in relay= for ruleset tls_server instead of the
+ client name.
+ Include original length of bad field/header when reporting
+ MaxMimeHeaderLength problems. Requested by Ulrich Windl of
+ the Universitat Regensburg.
+ Fix delivery to set-user-ID files that are expanded from aliases in
+ DeliveryMode queue. Problem noted by Ric Anderson of the
+ University of Arizona.
+ Fix LDAP map -m (match only) flag. Problem noted by Jeff Giuliano
+ of Collective Technologies.
+ Avoid using a negative argument for sleep() calls when delaying answers
+ to EXPN/VRFY commands on systems which respond very slowly.
+ Problem noted by Mikolaj J. Habryn of Optus Internet
+ Engineering.
+ Make sure the F=u flag is set in the default prog mailer
+ definition. Problem noted by Kari Hurtta of the Finnish
+ Meteorological Institute.
+ Fix IPv6 check for unspecified addresses. Patch from
+ Jun-ichiro itojun Hagino of the KAME Project.
+ Fix return values for IRIX nsd map. From Kari Hurtta of the Finnish
+ Meteorological Institute.
+ Fix parsing of DaemonPortOptions and ClientPortOptions. Read all
+ of the parameters to find Family= setting before trying to
+ interpret Addr= and Port=. Problem noted by Valdis
+ Kletnieks of Virginia Tech.
+ When delivering to a file directly from an alias, do not call
+ initgroups(); instead use the DefaultUser group information.
+ Problem noted by Marc Schaefer of ALPHANET NF.
+ RunAsUser now overrides the ownership of the control socket, if
+ created. Otherwise, sendmail can not remove it upon
+ close. Problem noted by Werner Wiethege.
+ Fix ConnectionRateThrottle counting as the option is the number of
+ overall connections, not the number of connections per
+ socket. A future version may change this to per socket
+ counting.
+ Portability:
+ Clean up libsmdb so it functions properly on platforms
+ where sizeof(u_int32_t) != sizeof(size_t). Problem
+ noted by Rein Tollevik of Basefarm AS.
+ Fix man page formatting for compatibility with Solaris'
+ whatis. From Stephen Gildea of InTouch Systems, Inc.
+ UnixWare 7 includes snprintf() support. From Larry
+ Rosenman.
+ IPv6 changes for platforms using KAME. Patch from
+ Jun-ichiro itojun Hagino of the KAME Project.
+ Avoid a typedef compile conflict with Berkeley DB 3.X and
+ Solaris 2.5 or earlier. Problem noted by Bob Hughes
+ of Pacific Access.
+ Add preliminary support for AIX 5. Contributed by
+ Valdis Kletnieks of Virginia Tech.
+ Solaris 9 load average support from Andrew Tucker of Sun
+ Microsystems.
+ CONFIG: Reject addresses of the form a!b if FEATURE(`nouucp', `r')
+ is used. Problem noted by Phil Homewood of Asia Online,
+ patch from Neil Rickert of Northern Illinois University.
+ CONFIG: Change the default DNS based blacklist server for
+ FEATURE(`dnsbl') to blackholes.mail-abuse.org.
+ CONFIG: Deal correctly with the 'C' flag in {daemon_flags}, i.e.,
+ implicitly assume canonical host names.
+ CONFIG: Deal with "::" in IPv6 addresses for access_db. Based on
+ patch by Motonori Nakamura of Kyoto University.
+ CONFIG: New OSTYPE(`aix5') contributed by Valdis Kletnieks of
+ Virginia Tech.
+ CONFIG: Pass the illegal header form <list:;> through untouched
+ instead of making it worse. Problem noted by Motonori
+ Nakamura of Kyoto University.
+ CONTRIB: Added buildvirtuser (see `perldoc contrib/buildvirtuser`).
+ CONTRIB: qtool.pl: An empty queue is not an error. Problem noted
+ by Jan Krueger of digitalanswers communications consulting
+ gmbh.
+ CONTRIB: domainmap.m4: Handle domains with '-' in them. From Mark
+ Roth of the University of Illinois at Urbana-Champaign.
+ DEVTOOLS: Change the internal devtools OS, REL, and ARCH m4
+ variables into bldOS, bldREL, and bldARCH to prevent
+ namespace collisions. Problem noted by Motonori Nakamura
+ of Kyoto University.
+ RMAIL: Undo the 8.11.1 change to use -G when calling sendmail. It
+ causes some changes in behavior and may break rmail for
+ installations where sendmail is actually a wrapper to
+ another MTA. The change will re-appear in a future
+ version.
+ SMRSH: Use the vendor supplied directory on HPUX 10.X, HPUX 11.X,
+ and SunOS 5.8. Requested by Jeff A. Earickson of Colby
+ College and John Beck of Sun Microsystems.
+ VACATION: Fix pattern matching for addresses to ignore.
+ VACATION: Don't reply to addresses of the form owner-*
+ or *-owner.
+ New Files:
+ cf/ostype/aix5.m4
+ contrib/buildvirtuser
+ devtools/OS/AIX.5.0
+
8.11.1/8.11.1 2000/09/27
Fix SMTP EXPN command output if the address expands to a single
name. Fix from John Beck of Sun Microsystems.
@@ -28,7 +147,8 @@ summary of the changes in that release.
attempt completes. Problem noted by Max France of AlphaNet.
Fix from Neil Rickert of Northern Illinois University.
Deal correctly with MaxMessageSize restriction if message size is
- greater than 2^31.
+ greater than 2^31. Problem noted by Tim "Darth Dice" Bosserman
+ of EarthLink.
Turn off queue checkpointing if CheckpointInterval is set to zero.
Treat an empty home directory (from getpw*() or $HOME) as
non-existent instead of treating it as /. Problem noted by
@@ -882,7 +1002,7 @@ summary of the changes in that release.
Ulrich Windl of the Universitat Regensburg.
Add new F=% mailer flag to allow for a store and forward
configuration. Mailers which have this flag will not attempt
- delivery on initial recipient of a message or on queue runs
+ delivery on initial receipt of a message or on queue runs
unless the queued message is selected using one of the
-qI/-qR/-qS queue run modifiers or an ETRN request. Code
provided by Philip Guenther of Gustavus Adolphus College.
@@ -921,9 +1041,8 @@ summary of the changes in that release.
Macro expand PostmasterCopy and DoubleBounceAddress options.
New "ph" map for performing ph queries in rulesets. More
information is available at
- http://www-wsg.cso.uiuc.edu/sendmail/patches/.
- Contributed by Mark Roth of the University of Illinois at
- Urbana-Champaign.
+ http://www-dev.cso.uiuc.edu/sendmail/. Contributed by Mark
+ Roth of the University of Illinois at Urbana-Champaign.
Detect temporary lookup failures in the host map if looking up a
bracketed IP address. Problem noted by Kari Hurtta of the
Finnish Meteorological Institute.
@@ -3309,9 +3428,9 @@ summary of the changes in that release.
first" error message. Problem pointed out by Chris Thomas
of UCLA; patch from John Beck of SunSoft.
Handle "sendmail -bp -qSfoobar" properly if restrictqrun is set
- in PrivacyOptions. The -q shouldn't turn this command off.
- Problem noted by Murray Kucherawy of Pacific Bell Internet;
- based on a patch from Gregory Neil Shapiro of WPI.
+ in PrivacyOptions. The -q shouldn't turn this command off.
+ Problem noted by Murray Kucherawy of Pacific Bell Internet;
+ based on a patch from Gregory Neil Shapiro of WPI.
Don't consider SMTP reply codes 452 or 552 (exceeded storage allocation)
in a DATA transaction to be sticky; these can occur because
a message is too large, and smaller messages should still go
diff --git a/contrib/sendmail/cf/README b/contrib/sendmail/cf/README
index 971140e..c8ad901 100644
--- a/contrib/sendmail/cf/README
+++ b/contrib/sendmail/cf/README
@@ -7,7 +7,7 @@ requires a post-V7 version of m4; if you are running the 4.2bsd, SysV.2, or
GNU m4 version 1.1 or later also works. Unfortunately, the M4 on BSDI 1.0
doesn't work -- you'll have to use a Net/2 or GNU version. GNU m4 is
available from ftp://ftp.gnu.org/pub/gnu/m4/m4-1.4.tar.gz (check for the
-latset version). EXCEPTIONS: DEC's m4 on Digital UNIX 4.x is broken (3.x
+latest version). EXCEPTIONS: DEC's m4 on Digital UNIX 4.x is broken (3.x
is fine). Use GNU m4 on this platform.
To get started, you may want to look at tcpproto.mc (for TCP-only sites),
@@ -426,13 +426,16 @@ DECNET_RELAY The host that will accept DECNET-addressed email.
of the form node::user will not work.
FAX_RELAY The host that will accept mail to the .FAX pseudo-domain.
The "fax" mailer overrides this value.
-LOCAL_RELAY DEPRECATED. The site that will handle unqualified
- names -- that is, names with out an @domain extension.
- If not set, they are assumed to belong on this machine.
- This allows you to have a central site to store a
- company- or department-wide alias database. This
- only works at small sites, and only with some user
- agents.
+LOCAL_RELAY The site that will handle unqualified names -- that
+ is, names with out an @domain extension.
+ Normally MAIL_HUB is preferred for this function.
+ LOCAL_RELAY is mostly useful in conjunction with
+ FEATURE(stickyhost) -- see the discussion of
+ stickyhost below. If not set, they are assumed to
+ belong on this machine. This allows you to have a
+ central site to store a company- or department-wide
+ alias database. This only works at small sites,
+ and only with some user agents.
LUSER_RELAY The site that will handle lusers -- that is, apparently
local names that aren't local accounts or aliases. To
specify a local user instead of a site, set this to
@@ -513,7 +516,7 @@ usenet Usenet (network news) delivery. If this is specified,
fax Facsimile transmission. This is experimental and based
on Sam Leffler's HylaFAX software. For more information,
- see http://www.vix.com/hylafax/.
+ see http://www.hylafax.org/.
pop Post Office Protocol.
@@ -623,8 +626,10 @@ nouucp Don't route UUCP addresses. This feature takes one
given as parameter.
nocanonify Don't pass addresses to $[ ... $] for canonification
- by default. It can be changed by setting the
- DaemonPortOptions modifiers (M=). That is,
+ by default, i.e., host/domain names are considered canonical,
+ except for unqualified names, which must not be used in this
+ mode (violation of the standard). It can be changed by
+ setting the DaemonPortOptions modifiers (M=). That is,
FEATURE(`nocanonify') will be overridden by setting the
'c' flag. Conversely, if FEATURE(`nocanonify') is not used,
it can be emulated by setting the 'C' flag
@@ -656,14 +661,22 @@ nocanonify Don't pass addresses to $[ ... $] for canonification
<user@host>, will be canonified (and hopefully fully
qualified), too.
-stickyhost If set, email sent to "user@local.host" are marked
- as "sticky" -- that is, the local addresses aren't
- matched against UDB and don't go through ruleset 5.
- This is used if you want a set up where "user" is
- not necessarily the same as "user@local.host", e.g.,
- to make a distinct domain-wide namespace. Prior to
- 8.7 this was the default, and notsticky was used to
- turn this off.
+stickyhost This feature is sometimes used with LOCAL_RELAY,
+ although it can be used for a different effect with
+ MAIL_HUB.
+
+ When used with without MAIL_HUB, email sent to
+ "user@local.host" are marked as "sticky" -- that
+ is, the local addresses aren't matched against UDB,
+ don't go through ruleset 5, and are not forwarded to
+ the LOCAL_RELAY (if defined).
+
+ With MAIL_HUB, mail addressed to "user@local.host"
+ is forwarded to the mail hub, with the envelope
+ address still remaining "user@local.host".
+ Without stickyhost, the envelope would be changed
+ to "user@mail_hub", in order to protect against
+ mailing loops.
mailertable Include a "mailer table" which can be used to override
routing for particular domains (which are not in class {w},
@@ -1064,6 +1077,12 @@ blacklist_recipients
described in the anti-spam configuration control section
later in this document.
+delay_checks The rulesets check_mail and check_relay will not be called
+ when a client connects or issues a MAIL command, respectively.
+ Instead, those rulesets will be called by the check_rcpt
+ ruleset; they will be skipped under certain circumstances.
+ See "Delay all checks" in "ANTI-SPAM CONFIGURATION CONTROL".
+
rbl This feature is deprecated! Please use dnsbl instead.
Turns on rejection of hosts found in the Realtime Blackhole
List. If an argument is provided it is used as the domain
@@ -1074,13 +1093,13 @@ rbl This feature is deprecated! Please use dnsbl instead.
dnsbl Turns on rejection of hosts found in an DNS based rejection
list. If an argument is provided it is used as the domain
in which blocked hosts are listed; otherwise it defaults to
- rbl.maps.vix.com. An explanation for an DNS based rejection
- list can be found http://maps.vix.com/rbl/. A second argument
- can be used to change the default error message of
- Mail from $&{client_addr} refused by blackhole site SERVER
- where SERVER is replaced by the first argument. This feature
- can be included several times to query different DNS based
- rejection lists.
+ blackholes.mail-abuse.org. An explanation for an DNS based
+ rejection list can be found http://mail-abuse.org/rbl/. A
+ second argument can be used to change the default error
+ message of Mail from $&{client_addr} refused by blackhole site
+ SERVER where SERVER is replaced by the first argument. This
+ feature can be included several times to query different DNS
+ based rejection lists.
loose_relay_check
Normally, if % addressing is used for a recipient, e.g.
@@ -1706,12 +1725,10 @@ The value part of the map can contain:
REJECT Reject the sender or recipient with a general
purpose message.
DISCARD Discard the message completely using the
- $#discard mailer. For sender addresses it
- indicates that you should discard anything
- received from the indicated domain. If it
- is used for recipients, it affects only
- the designated recipients, not the whole
- message.
+ $#discard mailer. If it is used in check_compat,
+ it affects only the designated recipient, not
+ the whole message as it does in all other cases.
+ This should only be used if really necessary.
### any text where ### is an RFC 821 compliant error code and
"any text" is a message to return for the command.
The string should be quoted to avoid surprises,
@@ -1803,11 +1820,14 @@ spammers. To use this database, use
This will cause sendmail to reject mail from any site in the
Realtime Blackhole List database. You can specify an alternative
RBL domain to check by specifying an argument to the FEATURE.
-A second argument can be used to change the default error message
-Mail from $&{client_addr} refused by blackhole site DOMAIN
-where DOMAIN is replaced by the first argument. This FEATURE can
-be included several times to query different DNS based rejection
-lists, e.g., the dial-up user list (see http://maps.vix.com/dul/).
+The default error message is
+
+ Mail from $&{client_addr} refused by blackhole site DOMAIN
+
+where DOMAIN is the first argument of the feature. A second argument
+can be used to specify a different text. This FEATURE can be
+included several times to query different DNS based rejection lists,
+e.g., the dial-up user list (see http://maps.vix.com/dul/).
The features described above make use of the check_relay, check_mail,
and check_rcpt rulesets. If you wish to include your own checks,
@@ -2134,6 +2154,8 @@ parameter if it is identical to the authenticated user.
Per default, relaying is allowed for any user who authenticated
via a "trusted" mechanism, i.e., one that is defined via
TRUST_AUTH_MECH(`list of mechanisms')
+For example:
+TRUST_AUTH_MECH(`KERBEROS_V4 DIGEST-MD5')
If the selected mechanism provides a security layer the number of
bits used for the key of the symmetric cipher is stored in the
@@ -2157,9 +2179,9 @@ LOCAL_RULESETS respectively. For example:
#if _FFR_MILTER
-+---------------------------+
-| ADDING NEW MAILER FILTERS |
-+---------------------------+
++-------------------------+
+| ADDING NEW MAIL FILTERS |
++-------------------------+
Sendmail supports mail filters to filter incoming SMTP messages according
to the "Sendmail Mail Filter API" documentation. These filters can be
@@ -2756,7 +2778,7 @@ confMAX_DAEMON_CHILDREN MaxDaemonChildren
rejected. If not set or <= 0, there is
no limit.
confMAX_HEADERS_LENGTH MaxHeadersLength
- [undefined] Maximum length of the sum
+ [32768] Maximum length of the sum
of all headers.
confMAX_MIME_HEADER_LENGTH MaxMimeHeaderLength
[undefined] Maximum length of
@@ -3235,4 +3257,4 @@ M4 DIVERSIONS
8 DNS based blacklists
9 special local rulesets (1 and 2)
-$Revision: 8.383.2.1.2.24 $, Last updated $Date: 2000/09/24 02:05:54 $
+$Revision: 8.383.2.1.2.35 $, Last updated $Date: 2000/12/17 17:19:11 $
diff --git a/contrib/sendmail/cf/cf/Makefile b/contrib/sendmail/cf/cf/Makefile
index da92979..7a7c6d9 100644
--- a/contrib/sendmail/cf/cf/Makefile
+++ b/contrib/sendmail/cf/cf/Makefile
@@ -1,7 +1,7 @@
#
# Makefile for configuration files.
#
-# $Id: Makefile,v 8.40.8.3 2000/08/08 22:23:30 gshapiro Exp $
+# $Id: Makefile,v 8.40.8.4 2000/10/26 18:27:44 gshapiro Exp $
#
#
@@ -25,10 +25,10 @@ RM= rm -f
$(CHMOD) $(ROMODE) $@
GENERIC=generic-bsd4.4.cf generic-hpux9.cf generic-hpux10.cf \
- generic-linux.cf \
+ generic-linux.cf generic-nextstep3.3.cf \
generic-osf1.cf generic-solaris2.cf \
generic-sunos4.1.cf generic-ultrix4.cf
-BERKELEY=cs-hpux9.cf cs-osf1.cf cs-solaris2.cf \
+BERKELEY=cs-hpux9.cf cs-hpux10.cf cs-osf1.cf cs-solaris2.cf \
cs-sunos4.1.cf cs-ultrix4.cf \
s2k-osf1.cf s2k-ultrix4.cf \
chez.cs.cf huginn.cs.cf mail.cs.cf mail.eecs.cf mailspool.cs.cf \
diff --git a/contrib/sendmail/cf/feature/dnsbl.m4 b/contrib/sendmail/cf/feature/dnsbl.m4
index fd3ceee..e5fd489 100644
--- a/contrib/sendmail/cf/feature/dnsbl.m4
+++ b/contrib/sendmail/cf/feature/dnsbl.m4
@@ -11,9 +11,9 @@ divert(-1)
divert(0)
ifdef(`_DNSBL_R_',`dnl',`dnl
-VERSIONID(`$Id: dnsbl.m4,v 8.18 1999/08/03 04:30:56 gshapiro Exp $')')
+VERSIONID(`$Id: dnsbl.m4,v 8.18.16.1 2000/11/22 01:13:21 ca Exp $')')
divert(-1)
-define(`_DNSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`rbl.maps.vix.com',_ARG_)')dnl
+define(`_DNSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`blackholes.mail-abuse.org',_ARG_)')dnl
define(`_DNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Mail from " $`'&{client_addr} " refused by blackhole site '_DNSBL_SRV_`"',`_ARG2_')')dnl
divert(8)
# DNS based IP address spam list _DNSBL_SRV_
diff --git a/contrib/sendmail/cf/m4/proto.m4 b/contrib/sendmail/cf/m4/proto.m4
index d8d826c..d21aba4 100644
--- a/contrib/sendmail/cf/m4/proto.m4
+++ b/contrib/sendmail/cf/m4/proto.m4
@@ -13,7 +13,7 @@ divert(-1)
#
divert(0)
-VERSIONID(`$Id: proto.m4,v 8.446.2.5.2.29 2000/09/15 04:45:14 gshapiro Exp $')
+VERSIONID(`$Id: proto.m4,v 8.446.2.5.2.38 2000/12/28 03:37:28 ca Exp $')
MAILER(local)dnl
@@ -409,7 +409,7 @@ _OPTION(RefuseLA, `confREFUSE_LA', `12')
_OPTION(MaxDaemonChildren, `confMAX_DAEMON_CHILDREN', `12')
# maximum number of new connections per second
-_OPTION(ConnectionRateThrottle, `confCONNECTION_RATE_THROTTLE', `3')
+_OPTION(ConnectionRateThrottle, `confCONNECTION_RATE_THROTTLE', `0')
# work recipient factor
_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', `30000')
@@ -635,6 +635,7 @@ R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
R$* : $* <@> $: $2 strip colon if marked
R$* <@> $: $1 unmark
R$* ; $1 strip trailing semi
+R$* < $+ :; > $* $@ $2 :; <@> catch <list:;>
R$* < $* ; > $1 < $2 > bogus bracketed semi
# null input now results from list:; syntax
@@ -779,6 +780,9 @@ dnl then $- does not work.
R$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4', `dnl')', `dnl
dnl _NO_CANONIFY_ is not set: canonify unless:
dnl {daemon_flags} contains CC (do not canonify)
+dnl but add a trailing dot to qualified hostnames so other rules will work
+dnl should we do this for every hostname: even unqualified?
+R$* CC $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6
R$* CC $* $| $* $: $3
# pass to name server to make hostname canonical
R$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4')
@@ -806,6 +810,7 @@ R$* < @ $* . . > $* $1 < @ $2 . > $3
##################################################
Sfinal=4
+R$+ :; <@> $@ $1 : handle <list:;>
R$* <@> $@ handle <> and list:;
# strip trailing dot off possibly canonical name
@@ -1286,6 +1291,7 @@ R<?> <$+.$+> <$+> <$*> <+ $*> $: < $(access .$2 $: ? $) > <$1.$2> <$3> <$4> <+ $
dnl lookup IP address (no check is done whether it is an IP number!)
R<?> <[$+.$-]> <$+> <$*> <$*> $@ $>LookUpDomain <[$1]> <$3> <$4> <$5>
dnl lookup IPv6 address
+R<?> <[$+::$-]> <$+> <$*> <$*> $: $>LookUpDomain <[$1]> <$3> <$4> <$5>
R<?> <[$+:$-]> <$+> <$*> <$*> $: $>LookUpDomain <[$1]> <$3> <$4> <$5>
dnl not found, but subdomain: try again
R<?> <$+.$+> <$+> <$*> <$*> $@ $>LookUpDomain <$2> <$3> <$4> <$5>
@@ -1315,6 +1321,7 @@ R<$+> <$+> <$*> <$- $+> $: < $(access $5`'_TAG_DELIM_`'$1 $: ? $) > <$1> <$2> <
dnl lookup without tag
R<?> <$+> <$+> <$*> <+ $+> $: < $(access $1 $: ? $) > <$1> <$2> <$3> <+ $4>
dnl no match; IPv6: remove last part
+R<?> <$+::$-> <$+> <$*> <$*> $@ $>LookUpAddress <$1> <$3> <$4> <$5>
R<?> <$+:$-> <$+> <$*> <$*> $@ $>LookUpAddress <$1> <$3> <$4> <$5>
dnl no match; IPv4: remove last part
R<?> <$+.$-> <$+> <$*> <$*> $@ $>LookUpAddress <$1> <$3> <$4> <$5>
@@ -1682,9 +1689,10 @@ dnl use $# to override further tests (delay_checks): see check_rcpt below
R$* $| $={TrustAuthMech} $# RELAYAUTH
dnl undo addition of ${auth_type}
R$* $| $* $: $1
-dnl workspace: localpart<@domain>
+dnl workspace: localpart<@domain> | localpart
ifelse(defn(`_NO_UUCP_'), `r',
-`R$* ! $* < @ $* > $: <REMOTE> $2 < @ BANG_PATH >', `dnl')
+`R$* ! $* < @ $* > $: <REMOTE> $2 < @ BANG_PATH >
+R$* ! $* $: <REMOTE> $2 < @ BANG_PATH >', `dnl')
# anything terminating locally is ok
ifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl
R$+ < @ $* $=m > $@ RELAYTO', `dnl')
@@ -1957,7 +1965,7 @@ R$* $: $>LookUpDomain <$&{server_name}> <?> <> <! TLS_TRY_TAG>
R<?>$* $: $>LookUpAddress <$&{server_addr}> <?> <> <! TLS_TRY_TAG>
R<?>$* $: <$(access TLS_TRY_TAG: $: ? $)>
R<?>$* $@ OK
-R<NO> <> $#error $@ 5.7.1 $: "550 do not try TLS with " $&{server_name} " ["$&{server_addr}"]"
+R<NO>$* $#error $@ 5.7.1 $: "550 do not try TLS with " $&{server_name} " ["$&{server_addr}"]"
')dnl
# is connection with client "good" enough? (done in server)
diff --git a/contrib/sendmail/cf/m4/version.m4 b/contrib/sendmail/cf/m4/version.m4
index e8e0b2e..a98a7e6 100644
--- a/contrib/sendmail/cf/m4/version.m4
+++ b/contrib/sendmail/cf/m4/version.m4
@@ -11,8 +11,8 @@ divert(-1)
# the sendmail distribution.
#
#
-VERSIONID(`$Id: version.m4,v 8.39.4.14 2000/09/19 07:28:06 gshapiro Exp $')
+VERSIONID(`$Id: version.m4,v 8.39.4.21 2000/12/29 18:22:15 gshapiro Exp $')
#
divert(0)
# Configuration version number
-DZ8.11.1`'ifdef(`confCF_VERSION', `/confCF_VERSION')
+DZ8.11.2`'ifdef(`confCF_VERSION', `/confCF_VERSION')
diff --git a/contrib/sendmail/cf/ostype/aix5.m4 b/contrib/sendmail/cf/ostype/aix5.m4
new file mode 100644
index 0000000..c23c0f3
--- /dev/null
+++ b/contrib/sendmail/cf/ostype/aix5.m4
@@ -0,0 +1,18 @@
+divert(-1)
+#
+# Copyright (c) 2000 Sendmail, Inc. and its suppliers.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set
+# forth in the LICENSE file which can be found at the top level of
+# the sendmail distribution.
+#
+#
+
+divert(0)
+VERSIONID(`$Id: aix5.m4,v 1.1.2.1 2000/12/09 03:32:08 ca Exp $')
+ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/bellmail)')dnl
+ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', mail -F $g $u)')dnl
+_DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl
+define(`confEBINDIR', `/usr/lib')dnl
+define(`confTIME_ZONE', `USE_TZ')dnl
diff --git a/contrib/sendmail/contrib/buildvirtuser b/contrib/sendmail/contrib/buildvirtuser
new file mode 100755
index 0000000..e544828
--- /dev/null
+++ b/contrib/sendmail/contrib/buildvirtuser
@@ -0,0 +1,167 @@
+#!/usr/bin/perl -w
+
+# Copyright (c) 1999-2000 Gregory Neil Shapiro. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of the author nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+# $Id: buildvirtuser,v 1.1.2.1 2000/10/26 22:51:03 gshapiro Exp $
+
+=head1 NAME
+
+buildvirtuser - Build virtusertable support from a directory of files
+
+=head1 SYNOPSIS
+
+ buildvirtuser
+
+=head1 DESCRIPTION
+
+buildvirtuser will build /etc/mail/virtusertable.db and /etc/mail/virthosts
+based on the contents of the directory /etc/mail/virtusers/. That
+directory should contain one file per virtual domain with the filename
+matching the virtual domain name and the contents containing a list of
+usernames on the left and the actual address for that username on the
+right. An empty left column translates to the default for that domain.
+Blank lines and lines beginning with '#' are ignored.
+
+=head1 CONFIGURATION
+
+In order to function properly, sendmail must be configured to use these
+files with:
+
+ FEATURE(`virtusertable')dnl
+ VIRTUSER_DOMAIN_FILE(`/etc/mail/virthosts')dnl
+
+If a new domain is added (i.e., by adding a new file to
+/etc/mail/virtusers/), the sendmail daemon must be restarted for the change
+to take affect.
+
+=head1 EXAMPLES
+
+Here are some example files from the /etc/mail/virtusers/ directory:
+
+=head2 /etc/mail/virtusers/bsdunix.org:
+
+ # Services
+ MAILER-DAEMON gshapiro+MAILER-DAEMON.bsdunix.org@gshapiro.net
+ postmaster gshapiro+postmaster.bsdunix.org@gshapiro.net
+ webmaster gshapiro+webmaster.bsdunix.org@gshapiro.net
+
+ # Defaults
+ error:nouser No such user
+
+ # Users
+ gshapiro gshapiro+bsdunix.org@gshapiro.net
+ bob robert@smtp.org
+
+=head2 /etc/mail/virtusers/smtp.org:
+
+ # Defaults
+ gshapiro+smtp.org@gshapiro.net
+
+ # Users
+ john john@wookie.org
+ nancy n@milter.com
+
+=head1 AUTHOR
+
+Gregory Neil Shapiro E<lt>F<gshapiro@gshapiro.net>E<gt>
+
+=cut
+
+my $makemap = "/usr/sbin/makemap";
+my $dbtype = "hash";
+my $maildir = "/etc/mail";
+my $virthosts = "$maildir/virthosts";
+my $newvirthosts = "$maildir/virthosts.new";
+my $virts = "$maildir/virtusers";
+my $newvirt = "$maildir/virtusertable.new.db";
+my $virt = "$maildir/virtusertable.db";
+my %virt = ();
+my $newest = 0;
+
+opendir(VIRTS, $virts) || die "Could not open directory $virts: $!\n";
+my @virts = grep { -f "$virts/$_" } readdir(VIRTS);
+closedir(VIRTS) || die "Could not close directory $virts: $!\n";
+
+foreach $domain (@virts)
+{
+ open(DOMAIN, "$virts/$domain") || die "Could not open file $virts/$domain: $!\n";
+ my $line = 0;
+ my $mtime = (stat(DOMAIN))[9] || 0;
+ if ($mtime > $newest)
+ {
+ $newest = $mtime;
+ }
+LINE: while (<DOMAIN>)
+ {
+ chomp;
+ $line++;
+ next LINE if /^#/;
+ next LINE if /^$/;
+ if (m/^([^\t ]*)[\t ]+(.*)$/)
+ {
+ if (defined($1))
+ {
+ $key = "$1\@$domain";
+ }
+ else
+ {
+ $key = "\@$domain";
+ }
+ $value = $2;
+ }
+ else
+ {
+ die "Bogus line $line in $virts/$domain\n";
+ }
+ $virt{$key} = $value;
+ }
+ close(DOMAIN) || die "Could not close $virts/$domain: $!\n";
+}
+
+my $virtmtime = (stat($virt))[9] || 0;
+if ($virtmtime < $newest)
+{
+ print STDOUT "Rebuilding $virt\n";
+# logger -s -t ${prog} -p mail.info "Rebuilding ${basedir}/virtusertable"
+ open(MAKEMAP, "|$makemap $dbtype $newvirt") || die "Could not start makemap: $!\n";
+ foreach $key (keys %virt)
+ {
+ print MAKEMAP "$key\t\t$virt{$key}\n";
+ }
+ close(MAKEMAP) || die "Could not close makemap ($?): $!\n";
+ rename($newvirt, $virt) || die "Could not rename $newvirt to $virt: $!\n";
+
+ open(VIRTHOST, ">$newvirthosts") || die "Could not open file $newvirthosts: $!\n";
+ foreach $domain (sort @virts)
+ {
+ print VIRTHOST "$domain\n";
+ }
+ close(VIRTHOST) || die "Could not close $newvirthosts: $!\n";
+ rename($newvirthosts, $virthosts) || die "Could not rename $newvirthosts to $virthosts: $!\n";
+}
+exit 0;
diff --git a/contrib/sendmail/contrib/domainmap.m4 b/contrib/sendmail/contrib/domainmap.m4
index dd2fa94..fbaf62c 100644
--- a/contrib/sendmail/contrib/domainmap.m4
+++ b/contrib/sendmail/contrib/domainmap.m4
@@ -69,11 +69,19 @@ LOCAL_RULESETS
SDomainMapLookup
R $=L <@ $=w .> $@ $1 <@ $2 .> weed out local users, in case
# Cw contains a mapped domain
-R $+ <@ $+> $: $1 <@ $2 > < $2 > find domain
+ifdef(`DOMAINMAP_NO_REGEX',`dnl
+R $+ <@ $+> $: $1 <@ $2> <$2> find domain
R $+ <$+> <$+ . $+> $1 <$2> < $(dequote $3 "_" $4 $) >
# change "." to "_"
R $+ <$+> <$+ .> $: $1 <$2> < $(dequote "domain_" $3 $) >
# prepend "domain_"
+dnl',`dnl
+R $+ <@ $+> $: $1 <@ $2> <$2 :NOTDONE:> find domain
+R $+ <$+> <$+ . :NOTDONE:> $1 <$2> < $(domainmap_regex $3 $: $3 $) >
+# change "." and "-" to "_"
+R $+ <$+> <$+> $: $1 <$2> < $(dequote "domain_" $3 $) >
+# prepend "domain_"
+dnl')
R $+ <$+> <$+> $: $1 <$2> <$3> $1 find user name
R $+ <$+> <$+> $+ + $* $: $1 <$2> <$3> $4 handle user+detail syntax
R $+ <$+> <$+> $+ $: $1 <$2> $( $3 $4 $: <ERROR> $)
@@ -84,8 +92,12 @@ R $+ <@ $+> $* <TEMP> $* $#dsmtp $@ localhost $: $1 @ $2
R $+ + $* <$+> $+ @ $+ $: $1 + $2 <$3> $4 + $2 @ $5
# reset original user+detail
R $+ <$+> $+ $@ $>Recurse $3 recanonify
-define(`_DOMAIN_MAP_',`1')')
+
+ifdef(`DOMAINMAP_NO_REGEX',`',`dnl
+LOCAL_CONFIG
+K domainmap_regex regex -a.:NOTDONE: -s1,2 -d_ (.*)[-\.]([^-\.]*)$
+')define(`_DOMAIN_MAP_',`1')')
LOCAL_CONFIG
C{MappedDomain} _ARG_
-K `domain_'translit(_ARG_, `.', `_') _ARG2_ -T<TEMP>
+K `domain_'translit(_ARG_, `.-', `__') _ARG2_ -T<TEMP>
diff --git a/contrib/sendmail/contrib/qtool.8 b/contrib/sendmail/contrib/qtool.8
index 4d0f1c4..1106d07 100644
--- a/contrib/sendmail/contrib/qtool.8
+++ b/contrib/sendmail/contrib/qtool.8
@@ -6,11 +6,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: qtool.8,v 8.9 1999/08/26 00:04:10 cying Exp $
+.\" $Id: qtool.8,v 8.9.16.2 2000/12/15 19:50:41 gshapiro Exp $
.\"
-.TH QTOOL 8 "July 12, 1999"
+.TH QTOOL 8 "$Date: 2000/12/15 19:50:41 $"
.SH NAME
-.B qtool
+qtool
\- manipulate sendmail queues
.SH SYNOPSIS
.B qtool.pl
diff --git a/contrib/sendmail/contrib/qtool.pl b/contrib/sendmail/contrib/qtool.pl
index 102eb15..f4d36f3 100755
--- a/contrib/sendmail/contrib/qtool.pl
+++ b/contrib/sendmail/contrib/qtool.pl
@@ -3,7 +3,7 @@
## Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
## All rights reserved.
##
-## $Id: qtool.pl,v 8.15.16.2 2000/09/17 17:04:22 gshapiro Exp $
+## $Id: qtool.pl,v 8.15.16.4 2000/11/30 07:14:01 gshapiro Exp $
##
use strict;
use File::Basename;
@@ -133,13 +133,12 @@ while (@ARGV)
if ($result)
{
print("$result.\n");
+ exit;
}
}
if (keys(%sources) == 0)
{
- print("You must at least specify at least one source.\n");
- usage();
exit;
}
@@ -164,7 +163,7 @@ sub usage
print(" -b Bounce the messages specified by source.\n");
print(" -d Delete the messages specified by source.\n");
print(" -e [perl expression] Move only messages for which perl expression returns true.\n");
- print(" -s [seconds] Move only messages older than seconds.\n");
+ print(" -s [seconds] Move only messages whose qf file is older than seconds.\n");
}
##
diff --git a/contrib/sendmail/doc/op/op.me b/contrib/sendmail/doc/op/op.me
index 52a9e2e..68fe3793 100644
--- a/contrib/sendmail/doc/op/op.me
+++ b/contrib/sendmail/doc/op/op.me
@@ -9,7 +9,7 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: op.me,v 8.317.4.39 2000/09/22 15:01:37 ca Exp $
+.\" $Id: op.me,v 8.317.4.47 2000/12/17 00:54:56 gshapiro Exp $
.\"
.\" eqn op.me | pic | troff -me
.eh 'SMM:08-%''Sendmail Installation and Operation Guide'
@@ -32,7 +32,6 @@
\\$1 \\$2. \\$3
.)x
..
-.sc
.+c
.(l C
.sz 16
@@ -54,7 +53,7 @@ eric@Sendmail.COM
.de Ve
Version \\$2
..
-.Ve $Revision: 8.317.4.39 $
+.Ve $Revision: 8.317.4.47 $
.rm Ve
.sp
For Sendmail Version 8.11
@@ -929,7 +928,7 @@ The ``controlling user'', that is, the name of the user
whose credentials we use for delivery.
.ip delay
The total delay between the time this message was received
-and the time it was delivered.
+and the current delivery attempt.
.ip xdelay
The amount of time needed in this delivery attempt
(normally indicative of the speed of the connection).
@@ -3486,8 +3485,8 @@ addr-->| 3 |-->| D |-- --->| 4 |-->msg
.)c
.\}
-.el .ie !"\*(.T"" \
-\{\
+.el \{\
+.ie !"\*(.T"" \{\
.PS
boxwid = 0.3i
boxht = 0.3i
@@ -3518,6 +3517,7 @@ Box0: arrow; box "0"
.PE
.\}
.el .sp 2i
+.\}
.ce
Figure 1 \*- Rewriting set semantics
.(c
@@ -4098,8 +4098,9 @@ Defined in the SMTP server only.
The host name of the SMTP client.
This may be the client's bracketed IP address
in the form [ nnn.nnn.nnn.nnn ] if the client's
-IP address is not resolvable, or if the resolved
-name doesn't match ${client_name}.
+IP address is not resolvable, or if it is resolvable
+but the IP address of the resolved hostname
+doesn't match the original IP address.
Defined in the SMTP server only.
.ip ${client_port}
The port number of the SMTP client.
@@ -5291,6 +5292,9 @@ comments (in parentheses) are deleted before processing,
unless the second form
.b $>+
is used.
+Note: only one ruleset can be associated with a header;
+.i sendmail
+will silently ignore multiple entries.
.pp
For example, the configuration lines:
.(b
@@ -5486,7 +5490,7 @@ Checkpoints the queue every
addresses sent.
If your system crashes during delivery to a large list,
this prevents retransmission to any but the last
-.I N
+.i N
recipients.
.ip ClassFactor=\fIfact\fP
[z]
@@ -6223,7 +6227,7 @@ If there is insufficient space
gives a 452 response
to the MAIL command.
This invites the sender to try again later.
-.ip MinQueueAge=\fPage\fP
+.ip MinQueueAge=\fIage\fP
[no short name]
Don't process any queued jobs
that have been in the queue less than the indicated time interval.
@@ -6342,6 +6346,7 @@ noreceipts Don't return success DSNs\**
nobodyreturn Don't return the body of a message with DSNs
goaway Disallow essentially all SMTP status queries
authwarnings Put X-Authentication-Warning: headers in messages
+ and log warnings
.)b
.(f
\**N.B.:
@@ -6537,7 +6542,7 @@ and all files to be written must be writable by
.i user
Also, all file and program deliveries will be marked unsafe
unless the option
-.b DontBlameSendmail=NonRootAddrSafe
+.b DontBlameSendmail=NonRootSafeAddr
is set,
in which case the delivery will be done as
.i user .
@@ -7259,7 +7264,7 @@ Contributed and supported by
Mark Roth, roth@uiuc.edu.
For more information,
consult the web site
-.q http://www-wsg.cso.uiuc.edu/sendmail/sendmail-phmap/ .
+.q http://www-dev.cso.uiuc.edu/sendmail/ .
.ip nsd
nsd map for IRIX 6.5 and later.
Contributed and supported by Bob Mende of SGI,
@@ -7642,6 +7647,10 @@ Set the alias dereference option to one of never, always, search, or find.
Set search scope to one of base, one (one level), or sub (subtree).
.ip "\-h\fIhost\fP"
LDAP server hostname.
+Some LDAP libraries allow you to specify multiple, space-separated hosts for
+redundancy.
+In addition, each of the hosts listed can be followed by a colon and a port
+number to override the default LDAP port.
.ip "\-b\fIbase\fP"
LDAP search base.
.ip "\-p\fIport\fP"
@@ -8926,7 +8935,7 @@ to the specified
.i value
(for long form option names).
These options are described in Section 5.6.
-.ip \-M\fIx\|value
+.ip \-M\fIx\|value\fP
Set macro
.i x
to the specified
@@ -9381,7 +9390,7 @@ replace it with a blank sheet for double-sided output.
.\".sz 10
.\"Eric Allman
.\".sp
-.\"Version $Revision: 8.317.4.39 $
+.\"Version $Revision: 8.317.4.47 $
.\".ce 0
.bp 3
.ce
diff --git a/contrib/sendmail/include/libsmdb/smdb.h b/contrib/sendmail/include/libsmdb/smdb.h
index 2ef7b62..db7fe8f 100644
--- a/contrib/sendmail/include/libsmdb/smdb.h
+++ b/contrib/sendmail/include/libsmdb/smdb.h
@@ -6,7 +6,7 @@
** forth in the LICENSE file which can be found at the top level of
** the sendmail distribution.
**
-** $Id: smdb.h,v 8.29.2.1.2.1 2000/08/24 17:08:00 gshapiro Exp $
+** $Id: smdb.h,v 8.29.2.1.2.2 2000/10/05 22:23:55 gshapiro Exp $
*/
#ifndef _SMDB_H_
@@ -53,7 +53,7 @@ ERROR NDBM or NEWDB must be defined.
typedef struct database_struct SMDB_DATABASE;
typedef struct cursor_struct SMDB_CURSOR;
-typedef union database_entity_union SMDB_DBENT;
+typedef struct entry_struct SMDB_DBENT;
/*
@@ -312,22 +312,12 @@ struct database_user_struct
typedef struct database_user_struct SMDB_USER_INFO;
-union database_entity_union
+struct entry_struct
{
-# ifdef NDBM
- datum dbm;
-# endif /* NDBM */
-# ifdef NEWDB
- DBT db;
-# endif /* NEWDB */
- struct
- {
- char *data;
- size_t size;
- } data;
+ void *data;
+ size_t size;
};
-
typedef char *SMDB_DBTYPE;
typedef u_int SMDB_FLAG;
diff --git a/contrib/sendmail/include/sendmail/pathnames.h b/contrib/sendmail/include/sendmail/pathnames.h
index fcc8e8d..9f99f6c 100644
--- a/contrib/sendmail/include/sendmail/pathnames.h
+++ b/contrib/sendmail/include/sendmail/pathnames.h
@@ -9,7 +9,7 @@
* the sendmail distribution.
*
*
- * $Id: pathnames.h,v 8.16.8.7 2000/08/25 18:36:57 geir Exp $
+ * $Id: pathnames.h,v 8.16.8.8 2000/09/28 21:26:39 gshapiro Exp $
*/
diff --git a/contrib/sendmail/include/sendmail/sendmail.h b/contrib/sendmail/include/sendmail/sendmail.h
index 467b553..a075709 100644
--- a/contrib/sendmail/include/sendmail/sendmail.h
+++ b/contrib/sendmail/include/sendmail/sendmail.h
@@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
- * $Id: sendmail.h,v 8.34.4.5 2000/09/14 23:32:26 gshapiro Exp $
+ * $Id: sendmail.h,v 8.34.4.7 2000/10/09 16:15:26 gshapiro Exp $
*/
/*
@@ -53,6 +53,9 @@
typedef unsigned int BITMAP256[BITMAPBYTES / sizeof (int)];
+/* properly case and truncate bit */
+#define bitidx(bit) ((unsigned int) (bit) & 0xff)
+
/* test bit number N */
#define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit))
diff --git a/contrib/sendmail/libmilter/Makefile.m4 b/contrib/sendmail/libmilter/Makefile.m4
index 9ac7760..4b92464 100644
--- a/contrib/sendmail/libmilter/Makefile.m4
+++ b/contrib/sendmail/libmilter/Makefile.m4
@@ -7,9 +7,18 @@ SMSRCDIR= ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail')
PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ')
bldPRODUCT_START(`library', `libmilter')
+define(`bldINSTALLABLE', `true')
define(`bldSOURCES', `main.c engine.c listener.c handler.c comm.c smfi.c signal.c sm_gethost.c ')
bldPUSH_SMLIB(`smutil')
+bldPUSH_INSTALL_TARGET(`install-mfapi')
bldPRODUCT_END
APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL')
+divert(bldTARGETS_SECTION)
+# Install the API header file
+MFAPI= ${SRCDIR}/include/libmilter/mfapi.h
+install-mfapi: ${MFAPI}
+ ${INSTALL} ${MFAPI} ${DESTDIR}${INCLUDEDIR}
+divert(0)
+
bldFINISH
diff --git a/contrib/sendmail/libmilter/README b/contrib/sendmail/libmilter/README
index 486a268..ffe09c4 100644
--- a/contrib/sendmail/libmilter/README
+++ b/contrib/sendmail/libmilter/README
@@ -178,6 +178,10 @@ See the sendmail(8) manual page for more information.
| SOURCE FOR SAMPLE FILTER |
+--------------------------+
+Note that the filter below may not be thread safe on some operating
+systems. You should check your system man pages for the functions used
+below to verify the functions are thread safe.
+
/* A trivial filter that logs all email to a file. */
#include <sys/types.h>
@@ -412,4 +416,4 @@ main(argc, argv)
/* eof */
-$Revision: 8.9.2.1.2.12 $, Last updated $Date: 2000/09/19 19:40:13 $
+$Revision: 8.9.2.1.2.13 $, Last updated $Date: 2000/12/29 18:55:23 $
diff --git a/contrib/sendmail/libmilter/comm.c b/contrib/sendmail/libmilter/comm.c
index 31f432c..af1ee6d 100644
--- a/contrib/sendmail/libmilter/comm.c
+++ b/contrib/sendmail/libmilter/comm.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: comm.c,v 8.30.4.5 2000/08/14 09:04:47 gshapiro Exp $";
+static char id[] = "@(#)$Id: comm.c,v 8.30.4.6 2000/10/05 22:44:01 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -55,6 +55,7 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name)
*cmd = '\0';
*rlen = 0;
+
if (sd >= FD_SETSIZE)
{
smi_log(SMI_LOG_ERR, "%s: fd %d is larger than FD_SETSIZE %d",
@@ -62,6 +63,7 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name)
*cmd = SMFIC_SELECT;
return NULL;
}
+
FD_Z;
i = 0;
while ((ret = select(sd + 1, &readset, NULL, &excset, timeout)) >= 1)
diff --git a/contrib/sendmail/libmilter/engine.c b/contrib/sendmail/libmilter/engine.c
index c2a3dc3..554631c 100644
--- a/contrib/sendmail/libmilter/engine.c
+++ b/contrib/sendmail/libmilter/engine.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: engine.c,v 8.67.4.14 2000/08/14 08:27:30 gshapiro Exp $";
+static char id[] = "@(#)$Id: engine.c,v 8.67.4.15 2000/12/29 19:43:10 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -381,7 +381,7 @@ sendreply(r, sd, timeout_ptr, ctx)
{
int ret = MI_SUCCESS;
- switch(r)
+ switch (r)
{
case SMFIS_CONTINUE:
ret = mi_wr_cmd(sd, timeout_ptr, SMFIR_CONTINUE, NULL, 0);
@@ -807,7 +807,7 @@ st_macros(g)
return _SMFIS_FAIL;
if ((argv = dec_argv(g->a_buf + 1, g->a_len - 1)) == NULL)
return _SMFIS_FAIL;
- switch(g->a_buf[0])
+ switch (g->a_buf[0])
{
case SMFIC_CONNECT:
i = CI_CONN;
diff --git a/contrib/sendmail/libmilter/handler.c b/contrib/sendmail/libmilter/handler.c
index f6e75e9..2ee5203 100644
--- a/contrib/sendmail/libmilter/handler.c
+++ b/contrib/sendmail/libmilter/handler.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: handler.c,v 8.19.4.2 2000/07/14 06:16:57 msk Exp $";
+static char id[] = "@(#)$Id: handler.c,v 8.19.4.3 2000/12/29 19:45:39 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -44,9 +44,15 @@ mi_handle_session(ctx)
return MI_FAILURE;
ret = mi_engine(ctx);
if (ValidSocket(ctx->ctx_sd))
+ {
(void) close(ctx->ctx_sd);
+ ctx->ctx_sd = INVALID_SOCKET;
+ }
if (ctx->ctx_reply != NULL)
+ {
free(ctx->ctx_reply);
+ ctx->ctx_reply = NULL;
+ }
if (ctx->ctx_privdata != NULL)
{
smi_log(SMI_LOG_WARN,
diff --git a/contrib/sendmail/libmilter/libmilter.h b/contrib/sendmail/libmilter/libmilter.h
index f43fd0e..358ba64 100644
--- a/contrib/sendmail/libmilter/libmilter.h
+++ b/contrib/sendmail/libmilter/libmilter.h
@@ -17,7 +17,7 @@
# define EXTERN
# define INIT(x) = x
# ifndef lint
-static char MilterlId[] = "@(#)$Id: libmilter.h,v 8.3.6.9 2000/09/01 00:49:04 ca Exp $";
+static char MilterlId[] = "@(#)$Id: libmilter.h,v 8.3.6.10 2000/11/20 21:15:36 ca Exp $";
# endif /* ! lint */
#else /* _DEFINE */
# define EXTERN extern
@@ -44,6 +44,13 @@ static char MilterlId[] = "@(#)$Id: libmilter.h,v 8.3.6.9 2000/09/01 00:49:04 ca
# define thread_create(ptid,wr,arg) pthread_create(ptid, NULL, wr, arg)
# define sthread_get_id() pthread_self()
+typedef pthread_mutex_t smutex_t;
+# define smutex_init(mp) (pthread_mutex_init(mp, NULL) == 0)
+# define smutex_destroy(mp) (pthread_mutex_destroy(mp) == 0)
+# define smutex_lock(mp) (pthread_mutex_lock(mp) == 0)
+# define smutex_unlock(mp) (pthread_mutex_unlock(mp) == 0)
+# define smutex_trylock(mp) (pthread_mutex_trylock(mp) == 0)
+
#include <sys/time.h>
/* version info */
diff --git a/contrib/sendmail/libmilter/listener.c b/contrib/sendmail/libmilter/listener.c
index c3ad445..8b1d952 100644
--- a/contrib/sendmail/libmilter/listener.c
+++ b/contrib/sendmail/libmilter/listener.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: listener.c,v 8.38.2.1.2.11 2000/09/01 00:49:04 ca Exp $";
+static char id[] = "@(#)$Id: listener.c,v 8.38.2.1.2.18 2000/12/29 19:44:28 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -47,7 +47,6 @@ mi_milteropen(conn, backlog, socksize, name)
char *p;
char *colon;
char *at;
- struct hostent *hp = NULL;
SOCKADDR addr;
if (conn == NULL || conn[0] == '\0')
@@ -299,6 +298,8 @@ mi_milteropen(conn, backlog, socksize, name)
}
else
{
+ struct hostent *hp = NULL;
+
hp = mi_gethostbyname(at, addr.sa.sa_family);
if (hp == NULL)
{
@@ -334,6 +335,9 @@ mi_milteropen(conn, backlog, socksize, name)
name, at, hp->h_addrtype);
return INVALID_SOCKET;
}
+# if _FFR_FREEHOSTENT && NETINET6
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
}
}
else
@@ -411,6 +415,8 @@ mi_thread_handle_wrapper(arg)
static socket_t listenfd = INVALID_SOCKET;
+static smutex_t L_Mutex;
+
/*
** MI_CLOSENER -- close listen socket
**
@@ -424,11 +430,13 @@ static socket_t listenfd = INVALID_SOCKET;
void
mi_closener()
{
+ (void) smutex_lock(&L_Mutex);
if (ValidSocket(listenfd))
{
(void) close(listenfd);
listenfd = INVALID_SOCKET;
}
+ (void) smutex_unlock(&L_Mutex);
}
/*
@@ -475,37 +483,56 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
smi_log(SMI_LOG_DEBUG,
"%s: Opening listen socket on conn %s",
smfi->xxfi_name, conn);
+ (void) smutex_init(&L_Mutex);
+ (void) smutex_lock(&L_Mutex);
listenfd = mi_milteropen(conn, backlog, &socksize, smfi->xxfi_name);
if (!ValidSocket(listenfd))
{
smi_log(SMI_LOG_FATAL,
"%s: Unable to create listening socket on conn %s",
smfi->xxfi_name, conn);
+ (void) smutex_unlock(&L_Mutex);
return MI_FAILURE;
}
clilen = socksize;
+
if (listenfd >= FD_SETSIZE)
{
smi_log(SMI_LOG_ERR, "%s: fd %d is larger than FD_SETSIZE %d",
smfi->xxfi_name, listenfd, FD_SETSIZE);
+ (void) smutex_unlock(&L_Mutex);
return MI_FAILURE;
}
+ (void) smutex_unlock(&L_Mutex);
while (mi_stop() == MILTER_CONT)
{
+ (void) smutex_lock(&L_Mutex);
+ if (!ValidSocket(listenfd))
+ {
+ (void) smutex_unlock(&L_Mutex);
+ break;
+ }
+
/* select on interface ports */
FD_ZERO(&readset);
- FD_SET((u_int) listenfd, &readset);
FD_ZERO(&excset);
+ FD_SET((u_int) listenfd, &readset);
FD_SET((u_int) listenfd, &excset);
chktime.tv_sec = MI_CHK_TIME;
chktime.tv_usec = 0;
r = select(listenfd + 1, &readset, NULL, &excset, &chktime);
if (r == 0) /* timeout */
+ {
+ (void) smutex_unlock(&L_Mutex);
continue; /* just check mi_stop() */
+ }
if (r < 0)
{
- if (errno == EINTR)
+ int err = errno;
+
+ (void) smutex_unlock(&L_Mutex);
+ if (err == EINTR)
continue;
ret = MI_FAILURE;
break;
@@ -514,11 +541,13 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
{
/* some error: just stop for now... */
ret = MI_FAILURE;
+ (void) smutex_unlock(&L_Mutex);
break;
}
connfd = accept(listenfd, (struct sockaddr *) &cliaddr,
&clilen);
+ (void) smutex_unlock(&L_Mutex);
if (!ValidSocket(connfd))
{
@@ -577,7 +606,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
if ((r = thread_create(&thread_id,
mi_thread_handle_wrapper,
- (void *) ctx)) != MI_SUCCESS)
+ (void *) ctx)) != 0)
{
smi_log(SMI_LOG_ERR,
"%s: thread_create() failed: %d",
@@ -596,8 +625,9 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
}
if (ret != MI_SUCCESS)
mi_stop_milters(MILTER_ABRT);
- if (listenfd >= 0)
- (void) close(listenfd);
+ else
+ mi_closener();
+ (void) smutex_destroy(&L_Mutex);
return ret;
}
#endif /* _FFR_MILTER */
diff --git a/contrib/sendmail/libmilter/signal.c b/contrib/sendmail/libmilter/signal.c
index 9448d77..0bc5081 100644
--- a/contrib/sendmail/libmilter/signal.c
+++ b/contrib/sendmail/libmilter/signal.c
@@ -9,19 +9,12 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: signal.c,v 8.10.4.7 2000/09/01 00:49:04 ca Exp $";
+static char id[] = "@(#)$Id: signal.c,v 8.10.4.8 2000/11/20 21:15:37 ca Exp $";
#endif /* ! lint */
#if _FFR_MILTER
#include "libmilter.h"
-typedef pthread_mutex_t smutex_t;
-# define smutex_init(mp) (pthread_mutex_init(mp, NULL) == 0)
-# define smutex_destroy(mp) (pthread_mutex_destroy(mp) == 0)
-# define smutex_lock(mp) (pthread_mutex_lock(mp) == 0)
-# define smutex_unlock(mp) (pthread_mutex_unlock(mp) == 0)
-# define smutex_trylock(mp) (pthread_mutex_trylock(mp) == 0)
-
/*
** thread to handle signals
*/
diff --git a/contrib/sendmail/libmilter/sm_gethost.c b/contrib/sendmail/libmilter/sm_gethost.c
index fdbaebd..9541a93 100644
--- a/contrib/sendmail/libmilter/sm_gethost.c
+++ b/contrib/sendmail/libmilter/sm_gethost.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: sm_gethost.c,v 8.7.8.2 2000/09/17 17:04:24 gshapiro Exp $";
+static char id[] = "@(#)$Id: sm_gethost.c,v 8.7.8.4 2000/12/19 04:26:33 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -61,6 +61,20 @@ getipnodebyname(name, family, flags, err)
_res.options &= ~RES_USE_INET6;
return h;
}
+
+# if _FFR_FREEHOSTENT
+void
+freehostent(h)
+ struct hostent *h;
+{
+ /*
+ ** Stub routine -- if they don't have getipnodeby*(),
+ ** they probably don't have the free routine either.
+ */
+
+ return;
+}
+# endif /* _FFR_FREEHOSTENT */
#endif /* NEEDSGETIPNODE && NETINET6 && __RES < 19990909 */
struct hostent *
diff --git a/contrib/sendmail/libsmdb/smdb1.c b/contrib/sendmail/libsmdb/smdb1.c
index c9eb96f..797bf2f 100644
--- a/contrib/sendmail/libsmdb/smdb1.c
+++ b/contrib/sendmail/libsmdb/smdb1.c
@@ -8,7 +8,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: smdb1.c,v 8.43.4.1 2000/08/24 17:08:00 gshapiro Exp $";
+static char id[] = "@(#)$Id: smdb1.c,v 8.43.4.3 2000/10/05 23:06:30 gshapiro Exp $";
#endif /* ! lint */
#include <unistd.h>
@@ -175,8 +175,12 @@ smdb1_del(database, key, flags)
u_int flags;
{
DB *db = ((SMDB_DB1_DATABASE *) database->smdb_impl)->smdb1_db;
+ DBT dbkey;
- return db->del(db, &key->db, flags);
+ memset(&dbkey, '\0', sizeof dbkey);
+ dbkey.data = key->data;
+ dbkey.size = key->size;
+ return db->del(db, &dbkey, flags);
}
int
@@ -212,14 +216,22 @@ smdb1_get(database, key, data, flags)
{
int result;
DB *db = ((SMDB_DB1_DATABASE *) database->smdb_impl)->smdb1_db;
+ DBT dbkey, dbdata;
- result = db->get(db, &key->db, &data->db, flags);
+ memset(&dbdata, '\0', sizeof dbdata);
+ memset(&dbkey, '\0', sizeof dbkey);
+ dbkey.data = key->data;
+ dbkey.size = key->size;
+
+ result = db->get(db, &dbkey, &dbdata, flags);
if (result != 0)
{
if (result == 1)
return SMDBE_NOT_FOUND;
return errno;
}
+ data->data = dbdata.data;
+ data->size = dbdata.size;
return SMDBE_OK;
}
@@ -231,9 +243,17 @@ smdb1_put(database, key, data, flags)
u_int flags;
{
DB *db = ((SMDB_DB1_DATABASE *) database->smdb_impl)->smdb1_db;
+ DBT dbkey, dbdata;
+
+ memset(&dbdata, '\0', sizeof dbdata);
+ memset(&dbkey, '\0', sizeof dbkey);
+ dbkey.data = key->data;
+ dbkey.size = key->size;
+ dbdata.data = data->data;
+ dbdata.size = data->size;
- return db->put(db, &key->db, &data->db,
- smdb_put_flags_to_db1_flags(flags));
+ return db->put(db, &dbkey, &dbdata,
+ smdb_put_flags_to_db1_flags(flags));
}
int
@@ -309,13 +329,21 @@ smdb1_cursor_get(cursor, key, value, flags)
SMDB_DB1_CURSOR *db1_cursor = (SMDB_DB1_CURSOR *) cursor->smdbc_impl;
SMDB_DB1_DATABASE *db1 = db1_cursor->db;
DB *db = db1->smdb1_db;
+ DBT dbkey, dbdata;
+
+ memset(&dbdata, '\0', sizeof dbdata);
+ memset(&dbkey, '\0', sizeof dbkey);
db1_flags = smdb_cursor_get_flags_to_smdb1(flags);
- result = db->seq(db, &key->db, &value->db, db1_flags);
+ result = db->seq(db, &dbkey, &dbdata, db1_flags);
if (result == -1)
return errno;
if (result == 1)
return SMDBE_LAST_ENTRY;
+ value->data = dbdata.data;
+ value->size = dbdata.size;
+ key->data = dbkey.data;
+ key->size = dbkey.size;
return SMDBE_OK;
}
@@ -329,8 +357,16 @@ smdb1_cursor_put(cursor, key, value, flags)
SMDB_DB1_CURSOR *db1_cursor = (SMDB_DB1_CURSOR *) cursor->smdbc_impl;
SMDB_DB1_DATABASE *db1 = db1_cursor->db;
DB *db = db1->smdb1_db;
+ DBT dbkey, dbdata;
+
+ memset(&dbdata, '\0', sizeof dbdata);
+ memset(&dbkey, '\0', sizeof dbkey);
+ dbkey.data = key->data;
+ dbkey.size = key->size;
+ dbdata.data = value->data;
+ dbdata.size = value->size;
- return db->put(db, &key->db, &value->db, R_CURSOR);
+ return db->put(db, &dbkey, &dbdata, R_CURSOR);
}
int
diff --git a/contrib/sendmail/libsmdb/smdb2.c b/contrib/sendmail/libsmdb/smdb2.c
index 8f46c20..e6f350a 100644
--- a/contrib/sendmail/libsmdb/smdb2.c
+++ b/contrib/sendmail/libsmdb/smdb2.c
@@ -8,7 +8,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: smdb2.c,v 8.53.2.1.2.2 2000/08/24 17:08:00 gshapiro Exp $";
+static char id[] = "@(#)$Id: smdb2.c,v 8.53.2.1.2.5 2000/10/26 00:39:56 geir Exp $";
#endif /* ! lint */
#include <fcntl.h>
@@ -250,8 +250,12 @@ smdb2_del(database, key, flags)
u_int flags;
{
DB *db = ((SMDB_DB2_DATABASE *) database->smdb_impl)->smdb2_db;
+ DBT dbkey;
- return db2_error_to_smdb(db->del(db, NULL, &key->db, flags));
+ memset(&dbkey, '\0', sizeof dbkey);
+ dbkey.data = key->data;
+ dbkey.size = key->size;
+ return db2_error_to_smdb(db->del(db, NULL, &dbkey, flags));
}
int
@@ -281,9 +285,19 @@ smdb2_get(database, key, data, flags)
SMDB_DBENT *data;
u_int flags;
{
+ int result;
DB *db = ((SMDB_DB2_DATABASE *) database->smdb_impl)->smdb2_db;
+ DBT dbkey, dbdata;
+
+ memset(&dbdata, '\0', sizeof dbdata);
+ memset(&dbkey, '\0', sizeof dbkey);
+ dbkey.data = key->data;
+ dbkey.size = key->size;
- return db2_error_to_smdb(db->get(db, NULL, &key->db, &data->db, flags));
+ result = db->get(db, NULL, &dbkey, &dbdata, flags);
+ data->data = dbdata.data;
+ data->size = dbdata.size;
+ return db2_error_to_smdb(result);
}
int
@@ -294,8 +308,16 @@ smdb2_put(database, key, data, flags)
u_int flags;
{
DB *db = ((SMDB_DB2_DATABASE *) database->smdb_impl)->smdb2_db;
+ DBT dbkey, dbdata;
- return db2_error_to_smdb(db->put(db, NULL, &key->db, &data->db,
+ memset(&dbdata, '\0', sizeof dbdata);
+ memset(&dbkey, '\0', sizeof dbkey);
+ dbkey.data = key->data;
+ dbkey.size = key->size;
+ dbdata.data = data->data;
+ dbdata.size = data->size;
+
+ return db2_error_to_smdb(db->put(db, NULL, &dbkey, &dbdata,
smdb_put_flags_to_db2_flags(flags)));
}
@@ -362,11 +384,19 @@ smdb2_cursor_get(cursor, key, value, flags)
int db2_flags;
int result;
DBC *dbc = (DBC *) cursor->smdbc_impl;
+ DBT dbkey, dbdata;
+
+ memset(&dbdata, '\0', sizeof dbdata);
+ memset(&dbkey, '\0', sizeof dbkey);
db2_flags = smdb_cursor_get_flags_to_db2(flags);
- result = dbc->c_get(dbc, &key->db, &value->db, db2_flags);
+ result = dbc->c_get(dbc, &dbkey, &dbdata, db2_flags);
if (result == DB_NOTFOUND)
return SMDBE_LAST_ENTRY;
+ key->data = dbkey.data;
+ key->size = dbkey.size;
+ value->data = dbdata.data;
+ value->size = dbdata.size;
return db2_error_to_smdb(result);
}
@@ -378,8 +408,16 @@ smdb2_cursor_put(cursor, key, value, flags)
SMDB_FLAG flags;
{
DBC *dbc = (DBC *) cursor->smdbc_impl;
+ DBT dbkey, dbdata;
+
+ memset(&dbdata, '\0', sizeof dbdata);
+ memset(&dbkey, '\0', sizeof dbkey);
+ dbkey.data = key->data;
+ dbkey.size = key->size;
+ dbdata.data = value->data;
+ dbdata.size = value->size;
- return db2_error_to_smdb(dbc->c_put(dbc, &key->db, &value->db, 0));
+ return db2_error_to_smdb(dbc->c_put(dbc, &dbkey, &dbdata, 0));
}
int
diff --git a/contrib/sendmail/libsmdb/smndbm.c b/contrib/sendmail/libsmdb/smndbm.c
index 8c78ffc..47e5cb5 100644
--- a/contrib/sendmail/libsmdb/smndbm.c
+++ b/contrib/sendmail/libsmdb/smndbm.c
@@ -8,7 +8,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: smndbm.c,v 8.40.4.1 2000/08/24 17:08:00 gshapiro Exp $";
+static char id[] = "@(#)$Id: smndbm.c,v 8.40.4.3 2000/10/05 22:27:50 gshapiro Exp $";
#endif /* ! lint */
#include <fcntl.h>
@@ -124,9 +124,14 @@ smdbm_del(database, key, flags)
{
int result;
DBM *dbm = ((SMDB_DBM_DATABASE *) database->smdb_impl)->smndbm_dbm;
+ datum dbkey;
+
+ memset(&dbkey, '\0', sizeof dbkey);
+ dbkey.dptr = key->data;
+ dbkey.dsize = key->size;
errno = 0;
- result = dbm_delete(dbm, key->dbm);
+ result = dbm_delete(dbm, dbkey);
if (result != 0)
{
int save_errno = errno;
@@ -173,10 +178,16 @@ smdbm_get(database, key, data, flags)
u_int flags;
{
DBM *dbm = ((SMDB_DBM_DATABASE *) database->smdb_impl)->smndbm_dbm;
+ datum dbkey, dbdata;
+
+ memset(&dbkey, '\0', sizeof dbkey);
+ memset(&dbdata, '\0', sizeof dbdata);
+ dbkey.dptr = key->data;
+ dbkey.dsize = key->size;
errno = 0;
- data->dbm = dbm_fetch(dbm, key->dbm);
- if (data->dbm.dptr == NULL)
+ dbdata = dbm_fetch(dbm, dbkey);
+ if (dbdata.dptr == NULL)
{
int save_errno = errno;
@@ -188,7 +199,8 @@ smdbm_get(database, key, data, flags)
return SMDBE_NOT_FOUND;
}
-
+ data->data = dbdata.dptr;
+ data->size = dbdata.dsize;
return SMDBE_OK;
}
@@ -202,9 +214,17 @@ smdbm_put(database, key, data, flags)
int result;
int save_errno;
DBM *dbm = ((SMDB_DBM_DATABASE *) database->smdb_impl)->smndbm_dbm;
+ datum dbkey, dbdata;
+
+ memset(&dbkey, '\0', sizeof dbkey);
+ memset(&dbdata, '\0', sizeof dbdata);
+ dbkey.dptr = key->data;
+ dbkey.dsize = key->size;
+ dbdata.dptr = data->data;
+ dbdata.dsize = data->size;
errno = 0;
- result = dbm_store(dbm, key->dbm, data->dbm,
+ result = dbm_store(dbm, dbkey, dbdata,
smdb_put_flags_to_ndbm_flags(flags));
switch (result)
{
@@ -321,6 +341,10 @@ smdbm_cursor_get(cursor, key, value, flags)
SMDB_DBM_CURSOR *dbm_cursor = (SMDB_DBM_CURSOR *) cursor->smdbc_impl;
SMDB_DBM_DATABASE *db = dbm_cursor->smndbmc_db;
DBM *dbm = db->smndbm_dbm;
+ datum dbkey, dbdata;
+
+ memset(&dbkey, '\0', sizeof dbkey);
+ memset(&dbdata, '\0', sizeof dbdata);
if (flags == SMDB_CURSOR_GET_RANGE)
return SMDBE_UNSUPPORTED;
@@ -347,8 +371,8 @@ smdbm_cursor_get(cursor, key, value, flags)
}
errno = 0;
- value->dbm = dbm_fetch(dbm, dbm_cursor->smndbmc_current_key);
- if (value->dbm.dptr == NULL)
+ dbdata = dbm_fetch(dbm, dbm_cursor->smndbmc_current_key);
+ if (dbdata.dptr == NULL)
{
int save_errno = errno;
@@ -360,7 +384,10 @@ smdbm_cursor_get(cursor, key, value, flags)
return SMDBE_NOT_FOUND;
}
- key->dbm = dbm_cursor->smndbmc_current_key;
+ value->data = dbdata.dptr;
+ value->size = dbdata.dsize;
+ key->data = dbm_cursor->smndbmc_current_key.dptr;
+ key->size = dbm_cursor->smndbmc_current_key.dsize;
return SMDBE_OK;
}
@@ -377,9 +404,14 @@ smdbm_cursor_put(cursor, key, value, flags)
SMDB_DBM_CURSOR *dbm_cursor = (SMDB_DBM_CURSOR *) cursor->smdbc_impl;
SMDB_DBM_DATABASE *db = dbm_cursor->smndbmc_db;
DBM *dbm = db->smndbm_dbm;
+ datum dbdata;
+
+ memset(&dbdata, '\0', sizeof dbdata);
+ dbdata.dptr = value->data;
+ dbdata.dsize = value->size;
errno = 0;
- result = dbm_store(dbm, dbm_cursor->smndbmc_current_key, value->dbm,
+ result = dbm_store(dbm, dbm_cursor->smndbmc_current_key, dbdata,
smdb_put_flags_to_ndbm_flags(flags));
switch (result)
{
diff --git a/contrib/sendmail/libsmutil/lockfile.c b/contrib/sendmail/libsmutil/lockfile.c
index 78fbc20..8c2dc6e 100644
--- a/contrib/sendmail/libsmutil/lockfile.c
+++ b/contrib/sendmail/libsmutil/lockfile.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: lockfile.c,v 8.3 1999/08/31 15:38:27 ca Exp $";
+static char id[] = "@(#)$Id: lockfile.c,v 8.3.16.11 2000/11/16 02:54:28 geir Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -27,6 +27,7 @@ static char id[] = "@(#)$Id: lockfile.c,v 8.3 1999/08/31 15:38:27 ca Exp $";
** type -- type of the lock. Bits can be:
** LOCK_EX -- exclusive lock.
** LOCK_NB -- non-blocking.
+** LOCK_UN -- unlock.
**
** Returns:
** TRUE if the lock was acquired.
diff --git a/contrib/sendmail/mail.local/mail.local.8 b/contrib/sendmail/mail.local/mail.local.8
index e6e8ea3..939d772 100644
--- a/contrib/sendmail/mail.local/mail.local.8
+++ b/contrib/sendmail/mail.local/mail.local.8
@@ -8,15 +8,17 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: mail.local.8,v 8.14.14.3 2000/09/17 17:04:25 gshapiro Exp $
+.\" $Id: mail.local.8,v 8.14.14.5 2000/12/29 18:12:16 gshapiro Exp $
.\"
-.TH MAIL.LOCAL 8 "$Date: 2000/09/17 17:04:25 $"
+.TH MAIL.LOCAL 8 "$Date: 2000/12/29 18:12:16 $"
.SH NAME
-.B mail.local
+mail.local
\- store mail in a mailbox
.SH SYNOPSIS
.B mail.local
-.RB [ \-7 "] [" \-b "] [" \-d "] [" \-l "] [" \-f
+.RB [ \-7 "] [" \-b "] [" \-d "] [" \-l "] [" \-f
+.IR from "] "
+.RB [ \-r
.IR from "] " "user ..."
.SH DESCRIPTION
.B Mail.local
diff --git a/contrib/sendmail/mail.local/mail.local.c b/contrib/sendmail/mail.local/mail.local.c
index 8178f7b..473d04a 100644
--- a/contrib/sendmail/mail.local/mail.local.c
+++ b/contrib/sendmail/mail.local/mail.local.c
@@ -19,7 +19,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.37 2000/09/22 00:49:10 doug Exp $";
+static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.39 2000/11/14 20:02:47 gshapiro Exp $";
#endif /* ! lint */
/*
@@ -650,7 +650,7 @@ dolmtp(bouncequota)
printf("250 2.0.0 ok\r\n");
rset:
- while (rcpt_num)
+ while (rcpt_num > 0)
free(rcpt_addr[--rcpt_num]);
if (return_path != NULL)
free(return_path);
@@ -911,7 +911,7 @@ deliver(fd, name, bouncequota)
struct stat sb;
struct passwd *pw;
char path[MAXPATHLEN];
- int mbfd, nr = 0, nw, off;
+ int mbfd = -1, nr = 0, nw, off;
char *p;
off_t curoff;
#ifdef CONTENTLENGTH
diff --git a/contrib/sendmail/mailstats/mailstats.8 b/contrib/sendmail/mailstats/mailstats.8
index 2fab81d..5122bd0 100644
--- a/contrib/sendmail/mailstats/mailstats.8
+++ b/contrib/sendmail/mailstats/mailstats.8
@@ -6,11 +6,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: mailstats.8,v 8.17 2000/03/11 20:18:21 gshapiro Exp $
+.\" $Id: mailstats.8,v 8.17.4.3 2000/12/29 18:12:20 gshapiro Exp $
.\"
-.TH MAILSTATS 1 "April 25, 1996"
+.TH MAILSTATS 1 "$Date: 2000/12/29 18:12:20 $"
.SH NAME
-.B mailstats
+mailstats
\- display mail statistics
.SH SYNOPSIS
.B mailstats
@@ -72,13 +72,13 @@ The options are as follows:
.B \-C
Read the specified file instead of the default
.B sendmail
-``cf'' file.
+configuration file.
.TP
.B \-f
Read the specified statistics file instead of the statistics file
specified in the
.B sendmail
-``cf'' file.
+configuration file.
.TP
.B \-p
Output information in program-readable mode and clear statistics.
@@ -95,7 +95,7 @@ utility exits 0 on success, and >0 if an error occurs.
/etc/mail/sendmail.cf
The default
.B sendmail
-``cf'' file.
+configuration file.
.TP
/etc/mail/statistics
The default
diff --git a/contrib/sendmail/makemap/makemap.8 b/contrib/sendmail/makemap/makemap.8
index 4be3048..375d1ec 100644
--- a/contrib/sendmail/makemap/makemap.8
+++ b/contrib/sendmail/makemap/makemap.8
@@ -8,11 +8,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: makemap.8,v 8.21.16.2 2000/09/17 17:04:26 gshapiro Exp $
+.\" $Id: makemap.8,v 8.21.16.5 2000/12/29 18:12:20 gshapiro Exp $
.\"
-.TH MAKEMAP 8 "November 16, 1992"
+.TH MAKEMAP 8 "$Date: 2000/12/29 18:12:20 $"
.SH NAME
-.B makemap
+makemap
\- create database maps for sendmail
.SH SYNOPSIS
.B makemap
@@ -87,8 +87,9 @@ the specified
.SS Flags
.TP
.B \-C
-Use the specified sendmail configuration file for
-looking up the TrustedUser option.
+Use the specified
+.B sendmail
+configuration file for looking up the TrustedUser option.
.TP
.B \-N
Include the null byte that terminates strings
diff --git a/contrib/sendmail/makemap/makemap.c b/contrib/sendmail/makemap/makemap.c
index 3111a87..cabb18a 100644
--- a/contrib/sendmail/makemap/makemap.c
+++ b/contrib/sendmail/makemap/makemap.c
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: makemap.c,v 8.135.4.11 2000/09/13 01:11:10 gshapiro Exp $";
+static char id[] = "@(#)$Id: makemap.c,v 8.135.4.13 2000/10/05 23:00:50 gshapiro Exp $";
#endif /* ! lint */
@@ -356,7 +356,6 @@ main(argc, argv)
exitstat = EX_OK;
if (unmake)
{
- bool stop;
errno = database->smdb_cursor(database, &cursor, 0);
if (errno != SMDBE_OK)
{
@@ -370,20 +369,18 @@ main(argc, argv)
memset(&db_key, '\0', sizeof db_key);
memset(&db_val, '\0', sizeof db_val);
- for (stop = FALSE, lineno = 0; !stop; lineno++)
+ for (lineno = 0; ; lineno++)
{
errno = cursor->smdbc_get(cursor, &db_key, &db_val,
SMDB_CURSOR_GET_NEXT);
if (errno != SMDBE_OK)
- {
- stop = TRUE;
- }
- if (!stop)
- printf("%.*s\t%.*s\n",
- (int) db_key.data.size,
- (char *) db_key.data.data,
- (int) db_val.data.size,
- (char *)db_val.data.data);
+ break;
+
+ printf("%.*s\t%.*s\n",
+ (int) db_key.size,
+ (char *) db_key.data,
+ (int) db_val.size,
+ (char *)db_val.data);
}
(void) cursor->smdbc_close(cursor);
@@ -430,16 +427,16 @@ main(argc, argv)
memset(&db_key, '\0', sizeof db_key);
memset(&db_val, '\0', sizeof db_val);
- db_key.data.data = ibuf;
+ db_key.data = ibuf;
for (p = ibuf; *p != '\0' && !(ISSEP(*p)); p++)
{
if (foldcase && isascii(*p) && isupper(*p))
*p = tolower(*p);
}
- db_key.data.size = p - ibuf;
+ db_key.size = p - ibuf;
if (inclnull)
- db_key.data.size++;
+ db_key.size++;
if (*p != '\0')
*p++ = '\0';
@@ -450,15 +447,15 @@ main(argc, argv)
fprintf(stderr,
"%s: %s: line %d: no RHS for LHS %s\n",
progname, mapname, lineno,
- (char *) db_key.data.data);
+ (char *) db_key.data);
exitstat = EX_DATAERR;
continue;
}
- db_val.data.data = p;
- db_val.data.size = strlen(p);
+ db_val.data = p;
+ db_val.size = strlen(p);
if (inclnull)
- db_val.data.size++;
+ db_val.size++;
/*
** Do the database insert.
@@ -467,8 +464,8 @@ main(argc, argv)
if (verbose)
{
printf("key=`%s', val=`%s'\n",
- (char *) db_key.data.data,
- (char *) db_val.data.data);
+ (char *) db_key.data,
+ (char *) db_val.data);
}
errno = database->smdb_put(database, &db_key, &db_val,
@@ -493,7 +490,7 @@ main(argc, argv)
fprintf(stderr,
"%s: %s: line %d: key %s: put error: %s\n",
progname, mapname, lineno,
- (char *) db_key.data.data,
+ (char *) db_key.data,
errstring(errno));
exitstat = EX_IOERR;
}
@@ -502,7 +499,7 @@ main(argc, argv)
fprintf(stderr,
"%s: %s: line %d: key %s: duplicate key\n",
progname, mapname,
- lineno, (char *) db_key.data.data);
+ lineno, (char *) db_key.data);
exitstat = EX_DATAERR;
}
}
diff --git a/contrib/sendmail/praliases/praliases.8 b/contrib/sendmail/praliases/praliases.8
index 0a63a79..91d4498 100644
--- a/contrib/sendmail/praliases/praliases.8
+++ b/contrib/sendmail/praliases/praliases.8
@@ -6,11 +6,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: praliases.8,v 8.15 2000/04/06 16:47:24 ca Exp $
+.\" $Id: praliases.8,v 8.15.4.2 2000/12/15 19:50:45 gshapiro Exp $
.\"
-.TH PRALIASES 8 "April 25, 1996"
+.TH PRALIASES 8 "$Date: 2000/12/15 19:50:45 $"
.SH NAME
-.B praliases
+praliases
\- display system mail aliases
.SH SYNOPSIS
.B praliases
diff --git a/contrib/sendmail/praliases/praliases.c b/contrib/sendmail/praliases/praliases.c
index 4c6c4d6..8db0cd1 100644
--- a/contrib/sendmail/praliases/praliases.c
+++ b/contrib/sendmail/praliases/praliases.c
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: praliases.c,v 8.59.4.10 2000/07/18 05:41:39 gshapiro Exp $";
+static char id[] = "@(#)$Id: praliases.c,v 8.59.4.15 2000/10/24 00:42:59 geir Exp $";
#endif /* ! lint */
#include <sys/types.h>
@@ -56,6 +56,8 @@ BITMAP256 DontBlameSendmail;
extern void syserr __P((const char *, ...));
+# define DELIMITERS " ,/"
+# define PATH_SEPARATOR ':'
int
main(argc, argv)
@@ -170,7 +172,7 @@ main(argc, argv)
break;
b = p;
- p = strpbrk(p, " ,/");
+ p = strpbrk(p, DELIMITERS);
/* find end of spec */
if (p != NULL)
@@ -244,7 +246,7 @@ praliases(filename, argc, argv)
SMDB_DBPARAMS params;
SMDB_USER_INFO user_info;
- colon = strchr(filename, ':');
+ colon = strchr(filename, PATH_SEPARATOR);
if (colon == NULL)
{
db_name = filename;
@@ -262,6 +264,7 @@ praliases(filename, argc, argv)
{
while (isascii(*db_name) && isspace(*db_name))
db_name++;
+
if (*db_name != '-')
break;
while (*db_name != '\0' &&
@@ -313,20 +316,20 @@ praliases(filename, argc, argv)
{
#if 0
/* skip magic @:@ entry */
- if (db_key.data.size == 2 &&
- db_key.data.data[0] == '@' &&
- db_key.data.data[1] == '\0' &&
- db_value.data.size == 2 &&
- db_value.data.data[0] == '@' &&
- db_value.data.data[1] == '\0')
+ if (db_key.size == 2 &&
+ db_key.data[0] == '@' &&
+ db_key.data[1] == '\0' &&
+ db_value.size == 2 &&
+ db_value.data[0] == '@' &&
+ db_value.data[1] == '\0')
continue;
#endif /* 0 */
printf("%.*s:%.*s\n",
- (int) db_key.data.size,
- (char *) db_key.data.data,
- (int) db_value.data.size,
- (char *) db_value.data.data);
+ (int) db_key.size,
+ (char *) db_key.data,
+ (int) db_value.size,
+ (char *) db_value.data);
}
if (result != SMDBE_OK && result != SMDBE_LAST_ENTRY)
@@ -341,19 +344,19 @@ praliases(filename, argc, argv)
{
memset(&db_key, '\0', sizeof db_key);
memset(&db_value, '\0', sizeof db_value);
- db_key.data.data = *argv;
- db_key.data.size = strlen(*argv) + 1;
+ db_key.data = *argv;
+ db_key.size = strlen(*argv) + 1;
if (database->smdb_get(database, &db_key,
&db_value, 0) == SMDBE_OK)
{
printf("%.*s:%.*s\n",
- (int) db_key.data.size,
- (char *) db_key.data.data,
- (int) db_value.data.size,
- (char *) db_value.data.data);
+ (int) db_key.size,
+ (char *) db_key.data,
+ (int) db_value.size,
+ (char *) db_value.data);
}
else
- printf("%s: No such key\n", (char *) db_key.data.data);
+ printf("%s: No such key\n", (char *) db_key.data);
}
fatal:
diff --git a/contrib/sendmail/rmail/rmail.8 b/contrib/sendmail/rmail/rmail.8
index c53e693..993507b 100644
--- a/contrib/sendmail/rmail/rmail.8
+++ b/contrib/sendmail/rmail/rmail.8
@@ -8,14 +8,17 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: rmail.8,v 8.1 1999/06/22 20:41:33 tony Exp $
+.\" $Id: rmail.8,v 8.1.16.2 2000/12/29 18:12:22 gshapiro Exp $
.\"
-.TH RMAIL 8 "$Date: 1999/06/22 20:41:33 $"
+.TH RMAIL 8 "$Date: 2000/12/29 18:12:22 $"
.SH NAME
-.B rmail
+rmail
\- handle remote mail received via uucp
.SH SYNOPSIS
.B rmail
+.RB [ \-D
+.IR domain ]
+.RB [ \-T ]
.I
user ...
.SH DESCRIPTION
@@ -34,6 +37,15 @@ is explicitly designed for use with
uucp
and
sendmail.
+.SS Flags
+.TP
+.B \-D
+Use the specified
+.I domain
+instead of the default domain of ``UUCP''.
+.TP
+.B \-T
+Turn on debugging.
.SH SEE ALSO
uucp(1),
mail.local(8),
diff --git a/contrib/sendmail/rmail/rmail.c b/contrib/sendmail/rmail/rmail.c
index 74020a1..dcd10d3 100644
--- a/contrib/sendmail/rmail/rmail.c
+++ b/contrib/sendmail/rmail/rmail.c
@@ -19,7 +19,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: rmail.c,v 8.39.4.8 2000/09/16 22:20:25 gshapiro Exp $";
+static char id[] = "@(#)$Id: rmail.c,v 8.39.4.9 2000/11/17 08:42:56 gshapiro Exp $";
#endif /* ! lint */
/*
@@ -311,12 +311,11 @@ main(argc, argv)
}
- /* Allocate args (with room for sendmail args as well as recipients */
+ /* Allocate args (with room for sendmail args as well as recipients) */
args = (char **)xalloc(sizeof(*args) * (10 + argc));
i = 0;
args[i++] = _PATH_SENDMAIL; /* Build sendmail's argument list. */
- args[i++] = "-G"; /* relay submission */
args[i++] = "-oee"; /* No errors, just status. */
args[i++] = "-odq"; /* Queue it, don't try to deliver. */
args[i++] = "-oi"; /* Ignore '.' on a line by itself. */
diff --git a/contrib/sendmail/smrsh/README b/contrib/sendmail/smrsh/README
index 1e048c6..8529463 100644
--- a/contrib/sendmail/smrsh/README
+++ b/contrib/sendmail/smrsh/README
@@ -75,8 +75,8 @@ You should NOT include interpreter programs such as sh(1), csh(1),
perl(1), uudecode(1) or the stream editor sed(1) in your list of
acceptable commands.
-
-You will next need to create the directory /usr/adm/sm.bin and populate
+If your platform doesn't have a default CMDDIR setting, you will
+next need to create the directory /usr/adm/sm.bin and populate
it with the programs that your site feels are allowable for sendmail
to execute. This directory is explicitly specified in the source
code for smrsh, so changing this directory must be accompanied with
@@ -153,4 +153,4 @@ a typical system follows:
host.domain# /usr/sbin/sendmail -bd -q30m
-$Revision: 8.6 $, Last updated $Date: 1999/04/28 01:09:51 $
+$Revision: 8.6.16.1 $, Last updated $Date: 2000/10/09 20:39:55 $
diff --git a/contrib/sendmail/smrsh/smrsh.8 b/contrib/sendmail/smrsh/smrsh.8
index ebb3841..06a4bdb 100644
--- a/contrib/sendmail/smrsh/smrsh.8
+++ b/contrib/sendmail/smrsh/smrsh.8
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+.\" Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1993 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1993
@@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: smrsh.8,v 8.11 1999/06/09 16:51:07 ca Exp $
+.\" $Id: smrsh.8,v 8.11.16.2 2000/12/15 19:50:46 gshapiro Exp $
.\"
-.TH SMRSH 8 11/02/93
+.TH SMRSH 8 "$Date: 2000/12/15 19:50:46 $"
.SH NAME
smrsh \- restricted shell for sendmail
.SH SYNOPSIS
@@ -37,7 +37,8 @@ limits the set of programs that he or she can execute.
.PP
Briefly,
.I smrsh
-limits programs to be in the directory
+limits programs to be in a single directory,
+by default
/usr/adm/sm.bin,
allowing the system administrator to choose the set of acceptable commands,
and to the shell builtin commands ``exec'', ``exit'', and ``echo''.
@@ -58,7 +59,7 @@ all actually forward to
``/usr/adm/sm.bin/vacation''.
.PP
System administrators should be conservative about populating
-/usr/adm/sm.bin.
+the sm.bin directory.
Reasonable additions are
.IR vacation (1),
.IR procmail (1),
diff --git a/contrib/sendmail/smrsh/smrsh.c b/contrib/sendmail/smrsh/smrsh.c
index d3683a3..f1e6225 100644
--- a/contrib/sendmail/smrsh/smrsh.c
+++ b/contrib/sendmail/smrsh/smrsh.c
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.5 2000/09/17 17:04:27 gshapiro Exp $";
+static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.6 2000/10/09 20:37:16 gshapiro Exp $";
#endif /* ! lint */
/*
@@ -74,7 +74,11 @@ static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.5 2000/09/17 17:04:27 gshapiro Exp
/* directory in which all commands must reside */
#ifndef CMDDIR
-# define CMDDIR "/usr/adm/sm.bin"
+# if defined(HPUX10) || defined(HPUX11) || SOLARIS >= 20800
+# define CMDDIR "/var/adm/sm.bin"
+# else /* HPUX10 || HPUX11 || SOLARIS > 20800 */
+# define CMDDIR "/usr/adm/sm.bin"
+# endif /* HPUX10 || HPUX11 || SOLARIS > 20800 */
#endif /* ! CMDDIR */
/* characters disallowed in the shell "-c" argument */
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README
index fe9f308..e4e62a1 100644
--- a/contrib/sendmail/src/README
+++ b/contrib/sendmail/src/README
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Id: README,v 8.263.2.1.2.21 2000/09/27 16:36:26 ca Exp $
+# $Id: README,v 8.263.2.1.2.27 2000/12/16 16:46:02 gshapiro Exp $
#
This directory contains the source files for sendmail(TM).
@@ -593,9 +593,8 @@ SFIO Uses sfio instead of stdio. sfio is available from AT&T
stdio.h must be installed in a subdirectory called sfio,
i.e., if you install sfio in /usr/local, stdio.h should
be in /usr/local/include/sfio, and libsfio.a should be in
- /usr/local/lib. Notice: you may run into problems if
- you use sfio2000 (the body of a message is lost). Use
- sfio1999 instead.
+ /usr/local/lib. Notice: read the sfio section in
+ OPERATING SYSTEM AND COMPILE QUIRKS.
+---------------------+
@@ -629,6 +628,12 @@ different version of the database internally that does not include
wildcard MX records that match your domain. ANYTHING ELSE WILL GIVE
YOU HEADACHES!
+When attempting to canonify a hostname, some broken name servers will
+return SERVFAIL (a temporary failure) on T_AAAA (IPv6) lookups. If you
+want to excuse this behavior, compile sendmail with
+-D_FFR_WORKAROUND_BROKEN_NAMESERVERS. However, instead, we recommend catching
+the problem and reporting it to the name server administrator so we can rid
+the world of broken name servers.
+----------------------------------------+
| STARTTLS COMPILATION AND CONFIGURATION |
@@ -918,6 +923,25 @@ Solaris 7 (SunOS 5.7)
to ldap_set_option for LDAP_OPT_REFERRALS in ldapmap_setopts if
LDAP support is compiled in sendmail.
+Solaris
+ If you are using dns for hostname resolution on Solaris, make sure
+ that the 'dns' entry is last on the hosts line in
+ '/etc/nsswitch.conf'. For example, use:
+
+ hosts: nisplus files dns
+
+ Do not use:
+
+ host: nisplus dns [NOTFOUND=return] files
+
+ Note that 'nisplus' above is an illustration. The same comment
+ applies no matter what naming services you are using. If you have
+ anything other than dns last, even after "[NOTFOUND=return]",
+ sendmail may not be able to determine whether an error was
+ temporary or permanent. The error returned by the solaris
+ gethostbyname() is the error for the last lookup used, and other
+ naming services do not have the same concept of temporary failure.
+
Ultrix
By default, the IDENT protocol is turned off on Ultrix. If you
are running Ultrix 4.4 or later, or if you have included patch
@@ -1247,7 +1271,7 @@ AIX 4.3.3
2) Build against a real Bind 8.2.2 include/lib tree
3) Wait for IBM to fix it
-AIX 4.2
+AIX 4.X
The AIX m4 implements a different mechanism for ifdef which is
inconsistent with other versions of m4. Therefore, it will not
work properly with the sendmail Build architecture or m4
@@ -1470,9 +1494,30 @@ OpenSSL
Do not use 0.9.3, but OpenSSL 0.9.5a or later if compatible with
0.9.5a.
+sfio
+ You may run into problems if you use sfio2000 (the body of a
+ message is lost). Use sfio1999 instead; however, it also has
+ a bug that can cause sendmail to fail. A patch has been provided
+ by Petr Lampa of Brno University of Technology, which is given here:
+
+diff -rc ../../../../sfio/src/lib/sfio/sfputr.c ./sfputr.c
+*** ../../../../sfio/src/lib/sfio/sfputr.c Tue May 16 18:25:49 2000
+--- ./sfputr.c Wed Sep 20 09:06:01 2000
+***************
+*** 24,29 ****
+--- 24,30 ----
+ for(w = 0; (*s || rc >= 0); )
+ { SFWPEEK(f,ps,p);
+
++ if(p == -1) return -1; /* PL */
+ if(p == 0 || (f->flags&SF_WHOLE) )
+ { n = strlen(s);
+ if(p >= (n + (rc < 0 ? 0 : 1)) )
+
+
PH
PH support is provided by Mark Roth <roth@uiuc.edu>. The map is
- described at http://www-wsg.cso.uiuc.edu/sendmail/patches/ .
+ described at http://www-dev.cso.uiuc.edu/sendmail/ .
Please contact Mark Roth for support and questions regarding the
map.
@@ -1623,4 +1668,4 @@ util.c Some general purpose routines used by sendmail.
version.c The version number and information about this
version of sendmail.
-(Version $Revision: 8.263.2.1.2.21 $, last update $Date: 2000/09/27 16:36:26 $ )
+(Version $Revision: 8.263.2.1.2.27 $, last update $Date: 2000/12/16 16:46:02 $ )
diff --git a/contrib/sendmail/src/alias.c b/contrib/sendmail/src/alias.c
index 6a0b17c..4c6a174 100644
--- a/contrib/sendmail/src/alias.c
+++ b/contrib/sendmail/src/alias.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
#ifndef lint
-static char id[] = "@(#)$Id: alias.c,v 8.142.4.3 2000/09/21 21:52:16 ca Exp $";
+static char id[] = "@(#)$Id: alias.c,v 8.142.4.9 2000/11/08 20:58:42 geir Exp $";
#endif /* ! lint */
# define SEPARATOR ':'
@@ -279,7 +279,7 @@ setalias(spec)
map = &s->s_map;
memset(map, '\0', sizeof *map);
map->map_mname = s->s_name;
- p = strpbrk(p,ALIAS_SPEC_SEPARATORS);
+ p = strpbrk(p, ALIAS_SPEC_SEPARATORS);
if (p != NULL && *p == SEPARATOR)
{
/* map name */
@@ -732,7 +732,7 @@ readaliases(map, af, announcestats, logstats)
register char *nlp;
nlp = &p[strlen(p)];
- if (nlp[-1] == '\n')
+ if (nlp > p && nlp[-1] == '\n')
*--nlp = '\0';
if (CheckAliases)
diff --git a/contrib/sendmail/src/aliases b/contrib/sendmail/src/aliases
index 85e62a9..1b19f41 100644
--- a/contrib/sendmail/src/aliases
+++ b/contrib/sendmail/src/aliases
@@ -1,5 +1,5 @@
#
-# $Id: aliases,v 8.1 1999/02/06 18:44:07 gshapiro Exp $
+# $Id: aliases,v 8.1.36.1 2000/10/16 20:18:39 gshapiro Exp $
# @(#)aliases 8.2 (Berkeley) 3/5/94
#
# Aliases in this file will NOT be expanded in the header from
@@ -31,24 +31,3 @@ operator: root
# trap decode to catch security attacks
decode: root
-
-# OFFICIAL CSRG/BUG ADDRESSES
-
-# Ftp maintainer.
-ftp: ftp-bugs
-ftp-bugs: bigbug@cs.berkeley.edu
-
-# Distribution office.
-bsd-dist: bsd-dist@cs.berkeley.edu
-
-# Fortune maintainer.
-fortune: fortune@cs.berkeley.edu
-
-# Termcap maintainer.
-termcap: termcap@cs.berkeley.edu
-
-# General bug address.
-ucb-fixes: bigbug@cs.berkeley.edu
-ucb-fixes-request: bigbug@cs.berkeley.edu
-bugs: bugs@cs.berkeley.edu
-# END OFFICIAL BUG ADDRESSES
diff --git a/contrib/sendmail/src/aliases.5 b/contrib/sendmail/src/aliases.5
index 4782c34..5142320 100644
--- a/contrib/sendmail/src/aliases.5
+++ b/contrib/sendmail/src/aliases.5
@@ -9,11 +9,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: aliases.5,v 8.15.4.1 2000/07/18 07:23:02 gshapiro Exp $
+.\" $Id: aliases.5,v 8.15.4.2 2000/12/14 23:08:15 gshapiro Exp $
.\"
-.TH ALIASES 5 "$Date: 2000/07/18 07:23:02 $"
+.TH ALIASES 5 "$Date: 2000/12/14 23:08:15 $"
.SH NAME
-.B aliases
+aliases
\- aliases file for sendmail
.SH SYNOPSIS
.B aliases
diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c
index f6ba02c..c6c5f78 100644
--- a/contrib/sendmail/src/collect.c
+++ b/contrib/sendmail/src/collect.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: collect.c,v 8.136.4.6 2000/09/21 21:52:16 ca Exp $";
+static char id[] = "@(#)$Id: collect.c,v 8.136.4.8 2000/10/09 00:50:04 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -436,7 +436,7 @@ nextstate:
dprintf("collect: rscheck(\"check_eoh\", \"%s $| %s\")\n",
hnum, hsize);
rstat = rscheck("check_eoh", hnum, hsize, e, FALSE,
- TRUE, 4);
+ TRUE, 4, NULL);
bp = buf;
@@ -854,6 +854,11 @@ eatfrom(fm, e)
p++;
while (*p == ' ')
p++;
+ if (strlen(p) < 17)
+ {
+ /* no room for the date */
+ return;
+ }
if (!(isascii(*p) && isupper(*p)) ||
p[3] != ' ' || p[13] != ':' || p[16] != ':')
continue;
@@ -866,8 +871,10 @@ eatfrom(fm, e)
continue;
for (dt = MonthList; *dt != NULL; dt++)
+ {
if (strncmp(*dt, &p[4], 3) == 0)
break;
+ }
if (*dt != NULL)
break;
}
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index 6bebd2c..f1d5a8a 100644
--- a/contrib/sendmail/src/conf.c
+++ b/contrib/sendmail/src/conf.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.32 2000/09/23 00:31:33 ca Exp $";
+static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.61 2000/12/28 23:46:41 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -380,7 +380,7 @@ setupmailers()
{
char buf[100];
- (void) strlcpy(buf, "prog, P=/bin/sh, F=lsoDq9, T=X-Unix/X-Unix/X-Unix, A=sh -c \201u",
+ (void) strlcpy(buf, "prog, P=/bin/sh, F=lsouDq9, T=X-Unix/X-Unix/X-Unix, A=sh -c \201u",
sizeof buf);
makemailer(buf);
@@ -825,7 +825,7 @@ switch_map_find(service, maptype, mapreturn)
char *maptype[MAXMAPSTACK];
short mapreturn[MAXMAPACTIONS];
{
- int svcno;
+ int svcno = 0;
int save_errno = errno;
#ifdef _USE_SUN_NSSWITCH_
@@ -845,7 +845,7 @@ switch_map_find(service, maptype, mapreturn)
else
lk = nsw_conf->lookups;
svcno = 0;
- while (lk != NULL)
+ while (lk != NULL && svcno < MAXMAPSTACK)
{
maptype[svcno] = lk->service_name;
if (lk->actions[__NSW_NOTFOUND] == __NSW_RETURN)
@@ -882,7 +882,7 @@ switch_map_find(service, maptype, mapreturn)
errno = save_errno;
return -1;
}
- for (svcno = 0; svcno < SVC_PATHSIZE; svcno++)
+ for (svcno = 0; svcno < SVC_PATHSIZE && svcno < MAXMAPSTACK; svcno++)
{
switch (svcinfo->svcpath[svc][svcno])
{
@@ -1512,6 +1512,7 @@ init_vendor_macros(e)
#define LA_KSTAT 12 /* special Solaris kstat(3k) implementation */
#define LA_DEVSHORT 13 /* read short from a device */
#define LA_ALPHAOSF 14 /* Digital UNIX (OSF/1 on Alpha) table() call */
+#define LA_PSET 15 /* Solaris per-processor-set load average */
/* do guesses based on general OS type */
#ifndef LA_TYPE
@@ -2069,6 +2070,28 @@ int getla()
#endif /* LA_TYPE == LA_ALPHAOSF */
+#if LA_TYPE == LA_PSET
+
+static int
+getla()
+{
+ double avenrun[3];
+
+ if (pset_getloadavg(PS_MYID, avenrun,
+ sizeof(avenrun) / sizeof(avenrun[0])) < 0)
+ {
+ if (tTd(3, 1))
+ dprintf("getla: pset_getloadavg failed: %s",
+ errstring(errno));
+ return -1;
+ }
+ if (tTd(3, 1))
+ dprintf("getla: %d\n", (int) (avenrun[0] +0.5));
+ return ((int) (avenrun[0] + 0.5));
+}
+
+#endif /* LA_TYPE == LA_PSET */
+
#if LA_TYPE == LA_ZERO
static int
@@ -2228,35 +2251,12 @@ refuseconnections(name, e, d)
ENVELOPE *e;
int d;
{
- time_t now;
- static time_t lastconn[MAXDAEMONS];
- static int conncnt[MAXDAEMONS];
-
-
#ifdef XLA
if (!xla_smtp_ok())
return TRUE;
#endif /* XLA */
- now = curtime();
- if (now != lastconn[d])
- {
- lastconn[d] = now;
- conncnt[d] = 0;
- }
- else if (conncnt[d]++ > ConnRateThrottle && ConnRateThrottle > 0)
- {
- /* sleep to flatten out connection load */
- sm_setproctitle(TRUE, e, "deferring connections on daemon %s: %d per second",
- name, ConnRateThrottle);
- if (LogLevel >= 9)
- sm_syslog(LOG_INFO, NOQID,
- "deferring connections on daemon %s: %d per second",
- name, ConnRateThrottle);
- (void) sleep(1);
- }
-
- CurrentLA = getla();
+ CurrentLA = sm_getla(NULL);
if (RefuseLA > 0 && CurrentLA >= RefuseLA)
{
sm_setproctitle(TRUE, e, "rejecting connections on daemon %s: load average: %d",
@@ -2473,7 +2473,7 @@ setproctitle(fmt, va_alist)
if (kmem < 0 || kmempid != getpid())
{
if (kmem >= 0)
- close(kmem);
+ (void) close(kmem);
kmem = open(_PATH_KMEM, O_RDWR, 0);
if (kmem < 0)
return;
@@ -3629,6 +3629,7 @@ transienterror(err)
** type -- type of the lock. Bits can be:
** LOCK_EX -- exclusive lock.
** LOCK_NB -- non-blocking.
+** LOCK_UN -- unlock.
**
** Returns:
** TRUE if the lock was acquired.
@@ -4137,7 +4138,7 @@ validate_connection(sap, hostname, e)
hostname, anynet_ntoa(sap));
if (rscheck("check_relay", hostname, anynet_ntoa(sap),
- e, TRUE, TRUE, 4) != EX_OK)
+ e, TRUE, TRUE, 4, NULL) != EX_OK)
{
static char reject[BUFSIZ*2];
extern char MsgBuf[];
@@ -4379,6 +4380,20 @@ getipnodebyaddr(addr, len, family, err)
*err = h_errno;
return h;
}
+
+# if _FFR_FREEHOSTENT
+void
+freehostent(h)
+ struct hostent *h;
+{
+ /*
+ ** Stub routine -- if they don't have getipnodeby*(),
+ ** they probably don't have the free routine either.
+ */
+
+ return;
+}
+# endif /* _FFR_FREEHOSTENT */
#endif /* NEEDSGETIPNODE && NETINET6 && __RES < 19990909 */
struct hostent *
@@ -4435,9 +4450,12 @@ sm_gethostbyname(name, family)
nmaps = switch_map_find("hosts", maptype, mapreturn);
while (--nmaps >= 0)
+ {
if (strcmp(maptype[nmaps], "nis") == 0 ||
strcmp(maptype[nmaps], "files") == 0)
break;
+ }
+
if (nmaps >= 0)
{
/* try short name */
@@ -4668,14 +4686,16 @@ add_hostnames(sa)
#if NETINET
case AF_INET:
hp = sm_gethostbyaddr((char *) &sa->sin.sin_addr,
- sizeof(sa->sin.sin_addr), sa->sa.sa_family);
+ sizeof(sa->sin.sin_addr),
+ sa->sa.sa_family);
break;
#endif /* NETINET */
#if NETINET6
case AF_INET6:
hp = sm_gethostbyaddr((char *) &sa->sin6.sin6_addr,
- sizeof(sa->sin6.sin6_addr), sa->sa.sa_family);
+ sizeof(sa->sin6.sin6_addr),
+ sa->sa.sa_family);
break;
#endif /* NETINET6 */
@@ -4748,6 +4768,9 @@ add_hostnames(sa)
*ha);
}
}
+#if _FFR_FREEHOSTENT && NETINET6
+ freehostent(hp);
+#endif /* _FFR_FREEHOSTENT && NETINET6 */
return 0;
}
/*
@@ -4816,7 +4839,7 @@ load_if_names()
if (numifs <= 0)
{
- close(s);
+ (void) close(s);
return;
}
lifc.lifc_len = numifs * sizeof (struct lifreq);
@@ -4827,7 +4850,8 @@ load_if_names()
{
if (tTd(0, 4))
dprintf("SIOCGLIFCONF failed: %s\n", errstring(errno));
- close(s);
+ (void) close(s);
+ free(lifc.lifc_buf);
return;
}
@@ -4860,7 +4884,10 @@ load_if_names()
s = socket(af, SOCK_DGRAM, 0);
if (s == -1)
+ {
+ free(lifc.lifc_buf);
return;
+ }
/*
** If we don't have a complete ifr structure,
@@ -4909,7 +4936,18 @@ load_if_names()
{
case AF_INET6:
ia6 = sa->sin6.sin6_addr;
- if (ia6.s6_addr == in6addr_any.s6_addr)
+# ifdef __KAME__
+ /* convert into proper scoped address - */
+ if ((IN6_IS_ADDR_LINKLOCAL(&ia6) ||
+ IN6_IS_ADDR_SITELOCAL(&ia6)) &&
+ sa->sin6.sin6_scope_id == 0)
+ {
+ sa->sin6.sin6_scope_id = ntohs(ia6.s6_addr[3] |
+ ((unsigned int) ia6.s6_addr[2] << 8));
+ ia6.s6_addr[2] = ia6.s6_addr[3] = 0;
+ }
+# endif /* __KAME__ */
+ if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
{
addr = anynet_ntop(&ia6, buf6, sizeof buf6);
message("WARNING: interface %s is UP with %s address",
@@ -4960,7 +4998,7 @@ load_if_names()
(void) add_hostnames(sa);
}
free(lifc.lifc_buf);
- close(s);
+ (void) close(s);
#else /* NETINET6 && defined(SIOCGLIFCONF) */
# if defined(SIOCGIFCONF) && !SIOCGIFCONF_IS_BROKEN
int s;
@@ -5092,7 +5130,7 @@ load_if_names()
# if NETINET6
case AF_INET6:
ia6 = sa->sin6.sin6_addr;
- if (ia6.s6_addr == in6addr_any.s6_addr)
+ if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
{
addr = anynet_ntop(&ia6, buf6, sizeof buf6);
message("WARNING: interface %s is UP with %s address",
diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h
index 88b5183..3e478f0 100644
--- a/contrib/sendmail/src/conf.h
+++ b/contrib/sendmail/src/conf.h
@@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
- * $Id: conf.h,v 8.496.4.25 2000/08/08 23:50:40 ca Exp $
+ * $Id: conf.h,v 8.496.4.32 2000/12/15 19:20:53 gshapiro Exp $
*/
/*
@@ -90,6 +90,7 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */
#define MAXSHORTSTR 203 /* max short string length */
#define MAXMACNAMELEN 25 /* max macro name length */
#define MAXMACROID 0377 /* max macro id number */
+ /* Must match (BITMAPBITS - 1) */
#ifndef MAXHDRSLEN
# define MAXHDRSLEN (32 * 1024) /* max size of message headers */
#endif /* ! MAXHDRSLEN */
@@ -526,12 +527,19 @@ typedef int pid_t;
# if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
# define HASSNPRINTF 1 /* has snprintf starting in 2.6 */
# else /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
- typedef int int32_t;
+# if _FFR_MILTER
+# define SM_INT32 int /* 32bit integer */
+# endif /* _FFR_MILTER */
# endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
# if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
# ifndef LA_TYPE
# include <sys/loadavg.h>
-# define LA_TYPE LA_SUBR /* getloadavg(3c) appears in 2.7 */
+# if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
+# include <sys/pset.h>
+# define LA_TYPE LA_PSET /* pset_getloadavg(3c) appears in 2.9 */
+# else
+# define LA_TYPE LA_SUBR /* getloadavg(3c) appears in 2.7 */
+# endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
# endif /* ! LA_TYPE */
# define HASGETUSERSHELL 1 /* getusershell(3c) bug fixed in 2.7 */
# endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
@@ -1698,6 +1706,7 @@ typedef int pid_t;
# define __svr4__
# define SYS5SIGNALS 1
# define HASSETSID 1
+# define HASSNPRINTF 1
# define HASSETREUID 1
# define HASWAITPID 1
# define HASGETDTABLESIZE 1
@@ -1717,6 +1726,7 @@ typedef int pid_t;
# ifndef _PATH_SENDMAILPID
# define _PATH_SENDMAILPID "/etc/sendmail.pid"
# endif /* ! _PATH_SENDMAILPID */
+# undef offsetof /* avoid stddefs.h, sys/sysmacros.h conflict */
#endif /* __svr5__ */
/* ###################################################################### */
diff --git a/contrib/sendmail/src/control.c b/contrib/sendmail/src/control.c
index 7865b0e..dda2761 100644
--- a/contrib/sendmail/src/control.c
+++ b/contrib/sendmail/src/control.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: control.c,v 8.44.14.8 2000/09/17 17:04:26 gshapiro Exp $";
+static char id[] = "@(#)$Id: control.c,v 8.44.14.13 2000/12/28 21:25:52 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -77,16 +77,26 @@ opencontrolsocket()
return -1;
}
- if (geteuid() == 0 && TrustedUid != 0)
+ if (geteuid() == 0)
{
- if (chown(ControlSocketName, TrustedUid, -1) < 0)
+ uid_t u = 0;
+
+ if (RunAsUid != 0)
+ u = RunAsUid;
+ else if (TrustedUid != 0)
+ u = TrustedUid;
+
+ if (u != 0 &&
+ chown(ControlSocketName, u, -1) < 0)
{
save_errno = errno;
sm_syslog(LOG_ALERT, NOQID,
- "ownership change on %s failed: %s",
- ControlSocketName, errstring(save_errno));
- message("050 ownership change on %s failed: %s",
- ControlSocketName, errstring(save_errno));
+ "ownership change on %s to uid %d failed: %s",
+ ControlSocketName, (int) u,
+ errstring(save_errno));
+ message("050 ownership change on %s to uid %d failed: %s",
+ ControlSocketName, (int) u,
+ errstring(save_errno));
closecontrolsocket(TRUE);
errno = save_errno;
return -1;
@@ -141,8 +151,8 @@ closecontrolsocket(fullclose)
ControlSocket = -1;
}
- rval = safefile(ControlSocketName, RunAsUid, RunAsGid, RunAsUserName,
- sff, S_IRUSR|S_IWUSR, NULL);
+ rval = safefile(ControlSocketName, RunAsUid, RunAsGid,
+ RunAsUserName, sff, S_IRUSR|S_IWUSR, NULL);
/* if not safe, don't unlink */
if (rval != 0)
diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c
index 6ef2b2f..e29d774 100644
--- a/contrib/sendmail/src/daemon.c
+++ b/contrib/sendmail/src/daemon.c
@@ -16,9 +16,9 @@
#ifndef lint
# ifdef DAEMON
-static char id[] = "@(#)$Id: daemon.c,v 8.401.4.18 2000/09/21 21:52:16 ca Exp $ (with daemon mode)";
+static char id[] = "@(#)$Id: daemon.c,v 8.401.4.41 2000/12/28 23:46:43 gshapiro Exp $ (with daemon mode)";
# else /* DAEMON */
-static char id[] = "@(#)$Id: daemon.c,v 8.401.4.18 2000/09/21 21:52:16 ca Exp $ (without daemon mode)";
+static char id[] = "@(#)$Id: daemon.c,v 8.401.4.41 2000/12/28 23:46:43 gshapiro Exp $ (without daemon mode)";
# endif /* DAEMON */
#endif /* ! lint */
@@ -162,8 +162,6 @@ getrequests(e)
# endif /* NETUNIX */
extern ENVELOPE BlankEnvelope;
-#define D(x,idx) x[idx]
-
for (idx = 0; idx < ndaemons; idx++)
{
@@ -171,6 +169,7 @@ getrequests(e)
Daemons[idx].d_firsttime = TRUE;
Daemons[idx].d_refuse_connections_until = (time_t) 0;
}
+
/*
** Try to actually open the connection.
*/
@@ -178,9 +177,11 @@ getrequests(e)
if (tTd(15, 1))
{
for (idx = 0; idx < ndaemons; idx++)
+ {
dprintf("getrequests: daemon %s: port %d\n",
Daemons[idx].d_name,
ntohs(Daemons[idx].d_port));
+ }
}
/* get a socket for the SMTP connection */
@@ -225,72 +226,124 @@ getrequests(e)
bool control = FALSE;
int save_errno;
int pipefd[2];
+ time_t timenow;
# if STARTTLS
long seed;
- time_t timenow;
# endif /* STARTTLS */
+ extern bool refuseconnections __P((char *, ENVELOPE *, int));
/* see if we are rejecting connections */
(void) blocksignal(SIGALRM);
+ timenow = curtime();
+
+ /*
+ ** Use ConnRateThrottle only if the
+ ** last pass was for a connection
+ */
+
+ if (ConnRateThrottle > 0 && curdaemon >= 0)
+ {
+ static int conncnt = 0;
+ static time_t lastconn = 0;
+
+ if (timenow != lastconn)
+ {
+ lastconn = timenow;
+ conncnt = 1;
+ }
+ else if (++conncnt > ConnRateThrottle)
+ {
+ /* sleep to flatten out connection load */
+ sm_setproctitle(TRUE, e,
+ "deferring connections: %d per second",
+ ConnRateThrottle);
+ if (LogLevel >= 9)
+ sm_syslog(LOG_INFO, NOQID,
+ "deferring connections: %d per second",
+ ConnRateThrottle);
+ (void) sleep(1);
+ }
+ }
+
for (idx = 0; idx < ndaemons; idx++)
{
- if (curtime() < Daemons[idx].d_refuse_connections_until)
+ if (timenow < Daemons[idx].d_refuse_connections_until)
continue;
if (refuseconnections(Daemons[idx].d_name, e, idx))
{
if (Daemons[idx].d_socket >= 0)
{
- /* close socket so peer fails quickly */
- (void) close(Daemons[idx].d_socket);
- Daemons[idx].d_socket = -1;
+ /* close socket so peer fails quickly */
+ (void) close(Daemons[idx].d_socket);
+ Daemons[idx].d_socket = -1;
}
/* refuse connections for next 15 seconds */
- Daemons[idx].d_refuse_connections_until = curtime() + 15;
+ Daemons[idx].d_refuse_connections_until = timenow + 15;
}
else if (Daemons[idx].d_socket < 0 ||
Daemons[idx].d_firsttime)
{
- if (!Daemons[idx].d_firsttime && LogLevel >= 9)
- sm_syslog(LOG_INFO, NOQID,
- "accepting connections again for daemon %s",
- Daemons[idx].d_name);
-
- /* arrange to (re)open the socket if needed */
- (void) opendaemonsocket(&Daemons[idx], FALSE);
- Daemons[idx].d_firsttime = FALSE;
+ if (!Daemons[idx].d_firsttime && LogLevel >= 9)
+ sm_syslog(LOG_INFO, NOQID,
+ "accepting connections again for daemon %s",
+ Daemons[idx].d_name);
+
+ /* arrange to (re)open the socket if needed */
+ (void) opendaemonsocket(&Daemons[idx], FALSE);
+ Daemons[idx].d_firsttime = FALSE;
}
}
- if (curtime() >= last_disk_space_check)
+ if (timenow >= last_disk_space_check)
{
+ bool logged = FALSE;
+
if (!enoughdiskspace(MinBlocksFree + 1, FALSE))
{
- if (!bitnset(D_ETRNONLY, Daemons[idx].d_flags))
+ for (idx = 0; idx < ndaemons; idx++)
{
- /* log only if not logged before */
- if (LogLevel >= 9)
- sm_syslog(LOG_INFO, NOQID,
- "rejecting new messages: min free: %ld",
- MinBlocksFree);
- sm_setproctitle(TRUE, e,
- "rejecting new messages: min free: %ld",
- MinBlocksFree);
- setbitn(D_ETRNONLY, Daemons[idx].d_flags);
+ if (!bitnset(D_ETRNONLY, Daemons[idx].d_flags))
+ {
+ /* log only if not logged before */
+ if (!logged)
+ {
+ if (LogLevel >= 9)
+ sm_syslog(LOG_INFO, NOQID,
+ "rejecting new messages: min free: %ld",
+ MinBlocksFree);
+ logged = TRUE;
+ sm_setproctitle(TRUE, e,
+ "rejecting new messages: min free: %ld",
+ MinBlocksFree);
+ }
+ setbitn(D_ETRNONLY, Daemons[idx].d_flags);
+ }
}
}
- else if (bitnset(D_ETRNONLY, Daemons[idx].d_flags))
+ else
{
- /* log only if not logged before */
- if (LogLevel >= 9)
- sm_syslog(LOG_INFO, NOQID,
- "accepting new messages (again)");
- /* title will be set below */
- clrbitn(D_ETRNONLY, Daemons[idx].d_flags);
+ for (idx = 0; idx < ndaemons; idx++)
+ {
+ if (bitnset(D_ETRNONLY, Daemons[idx].d_flags))
+ {
+ /* log only if not logged before */
+ if (!logged)
+ {
+ if (LogLevel >= 9)
+ sm_syslog(LOG_INFO, NOQID,
+ "accepting new messages (again)");
+ logged = TRUE;
+ }
+
+ /* title will be set below */
+ clrbitn(D_ETRNONLY, Daemons[idx].d_flags);
+ }
+ }
}
/* only check disk space once a minute */
- last_disk_space_check = curtime() + 60;
+ last_disk_space_check = timenow + 60;
}
# if XDEBUG
@@ -331,6 +384,7 @@ getrequests(e)
for (;;)
{
+ bool setproc = FALSE;
int highest = -1;
fd_set readfds;
struct timeval timeout;
@@ -342,10 +396,13 @@ getrequests(e)
/* wait for a connection */
if (Daemons[idx].d_socket >= 0)
{
- if (!bitnset(D_ETRNONLY, Daemons[idx].d_flags))
+ if (!setproc &&
+ !bitnset(D_ETRNONLY,
+ Daemons[idx].d_flags))
{
sm_setproctitle(TRUE, e,
"accepting connections");
+ setproc = TRUE;
}
if (Daemons[idx].d_socket > highest)
highest = Daemons[idx].d_socket;
@@ -367,6 +424,7 @@ getrequests(e)
** to 5 seconds (so it might get reopened soon),
** otherwise (all sockets open) 60.
*/
+
idx = 0;
while (idx < ndaemons && Daemons[idx].d_socket >= 0)
idx++;
@@ -379,8 +437,12 @@ getrequests(e)
t = select(highest + 1, FDSET_CAST &readfds,
NULL, NULL, &timeout);
+
+
if (DoQueueRun)
(void) runqueue(TRUE, FALSE);
+
+ curdaemon = -1;
if (t <= 0)
{
timedout = TRUE;
@@ -389,7 +451,6 @@ getrequests(e)
control = FALSE;
errno = 0;
- curdaemon = -1;
/* look "round-robin" for an active socket */
if ((idx = olddaemon + 1) >= ndaemons)
@@ -411,7 +472,7 @@ getrequests(e)
}
# if NETUNIX
if (curdaemon == -1 && ControlSocket >= 0 &&
- FD_ISSET(ControlSocket, &readfds))
+ FD_ISSET(ControlSocket, &readfds))
{
struct sockaddr_un sa_un;
@@ -421,6 +482,12 @@ getrequests(e)
&lotherend);
control = TRUE;
}
+# else /* NETUNIX */
+ if (curdaemon == -1)
+ {
+ /* No daemon to service */
+ continue;
+ }
# endif /* NETUNIX */
if (t >= 0 || errno != EINTR)
break;
@@ -431,6 +498,7 @@ getrequests(e)
continue;
}
save_errno = errno;
+ timenow = curtime();
(void) blocksignal(SIGALRM);
if (t < 0)
{
@@ -447,7 +515,7 @@ getrequests(e)
** force accept() to fail on affected systems.
*/
- Daemons[curdaemon].d_refuse_connections_until = curtime() + 15;
+ Daemons[curdaemon].d_refuse_connections_until = timenow + 15;
# endif /* SO_REUSEADDR_IS_BROKEN */
continue;
}
@@ -521,13 +589,13 @@ getrequests(e)
seed = get_random();
RAND_seed((void *) &last_disk_space_check,
sizeof last_disk_space_check);
- timenow = curtime();
RAND_seed((void *) &timenow, sizeof timenow);
RAND_seed((void *) &seed, sizeof seed);
# else /* STARTTLS */
(void) get_random();
# endif /* STARTTLS */
+#ifndef DEBUG_NO_FORK
/*
** Create a pipe to keep the child from writing to the
** socket until after the parent has closed it. Otherwise
@@ -552,6 +620,9 @@ getrequests(e)
(void) close(t);
continue;
}
+#else /* ! DEBUG_NO_FORK */
+ pid = 0;
+#endif /* ! DEBUG_NO_FORK */
if (pid == 0)
{
@@ -608,6 +679,7 @@ getrequests(e)
anynet_ntoa(&RealHostAddr));
}
+#ifndef DEBUG_NO_FORK
if (pipefd[0] != -1)
{
auto char c;
@@ -629,6 +701,7 @@ getrequests(e)
continue;
(void) close(pipefd[0]);
}
+#endif /* ! DEBUG_NO_FORK */
/* control socket processing */
if (control)
@@ -1045,10 +1118,12 @@ setsockaddroptions(p, d)
struct daemon *d;
{
# if NETISO
- short port;
+ short portno;
# endif /* NETISO */
int l;
char *h, *flags;
+ char *port = NULL;
+ char *addr = NULL;
# if NETINET
if (d->d_addr.sa.sa_family == AF_UNSPEC)
@@ -1107,152 +1182,11 @@ setsockaddroptions(p, d)
break;
case 'A': /* address */
- switch (d->d_addr.sa.sa_family)
- {
-# if NETINET
- case AF_INET:
- if (!isascii(*v) || !isdigit(*v) ||
- ((d->d_addr.sin.sin_addr.s_addr = inet_addr(v)) == INADDR_NONE))
- {
- register struct hostent *hp;
-
- hp = sm_gethostbyname(v, AF_INET);
- if (hp == NULL)
- syserr("554 5.3.0 host \"%s\" unknown",
- v);
- else
- {
- while (*(hp->h_addr_list) &&
- hp->h_addrtype != AF_INET)
- hp->h_addr_list++;
- if (*(hp->h_addr_list) == NULL)
- syserr("554 5.3.0 host \"%s\" unknown",
- v);
- else
- memmove(&d->d_addr.sin.sin_addr,
- *(hp->h_addr_list),
- INADDRSZ);
- }
- }
- break;
-# endif /* NETINET */
-
-# if NETINET6
- case AF_INET6:
- if (!isascii(*v) || !isxdigit(*v) ||
- inet_pton(AF_INET6, v,
- &d->d_addr.sin6.sin6_addr) != 1)
- {
- register struct hostent *hp;
-
- hp = sm_gethostbyname(v, AF_INET6);
- if (hp == NULL)
- syserr("554 5.3.0 host \"%s\" unknown",
- v);
- else
- {
- while (*(hp->h_addr_list) &&
- hp->h_addrtype != AF_INET6)
- hp->h_addr_list++;
- if (*(hp->h_addr_list) == NULL)
- syserr("554 5.3.0 host \"%s\" unknown",
- v);
- else
- memmove(&d->d_addr.sin6.sin6_addr,
- *(hp->h_addr_list),
- IN6ADDRSZ);
- }
- }
- break;
-# endif /* NETINET6 */
-
- default:
- syserr("554 5.3.5 address= option unsupported for family %d",
- d->d_addr.sa.sa_family);
- break;
- }
+ addr = v;
break;
case 'P': /* port */
- switch (d->d_addr.sa.sa_family)
- {
-# if NETINET
- case AF_INET:
- if (isascii(*v) && isdigit(*v))
- d->d_addr.sin.sin_port = htons((u_short)atoi((const char *)v));
- else
- {
-# ifdef NO_GETSERVBYNAME
- syserr("554 5.3.5 invalid port number: %s",
- v);
-# else /* NO_GETSERVBYNAME */
- register struct servent *sp;
-
- sp = getservbyname(v, "tcp");
- if (sp == NULL)
- syserr("554 5.3.5 service \"%s\" unknown",
- v);
- else
- d->d_addr.sin.sin_port = sp->s_port;
-# endif /* NO_GETSERVBYNAME */
- }
- break;
-# endif /* NETINET */
-
-# if NETINET6
- case AF_INET6:
- if (isascii(*v) && isdigit(*v))
- d->d_addr.sin6.sin6_port = htons((u_short)atoi(v));
- else
- {
-# ifdef NO_GETSERVBYNAME
- syserr("554 5.3.5 invalid port number: %s",
- v);
-# else /* NO_GETSERVBYNAME */
- register struct servent *sp;
-
- sp = getservbyname(v, "tcp");
- if (sp == NULL)
- syserr("554 5.3.5 service \"%s\" unknown",
- v);
- else
- d->d_addr.sin6.sin6_port = sp->s_port;
-# endif /* NO_GETSERVBYNAME */
- }
- break;
-# endif /* NETINET6 */
-
-# if NETISO
- case AF_ISO:
- /* assume two byte transport selector */
- if (isascii(*v) && isdigit(*v))
- port = htons((u_short)atoi(v));
- else
- {
-# ifdef NO_GETSERVBYNAME
- syserr("554 5.3.5 invalid port number: %s",
- v);
-# else /* NO_GETSERVBYNAME */
- register struct servent *sp;
-
- sp = getservbyname(v, "tcp");
- if (sp == NULL)
- syserr("554 5.3.5 service \"%s\" unknown",
- v);
- else
- port = sp->s_port;
-# endif /* NO_GETSERVBYNAME */
- }
- memmove(TSEL(&d->d_addr.siso),
- (char *) &port, 2);
- break;
-# endif /* NETISO */
-
- default:
- syserr("554 5.3.5 Port= option unsupported for family %d",
- d->d_addr.sa.sa_family);
- break;
- }
+ port = v;
break;
case 'L': /* listen queue size */
@@ -1278,7 +1212,7 @@ setsockaddroptions(p, d)
*flags++ = '\0';
for (; *v != '\0'; v++)
if (!(isascii(*v) && isspace(*v)))
- setbitn(*v, d->d_flags);
+ setbitn(bitidx(*v), d->d_flags);
break;
case 'S': /* send buffer size */
@@ -1298,6 +1232,167 @@ setsockaddroptions(p, d)
f);
}
}
+
+ /* Check addr and port after finding family */
+ if (addr != NULL)
+ {
+ switch (d->d_addr.sa.sa_family)
+ {
+# if NETINET
+ case AF_INET:
+ if (!isascii(*addr) || !isdigit(*addr) ||
+ ((d->d_addr.sin.sin_addr.s_addr = inet_addr(addr)) == INADDR_NONE))
+ {
+ register struct hostent *hp;
+
+ hp = sm_gethostbyname(addr, AF_INET);
+ if (hp == NULL)
+ syserr("554 5.3.0 host \"%s\" unknown",
+ addr);
+ else
+ {
+ while (*(hp->h_addr_list) != NULL &&
+ hp->h_addrtype != AF_INET)
+ hp->h_addr_list++;
+ if (*(hp->h_addr_list) == NULL)
+ syserr("554 5.3.0 host \"%s\" unknown",
+ addr);
+ else
+ memmove(&d->d_addr.sin.sin_addr,
+ *(hp->h_addr_list),
+ INADDRSZ);
+# if _FFR_FREEHOSTENT && NETINET6
+ freehostent(hp);
+ hp = NULL;
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
+ }
+ }
+ break;
+# endif /* NETINET */
+
+# if NETINET6
+ case AF_INET6:
+ if (!isascii(*addr) ||
+ (!isxdigit(*addr) && *addr != ':') ||
+ inet_pton(AF_INET6, addr,
+ &d->d_addr.sin6.sin6_addr) != 1)
+ {
+ register struct hostent *hp;
+
+ hp = sm_gethostbyname(addr, AF_INET6);
+ if (hp == NULL)
+ syserr("554 5.3.0 host \"%s\" unknown",
+ addr);
+ else
+ {
+ while (*(hp->h_addr_list) != NULL &&
+ hp->h_addrtype != AF_INET6)
+ hp->h_addr_list++;
+ if (*(hp->h_addr_list) == NULL)
+ syserr("554 5.3.0 host \"%s\" unknown",
+ addr);
+ else
+ memmove(&d->d_addr.sin6.sin6_addr,
+ *(hp->h_addr_list),
+ IN6ADDRSZ);
+# if _FFR_FREEHOSTENT
+ freehostent(hp);
+ hp = NULL;
+# endif /* _FFR_FREEHOSTENT */
+ }
+ }
+ break;
+# endif /* NETINET6 */
+
+ default:
+ syserr("554 5.3.5 address= option unsupported for family %d",
+ d->d_addr.sa.sa_family);
+ break;
+ }
+ }
+
+ if (port != NULL)
+ {
+ switch (d->d_addr.sa.sa_family)
+ {
+# if NETINET
+ case AF_INET:
+ if (isascii(*port) && isdigit(*port))
+ d->d_addr.sin.sin_port = htons((u_short)atoi((const char *)port));
+ else
+ {
+# ifdef NO_GETSERVBYNAME
+ syserr("554 5.3.5 invalid port number: %s",
+ port);
+# else /* NO_GETSERVBYNAME */
+ register struct servent *sp;
+
+ sp = getservbyname(port, "tcp");
+ if (sp == NULL)
+ syserr("554 5.3.5 service \"%s\" unknown",
+ port);
+ else
+ d->d_addr.sin.sin_port = sp->s_port;
+# endif /* NO_GETSERVBYNAME */
+ }
+ break;
+# endif /* NETINET */
+
+# if NETINET6
+ case AF_INET6:
+ if (isascii(*port) && isdigit(*port))
+ d->d_addr.sin6.sin6_port = htons((u_short)atoi(port));
+ else
+ {
+# ifdef NO_GETSERVBYNAME
+ syserr("554 5.3.5 invalid port number: %s",
+ port);
+# else /* NO_GETSERVBYNAME */
+ register struct servent *sp;
+
+ sp = getservbyname(port, "tcp");
+ if (sp == NULL)
+ syserr("554 5.3.5 service \"%s\" unknown",
+ port);
+ else
+ d->d_addr.sin6.sin6_port = sp->s_port;
+# endif /* NO_GETSERVBYNAME */
+ }
+ break;
+# endif /* NETINET6 */
+
+# if NETISO
+ case AF_ISO:
+ /* assume two byte transport selector */
+ if (isascii(*port) && isdigit(*port))
+ portno = htons((u_short)atoi(port));
+ else
+ {
+# ifdef NO_GETSERVBYNAME
+ syserr("554 5.3.5 invalid port number: %s",
+ port);
+# else /* NO_GETSERVBYNAME */
+ register struct servent *sp;
+
+ sp = getservbyname(port, "tcp");
+ if (sp == NULL)
+ syserr("554 5.3.5 service \"%s\" unknown",
+ port);
+ else
+ portno = sp->s_port;
+# endif /* NO_GETSERVBYNAME */
+ }
+ memmove(TSEL(&d->d_addr.siso),
+ (char *) &portno, 2);
+ break;
+# endif /* NETISO */
+
+ default:
+ syserr("554 5.3.5 Port= option unsupported for family %d",
+ d->d_addr.sa.sa_family);
+ break;
+ }
+ }
}
/*
** SETDAEMONOPTIONS -- set options for running the MTA daemon
@@ -1494,7 +1589,7 @@ makeconnection(host, port, mci, e)
for (; *p != '\0'; p++)
{
if (!(isascii(*p) && isspace(*p)))
- setbitn(*p, d_flags);
+ setbitn(bitidx(*p), d_flags);
}
}
@@ -1506,7 +1601,7 @@ makeconnection(host, port, mci, e)
/* look for just this one flag */
if (*p == D_IFNHELO)
{
- setbitn(*p, d_flags);
+ setbitn(bitidx(*p), d_flags);
break;
}
}
@@ -1846,6 +1941,10 @@ gothostent:
syserr("Can't connect to address family %d", addr.sa.sa_family);
mci_setstat(mci, EX_NOHOST, "5.1.2", NULL);
errno = EINVAL;
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return EX_NOHOST;
}
@@ -1856,7 +1955,13 @@ gothostent:
# ifdef XLA
/* if too many connections, don't bother trying */
if (!xla_noqueue_ok(host))
+ {
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return EX_TEMPFAIL;
+ }
# endif /* XLA */
firstconnect = TRUE;
@@ -1887,6 +1992,10 @@ gothostent:
xla_host_end(host);
# endif /* XLA */
mci_setstat(mci, EX_TEMPFAIL, "4.4.5", NULL);
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
errno = save_errno;
return EX_TEMPFAIL;
}
@@ -1960,6 +2069,10 @@ gothostent:
errno = save_errno;
syserr("makeconnection: cannot bind socket [%s]",
anynet_ntoa(&clt_addr));
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
errno = save_errno;
return EX_TEMPFAIL;
}
@@ -2068,6 +2181,13 @@ gothostent:
errstring(save_errno));
v6found = TRUE;
family = AF_INET;
+# if _FFR_FREEHOSTENT
+ if (hp != NULL)
+ {
+ freehostent(hp);
+ hp = NULL;
+ }
+# endif /* _FFR_FREEHOSTENT */
goto v4retry;
}
v6tempfail:
@@ -2084,10 +2204,22 @@ gothostent:
xla_host_end(host);
# endif /* XLA */
mci_setstat(mci, EX_TEMPFAIL, "4.4.1", NULL);
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
errno = save_errno;
return EX_TEMPFAIL;
}
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ {
+ freehostent(hp);
+ hp = NULL;
+ }
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
+
/* connection ok, put it into canonical form */
mci->mci_out = NULL;
if ((mci->mci_out = fdopen(s, "w")) == NULL ||
@@ -2449,7 +2581,7 @@ getauthinfo(fd, may_be_forged)
errno = 0;
}
(void) snprintf(hbuf, sizeof hbuf, "%s@localhost",
- RealUserName);
+ RealUserName);
if (tTd(9, 1))
dprintf("getauthinfo: %s\n", hbuf);
return hbuf;
@@ -2487,6 +2619,10 @@ getauthinfo(fd, may_be_forged)
if (addrcmp(hp, *ha, &RealHostAddr) == 0)
break;
*may_be_forged = *ha == NULL;
+# if _FFR_FREEHOSTENT && NETINET6
+ freehostent(hp);
+ hp = NULL;
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
}
}
@@ -2971,7 +3107,11 @@ host_map_lookup(map, name, av, statp)
else
{
if ((cp = strchr(name, ']')) == NULL)
+ {
+ if (tTd(9, 1))
+ dprintf("FAILED\n");
return NULL;
+ }
*cp = '\0';
hp = NULL;
@@ -2992,6 +3132,10 @@ host_map_lookup(map, name, av, statp)
{
/* found a match -- copy out */
ans = denlstring((char *) hp->h_name, TRUE, TRUE);
+# if _FFR_FREEHOSTENT && NETINET6
+ freehostent(hp);
+ hp = NULL;
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
}
}
@@ -3006,6 +3150,8 @@ host_map_lookup(map, name, av, statp)
cp = map_rewrite(map, name, strlen(name), NULL);
else
cp = map_rewrite(map, ans, strlen(ans), av);
+ if (tTd(9, 1))
+ dprintf("FOUND %s\n", ans);
return cp;
}
@@ -3176,6 +3322,9 @@ host_map_lookup(map, name, avp, statp)
cp = map_rewrite(map, name, strlen(name), NULL);
else
cp = map_rewrite(map, hp->h_name, strlen(hp->h_name), avp);
+# if _FFR_FREEHOSTENT && NETINET6
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return cp;
}
@@ -3428,8 +3577,35 @@ hostnamebyanyaddr(sap)
&& inet_addr(hp->h_name) == INADDR_NONE
# endif /* NETINET */
)
- return denlstring((char *) hp->h_name, TRUE, TRUE);
+ {
+ char *name;
+
+ name = denlstring((char *) hp->h_name, TRUE, TRUE);
+
+# if _FFR_FREEHOSTENT && NETINET6
+ if (name == hp->h_name)
+ {
+ static char n[MAXNAME + 1];
+
+ /* Copy the string, hp->h_name is about to disappear */
+ strlcpy(n, name, sizeof n);
+ name = n;
+ }
+
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
+ return name;
+ }
# endif /* NETINET || NETINET6 */
+
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ {
+ freehostent(hp);
+ hp = NULL;
+ }
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
+
# if NETUNIX
if (sap->sa.sa_family == AF_UNIX && sap->sunix.sun_path[0] == '\0')
return "localhost";
diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c
index 35a4505..440b1db 100644
--- a/contrib/sendmail/src/deliver.c
+++ b/contrib/sendmail/src/deliver.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: deliver.c,v 8.600.2.1.2.44 2000/09/21 21:52:17 ca Exp $";
+static char id[] = "@(#)$Id: deliver.c,v 8.600.2.1.2.56 2000/12/19 01:16:12 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -463,17 +463,19 @@ sendall(e, mode)
if (!somedeliveries && mode != SM_QUEUE && mode != SM_DEFER &&
mode != SM_VERIFY)
{
+ time_t now = curtime();
+
if (tTd(13, 29))
dprintf("No deliveries: auto-queuing\n");
mode = SM_QUEUE;
/* treat this as a delivery in terms of counting tries */
- e->e_dtime = curtime();
+ e->e_dtime = now;
if (!expensive)
e->e_ntries++;
for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
{
- ee->e_dtime = curtime();
+ ee->e_dtime = now;
if (!expensive)
ee->e_ntries++;
}
@@ -1239,7 +1241,7 @@ deliver(e, firstto)
ovr = TRUE;
/* do config file checking of compatibility */
rcode = rscheck("check_compat", e->e_from.q_paddr, to->q_paddr,
- e, TRUE, TRUE, 4);
+ e, TRUE, TRUE, 4, NULL);
if (rcode == EX_OK)
{
/* do in-code checking if not discarding */
@@ -2238,21 +2240,17 @@ tryhost:
#if SMTP
if (clever && mci->mci_state != MCIS_CLOSED)
{
- static u_short again;
# if SASL && SFIO
-# define DONE_TLS_B 0x01
-# define DONE_TLS bitset(DONE_TLS_B, again)
+# define DONE_AUTH(f) bitset(MCIF_AUTHACT, f)
# endif /* SASL && SFIO */
# if STARTTLS
-# define DONE_STARTTLS_B 0x02
-# define DONE_STARTTLS bitset(DONE_STARTTLS_B, again)
+# define DONE_STARTTLS(f) bitset(MCIF_TLSACT, f)
# endif /* STARTTLS */
-# define ONLY_HELO_B 0x04
-# define ONLY_HELO bitset(ONLY_HELO_B, again)
-# define SET_HELO again |= ONLY_HELO_B
-# define CLR_HELO again &= ~ONLY_HELO_B
+# define ONLY_HELO(f) bitset(MCIF_ONLY_EHLO, f)
+# define SET_HELO(f) f |= MCIF_ONLY_EHLO
+# define CLR_HELO(f) f &= ~MCIF_ONLY_EHLO
+
- again = 0;
# if STARTTLS || (SASL && SFIO)
reconnect: /* after switching to an authenticated connection */
# endif /* STARTTLS || (SASL && SFIO) */
@@ -2260,18 +2258,20 @@ reconnect: /* after switching to an authenticated connection */
# if SASL
mci->mci_saslcap = NULL;
# endif /* SASL */
- smtpinit(m, mci, e, ONLY_HELO);
- CLR_HELO;
+ smtpinit(m, mci, e, ONLY_HELO(mci->mci_flags));
+ CLR_HELO(mci->mci_flags);
# if STARTTLS
/* first TLS then AUTH to provide a security layer */
- if (mci->mci_state != MCIS_CLOSED && !DONE_STARTTLS)
+ if (mci->mci_state != MCIS_CLOSED &&
+ !DONE_STARTTLS(mci->mci_flags))
{
int olderrors;
bool hasdot;
bool usetls;
bool saveQuickAbort = QuickAbort;
bool saveSuprErrs = SuprErrs;
+ char *host = NULL;
# if _FFR_TLS_CLT1
char *p;
# endif /* _FFR_TLS_CLT1 */
@@ -2306,20 +2306,22 @@ reconnect: /* after switching to an authenticated connection */
newstr(anynet_ntoa(&CurHostAddr)), e);
else
define(macid("{server_addr}", NULL), NULL, e);
-# if _FFR_TLS_O_T
if (usetls)
{
+ host = macvalue(macid("{server_name}", NULL),
+ e);
+# if _FFR_TLS_O_T
olderrors = Errors;
QuickAbort = FALSE;
SuprErrs = TRUE;
if (rscheck("try_tls", CurHostName, NULL,
- e, TRUE, FALSE, 8) != EX_OK
+ e, TRUE, FALSE, 8, host) != EX_OK
|| Errors > olderrors)
usetls = FALSE;
SuprErrs = saveSuprErrs;
QuickAbort = saveQuickAbort;
- }
# endif /* _FFR_TLS_O_T */
+ }
/* undo change of CurHostName */
if (hasdot)
@@ -2329,7 +2331,6 @@ reconnect: /* after switching to an authenticated connection */
if ((rcode = starttls(m, mci, e)) == EX_OK)
{
/* start again without STARTTLS */
- again |= DONE_STARTTLS_B;
mci->mci_flags |= MCIF_TLSACT;
}
else
@@ -2367,6 +2368,12 @@ reconnect: /* after switching to an authenticated connection */
newstr(s), e);
}
}
+ else if (mci->mci_ssl != NULL)
+ {
+ /* active TLS connection, use that data */
+ (void) tls_get_info(mci->mci_ssl, e, FALSE,
+ mci->mci_host, FALSE);
+ }
else
define(macid("{verify}", NULL), "NONE", e);
olderrors = Errors;
@@ -2383,7 +2390,7 @@ reconnect: /* after switching to an authenticated connection */
*/
if (rscheck("tls_server",
macvalue(macid("{verify}", NULL), e),
- NULL, e, TRUE, TRUE, 6) != EX_OK ||
+ NULL, e, TRUE, TRUE, 6, host) != EX_OK ||
Errors > olderrors ||
rcode == EX_SOFTWARE)
{
@@ -2422,6 +2429,9 @@ reconnect: /* after switching to an authenticated connection */
smtpquit(m, mci, e);
}
+ /* avoid bogus error msg */
+ mci->mci_errno = 0;
+
/* temp or permanent failure? */
rcode = (*p == '4') ? EX_TEMPFAIL
: EX_UNAVAILABLE;
@@ -2435,20 +2445,27 @@ reconnect: /* after switching to an authenticated connection */
}
QuickAbort = saveQuickAbort;
SuprErrs = saveSuprErrs;
- if (DONE_STARTTLS && mci->mci_state != MCIS_CLOSED)
+ if (DONE_STARTTLS(mci->mci_flags) &&
+ mci->mci_state != MCIS_CLOSED)
{
- SET_HELO;
+ SET_HELO(mci->mci_flags);
mci->mci_flags &= ~MCIF_EXTENS;
goto reconnect;
}
}
+ else if (mci->mci_ssl != NULL)
+ {
+ /* active TLS connection, use that data */
+ (void) tls_get_info(mci->mci_ssl, e, FALSE,
+ mci->mci_host, FALSE);
+ }
# endif /* STARTTLS */
# if SASL
/* if other server supports authentication let's authenticate */
if (mci->mci_state != MCIS_CLOSED &&
mci->mci_saslcap != NULL &&
# if SFIO
- !DONE_TLS &&
+ !DONE_AUTH(mci->mci_flags) &&
# endif /* SFIO */
SASLInfo != NULL)
{
@@ -2490,8 +2507,7 @@ reconnect: /* after switching to an authenticated connection */
if (sfdcsasl(mci->mci_in, mci->mci_out,
mci->mci_conn) == 0)
{
- again |= DONE_TLS_B;
- SET_HELO;
+ SET_HELO(mci->mci_flags);
mci->mci_flags &= ~MCIF_EXTENS;
mci->mci_flags |= MCIF_AUTHACT;
goto reconnect;
@@ -2609,9 +2625,11 @@ do_transfer:
# if STARTTLS
# if _FFR_TLS_RCPT
i = rscheck("tls_rcpt", to->q_user, NULL, e,
- TRUE, TRUE, 4);
+ TRUE, TRUE, 4, mci->mci_host);
if (i != EX_OK)
{
+ /* avoid bogus error msg */
+ errno = 0;
markfailure(e, to, mci, i, FALSE);
giveresponse(i, to->q_status, m,
mci, ctladdr, xstart, e);
@@ -3368,6 +3386,7 @@ logdelivery(m, mci, dsn, status, ctladdr, xstart, e)
register char *bp;
register char *p;
int l;
+ time_t now;
char buf[1024];
#if (SYSLOG_BUFSIZE) >= 256
@@ -3388,14 +3407,15 @@ logdelivery(m, mci, dsn, status, ctladdr, xstart, e)
}
/* delay & xdelay: max 41 bytes */
+ now = curtime();
snprintf(bp, SPACELEFT(buf, bp), ", delay=%s",
- pintvl(curtime() - e->e_ctime, TRUE));
+ pintvl(now - e->e_ctime, TRUE));
bp += strlen(bp);
if (xstart != (time_t) 0)
{
snprintf(bp, SPACELEFT(buf, bp), ", xdelay=%s",
- pintvl(curtime() - xstart, TRUE));
+ pintvl(now - xstart, TRUE));
bp += strlen(bp);
}
@@ -3553,12 +3573,12 @@ logdelivery(m, mci, dsn, status, ctladdr, xstart, e)
}
bp = buf;
snprintf(bp, SPACELEFT(buf, bp), "delay=%s",
- pintvl(curtime() - e->e_ctime, TRUE));
+ pintvl(now - e->e_ctime, TRUE));
bp += strlen(bp);
if (xstart != (time_t) 0)
{
snprintf(bp, SPACELEFT(buf, bp), ", xdelay=%s",
- pintvl(curtime() - xstart, TRUE));
+ pintvl(now - xstart, TRUE));
bp += strlen(bp);
}
@@ -3901,6 +3921,11 @@ putbody(mci, e, separator)
dead = TRUE;
continue;
}
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
pos++;
}
for (xp = buf; xp < bp; xp++)
@@ -3911,9 +3936,11 @@ putbody(mci, e, separator)
dead = TRUE;
break;
}
-
- /* record progress for DATA timeout */
- DataProgress = TRUE;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
}
if (dead)
continue;
@@ -3922,6 +3949,11 @@ putbody(mci, e, separator)
if (fputs(mci->mci_mailer->m_eol,
mci->mci_out) == EOF)
break;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
pos = 0;
}
else
@@ -3931,8 +3963,6 @@ putbody(mci, e, separator)
*pbp++ = c;
}
- /* record progress for DATA timeout */
- DataProgress = TRUE;
bp = buf;
/* determine next state */
@@ -3951,9 +3981,11 @@ putbody(mci, e, separator)
if (fputs(mci->mci_mailer->m_eol,
mci->mci_out) == EOF)
continue;
-
- /* record progress for DATA timeout */
- DataProgress = TRUE;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
if (TrafficLogFile != NULL)
{
@@ -4005,6 +4037,11 @@ putch:
dead = TRUE;
continue;
}
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
pos++;
continue;
}
@@ -4016,9 +4053,11 @@ putch:
dead = TRUE;
continue;
}
-
- /* record progress for DATA timeout */
- DataProgress = TRUE;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
if (TrafficLogFile != NULL)
{
@@ -4037,6 +4076,11 @@ putch:
if (fputs(mci->mci_mailer->m_eol,
mci->mci_out) == EOF)
continue;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
pos = 0;
ostate = OS_HEAD;
}
@@ -4051,12 +4095,14 @@ putch:
dead = TRUE;
continue;
}
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
pos++;
ostate = OS_INLINE;
}
-
- /* record progress for DATA timeout */
- DataProgress = TRUE;
break;
}
}
@@ -4078,9 +4124,11 @@ putch:
dead = TRUE;
break;
}
-
- /* record progress for DATA timeout */
- DataProgress = TRUE;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
}
pos += bp - buf;
}
@@ -4398,12 +4446,21 @@ mailfile(filename, mailer, ctladdr, sfflags, e)
}
else if (bitset(S_ISGID, mode))
RealGid = stb.st_gid;
- else if (ctladdr != NULL && ctladdr->q_uid != 0)
- RealGid = ctladdr->q_gid;
else if (ctladdr != NULL &&
ctladdr->q_uid == DefUid &&
ctladdr->q_gid == 0)
+ {
+ /*
+ ** Special case: This means it is an
+ ** alias and we should act as DefaultUser.
+ ** See alias()'s comments.
+ */
+
RealGid = DefGid;
+ RealUserName = DefUser;
+ }
+ else if (ctladdr != NULL && ctladdr->q_uid != 0)
+ RealGid = ctladdr->q_gid;
else if (mailer != NULL && mailer->m_gid != 0)
RealGid = mailer->m_gid;
else
@@ -4698,6 +4755,7 @@ hostsignature(m, host)
int len;
int nmx;
int hl;
+ time_t now;
char *hp;
char *endp;
int oldoptions = _res.options;
@@ -4756,6 +4814,7 @@ hostsignature(m, host)
if (ConfigLevel < 2)
_res.options &= ~(RES_DEFNAMES | RES_DNSRCH); /* XXX */
+ now = curtime();
for (hp = host; hp != NULL; hp = endp)
{
#if NETINET6
@@ -4795,7 +4854,7 @@ hostsignature(m, host)
mci = mci_get(hp, m);
mci->mci_errno = errno;
mci->mci_herrno = h_errno;
- mci->mci_lastuse = curtime();
+ mci->mci_lastuse = now;
if (rcode == EX_NOHOST)
mci_setstat(mci, rcode, "5.1.2",
"550 Host unknown");
@@ -5113,7 +5172,7 @@ starttls(m, mci, e)
return EX_SOFTWARE;
}
mci->mci_ssl = clt_ssl;
- result = tls_get_info(clt_ssl, e, FALSE, mci->mci_host);
+ result = tls_get_info(clt_ssl, e, FALSE, mci->mci_host, TRUE);
/* switch to use SSL... */
#if SFIO
diff --git a/contrib/sendmail/src/domain.c b/contrib/sendmail/src/domain.c
index 8f5c8e2..39126dd 100644
--- a/contrib/sendmail/src/domain.c
+++ b/contrib/sendmail/src/domain.c
@@ -15,9 +15,9 @@
#ifndef lint
# if NAMED_BIND
-static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.3 2000/06/13 18:00:08 gshapiro Exp $ (with name server)";
+static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.6 2000/12/19 02:50:33 gshapiro Exp $ (with name server)";
# else /* NAMED_BIND */
-static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.3 2000/06/13 18:00:08 gshapiro Exp $ (without name server)";
+static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.6 2000/12/19 02:50:33 gshapiro Exp $ (without name server)";
# endif /* NAMED_BIND */
#endif /* ! lint */
@@ -393,6 +393,10 @@ punt:
host, MyHostName);
return -1;
}
+# if _FFR_FREEHOSTENT && NETINET6
+ freehostent(h);
+ hp = NULL;
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
}
if (strlen(host) >= (SIZE_T) sizeof MXHostBuf)
{
@@ -640,6 +644,8 @@ dns_getcanonname(host, hbsize, trymx, statp)
return FALSE;
}
+ *statp = EX_OK;
+
/*
** Initialize domain search list. If there is at least one
** dot in the name, search the unmodified name first so we
@@ -730,6 +736,7 @@ cnameloop:
qtype == T_A ? "A" :
qtype == T_MX ? "MX" :
"???");
+ errno = 0;
ret = res_querydomain(host, *dp, C_IN, qtype,
answer.qb2, sizeof(answer.qb2));
if (ret <= 0)
@@ -740,7 +747,11 @@ cnameloop:
if (errno == ECONNREFUSED || h_errno == TRY_AGAIN)
{
- /* the name server seems to be down */
+ /*
+ ** the name server seems to be down or
+ ** broken.
+ */
+
h_errno = TRY_AGAIN;
*statp = EX_TEMPFAIL;
@@ -757,8 +768,23 @@ cnameloop:
** the cache so this isn't dangerous.
*/
+#if _FFR_WORKAROUND_BROKEN_NAMESERVERS
+ /*
+ ** Only return if not TRY_AGAIN as an
+ ** attempt with a different qtype may
+ ** succeed (res_querydomain() calls
+ ** res_query() calls res_send() which
+ ** sets errno to ETIMEDOUT if the
+ ** nameservers could be contacted but
+ ** didn't give an answer).
+ */
+
+ if (qtype != T_ANY && errno != ETIMEDOUT)
+ return FALSE;
+#else /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */
if (qtype != T_ANY)
return FALSE;
+#endif /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */
}
if (h_errno != HOST_NOT_FOUND)
@@ -976,7 +1002,8 @@ cnameloop:
/* if nothing was found, we are done */
if (mxmatch == NULL)
{
- *statp = EX_NOHOST;
+ if (*statp == EX_OK)
+ *statp = EX_NOHOST;
return FALSE;
}
diff --git a/contrib/sendmail/src/envelope.c b/contrib/sendmail/src/envelope.c
index 1a6136e..a708589 100644
--- a/contrib/sendmail/src/envelope.c
+++ b/contrib/sendmail/src/envelope.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: envelope.c,v 8.180.14.4 2000/08/22 18:22:39 gshapiro Exp $";
+static char id[] = "@(#)$Id: envelope.c,v 8.180.14.6 2000/11/30 00:39:46 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -91,6 +91,7 @@ dropenvelope(e, fulldrop)
bool done = FALSE;
register ADDRESS *q;
char *id = e->e_id;
+ time_t now;
char buf[MAXLINE];
if (tTd(50, 1))
@@ -130,7 +131,8 @@ dropenvelope(e, fulldrop)
** Extract state information from dregs of send list.
*/
- if (curtime() > e->e_ctime + TimeOuts.to_q_return[e->e_timeoutclass])
+ now = curtime();
+ if (now > e->e_ctime + TimeOuts.to_q_return[e->e_timeoutclass])
message_timeout = TRUE;
if (TimeOuts.to_q_return[e->e_timeoutclass] == NOW &&
@@ -208,7 +210,7 @@ dropenvelope(e, fulldrop)
}
}
else if (TimeOuts.to_q_warning[e->e_timeoutclass] > 0 &&
- curtime() > e->e_ctime + TimeOuts.to_q_warning[e->e_timeoutclass])
+ now > e->e_ctime + TimeOuts.to_q_warning[e->e_timeoutclass])
{
if (!bitset(EF_WARNING|EF_RESPONSE, e->e_flags) &&
e->e_class >= 0 &&
@@ -965,7 +967,7 @@ static struct eflags EnvelopeFlags[] =
{ "HAS_DF", EF_HAS_DF },
{ "IS_MIME", EF_IS_MIME },
{ "DONT_MIME", EF_DONT_MIME },
- { NULL }
+ { NULL, 0 }
};
void
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index 824b333..e57a91d 100644
--- a/contrib/sendmail/src/headers.c
+++ b/contrib/sendmail/src/headers.c
@@ -12,12 +12,12 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: headers.c,v 8.203.4.7 2000/08/22 21:50:36 gshapiro Exp $";
+static char id[] = "@(#)$Id: headers.c,v 8.203.4.10 2000/10/13 17:54:30 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
-static bool fix_mime_header __P((char *));
+static size_t fix_mime_header __P((char *));
static int priencode __P((char *));
static void put_vanilla_header __P((HDR *, char *, MCI *));
@@ -164,7 +164,7 @@ chompheader(line, pflag, hdrp, e)
goto hse;
}
- setbitn(*p, mopts);
+ setbitn(bitidx(*p), mopts);
cond = TRUE;
p++;
}
@@ -344,7 +344,8 @@ hse:
free(sp);
define(macid("{currHeader}", NULL), newstr(qval), e);
define(macid("{hdr_name}", NULL), newstr(fname), e);
- (void) rscheck(rs, fvalue, NULL, e, stripcom, TRUE, 4);
+ (void) rscheck(rs, fvalue, NULL, e, stripcom, TRUE, 4,
+ NULL);
}
}
@@ -1388,14 +1389,18 @@ putheader(mci, hdr, e, flags)
wordinclass(h->h_field,
macid("{checkMIMEFieldHeaders}", NULL)))
{
- if (fix_mime_header(h->h_value))
+ size_t len;
+
+ len = fix_mime_header(h->h_value);
+ if (len > 0)
{
sm_syslog(LOG_ALERT, e->e_id,
- "Truncated MIME %s header due to field size (possible attack)",
- h->h_field);
+ "Truncated MIME %s header due to field size (length = %ld) (possible attack)",
+ h->h_field, (unsigned long) len);
if (tTd(34, 11))
- dprintf(" truncated MIME %s header due to field size (possible attack)\n",
- h->h_field);
+ dprintf(" truncated MIME %s header due to field size (length = %ld) (possible attack)\n",
+ h->h_field,
+ (unsigned long) len);
}
}
@@ -1403,15 +1408,19 @@ putheader(mci, hdr, e, flags)
wordinclass(h->h_field,
macid("{checkMIMETextHeaders}", NULL)))
{
- if (strlen(h->h_value) > (size_t)MaxMimeHeaderLength)
+ size_t len;
+
+ len = strlen(h->h_value);
+ if (len > (size_t) MaxMimeHeaderLength)
{
h->h_value[MaxMimeHeaderLength - 1] = '\0';
sm_syslog(LOG_ALERT, e->e_id,
- "Truncated long MIME %s header (possible attack)",
- h->h_field);
+ "Truncated long MIME %s header (length = %ld) (possible attack)",
+ h->h_field, (unsigned long) len);
if (tTd(34, 11))
- dprintf(" truncated long MIME %s header (possible attack)\n",
- h->h_field);
+ dprintf(" truncated long MIME %s header (length = %ld) (possible attack)\n",
+ h->h_field,
+ (unsigned long) len);
}
}
@@ -1419,14 +1428,19 @@ putheader(mci, hdr, e, flags)
wordinclass(h->h_field,
macid("{checkMIMEHeaders}", NULL)))
{
- if (shorten_rfc822_string(h->h_value, MaxMimeHeaderLength))
+ size_t len;
+
+ len = strlen(h->h_value);
+ if (shorten_rfc822_string(h->h_value,
+ MaxMimeHeaderLength))
{
sm_syslog(LOG_ALERT, e->e_id,
- "Truncated long MIME %s header (possible attack)",
- h->h_field);
+ "Truncated long MIME %s header (length = %ld) (possible attack)",
+ h->h_field, (unsigned long) len);
if (tTd(34, 11))
- dprintf(" truncated long MIME %s header (possible attack)\n",
- h->h_field);
+ dprintf(" truncated long MIME %s header (length = %ld) (possible attack)\n",
+ h->h_field,
+ (unsigned long) len);
}
}
@@ -1457,7 +1471,7 @@ putheader(mci, hdr, e, flags)
if (bitset(H_CHECK|H_ACHECK, h->h_flags) &&
!bitintersect(h->h_mflags, mci->mci_mailer->m_flags) &&
(h->h_macro == '\0' ||
- macvalue(h->h_macro & 0377, e) == NULL))
+ macvalue(bitidx(h->h_macro), e) == NULL))
{
if (tTd(34, 11))
dprintf(" (skipped)\n");
@@ -1819,22 +1833,23 @@ copyheader(header)
** string -- the full header
**
** Returns:
-** TRUE if the header was modified, FALSE otherwise
+** length of last offending field, 0 if all ok.
**
** Side Effects:
** string modified in place
*/
-static bool
+static size_t
fix_mime_header(string)
char *string;
{
- bool modified = FALSE;
char *begin = string;
char *end;
+ size_t len = 0;
+ size_t retlen = 0;
if (string == NULL || *string == '\0')
- return FALSE;
+ return 0;
/* Split on each ';' */
while ((end = find_character(begin, ';')) != NULL)
@@ -1844,9 +1859,11 @@ fix_mime_header(string)
*end = '\0';
+ len = strlen(begin);
+
/* Shorten individual parameter */
if (shorten_rfc822_string(begin, MaxMimeFieldLength))
- modified = TRUE;
+ retlen = len;
/* Collapse the possibly shortened string with rest */
bp = begin + strlen(begin);
@@ -1870,5 +1887,5 @@ fix_mime_header(string)
/* Move past ';' */
begin = end + 1;
}
- return modified;
+ return retlen;
}
diff --git a/contrib/sendmail/src/macro.c b/contrib/sendmail/src/macro.c
index 007a6eb..1a32182 100644
--- a/contrib/sendmail/src/macro.c
+++ b/contrib/sendmail/src/macro.c
@@ -12,14 +12,17 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: macro.c,v 8.40.16.2 2000/09/17 17:04:26 gshapiro Exp $";
+static char id[] = "@(#)$Id: macro.c,v 8.40.16.7 2000/10/09 15:49:06 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
-char *MacroName[256]; /* macro id to name table */
-int NextMacroId = 0240; /* codes for long named macros */
+#if MAXMACROID != (BITMAPBITS - 1)
+ ERROR Read the comment in conf.h
+#endif /* MAXMACROID != (BITMAPBITS - 1) */
+char *MacroName[MAXMACROID + 1]; /* macro id to name table */
+int NextMacroId = 0240; /* codes for long named macros */
/*
** EXPAND -- macro expand a string using $x escapes.
@@ -111,7 +114,7 @@ expand(s, buf, bufsize, e)
continue;
case MACROEXPAND: /* macro interpolation */
- c = *++s & 0377;
+ c = bitidx(*++s);
if (c != '\0')
q = macvalue(c, e);
else
@@ -247,7 +250,7 @@ define(n, v, e)
{
int m;
- m = n & 0377;
+ m = bitidx(n);
if (tTd(35, 9))
{
dprintf("%sdefine(%s as ",
@@ -285,7 +288,7 @@ macvalue(n, e)
int n;
register ENVELOPE *e;
{
- n &= 0377;
+ n = bitidx(n);
while (e != NULL)
{
register char *p = e->e_macro[n];
@@ -315,7 +318,7 @@ macname(n)
{
static char mbuf[2];
- n &= 0377;
+ n = bitidx(n);
if (bitset(0200, n))
{
char *p = MacroName[n];
@@ -368,7 +371,7 @@ macid(p, ep)
*ep = p;
if (tTd(35, 14))
dprintf("NULL\n");
- return '\0';
+ return 0;
}
if (*p != '{')
{
@@ -376,8 +379,8 @@ macid(p, ep)
if (ep != NULL)
*ep = p + 1;
if (tTd(35, 14))
- dprintf("%c\n", *p);
- return *p;
+ dprintf("%c\n", bitidx(*p));
+ return bitidx(*p);
}
bp = mbuf;
while (*++p != '\0' && *p != '}' && bp < &mbuf[sizeof mbuf - 1])
@@ -401,7 +404,7 @@ macid(p, ep)
else if (mbuf[1] == '\0')
{
/* ${x} == $x */
- mid = mbuf[0];
+ mid = bitidx(mbuf[0]);
p++;
}
else
@@ -428,6 +431,13 @@ macid(p, ep)
}
if (ep != NULL)
*ep = p;
+ if (mid < 0 || mid > MAXMACROID)
+ {
+ syserr("Unable to assign macro/class ID (mid = 0x%x)", mid);
+ if (tTd(35, 14))
+ dprintf("NULL\n");
+ return 0;
+ }
if (tTd(35, 14))
dprintf("0x%x\n", mid);
return mid;
@@ -452,5 +462,5 @@ wordinclass(str, cl)
register STAB *s;
s = stab(str, ST_CLASS, ST_FIND);
- return s != NULL && bitnset(cl & 0xff, s->s_class);
+ return s != NULL && bitnset(bitidx(cl), s->s_class);
}
diff --git a/contrib/sendmail/src/mailq.1 b/contrib/sendmail/src/mailq.1
index f261b0f..ab13b55 100644
--- a/contrib/sendmail/src/mailq.1
+++ b/contrib/sendmail/src/mailq.1
@@ -9,11 +9,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: mailq.1,v 8.14.28.2 2000/09/17 17:04:27 gshapiro Exp $
+.\" $Id: mailq.1,v 8.14.28.3 2000/12/14 23:08:15 gshapiro Exp $
.\"
-.TH MAILQ 1 "$Date: 2000/09/17 17:04:27 $"
+.TH MAILQ 1 "$Date: 2000/12/14 23:08:15 $"
.SH NAME
-.B mailq
+mailq
\- print the mail queue
.SH SYNOPSIS
.B mailq
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index 58f49c4..5097b58 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: main.c,v 8.485.4.27 2000/09/26 01:30:38 gshapiro Exp $";
+static char id[] = "@(#)$Id: main.c,v 8.485.4.38 2000/12/19 02:50:33 gshapiro Exp $";
#endif /* ! lint */
#define _DEFINE
@@ -624,6 +624,10 @@ main(argc, argv, envp)
setclass('w', ipbuf);
}
#endif /* NETINET || NETINET6 */
+#if _FFR_FREEHOSTENT && NETINET6
+ freehostent(hp);
+ hp = NULL;
+#endif /* _FFR_FREEHOSTENT && NETINET6 */
}
/* current time */
@@ -1540,6 +1544,15 @@ main(argc, argv, envp)
{
char buf[MAXLINE];
+#if _FFR_TESTMODE_DROP_PRIVS
+ dp = drop_privileges(TRUE);
+ if (dp != EX_OK)
+ {
+ CurEnv->e_id = NULL;
+ finis(TRUE, dp);
+ }
+#endif /* _FFR_TESTMODE_DROP_PRIVS */
+
if (isatty(fileno(stdin)))
Verbose = 2;
@@ -1608,6 +1621,16 @@ main(argc, argv, envp)
}
#endif /* QUEUE */
+# if SASL
+ if (OpMode == MD_SMTP || OpMode == MD_DAEMON)
+ {
+ /* give a syserr or just disable AUTH ? */
+ if ((i = sasl_server_init(srvcallbacks, "Sendmail")) != SASL_OK)
+ syserr("!sasl_server_init failed! [%s]",
+ sasl_errstring(i, NULL, NULL));
+ }
+# endif /* SASL */
+
/*
** If a daemon, wait for a request.
** getrequests will always return in a child.
@@ -1760,13 +1783,6 @@ main(argc, argv, envp)
define(macid("{client_port}", NULL),
newstr(pbuf), &BlankEnvelope);
-#if SASL
- /* give a syserr or just disable AUTH ? */
- if ((i = sasl_server_init(srvcallbacks, "Sendmail")) != SASL_OK)
- syserr("!sasl_server_init failed! [%s]",
- sasl_errstring(i, NULL, NULL));
-#endif /* SASL */
-
if (OpMode == MD_DAEMON)
{
/* validate the connection */
@@ -1784,6 +1800,8 @@ main(argc, argv, envp)
if (OpMode == MD_SMTP)
(void) initsrvtls();
# endif /* STARTTLS */
+
+
smtp(nullserver, *p_flags, CurEnv);
}
#endif /* SMTP */
@@ -2167,7 +2185,7 @@ struct metamac MetaMacros[] =
/* miscellaneous control characters */
{ '&', MACRODEXPAND },
- { '\0' }
+ { '\0', '\0' }
};
#define MACBINDING(name, mid) \
@@ -2181,7 +2199,7 @@ initmacros(e)
register struct metamac *m;
register int c;
char buf[5];
- extern char *MacroName[256];
+ extern char *MacroName[MAXMACROID + 1];
for (m = MetaMacros; m->metaname != '\0'; m++)
{
@@ -2388,7 +2406,18 @@ auth_warning(e, msg, va_alist)
static char hostbuf[48];
if (hostbuf[0] == '\0')
- (void) myhostname(hostbuf, sizeof hostbuf);
+ {
+ struct hostent *hp;
+
+ hp = myhostname(hostbuf, sizeof hostbuf);
+#if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ {
+ freehostent(hp);
+ hp = NULL;
+ }
+#endif /* _FFR_FREEHOSTENT && NETINET6 */
+ }
(void) snprintf(buf, sizeof buf, "%s: ", hostbuf);
p = &buf[strlen(buf)];
@@ -2782,7 +2811,7 @@ testmodeline(line, e)
{
case 'D':
mid = macid(&line[2], &delimptr);
- if (mid == '\0')
+ if (mid == 0)
return;
translate_dollars(delimptr);
define(mid, newstr(delimptr), e);
@@ -2793,7 +2822,7 @@ testmodeline(line, e)
return;
mid = macid(&line[2], &delimptr);
- if (mid == '\0')
+ if (mid == 0)
return;
translate_dollars(delimptr);
expand(delimptr, exbuf, sizeof exbuf, e);
@@ -2899,12 +2928,12 @@ testmodeline(line, e)
if (line[1] == '=')
{
mid = macid(&line[2], NULL);
- if (mid != '\0')
+ if (mid != 0)
stabapply(dump_class, mid);
return;
}
mid = macid(&line[1], NULL);
- if (mid == '\0')
+ if (mid == 0)
return;
p = macvalue(mid, e);
if (p == NULL)
@@ -3169,6 +3198,6 @@ dump_class(s, id)
{
if (s->s_type != ST_CLASS)
return;
- if (bitnset(id & 0xff, s->s_class))
+ if (bitnset(bitidx(id), s->s_class))
printf("%s\n", s->s_name);
}
diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c
index 3676d44..8fb0cfd 100644
--- a/contrib/sendmail/src/map.c
+++ b/contrib/sendmail/src/map.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: map.c,v 8.414.4.24 2000/09/27 04:11:29 gshapiro Exp $";
+static char id[] = "@(#)$Id: map.c,v 8.414.4.34 2000/12/18 18:00:43 ca Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -2895,6 +2895,7 @@ ldapmap_start(map)
# if USE_LDAP_INIT
ld = ldap_init(lmap->ldap_host, lmap->ldap_port);
+ save_errno = errno;
# else /* USE_LDAP_INIT */
/*
** If using ldap_open(), the actual connection to the server
@@ -3574,7 +3575,7 @@ ldapmap_lookup(map, name, av, statp)
}
/* Did we match anything? */
- if (vp == NULL)
+ if (vp == NULL && !bitset(MF_MATCHONLY, map->map_mflags))
return NULL;
/*
@@ -3586,22 +3587,26 @@ ldapmap_lookup(map, name, av, statp)
if (bitset(MF_NOREWRITE, map->map_mflags))
{
- /* vp != NULL due to test above */
- free(vp);
+ if (vp != NULL)
+ free(vp);
return "";
}
if (*statp == EX_OK)
{
- /* vp != NULL due to test above */
if (LogLevel > 9)
sm_syslog(LOG_INFO, CurEnv->e_id,
- "ldap %.100s => %s", name, vp);
+ "ldap %.100s => %s", name,
+ vp == NULL ? "<NULL>" : vp);
if (bitset(MF_MATCHONLY, map->map_mflags))
result = map_rewrite(map, name, strlen(name), NULL);
else
+ {
+ /* vp != NULL according to test above */
result = map_rewrite(map, vp, strlen(vp), av);
- free(vp);
+ }
+ if (vp != NULL)
+ free(vp);
}
return result;
}
@@ -4238,7 +4243,7 @@ ldapmap_parseargs(map, args)
if (p != NULL)
*p++ = '\0';
- if (i == LDAPMAP_MAX_ATTR)
+ if (i >= LDAPMAP_MAX_ATTR)
{
syserr("Too many return attributes in %s (max %d)",
map->map_mname, LDAPMAP_MAX_ATTR);
@@ -4631,7 +4636,7 @@ ph_map_open(map, mode)
{
if (tTd(9, 1))
dprintf("ph_map_open(%s) => DEFERRED\n",
- map->map_mname);
+ map->map_mname);
/*
** Unset MF_DEFER here so that map_lookup() returns
@@ -6719,7 +6724,7 @@ macro_map_lookup(map, name, av, statp)
struct regex_map
{
- regex_t regex_pattern_buf; /* xalloc it */
+ regex_t *regex_pattern_buf; /* xalloc it */
int *regex_subfields; /* move to type MAP */
char *regex_delim; /* move to type MAP */
};
@@ -6796,6 +6801,7 @@ regex_map_init(map, ap)
p = ap;
map_p = (struct regex_map *) xnalloc(sizeof *map_p);
+ map_p->regex_pattern_buf = (regex_t *)xnalloc(sizeof(regex_t));
for (;;)
{
@@ -6852,14 +6858,15 @@ regex_map_init(map, ap)
if (tTd(38, 3))
dprintf("regex_map_init: compile '%s' 0x%x\n", p, pflags);
- if ((regerr = regcomp(&(map_p->regex_pattern_buf), p, pflags)) != 0)
+ if ((regerr = regcomp(map_p->regex_pattern_buf, p, pflags)) != 0)
{
/* Errorhandling */
char errbuf[ERRBUF_SIZE];
- (void) regerror(regerr, &(map_p->regex_pattern_buf),
+ (void) regerror(regerr, map_p->regex_pattern_buf,
errbuf, ERRBUF_SIZE);
syserr("pattern-compile-error: %s\n", errbuf);
+ free(map_p->regex_pattern_buf);
free(map_p);
return FALSE;
}
@@ -6877,7 +6884,7 @@ regex_map_init(map, ap)
int substrings;
int *fields = (int *) xalloc(sizeof(int) * (MAX_MATCH + 1));
- substrings = map_p->regex_pattern_buf.re_nsub + 1;
+ substrings = map_p->regex_pattern_buf->re_nsub + 1;
if (tTd(38, 3))
dprintf("regex_map_init: nr of substrings %d\n",
@@ -6886,6 +6893,7 @@ regex_map_init(map, ap)
if (substrings >= MAX_MATCH)
{
syserr("too many substrings, %d max\n", MAX_MATCH);
+ free(map_p->regex_pattern_buf);
free(map_p);
return FALSE;
}
@@ -6955,7 +6963,7 @@ regex_map_lookup(map, name, av, statp)
}
map_p = (struct regex_map *)(map->map_db1);
- reg_res = regexec(&(map_p->regex_pattern_buf),
+ reg_res = regexec(map_p->regex_pattern_buf,
name, MAX_MATCH, pmatch, 0);
if (bitset(MF_REGEX_NOT, map->map_mflags))
@@ -6987,7 +6995,7 @@ regex_map_lookup(map, name, av, statp)
if (av[1] != NULL)
{
if (parse_fields(av[1], fields, MAX_MATCH + 1,
- (int) map_p->regex_pattern_buf.re_nsub + 1) == -1)
+ (int) map_p->regex_pattern_buf->re_nsub + 1) == -1)
{
*statp = EX_CONFIG;
return NULL;
@@ -7011,7 +7019,8 @@ regex_map_lookup(map, name, av, statp)
first = FALSE;
- if (pmatch[*ip].rm_so < 0 || pmatch[*ip].rm_eo < 0)
+ if (*ip >= MAX_MATCH ||
+ pmatch[*ip].rm_so < 0 || pmatch[*ip].rm_eo < 0)
continue;
sp = name + pmatch[*ip].rm_so;
@@ -7128,7 +7137,7 @@ nsd_map_lookup(map, name, av, statp)
char **av;
int *statp;
{
- int buflen;
+ int buflen, r;
char *p;
ns_map_t *ns_map;
char keybuf[MAXNAME + 1];
@@ -7150,12 +7159,27 @@ nsd_map_lookup(map, name, av, statp)
{
if (tTd(38, 20))
dprintf("nsd_map_t_find failed\n");
+ *statp = EX_UNAVAILABLE;
return NULL;
}
-
- if (ns_lookup(ns_map, NULL, map->map_file,
- keybuf, NULL, buf, MAXLINE) == NULL)
+ r = ns_lookup(ns_map, NULL, map->map_file, keybuf, NULL, buf, MAXLINE);
+ if (r == NS_UNAVAIL || r == NS_TRYAGAIN)
+ {
+ *statp = EX_TEMPFAIL;
return NULL;
+ }
+ if (r == NS_BADREQ || r == NS_NOPERM)
+ {
+ *statp = EX_CONFIG;
+ return NULL;
+ }
+ if (r != NS_SUCCESS)
+ {
+ *statp = EX_NOTFOUND;
+ return NULL;
+ }
+
+ *statp = EX_OK;
/* Null out trailing \n */
if ((p = strchr(buf, '\n')) != NULL)
diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c
index 18877ed..073c6bd 100644
--- a/contrib/sendmail/src/mci.c
+++ b/contrib/sendmail/src/mci.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: mci.c,v 8.133.10.3 2000/06/23 16:17:06 ca Exp $";
+static char id[] = "@(#)$Id: mci.c,v 8.133.10.7 2000/12/12 00:39:34 ca Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -274,8 +274,10 @@ mci_flush(doquit, allbut)
return;
for (i = 0; i < MaxMciCache; i++)
+ {
if (allbut != MciCache[i])
mci_uncache(&MciCache[i], doquit);
+ }
}
/*
** MCI_GET -- get information about a particular host
@@ -300,7 +302,7 @@ mci_get(host, m)
(void) mci_scan(NULL);
if (m->m_mno < 0)
- syserr("negative mno %d (%s)", m->m_mno, m->m_name);
+ syserr("!negative mno %d (%s)", m->m_mno, m->m_name);
s = stab(host, ST_MCI + m->m_mno, ST_ENTER);
mci = &s->s_mci;
@@ -383,7 +385,7 @@ mci_match(host, m)
register MCI *mci;
register STAB *s;
- if (m->m_mno < 0)
+ if (m->m_mno < 0 || m->m_mno > MAXMAILERS)
return FALSE;
s = stab(host, ST_MCI + m->m_mno, ST_FIND);
if (s == NULL)
@@ -460,7 +462,7 @@ static struct mcifbits MciFlags[] =
{ MCIF_8BITOK, "8BITOK" },
{ MCIF_CVT7TO8, "CVT7TO8" },
{ MCIF_INMIME, "INMIME" },
- { 0, NULL }
+ { 0, NULL }
};
@@ -1327,12 +1329,12 @@ mci_generate_persistent_path(host, path, pathlen, createflag)
#if NETINET || NETINET6
/* check for bogus bracketed address */
- if (host[0] == '[' &&
+ if (host[0] == '['
# if NETINET6
- inet_pton(AF_INET6, t_host, &in6_addr) != 1 &&
+ && inet_pton(AF_INET6, t_host, &in6_addr) != 1
# endif /* NETINET6 */
# if NETINET
- inet_addr(t_host) == INADDR_NONE
+ && inet_addr(t_host) == INADDR_NONE
# endif /* NETINET */
)
return -1;
diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c
index 248cba7..a248090 100644
--- a/contrib/sendmail/src/milter.c
+++ b/contrib/sendmail/src/milter.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: milter.c,v 8.50.4.33 2000/09/19 19:40:15 gshapiro Exp $";
+static char id[] = "@(#)$Id: milter.c,v 8.50.4.41 2000/12/27 21:35:32 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -22,6 +22,9 @@ static char id[] = "@(#)$Id: milter.c,v 8.50.4.33 2000/09/19 19:40:15 gshapiro E
# include <arpa/inet.h>
# endif /* NETINET || NETINET6 */
+# define SM_FD_SET FD_SET
+# define SM_FD_ISSET FD_ISSET
+# define SM_FD_SETSIZE FD_SETSIZE
static void milter_error __P((struct milter *));
static int milter_open __P((struct milter *, bool, ENVELOPE *));
@@ -113,29 +116,28 @@ static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1];
** Assumes 'm' is a milter structure for the current socket.
*/
-
-# define MILTER_TIMEOUT(routine, secs, write) \
+# define MILTER_TIMEOUT(routine, secs, write) \
{ \
int ret; \
int save_errno; \
fd_set fds; \
struct timeval tv; \
\
- if (m->mf_sock >= FD_SETSIZE) \
+ if (SM_FD_SETSIZE != 0 && m->mf_sock >= SM_FD_SETSIZE) \
{ \
if (tTd(64, 5)) \
dprintf("%s(%s): socket %d is larger than FD_SETSIZE %d\n", \
- routine, m->mf_name, m->mf_sock, FD_SETSIZE); \
+ routine, m->mf_name, m->mf_sock, SM_FD_SETSIZE); \
if (LogLevel > 0) \
sm_syslog(LOG_ERR, e->e_id, \
"%s(%s): socket %d is larger than FD_SETSIZE %d\n", \
- routine, m->mf_name, m->mf_sock, FD_SETSIZE); \
+ routine, m->mf_name, m->mf_sock, SM_FD_SETSIZE); \
milter_error(m); \
return NULL; \
} \
\
FD_ZERO(&fds); \
- FD_SET(m->mf_sock, &fds); \
+ SM_FD_SET(m->mf_sock, &fds); \
tv.tv_sec = secs; \
tv.tv_usec = 0; \
ret = select(m->mf_sock + 1, \
@@ -167,7 +169,7 @@ static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1];
return NULL; \
\
default: \
- if (FD_ISSET(m->mf_sock, &fds)) \
+ if (SM_FD_ISSET(m->mf_sock, &fds)) \
break; \
if (tTd(64, 5)) \
dprintf("%s(%s): socket not ready\n", \
@@ -181,7 +183,6 @@ static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1];
} \
}
-
/*
** Low level functions
*/
@@ -879,6 +880,9 @@ milter_open(m, parseonly, e)
m->mf_name, at,
hp->h_addrtype);
milter_error(m);
+# if _FFR_FREEHOSTENT && NETINET6
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return -1;
}
}
@@ -901,6 +905,10 @@ milter_open(m, parseonly, e)
if (parseonly)
{
m->mf_state = SMFS_READY;
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return 0;
}
@@ -913,6 +921,10 @@ milter_open(m, parseonly, e)
dprintf("milter_open(%s): Trying to open filter in state %c\n",
m->mf_name, (char) m->mf_state);
milter_error(m);
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return -1;
}
@@ -931,6 +943,10 @@ milter_open(m, parseonly, e)
"X%s: error creating socket: %s",
m->mf_name, errstring(save_errno));
milter_error(m);
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return -1;
}
@@ -983,6 +999,9 @@ milter_open(m, parseonly, e)
m->mf_name, at,
hp->h_addrtype);
milter_error(m);
+# if _FFR_FREEHOSTENT && NETINET6
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return -1;
}
continue;
@@ -995,9 +1014,20 @@ milter_open(m, parseonly, e)
"X%s: error connecting to filter",
m->mf_name);
milter_error(m);
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ freehostent(hp);
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return -1;
}
m->mf_state = SMFS_OPEN;
+# if _FFR_FREEHOSTENT && NETINET6
+ if (hp != NULL)
+ {
+ freehostent(hp);
+ hp = NULL;
+ }
+# endif /* _FFR_FREEHOSTENT && NETINET6 */
return sock;
}
/*
@@ -1078,7 +1108,7 @@ milter_setup(line)
for (; *p != '\0'; p++)
{
if (!(isascii(*p) && isspace(*p)))
- setbitn(*p, m->mf_flags);
+ setbitn(bitidx(*p), m->mf_flags);
}
break;
@@ -1549,8 +1579,11 @@ milter_quit_filter(m, e)
(void) milter_write(m, SMFIC_QUIT, (char *) NULL, 0,
m->mf_timeout[SMFTO_WRITE], e);
- (void) close(m->mf_sock);
- m->mf_sock = -1;
+ if (m->mf_sock >= 0)
+ {
+ (void) close(m->mf_sock);
+ m->mf_sock = -1;
+ }
if (m->mf_state != SMFS_ERROR)
m->mf_state = SMFS_CLOSED;
}
@@ -1617,7 +1650,7 @@ milter_send_macros(m, macros, cmd, e)
for (i = 0; macros[i] != NULL; i++)
{
mid = macid(macros[i], NULL);
- if (mid == '\0')
+ if (mid == 0)
continue;
v = macvalue(mid, e);
if (v == NULL)
@@ -1631,7 +1664,7 @@ milter_send_macros(m, macros, cmd, e)
for (i = 0; macros[i] != NULL; i++)
{
mid = macid(macros[i], NULL);
- if (mid == '\0')
+ if (mid == 0)
continue;
v = macvalue(mid, e);
if (v == NULL)
@@ -1841,6 +1874,13 @@ milter_command(command, data, sz, macros, e, state)
{
struct milter *m = InputFilters[i];
+ /* previous problem? */
+ if (m->mf_state == SMFS_ERROR)
+ {
+ MILTER_CHECK_ERROR(continue);
+ break;
+ }
+
/* sanity check */
if (m->mf_sock < 0 ||
(m->mf_state != SMFS_OPEN && m->mf_state != SMFS_INMSG))
@@ -2282,6 +2322,7 @@ milter_addheader(response, rlen, e)
ENVELOPE *e;
{
char *val;
+ HDR *h;
if (tTd(64, 10))
dprintf("milter_addheader: ");
@@ -2319,13 +2360,31 @@ milter_addheader(response, rlen, e)
return;
}
+ for (h = e->e_header; h != NULL; h = h->h_link)
+ {
+ if (strcasecmp(h->h_field, response) == 0 &&
+ !bitset(H_USER, h->h_flags) &&
+ !bitset(H_TRACE, h->h_flags))
+ break;
+ }
+
/* add to e_msgsize */
e->e_msgsize += strlen(response) + 2 + strlen(val);
- if (tTd(64, 10))
- dprintf("Add %s: %s\n", response, val);
-
- addheader(newstr(response), val, H_USER, &e->e_header);
+ if (h != NULL)
+ {
+ if (tTd(64, 10))
+ dprintf("Replace default header %s value with %s\n",
+ h->h_field, val);
+ h->h_value = newstr(val);
+ h->h_flags |= H_USER;
+ }
+ else
+ {
+ if (tTd(64, 10))
+ dprintf("Add %s: %s\n", response, val);
+ addheader(newstr(response), val, H_USER, &e->e_header);
+ }
}
/*
** MILTER_CHANGEHEADER -- Change the supplied header in the message
@@ -2347,7 +2406,7 @@ milter_changeheader(response, rlen, e)
{
mi_int32 i, index;
char *field, *val;
- HDR *h;
+ HDR *h, *sysheader;
if (tTd(64, 10))
dprintf("milter_changeheader: ");
@@ -2389,14 +2448,36 @@ milter_changeheader(response, rlen, e)
return;
}
+ sysheader = NULL;
for (h = e->e_header; h != NULL; h = h->h_link)
{
- if (bitset(H_USER, h->h_flags) &&
- strcasecmp(h->h_field, field) == 0 &&
- --index <= 0)
- break;
+ if (strcasecmp(h->h_field, field) == 0)
+ {
+ if (bitset(H_USER, h->h_flags) &&
+ --index <= 0)
+ {
+ sysheader = NULL;
+ break;
+ }
+ else if (!bitset(H_USER, h->h_flags) &&
+ !bitset(H_TRACE, h->h_flags))
+ {
+ /*
+ ** DRUMS msg-fmt draft says can only have
+ ** multiple occurences of trace fields,
+ ** so make sure we replace any non-trace,
+ ** non-user field.
+ */
+
+ sysheader = h;
+ }
+ }
}
+ /* if not found as user-provided header at index, use sysheader */
+ if (h == NULL)
+ h = sysheader;
+
if (h == NULL)
{
if (*val == '\0')
@@ -2419,19 +2500,22 @@ milter_changeheader(response, rlen, e)
{
if (*val == '\0')
{
- dprintf("Delete %s: %s\n", field,
+ dprintf("Delete%s %s: %s\n",
+ h == sysheader ? " (default header)" : "",
+ field,
h->h_value == NULL ? "<NULL>" : h->h_value);
}
else
{
- dprintf("Change %s: from %s to %s\n",
+ dprintf("Change%s %s: from %s to %s\n",
+ h == sysheader ? " (default header)" : "",
field,
h->h_value == NULL ? "<NULL>" : h->h_value,
val);
}
}
- if (h->h_value != NULL)
+ if (h != sysheader && h->h_value != NULL)
{
e->e_msgsize -= strlen(h->h_value);
free(h->h_value);
@@ -2440,12 +2524,14 @@ milter_changeheader(response, rlen, e)
if (*val == '\0')
{
/* Remove "Field: " from message size */
- e->e_msgsize -= strlen(h->h_field) + 2;
+ if (h != sysheader)
+ e->e_msgsize -= strlen(h->h_field) + 2;
h->h_value = NULL;
}
else
{
h->h_value = newstr(val);
+ h->h_flags |= H_USER;
e->e_msgsize += strlen(h->h_value);
}
}
@@ -2693,17 +2779,8 @@ milter_init(e, state)
m->mf_sock < 0 ? "open" : "negotiate");
/* if negotation failure, close socket */
- if (m->mf_sock >= 0)
- {
- (void) close(m->mf_sock);
- m->mf_sock = -1;
- }
milter_error(m);
- if (m->mf_state == SMFS_ERROR)
- {
- MILTER_CHECK_ERROR(continue);
- break;
- }
+ MILTER_CHECK_ERROR(continue);
}
}
@@ -3087,6 +3164,13 @@ milter_data(e, state)
*state = SMFIR_CONTINUE;
newfilter = TRUE;
+ /* previous problem? */
+ if (m->mf_state == SMFS_ERROR)
+ {
+ MILTER_CHECK_ERROR(continue);
+ break;
+ }
+
/* sanity checks */
if (m->mf_sock < 0 ||
(m->mf_state != SMFS_OPEN && m->mf_state != SMFS_INMSG))
diff --git a/contrib/sendmail/src/mime.c b/contrib/sendmail/src/mime.c
index e92f615..2ba078f 100644
--- a/contrib/sendmail/src/mime.c
+++ b/contrib/sendmail/src/mime.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1994, 1996-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1994
@@ -15,7 +15,7 @@
#include <string.h>
#ifndef lint
-static char id[] = "@(#)$Id: mime.c,v 8.94 1999/10/17 17:35:58 ca Exp $";
+static char id[] = "@(#)$Id: mime.c,v 8.94.16.3 2000/10/09 02:46:10 gshapiro Exp $";
#endif /* ! lint */
static int isboundary __P((char *, char **));
@@ -277,8 +277,10 @@ mime8to7(mci, header, e, boundaries, flags)
if (tTd(43, 1))
dprintf("mime8to7: multipart boundary \"%s\"\n", bbuf);
for (i = 0; i < MAXMIMENESTING; i++)
+ {
if (boundaries[i] == NULL)
break;
+ }
if (i >= MAXMIMENESTING)
{
usrerr("mime8to7: multipart nesting boundary too deep");
@@ -621,7 +623,7 @@ mime8to7(mci, header, e, boundaries, flags)
linelen++;
}
}
- if (bitnset(c1 & 0xff, badchars))
+ if (bitnset(bitidx(c1), badchars))
{
*bp++ = '=';
*bp++ = Base16Code[(c1 >> 4) & 0x0f];
@@ -828,11 +830,11 @@ mimeboundary(line, boundaries)
if (line[0] != '-' || line[1] != '-' || boundaries == NULL)
return MBT_NOTSEP;
i = strlen(line);
- if (line[i - 1] == '\n')
+ if (i > 0 && line[i - 1] == '\n')
i--;
/* strip off trailing whitespace */
- while (line[i - 1] == ' ' || line[i - 1] == '\t')
+ while (i > 0 && (line[i - 1] == ' ' || line[i - 1] == '\t'))
i--;
savec = line[i];
line[i] = '\0';
@@ -904,7 +906,7 @@ isboundary(line, boundaries)
{
register int i;
- for (i = 0; boundaries[i] != NULL; i++)
+ for (i = 0; i <= MAXMIMENESTING && boundaries[i] != NULL; i++)
{
if (strcmp(line, boundaries[i]) == 0)
return i;
diff --git a/contrib/sendmail/src/newaliases.1 b/contrib/sendmail/src/newaliases.1
index dffa4ce..5a7c916 100644
--- a/contrib/sendmail/src/newaliases.1
+++ b/contrib/sendmail/src/newaliases.1
@@ -9,11 +9,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: newaliases.1,v 8.15 1999/06/22 20:41:34 tony Exp $
+.\" $Id: newaliases.1,v 8.15.28.1 2000/12/14 23:08:15 gshapiro Exp $
.\"
-.TH NEWALIASES 1 "$Date: 1999/06/22 20:41:34 $"
+.TH NEWALIASES 1 "$Date: 2000/12/14 23:08:15 $"
.SH NAME
-.B newaliases
+newaliases
\- rebuild the data base for the mail aliases file
.SH SYNOPSIS
.B newaliases
diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c
index eb63223..fd4f34b 100644
--- a/contrib/sendmail/src/parseaddr.c
+++ b/contrib/sendmail/src/parseaddr.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: parseaddr.c,v 8.234.4.5 2000/09/25 07:53:29 gshapiro Exp $";
+static char id[] = "@(#)$Id: parseaddr.c,v 8.234.4.9 2000/10/09 03:14:48 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -2054,7 +2054,7 @@ static struct qflags AddressFlags[] =
{ "QDELAYED", QDELAYED },
{ "QTHISPASS", QTHISPASS },
{ "QRCPTOK", QRCPTOK },
- { NULL }
+ { NULL, 0 }
};
void
@@ -2644,6 +2644,7 @@ dequote_map(map, name, av, statp)
** rmcomm -- remove comments?
** cnt -- count rejections (statistics)?
** logl -- logging level
+** host -- NULL or relay host.
**
** Returns:
** EX_OK -- if the rwset doesn't resolve to $#error
@@ -2651,13 +2652,14 @@ dequote_map(map, name, av, statp)
*/
int
-rscheck(rwset, p1, p2, e, rmcomm, cnt, logl)
+rscheck(rwset, p1, p2, e, rmcomm, cnt, logl, host)
char *rwset;
char *p1;
char *p2;
ENVELOPE *e;
bool rmcomm, cnt;
int logl;
+ char *host;
{
char *buf;
int bufsize;
@@ -2775,7 +2777,12 @@ rscheck(rwset, p1, p2, e, rmcomm, cnt, logl)
p2);
p += strlen(p);
}
- if ((relay = macvalue('_', e)) != NULL)
+
+ if (host != NULL)
+ relay = host;
+ else
+ relay = macvalue('_', e);
+ if (relay != NULL)
{
snprintf(p, SPACELEFT(lbuf, p),
", relay=%s", relay);
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index a91a988..590aed9 100644
--- a/contrib/sendmail/src/queue.c
+++ b/contrib/sendmail/src/queue.c
@@ -16,9 +16,9 @@
#ifndef lint
# if QUEUE
-static char id[] = "@(#)$Id: queue.c,v 8.343.4.17 2000/09/15 03:34:51 gshapiro Exp $ (with queueing)";
+static char id[] = "@(#)$Id: queue.c,v 8.343.4.38 2000/12/08 14:33:02 ca Exp $ (with queueing)";
# else /* QUEUE */
-static char id[] = "@(#)$Id: queue.c,v 8.343.4.17 2000/09/15 03:34:51 gshapiro Exp $ (without queueing)";
+static char id[] = "@(#)$Id: queue.c,v 8.343.4.38 2000/12/08 14:33:02 ca Exp $ (without queueing)";
# endif /* QUEUE */
#endif /* ! lint */
@@ -84,6 +84,7 @@ static int workcmpf4();
*/
# define TEMPQF_LETTER 'T'
+# define LOSEQF_LETTER 'Q'
void
queueup(e, announce)
@@ -384,6 +385,9 @@ queueup(e, announce)
(void) putc('F', tfp);
if (bitset(QPINGONDELAY, q->q_flags))
(void) putc('D', tfp);
+ if (q->q_alias != NULL &&
+ bitset(QALIAS, q->q_alias->q_flags))
+ (void) putc('A', tfp);
(void) putc(':', tfp);
(void) fprintf(tfp, "%s\n", denlstring(q->q_paddr, TRUE, FALSE));
if (announce)
@@ -447,7 +451,7 @@ queueup(e, announce)
{
if (bitset(0200, h->h_macro))
fprintf(tfp, "${%s}",
- macname(h->h_macro & 0377));
+ macname(bitidx(h->h_macro)));
else
fprintf(tfp, "$%c", h->h_macro);
}
@@ -520,7 +524,6 @@ queueup(e, announce)
if (rename(tf, qf) < 0)
syserr("cannot rename(%s, %s), uid=%d",
tf, qf, geteuid());
-
/*
** fsync() after renaming to make sure
** metadata is written to disk on
@@ -529,8 +532,7 @@ queueup(e, announce)
*/
if (tfd >= 0 && SuperSafe && fsync(tfd) < 0)
- syserr("!queueup: cannot fsync queue temp file %s",
- tf);
+ syserr("!queueup: cannot fsync queue temp file %s", tf);
/* close and unlock old (locked) qf */
if (e->e_lockfp != NULL)
@@ -653,6 +655,9 @@ runqueue(forkflag, verbose)
bool ret = TRUE;
static int curnum = 0;
+ DoQueueRun = FALSE;
+
+
if (!forkflag && NumQueues > 1 && !verbose)
forkflag = TRUE;
@@ -710,11 +715,9 @@ run_single_queue(queuedir, forkflag, verbose)
register ENVELOPE *e;
int njobs;
int sequenceno = 0;
- time_t current_la_time;
+ time_t current_la_time, now;
extern ENVELOPE BlankEnvelope;
- DoQueueRun = FALSE;
-
/*
** If no work will ever be selected, don't even bother reading
** the queue.
@@ -877,10 +880,11 @@ run_single_queue(queuedir, forkflag, verbose)
** Get new load average every 30 seconds.
*/
- if (current_la_time < curtime() - 30)
+ now = curtime();
+ if (current_la_time < now - 30)
{
CurrentLA = sm_getla(e);
- current_la_time = curtime();
+ current_la_time = now;
}
if (shouldqueue(WkRecipFact, current_la_time))
{
@@ -993,6 +997,7 @@ runqueueevent()
# define NEED_T 002
# define NEED_R 004
# define NEED_S 010
+# define NEED_H 020
static WORK *WorkList = NULL;
static int WorkListSize = 0;
@@ -1163,6 +1168,7 @@ orderq(queuedir, doall)
/* open control file */
cf = fopen(qf, "r");
+
if (cf == NULL)
{
/* this may be some random person sending hir msgs */
@@ -1185,6 +1191,11 @@ orderq(queuedir, doall)
/* extract useful information */
i = NEED_P | NEED_T;
+ if (QueueSortOrder == QSO_BYHOST)
+ {
+ /* need w_host set for host sort order */
+ i |= NEED_H;
+ }
if (QueueLimitSender != NULL)
i |= NEED_S;
if (QueueLimitRecipient != NULL)
@@ -1226,6 +1237,7 @@ orderq(queuedir, doall)
{
w->w_host = strrev(&p[1]);
makelower(w->w_host);
+ i &= ~NEED_H;
}
if (QueueLimitRecipient == NULL)
{
@@ -1952,6 +1964,7 @@ readqf(e)
u_long qflags;
ADDRESS *q;
int mid;
+ time_t now;
auto char *ep;
if (tTd(40, 4))
@@ -2013,6 +2026,11 @@ readqf(e)
case 'P':
qflags |= QPRIMARY;
break;
+
+ case 'A':
+ if (ctladdr != NULL)
+ ctladdr->q_flags |= QALIAS;
+ break;
}
}
}
@@ -2088,12 +2106,13 @@ readqf(e)
e->e_ntries = atoi(&buf[1]);
/* if this has been tried recently, let it be */
- if (e->e_ntries > 0 && e->e_dtime <= curtime() &&
- curtime() < e->e_dtime + queuedelay(e))
+ now = curtime();
+ if (e->e_ntries > 0 && e->e_dtime <= now &&
+ now < e->e_dtime + queuedelay(e))
{
char *howlong;
- howlong = pintvl(curtime() - e->e_dtime, TRUE);
+ howlong = pintvl(now - e->e_dtime, TRUE);
if (Verbose)
printf("%s: too young (%s)\n",
e->e_id, howlong);
@@ -2183,6 +2202,9 @@ readqf(e)
char *p;
mid = macid(&bp[1], &ep);
+ if (mid == 0)
+ break;
+
p = newstr(ep);
define(mid, p, e);
@@ -2339,7 +2361,7 @@ printqueue()
** queuedir -- queue directory
**
** Returns:
-** none.
+** number of entries
**
** Side Effects:
** Prints a listing of the mail queue on the standard output.
@@ -2618,9 +2640,9 @@ queuename(e, type)
sub = "/df";
break;
- case 'T':
+ case TEMPQF_LETTER:
case 't':
- case 'Q':
+ case LOSEQF_LETTER:
case 'q':
if (bitset(QP_SUBQF, QPaths[e->e_queuedir].qp_subdirs))
sub = "/qf";
@@ -2873,8 +2895,6 @@ setctluser(user, qfver)
** none.
*/
-# define LOSEQF_LETTER 'Q'
-
void
loseqfile(e, why)
register ENVELOPE *e;
@@ -3138,7 +3158,7 @@ multiqueue_cache()
syserr("QueueDirectory: can not wildcard relative path");
if (tTd(41, 2))
dprintf("multiqueue_cache: \"%s\": Can not wildcard relative path.\n",
- QueueDir);
+ qpath);
ExitStat = EX_CONFIG;
return;
}
diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c
index 8235883..942ca5b 100644
--- a/contrib/sendmail/src/readcf.c
+++ b/contrib/sendmail/src/readcf.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: readcf.c,v 8.382.4.27 2000/09/28 01:31:16 gshapiro Exp $";
+static char id[] = "@(#)$Id: readcf.c,v 8.382.4.31 2000/12/18 18:00:43 ca Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -356,6 +356,8 @@ readcf(cfname, safe, e)
case 'D': /* macro definition */
mid = macid(&bp[1], &ep);
+ if (mid == 0)
+ break;
p = munchstring(ep, NULL, '\0');
define(mid, newstr(p), e);
break;
@@ -369,6 +371,8 @@ readcf(cfname, safe, e)
if (bp[0] == 'C')
{
mid = macid(&bp[1], &ep);
+ if (mid == 0)
+ break;
expand(ep, exbuf, sizeof exbuf, e);
p = exbuf;
}
@@ -397,6 +401,8 @@ readcf(cfname, safe, e)
case 'F': /* word class from file */
mid = macid(&bp[1], &ep);
+ if (mid == 0)
+ break;
for (p = ep; isascii(*p) && isspace(*p); )
p++;
if (p[0] == '-' && p[1] == 'o')
@@ -869,7 +875,10 @@ makemailer(line)
if (*p != '\0')
*p++ = '\0';
if (line[0] == '\0')
+ {
syserr("name required for mailer");
+ return;
+ }
m->m_name = newstr(line);
/* now scan through and assign info from the fields */
@@ -901,13 +910,14 @@ makemailer(line)
case 'P': /* pathname */
if (*p == '\0')
syserr("mailer %s: empty path name", m->m_name);
- m->m_mailer = newstr(p);
+ else
+ m->m_mailer = newstr(p);
break;
case 'F': /* flags */
for (; *p != '\0'; p++)
if (!(isascii(*p) && isspace(*p)))
- setbitn(*p, m->m_flags);
+ setbitn(bitidx(*p), m->m_flags);
break;
case 'S': /* sender rewriting ruleset */
@@ -937,14 +947,16 @@ makemailer(line)
if (*p == '\0')
syserr("mailer %s: null end-of-line string",
m->m_name);
- m->m_eol = newstr(p);
+ else
+ m->m_eol = newstr(p);
break;
case 'A': /* argument vector */
if (*p == '\0')
syserr("mailer %s: null argument vector",
m->m_name);
- m->m_argv = makeargv(p);
+ else
+ m->m_argv = makeargv(p);
break;
case 'M': /* maximum message size */
@@ -975,13 +987,15 @@ makemailer(line)
if (*p == '\0')
syserr("mailer %s: null working directory",
m->m_name);
- m->m_execdir = newstr(p);
+ else
+ m->m_execdir = newstr(p);
break;
case 'C': /* default charset */
if (*p == '\0')
syserr("mailer %s: null charset", m->m_name);
- m->m_defcharset = newstr(p);
+ else
+ m->m_defcharset = newstr(p);
break;
case 'T': /* MTA-Name/Address/Diagnostic types */
@@ -1030,11 +1044,17 @@ makemailer(line)
if (*p != '\0')
*p++ = '\0';
if (*q == '\0')
+ {
syserr("mailer %s: null user name",
m->m_name);
+ break;
+ }
pw = sm_getpwnam(q);
if (pw == NULL)
+ {
syserr("readcf: mailer U= flag: unknown user %s", q);
+ break;
+ }
else
{
m->m_uid = pw->pw_uid;
@@ -1065,11 +1085,17 @@ makemailer(line)
p++;
*p++ = '\0';
if (*q == '\0')
+ {
syserr("mailer %s: null group name",
m->m_name);
+ break;
+ }
gr = getgrnam(q);
if (gr == NULL)
+ {
syserr("readcf: mailer U= flag: unknown group %s", q);
+ break;
+ }
else
m->m_gid = gr->gr_gid;
}
@@ -1137,6 +1163,7 @@ makemailer(line)
#if _FFR_REMOVE_TCP_MAILER_PATH
syserr("M%s: P=[TCP] is deprecated, use P=[IPC] instead\n",
m->m_name);
+ return;
#else /* _FFR_REMOVE_TCP_MAILER_PATH */
printf("M%s: Warning: P=[TCP] is deprecated, use P=[IPC] instead\n",
m->m_name);
@@ -1155,6 +1182,7 @@ makemailer(line)
{
syserr("M%s: too few parameters for %s mailer",
m->m_name, m->m_mailer);
+ return;
}
if (strcmp(m->m_argv[0], "TCP") != 0
#if NETUNIX
@@ -1186,11 +1214,13 @@ makemailer(line)
m->m_name,
(m->m_argv[0] == NULL ||
m->m_argv[1] == NULL) ? "few" : "many");
+ return;
}
else if (strcmp(m->m_argv[0], "FILE") != 0)
{
syserr("M%s: first argument in [FILE] mailer must be FILE",
m->m_name);
+ return;
}
}
@@ -1956,6 +1986,7 @@ setoption(opt, val, safe, sticky, e)
case SM_DEFER: /* queue only and defer map lookups */
#if !QUEUE
syserr("need QUEUE to set -odqueue or -oddefer");
+ break;
#endif /* !QUEUE */
/* FALLTHROUGH */
@@ -2115,12 +2146,14 @@ setoption(opt, val, safe, sticky, e)
break;
case 'M': /* define macro */
+ sticky = FALSE;
mid = macid(val, &ep);
+ if (mid == 0)
+ break;
p = newstr(ep);
if (!safe)
cleanstrcpy(p, p, MAXNAME);
define(mid, p, CurEnv);
- sticky = FALSE;
break;
case 'm': /* send to me too */
@@ -2136,9 +2169,7 @@ setoption(opt, val, safe, sticky, e)
case 'O': /* daemon options */
#if DAEMON
if (!setdaemonoptions(val))
- {
syserr("too many daemons defined (%d max)", MAXDAEMONS);
- }
#else /* DAEMON */
syserr("DaemonPortOptions (O option) set but DAEMON not compiled in");
#endif /* DAEMON */
@@ -2175,7 +2206,8 @@ setoption(opt, val, safe, sticky, e)
}
if (pv->pv_name == NULL)
syserr("readcf: Op line: %s unrecognized", val);
- PrivacyFlags |= pv->pv_flag;
+ else
+ PrivacyFlags |= pv->pv_flag;
}
sticky = FALSE;
break;
@@ -2262,7 +2294,10 @@ setoption(opt, val, safe, sticky, e)
DefUid = -1;
pw = sm_getpwnam(val);
if (pw == NULL)
+ {
syserr("readcf: option u: unknown user %s", val);
+ break;
+ }
else
{
DefUid = pw->pw_uid;
@@ -2275,7 +2310,8 @@ setoption(opt, val, safe, sticky, e)
if (DefUid > UID_MAX)
{
syserr("readcf: option u: uid value (%ld) > UID_MAX (%ld); ignored",
- DefUid, UID_MAX);
+ (long) DefUid, (long) UID_MAX);
+ break;
}
#endif /* UID_MAX */
@@ -2540,7 +2576,10 @@ setoption(opt, val, safe, sticky, e)
pw = sm_getpwnam(val);
if (pw == NULL)
+ {
syserr("readcf: option RunAsUser: unknown user %s", val);
+ break;
+ }
else if (can_setuid)
{
if (*p == '\0')
@@ -2553,7 +2592,8 @@ setoption(opt, val, safe, sticky, e)
if (RunAsUid > UID_MAX)
{
syserr("readcf: option RunAsUser: uid value (%ld) > UID_MAX (%ld); ignored",
- RunAsUid, UID_MAX);
+ (long) RunAsUid, (long) UID_MAX);
+ break;
}
#endif /* UID_MAX */
if (*p != '\0')
@@ -2679,7 +2719,10 @@ setoption(opt, val, safe, sticky, e)
TrustedUid = 0;
pw = sm_getpwnam(val);
if (pw == NULL)
+ {
syserr("readcf: option TrustedUser: unknown user %s", val);
+ break;
+ }
else
TrustedUid = pw->pw_uid;
}
@@ -2688,7 +2731,7 @@ setoption(opt, val, safe, sticky, e)
if (TrustedUid > UID_MAX)
{
syserr("readcf: option TrustedUser: uid value (%ld) > UID_MAX (%ld)",
- TrustedUid, UID_MAX);
+ (long) TrustedUid, (long) UID_MAX);
TrustedUid = 0;
}
# endif /* UID_MAX */
@@ -2997,7 +3040,7 @@ setclass(class, str)
str++;
mid = macid(str, NULL);
- if (mid == '\0')
+ if (mid == 0)
return;
if (tTd(37, 8))
@@ -3011,7 +3054,7 @@ setclass(class, str)
dprintf("setclass(%s, %s)\n", macname(class), str);
s = stab(str, ST_CLASS, ST_ENTER);
- setbitn(class, s->s_class);
+ setbitn(bitidx(class), s->s_class);
}
}
/*
@@ -3209,7 +3252,7 @@ strtorwset(p, endp, stabmode)
{
s->s_ruleset = ruleset;
}
- if (stabmode == ST_ENTER)
+ if (stabmode == ST_ENTER && ruleset >= 0)
{
char *h = NULL;
@@ -3334,7 +3377,11 @@ settimeout(name, val, sticky)
}
if (to->to_name == NULL)
+ {
+ errno = 0; /* avoid bogus error text */
syserr("settimeout: invalid timeout %s", name);
+ return;
+ }
/*
** See if this option is preset for us.
diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c
index f297ef9..8e5c9d5 100644
--- a/contrib/sendmail/src/savemail.c
+++ b/contrib/sendmail/src/savemail.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: savemail.c,v 8.212.4.5 2000/08/22 22:46:00 gshapiro Exp $";
+static char id[] = "@(#)$Id: savemail.c,v 8.212.4.11 2000/12/18 18:00:44 ca Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -614,7 +614,7 @@ returntosender(msg, returnq, flags, e)
addheader("MIME-Version", "1.0", 0, &ee->e_header);
(void) snprintf(buf, sizeof buf, "%s.%ld/%.100s",
- ee->e_id, curtime(), MyHostName);
+ ee->e_id, (long) curtime(), MyHostName);
ee->e_msgboundary = newstr(buf);
(void) snprintf(buf, sizeof buf,
#if DSN
@@ -993,6 +993,8 @@ errbody(mci, e, separator)
if (e->e_msgboundary != NULL)
{
+ time_t now = curtime();
+
putline("", mci);
(void) snprintf(buf, sizeof buf, "--%s", e->e_msgboundary);
putline(buf, mci);
@@ -1046,7 +1048,13 @@ errbody(mci, e, separator)
char *action;
if (QS_IS_BADADDR(q->q_state))
+ {
+ /* RFC 1891, 6.2.6 (b) */
+ if (bitset(QHASNOTIFY, q->q_flags) &&
+ !bitset(QPINGONFAILURE, q->q_flags))
+ continue;
action = "failed";
+ }
else if (!bitset(QPRIMARY, q->q_flags))
continue;
else if (bitset(QDELIVERED, q->q_flags))
@@ -1196,7 +1204,7 @@ errbody(mci, e, separator)
/* Last-Attempt-Date: -- fine granularity */
if (q->q_statdate == (time_t) 0L)
- q->q_statdate = curtime();
+ q->q_statdate = now;
(void) snprintf(buf, sizeof buf,
"Last-Attempt-Date: %s",
arpadate(ctime(&q->q_statdate)));
diff --git a/contrib/sendmail/src/sendmail.8 b/contrib/sendmail/src/sendmail.8
index 845b1a6..bbcd55d 100644
--- a/contrib/sendmail/src/sendmail.8
+++ b/contrib/sendmail/src/sendmail.8
@@ -9,11 +9,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: sendmail.8,v 8.36.8.2 2000/09/07 21:14:00 ca Exp $
+.\" $Id: sendmail.8,v 8.36.8.3 2000/12/14 23:08:15 gshapiro Exp $
.\"
-.TH SENDMAIL 8 "$Date: 2000/09/07 21:14:00 $"
+.TH SENDMAIL 8 "$Date: 2000/12/14 23:08:15 $"
.SH NAME
-.B sendmail
+sendmail
\- an electronic mail transport agent
.SH SYNOPSIS
.B sendmail
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index 1748a73..9a6698a 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -20,7 +20,7 @@
#ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.37 2000/09/25 07:53:29 gshapiro Exp $";
+static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.45 2000/12/28 23:46:44 gshapiro Exp $";
# endif /* ! lint */
#else /* _DEFINE */
# define EXTERN extern
@@ -226,14 +226,14 @@ typedef struct address ADDRESS;
#define QS_QUEUEUP 3 /* save address in queue */
#define QS_VERIFIED 4 /* verified, but not expanded */
#define QS_DONTSEND 5 /* don't send to this address */
-#define QS_EXPANDED 6 /* expanded */
-#define QS_SENDER 7 /* message sender (MeToo) */
-#define QS_CLONED 8 /* addr cloned to a split envelope */
-#define QS_DISCARDED 9 /* recipient discarded (EF_DISCARD) */
-#define QS_REPLACED 10 /* maplocaluser()/UserDB replaced */
-#define QS_REMOVED 11 /* removed (removefromlist()) */
-#define QS_DUPLICATE 12 /* duplicate suppressed */
-#define QS_INCLUDED 13 /* :include: delivery */
+#define QS_EXPANDED 6 /* QS_DONTSEND: expanded */
+#define QS_SENDER 7 /* QS_DONTSEND: message sender (MeToo) */
+#define QS_CLONED 8 /* QS_DONTSEND: addr cloned to split envelope */
+#define QS_DISCARDED 9 /* QS_DONTSEND: rcpt discarded (EF_DISCARD) */
+#define QS_REPLACED 10 /* QS_DONTSEND: maplocaluser()/UserDB replaced */
+#define QS_REMOVED 11 /* QS_DONTSEND: removed (removefromlist()) */
+#define QS_DUPLICATE 12 /* QS_DONTSEND: duplicate suppressed */
+#define QS_INCLUDED 13 /* QS_DONTSEND: :include: delivery */
/* address state testing primitives */
#define QS_IS_OK(s) ((s) == QS_OK)
@@ -459,6 +459,8 @@ MCI
#else /* STARTTLS */
#define MCIF_EXTENS (MCIF_EXPN | MCIF_SIZE | MCIF_8BITMIME | MCIF_DSN | MCIF_8BITOK | MCIF_AUTH | MCIF_ENHSTAT)
#endif /* STARTTLS */
+#define MCIF_ONLY_EHLO 0x10000000 /* use only EHLO in smtpinit */
+
/* states */
#define MCIS_CLOSED 0 /* no traffic on this connection */
@@ -627,7 +629,7 @@ struct envelope
int e_ntries; /* number of delivery attempts */
dev_t e_dfdev; /* df file's device, for crash recov */
ino_t e_dfino; /* df file's ino, for crash recovery */
- char *e_macro[256]; /* macro definitions */
+ char *e_macro[MAXMACROID + 1]; /* macro definitions */
char *e_if_macros[2]; /* HACK: incoming interface info */
char *e_auth_param;
TIMERS e_timers; /* per job timers */
@@ -776,7 +778,7 @@ extern void expand __P((char *, char *, size_t, ENVELOPE *));
extern int macid __P((char *, char **));
extern char *macname __P((int));
extern char *macvalue __P((int, ENVELOPE *));
-extern int rscheck __P((char *, char *, char *, ENVELOPE *, bool, bool, int));
+extern int rscheck __P((char *, char *, char *, ENVELOPE *, bool, bool, int, char *));
extern void setclass __P((int, char *));
extern int strtorwset __P((char *, char **, int));
extern void translate_dollars __P((char *));
@@ -1870,7 +1872,7 @@ extern void apps_ssl_info_cb __P((SSL *, int , int));
extern bool inittls __P((SSL_CTX **, u_long, bool, char *, char *, char *, char *, char *));
extern bool initclttls __P((void));
extern bool initsrvtls __P((void));
-extern int tls_get_info __P((SSL *, ENVELOPE *, bool, char *));
+extern int tls_get_info __P((SSL *, ENVELOPE *, bool, char *, bool));
extern int endtls __P((SSL *, char *));
extern int endtlsclt __P((MCI *));
extern void tlslogerr __P((void));
@@ -2044,7 +2046,6 @@ extern void queueup_macros __P((int, FILE *, ENVELOPE *));
extern SIGFUNC_DECL quiesce __P((int));
extern void readcf __P((char *, bool, ENVELOPE *));
extern SIGFUNC_DECL reapchild __P((int));
-extern bool refuseconnections __P((char *, ENVELOPE *, int));
extern int releasesignal __P((int));
extern void resetlimits __P((void));
extern bool rfc822_string __P((char *));
diff --git a/contrib/sendmail/src/sfsasl.c b/contrib/sendmail/src/sfsasl.c
index 582a064..c09e4e8 100644
--- a/contrib/sendmail/src/sfsasl.c
+++ b/contrib/sendmail/src/sfsasl.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: sfsasl.c,v 8.17.4.8 2000/09/14 00:14:13 ca Exp $";
+static char id[] = "@(#)$Id: sfsasl.c,v 8.17.4.13 2000/11/03 00:24:49 gshapiro Exp $";
#endif /* ! lint */
#if SFIO
@@ -27,6 +27,9 @@ static char id[] = "@(#)$Id: sfsasl.c,v 8.17.4.8 2000/09/14 00:14:13 ca Exp $";
# include <sasl.h>
# include "sfsasl.h"
+/* how to deallocate a buffer allocated by SASL */
+# define SASL_DEALLOC(b) free(b)
+
static ssize_t
sasl_read(f, buf, size, disc)
Sfio_t *f;
@@ -35,29 +38,61 @@ sasl_read(f, buf, size, disc)
Sfdisc_t *disc;
{
int len, result;
- char *outbuf;
- unsigned int outlen;
+ static char *outbuf = NULL;
+ static unsigned int outlen = 0;
+ static unsigned int offset = 0;
Sasldisc_t *sd = (Sasldisc_t *) disc;
- len = sfrd(f, buf, size, disc);
-
- if (len <= 0)
- return len;
-
- result = sasl_decode(sd->conn, buf, len, &outbuf, &outlen);
+ /*
+ ** sasl_decode() may require more data than a single read() returns.
+ ** Hence we have to put a loop around the decoding.
+ ** This also requires that we may have to split up the returned
+ ** data since it might be larger than the allowed size.
+ ** Therefore we use a static pointer and return portions of it
+ ** if necessary.
+ */
- if (result != SASL_OK)
+ while (outbuf == NULL && outlen == 0)
{
- /* eventually, we'll want an exception here */
- return -1;
+ len = sfrd(f, buf, size, disc);
+ if (len <= 0)
+ return len;
+ result = sasl_decode(sd->conn, buf, len, &outbuf, &outlen);
+ if (result != SASL_OK)
+ {
+ outbuf = NULL;
+ offset = 0;
+ outlen = 0;
+ return -1;
+ }
}
if (outbuf != NULL)
{
- (void)memcpy(buf, outbuf, outlen);
- free(outbuf);
+ if (outlen - offset > size)
+ {
+ /* return another part of the buffer */
+ (void) memcpy(buf, outbuf + offset, (size_t) size);
+ offset += size;
+ result = size;
+ }
+ else
+ {
+ /* return the rest of the buffer */
+ result = outlen - offset;
+ (void) memcpy(buf, outbuf + offset, (size_t) result);
+ SASL_DEALLOC(outbuf);
+ outbuf = NULL;
+ offset = 0;
+ outlen = 0;
+ }
}
- return outlen;
+ else
+ {
+ /* be paranoid: outbuf == NULL but outlen != 0 */
+ syserr("!sasl_read failure: outbuf == NULL but outlen != 0");
+ }
+ return result;
}
static ssize_t
@@ -75,15 +110,12 @@ sasl_write(f, buf, size, disc)
result = sasl_encode(sd->conn, buf, size, &outbuf, &outlen);
if (result != SASL_OK)
- {
- /* eventually, we'll want an exception here */
return -1;
- }
if (outbuf != NULL)
{
sfwr(f, outbuf, outlen, disc);
- free(outbuf);
+ SASL_DEALLOC(outbuf);
}
return size;
}
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index 9989c75..78443a8 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -16,9 +16,9 @@
#ifndef lint
# if SMTP
-static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.58 2000/09/21 21:52:18 ca Exp $ (with SMTP)";
+static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.66 2000/12/18 18:00:44 ca Exp $ (with SMTP)";
# else /* SMTP */
-static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.58 2000/09/21 21:52:18 ca Exp $ (without SMTP)";
+static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.66 2000/12/18 18:00:44 ca Exp $ (without SMTP)";
# endif /* SMTP */
#endif /* ! lint */
@@ -376,8 +376,8 @@ smtp(nullserver, d_flags, e)
saveSuprErrs = SuprErrs;
SuprErrs = TRUE;
QuickAbort = FALSE;
- if (rscheck("offer_tls", CurSmtpClient, "", e, TRUE, FALSE, 8) != EX_OK
- || Errors > 0)
+ if (rscheck("offer_tls", CurSmtpClient, "", e, TRUE, FALSE, 8,
+ NULL) != EX_OK || Errors > 0)
usetls = FALSE;
QuickAbort = saveQuickAbort;
SuprErrs = saveSuprErrs;
@@ -1054,7 +1054,7 @@ smtp(nullserver, d_flags, e)
/* ignore return code for now, it's in {verify} */
(void) tls_get_info(srv_ssl, &BlankEnvelope, TRUE,
- CurSmtpClient);
+ CurSmtpClient, TRUE);
/*
** call Stls_client to find out whether
@@ -1067,8 +1067,8 @@ smtp(nullserver, d_flags, e)
QuickAbort = FALSE;
if (rscheck("tls_client",
macvalue(macid("{verify}", NULL), e),
- "STARTTLS", e, TRUE, TRUE, 6) != EX_OK ||
- Errors > 0)
+ "STARTTLS", e, TRUE, TRUE, 6, NULL) !=
+ EX_OK || Errors > 0)
{
extern char MsgBuf[];
@@ -1520,7 +1520,7 @@ smtp(nullserver, d_flags, e)
/* do config file checking of the sender */
if (rscheck("check_mail", addr,
- NULL, e, TRUE, TRUE, 4) != EX_OK ||
+ NULL, e, TRUE, TRUE, 4, NULL) != EX_OK ||
Errors > 0)
goto undo_subproc_no_pm;
@@ -1715,7 +1715,7 @@ smtp(nullserver, d_flags, e)
/* do config file checking of the recipient */
if (rscheck("check_rcpt", addr,
- NULL, e, TRUE, TRUE, 4) != EX_OK ||
+ NULL, e, TRUE, TRUE, 4, NULL) != EX_OK ||
Errors > 0)
break;
@@ -2074,13 +2074,19 @@ smtp(nullserver, d_flags, e)
{
/* do config file checking of the address */
if (rscheck(vrfy ? "check_vrfy" : "check_expn",
- p, NULL, e, TRUE, FALSE, 4)
+ p, NULL, e, TRUE, FALSE, 4, NULL)
!= EX_OK || Errors > 0)
goto undo_subproc;
(void) sendtolist(p, NULLADDR, &vrfyqueue, 0, e);
}
if (wt > 0)
- (void) sleep(wt - (curtime() - previous));
+ {
+ time_t t;
+
+ t = wt - (curtime() - previous);
+ if (t > 0)
+ (void) sleep(t);
+ }
if (Errors > 0)
goto undo_subproc;
if (vrfyqueue == NULL)
@@ -2141,8 +2147,8 @@ smtp(nullserver, d_flags, e)
"ETRN", e);
/* do config file checking of the parameter */
- if (rscheck("check_etrn", p, NULL, e, TRUE, FALSE, 4)
- != EX_OK || Errors > 0)
+ if (rscheck("check_etrn", p, NULL, e, TRUE, FALSE, 4,
+ NULL) != EX_OK || Errors > 0)
break;
if (LogLevel > 5)
@@ -2330,7 +2336,7 @@ doquit:
** e -- the current envelope.
**
** Returns:
-** none.
+** time to wait.
**
** Side Effects:
** Slows down if we seem to be under attack.
@@ -2448,7 +2454,7 @@ mail_esmtp_args(kp, vp, e)
/* NOTREACHED */
}
define(macid("{msg_size}", NULL), newstr(vp), e);
- e->e_msgsize = strtol(vp, (char **) NULL, 10);
+ e->e_msgsize = strtol(vp, (char **) NULL, 10);
if (e->e_msgsize == LONG_MAX && errno == ERANGE)
{
usrerr("552 5.2.3 Message size exceeds maximum value");
@@ -2580,8 +2586,8 @@ mail_esmtp_args(kp, vp, e)
SuprErrs = TRUE;
QuickAbort = FALSE;
if (strcmp(auth_param, "<>") != 0 &&
- (rscheck("trust_auth", pbuf, NULL, e, TRUE, FALSE, 10)
- != EX_OK || Errors > 0))
+ (rscheck("trust_auth", pbuf, NULL, e, TRUE, FALSE, 10,
+ NULL) != EX_OK || Errors > 0))
{
if (tTd(95, 8))
{
@@ -2800,6 +2806,7 @@ runinchild(label, e)
(void) blocksignal(SIGCHLD);
+
childpid = dofork();
if (childpid < 0)
{
@@ -2889,6 +2896,7 @@ saslmechs(conn, mechlist)
sm_syslog(LOG_WARNING, NOQID,
"SASL error: listmech=%d, num=%d",
result, num);
+ num = 0;
}
return num;
}
@@ -3812,6 +3820,7 @@ initsrvtls()
** e -- current envelope
** srv -- server or client
** host -- hostname of other side
+** log -- log connection information?
**
** Returns:
** result of authentication.
@@ -3822,11 +3831,12 @@ initsrvtls()
*/
int
-tls_get_info(ssl, e, srv, host)
+tls_get_info(ssl, e, srv, host, log)
SSL *ssl;
ENVELOPE *e;
bool srv;
char *host;
+ bool log;
{
SSL_CIPHER *c;
int b, r;
@@ -3849,7 +3859,7 @@ tls_get_info(ssl, e, srv, host)
define(macid("{tls_version}", NULL), newstr(s), e);
cert = SSL_get_peer_certificate(ssl);
- if (LogLevel >= 14)
+ if (log && LogLevel >= 14)
sm_syslog(LOG_INFO, e->e_id,
"TLS: get_verify in %s: %ld get_peer: 0x%lx",
srv ? "srv" : "clt",
@@ -3910,7 +3920,7 @@ tls_get_info(ssl, e, srv, host)
X509_free(cert);
/* do some logging */
- if (LogLevel > 9)
+ if (log && LogLevel > 9)
{
char *vers, *s1, *s2, *bits;
diff --git a/contrib/sendmail/src/stab.c b/contrib/sendmail/src/stab.c
index 2177ae6..1249f9d 100644
--- a/contrib/sendmail/src/stab.c
+++ b/contrib/sendmail/src/stab.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: stab.c,v 8.40.16.2 2000/06/05 21:46:59 gshapiro Exp $";
+static char id[] = "@(#)$Id: stab.c,v 8.40.16.3 2000/10/09 02:46:12 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -268,6 +268,7 @@ queueup_macros(class, qfp, e)
if (e == NULL)
return;
+ class = bitidx(class);
for (shead = SymTab; shead < &SymTab[STABSIZE]; shead++)
{
for (s = *shead; s != NULL; s = s->s_next)
@@ -276,7 +277,7 @@ queueup_macros(class, qfp, e)
char *p;
if (s->s_type == ST_CLASS &&
- bitnset(class & 0xff, s->s_class) &&
+ bitnset(class, s->s_class) &&
(m = macid(s->s_name, NULL)) != '\0' &&
(p = macvalue(m, e)) != NULL)
{
@@ -326,12 +327,14 @@ copy_class(src, dst)
register STAB **shead;
register STAB *s;
+ src = bitidx(src);
+ dst = bitidx(dst);
for (shead = SymTab; shead < &SymTab[STABSIZE]; shead++)
{
for (s = *shead; s != NULL; s = s->s_next)
{
if (s->s_type == ST_CLASS &&
- bitnset(src & 0xff, s->s_class))
+ bitnset(src, s->s_class))
setbitn(dst, s->s_class);
}
}
diff --git a/contrib/sendmail/src/timers.c b/contrib/sendmail/src/timers.c
index 74d0ccf..acd774c 100644
--- a/contrib/sendmail/src/timers.c
+++ b/contrib/sendmail/src/timers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -11,7 +11,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: timers.c,v 8.13 1999/11/23 07:22:28 gshapiro Exp $";
+static char id[] = "@(#)$Id: timers.c,v 8.13.16.1 2000/10/09 01:06:45 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_TIMERS
@@ -204,8 +204,11 @@ poptimer(ptimer)
/* pop back to this timer */
for (i = 0; i < NTimers; i++)
+ {
if (TimerStack[i] == ptimer)
break;
+ }
+
if (i != NTimers - 1)
warntimer("poptimer: odd pop (timer=0x%lx, index=%d, NTimers=%d)",
(u_long) ptimer, i, NTimers);
diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c
index 0a9c287..bfce56a 100644
--- a/contrib/sendmail/src/usersmtp.c
+++ b/contrib/sendmail/src/usersmtp.c
@@ -15,9 +15,9 @@
#ifndef lint
# if SMTP
-static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.13 2000/09/26 00:46:21 gshapiro Exp $ (with SMTP)";
+static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.18 2000/12/20 16:36:11 ca Exp $ (with SMTP)";
# else /* SMTP */
-static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.13 2000/09/26 00:46:21 gshapiro Exp $ (without SMTP)";
+static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.18 2000/12/20 16:36:11 ca Exp $ (without SMTP)";
# endif /* SMTP */
#endif /* ! lint */
@@ -1187,7 +1187,7 @@ attemptauth(m, mci, e, mechused)
return EX_TEMPFAIL;
addrsize = sizeof(struct sockaddr_in);
if (getsockname(fileno(mci->mci_out),
- (struct sockaddr *) &saddr_l, &addrsize) != 0)
+ (struct sockaddr *) &saddr_l, &addrsize) == 0)
{
if (sasl_setprop(mci->mci_conn, SASL_IP_LOCAL,
&saddr_l) != SASL_OK)
@@ -1298,7 +1298,7 @@ attemptauth(m, mci, e, mechused)
}
else
in64[0] = '\0';
- smtpmessage(in64, m, mci);
+ smtpmessage("%s", m, mci, in64);
smtpresult = reply(m, mci, e, TimeOuts.to_datafinal,
getsasldata, NULL);
/* which timeout? XXX */
@@ -1542,7 +1542,7 @@ smtpmailfrom(m, mci, e)
smtpquit(m, mci, e);
return EX_TEMPFAIL;
}
- else if (r == 421)
+ else if (r == SMTPCLOSING)
{
/* service shutting down */
mci_setstat(mci, EX_TEMPFAIL, ENHSCN(enhsc, "4.5.0"),
@@ -2106,7 +2106,7 @@ smtpquit(m, mci, e)
/* look for naughty mailers */
sm_syslog(LOG_ERR, e->e_id,
- "smtpquit: mailer%s%s exited with exit value %d\n",
+ "smtpquit: mailer%s%s exited with exit value %d",
mailer == NULL ? "" : " ",
mailer == NULL ? "" : mailer,
rcode);
@@ -2141,9 +2141,13 @@ smtprset(m, mci, e)
** Any response is deemed to be acceptable.
** The standard does not state the proper action
** to take when a value other than 250 is received.
+ **
+ ** However, if 421 is returned for the RSET, leave
+ ** mci_state as MCIS_SSD (set in reply()).
*/
- mci->mci_state = MCIS_OPEN;
+ if (mci->mci_state != MCIS_SSD)
+ mci->mci_state = MCIS_OPEN;
return;
}
smtpquit(m, mci, e);
diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c
index fa0f74a..e71627f 100644
--- a/contrib/sendmail/src/util.c
+++ b/contrib/sendmail/src/util.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: util.c,v 8.225.2.1.2.8 2000/07/03 18:28:56 geir Exp $";
+static char id[] = "@(#)$Id: util.c,v 8.225.2.1.2.15 2000/10/18 23:46:07 ca Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -209,6 +209,7 @@ shorten_rfc822_string(string, length)
** If have to rebalance an already short enough string,
** need to do it within allocated space.
*/
+
slen = strlen(string);
if (length == 0 || slen < length)
length = slen;
@@ -500,10 +501,13 @@ log_sendmail_pid(e)
}
else
{
+ long pid;
extern char *CommandLineArgs;
+ pid = (long) getpid();
+
/* write the process id on line 1 */
- fprintf(pidf, "%ld\n", (long) getpid());
+ fprintf(pidf, "%ld\n", pid);
/* line 2 contains all command line flags */
fprintf(pidf, "%s\n", CommandLineArgs);
@@ -640,7 +644,7 @@ xputs(s)
if (strchr("=~&?", *s) != NULL)
(void) putchar(*s++);
if (bitset(0200, *s))
- printf("{%s}", macname(*s++ & 0377));
+ printf("{%s}", macname(bitidx(*s++)));
else
printf("%c", *s++);
continue;
@@ -918,6 +922,11 @@ putxline(l, len, mci, pxflags)
{
if (putc('.', mci->mci_out) == EOF)
dead = TRUE;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
if (TrafficLogFile != NULL)
(void) putc('.', TrafficLogFile);
}
@@ -928,6 +937,11 @@ putxline(l, len, mci, pxflags)
{
if (putc('>', mci->mci_out) == EOF)
dead = TRUE;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
if (TrafficLogFile != NULL)
(void) putc('>', TrafficLogFile);
}
@@ -942,9 +956,11 @@ putxline(l, len, mci, pxflags)
dead = TRUE;
break;
}
-
- /* record progress for DATA timeout */
- DataProgress = TRUE;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
}
if (dead)
break;
@@ -957,10 +973,11 @@ putxline(l, len, mci, pxflags)
dead = TRUE;
break;
}
-
- /* record progress for DATA timeout */
- DataProgress = TRUE;
-
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
if (TrafficLogFile != NULL)
{
for (l = l_base; l < q; l++)
@@ -981,6 +998,11 @@ putxline(l, len, mci, pxflags)
{
if (putc('.', mci->mci_out) == EOF)
break;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
if (TrafficLogFile != NULL)
(void) putc('.', TrafficLogFile);
}
@@ -991,6 +1013,11 @@ putxline(l, len, mci, pxflags)
{
if (putc('>', mci->mci_out) == EOF)
break;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
if (TrafficLogFile != NULL)
(void) putc('>', TrafficLogFile);
}
@@ -1003,9 +1030,11 @@ putxline(l, len, mci, pxflags)
dead = TRUE;
break;
}
-
- /* record progress for DATA timeout */
- DataProgress = TRUE;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
}
if (dead)
break;
@@ -1014,6 +1043,11 @@ putxline(l, len, mci, pxflags)
(void) putc('\n', TrafficLogFile);
if (fputs(mci->mci_mailer->m_eol, mci->mci_out) == EOF)
break;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
if (l < end && *l == '\n')
{
if (*++l != ' ' && *l != '\t' && *l != '\0' &&
@@ -1021,13 +1055,15 @@ putxline(l, len, mci, pxflags)
{
if (putc(' ', mci->mci_out) == EOF)
break;
+ else
+ {
+ /* record progress for DATA timeout */
+ DataProgress = TRUE;
+ }
if (TrafficLogFile != NULL)
(void) putc(' ', TrafficLogFile);
}
}
-
- /* record progress for DATA timeout */
- DataProgress = TRUE;
} while (l < end);
}
/*
@@ -1347,8 +1383,10 @@ bitintersect(a, b)
int i;
for (i = BITMAPBYTES / sizeof (int); --i >= 0; )
+ {
if ((a[i] & b[i]) != 0)
return TRUE;
+ }
return FALSE;
}
/*
@@ -1372,8 +1410,10 @@ bitzerop(map)
int i;
for (i = BITMAPBYTES / sizeof (int); --i >= 0; )
+ {
if (map[i] != 0)
return FALSE;
+ }
return TRUE;
}
/*
@@ -1485,8 +1525,8 @@ checkfds(where)
static BITMAP256 baseline;
extern int DtableSize;
- if (DtableSize > 256)
- maxfd = 256;
+ if (DtableSize > BITMAPBITS)
+ maxfd = BITMAPBITS;
else
maxfd = DtableSize;
if (where == NULL)
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index f3a25f4..2499b10 100644
--- a/contrib/sendmail/src/version.c
+++ b/contrib/sendmail/src/version.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: version.c,v 8.43.4.16 2000/09/21 04:12:23 geir Exp $";
+static char id[] = "@(#)$Id: version.c,v 8.43.4.25 2000/12/29 18:22:18 gshapiro Exp $";
#endif /* ! lint */
-char Version[] = "8.11.1";
+char Version[] = "8.11.2";
diff --git a/contrib/sendmail/vacation/vacation.1 b/contrib/sendmail/vacation/vacation.1
index 54bb674..3b3c712 100644
--- a/contrib/sendmail/vacation/vacation.1
+++ b/contrib/sendmail/vacation/vacation.1
@@ -9,19 +9,19 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: vacation.1,v 8.11 2000/03/17 07:32:50 gshapiro Exp $
+.\" $Id: vacation.1,v 8.11.4.6 2000/12/29 18:12:23 gshapiro Exp $
.\"
-.TH VACATION 1 "$Date: 2000/03/17 07:32:50 $"
+.TH VACATION 1 "$Date: 2000/12/29 18:12:23 $"
.SH NAME
-.B vacation
+vacation
\- return ``I am not here'' indication
.SH SYNOPSIS
.B vacation
-.B \-i
+.RB [ \-i ]
+.RB [ \-I ]
.RB [ \-r
.IR interval ]
.RB [ \-x ]
-.B vacation
.RB [ \-a
.IR alias ]
.RB [ \-f
@@ -74,6 +74,11 @@ before you modify your
.I .forward
file.
.TP
+.B \-I
+Same as
+.B \-i
+(for backwards compatibility).
+.TP
.BI \-m " filename"
Use
.I filename
@@ -95,9 +100,9 @@ one reply.
.BI \-s " address"
Use
.I address
-instead of the sender address in the
+instead of the incoming message sender address on the
.I From
-line to determine the reply address.
+line as the recipient for the vacation message.
.TP
.BI \-t " time"
Ignored, available only for compatibility with Sun's
@@ -132,6 +137,9 @@ or
headers of the mail.
No messages from
``???-REQUEST'',
+``???-RELAY'',
+``???-OWNER'',
+``OWNER-???'',
``Postmaster'',
``UUCP'',
``MAILER'',
@@ -186,10 +194,10 @@ syslog(8).
.SH FILES
.TP 1.8i
~/.vacation.db
-database file
+default database file
.TP
~/.vacation.msg
-message to send
+default message to send
.SH SEE ALSO
sendmail(8),
syslog(8)
diff --git a/contrib/sendmail/vacation/vacation.c b/contrib/sendmail/vacation/vacation.c
index dfc2a7d..8b85c38 100644
--- a/contrib/sendmail/vacation/vacation.c
+++ b/contrib/sendmail/vacation/vacation.c
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: vacation.c,v 8.68.4.7 2000/09/05 21:48:45 gshapiro Exp $";
+static char id[] = "@(#)$Id: vacation.c,v 8.68.4.15 2000/11/27 22:17:27 ca Exp $";
#endif /* ! lint */
#include <ctype.h>
@@ -48,6 +48,11 @@ static char id[] = "@(#)$Id: vacation.c,v 8.68.4.7 2000/09/05 21:48:45 gshapiro
#define ONLY_ONCE ((time_t) 0) /* send at most one reply */
#define INTERVAL_UNDEF ((time_t) (-1)) /* no value given */
+#ifndef TRUE
+# define TRUE 1
+# define FALSE 0
+#endif /* ! TRUE */
+
uid_t RealUid;
gid_t RealGid;
char *RealUserName;
@@ -73,11 +78,6 @@ BITMAP256 DontBlameSendmail;
#define SECSPERDAY (60 * 60 * 24)
#define DAYSPERWEEK 7
-#ifndef TRUE
-# define TRUE 1
-# define FALSE 0
-#endif /* ! TRUE */
-
#ifndef __P
# ifdef __STDC__
# define __P(protos) protos
@@ -111,7 +111,7 @@ static void eatmsg __P((void));
/* exit after reading input */
#define EXITIT(excode) { \
eatmsg(); \
- exit(excode); \
+ return excode; \
}
int
main(argc, argv)
@@ -138,7 +138,7 @@ main(argc, argv)
extern char *optarg;
extern void usage __P((void));
extern void setinterval __P((time_t));
- extern void readheaders __P((void));
+ extern int readheaders __P((void));
extern bool recent __P((void));
extern void setreply __P((char *, time_t));
extern void sendmessage __P((char *, char *, bool));
@@ -348,7 +348,7 @@ main(argc, argv)
static void listdb __P((void));
listdb();
- (void)Db->smdb_close(Db);
+ (void) Db->smdb_close(Db);
exit(EX_OK);
}
#endif /* _FFR_LISTDB */
@@ -356,17 +356,16 @@ main(argc, argv)
if (interval != INTERVAL_UNDEF)
setinterval(interval);
- if (iflag)
+ if (iflag && !exclude)
{
- result = Db->smdb_close(Db);
- if (!exclude)
- exit(EX_OK);
+ (void) Db->smdb_close(Db);
+ exit(EX_OK);
}
if (exclude)
{
xclude(stdin);
- result = Db->smdb_close(Db);
+ (void) Db->smdb_close(Db);
EXITM(EX_OK);
}
@@ -374,27 +373,28 @@ main(argc, argv)
{
msglog(LOG_NOTICE,
"vacation: can't allocate memory for username.\n");
+ (void) Db->smdb_close(Db);
EXITM(EX_OSERR);
}
cur->name = name;
cur->next = Names;
Names = cur;
- readheaders();
- if (!recent())
+ result = readheaders();
+ if (result == EX_OK && !recent())
{
time_t now;
(void) time(&now);
setreply(From, now);
- result = Db->smdb_close(Db);
+ (void) Db->smdb_close(Db);
sendmessage(name, msgfilename, emptysender);
}
else
- result = Db->smdb_close(Db);
- exit(EX_OK);
- /* NOTREACHED */
- return EX_OK;
+ (void) Db->smdb_close(Db);
+ if (result == EX_NOUSER)
+ result = EX_OK;
+ exit(result);
}
/*
@@ -425,13 +425,14 @@ eatmsg()
** none.
**
** Returns:
-** nothing.
+** a exit code: NOUSER if no reply, OK if reply, * if error
**
** Side Effects:
** may exit().
**
*/
-void
+
+int
readheaders()
{
bool tome, cont;
@@ -484,12 +485,12 @@ readheaders()
/* ok since both strings have MAXLINE length */
if (*From == '\0')
- (void)strlcpy(From, buf + 5,
- sizeof From);
+ (void) strlcpy(From, buf + 5,
+ sizeof From);
if ((p = strchr(buf + 5, '\n')) != NULL)
*p = '\0';
if (junkmail(buf + 5))
- EXITIT(EX_OK);
+ EXITIT(EX_NOUSER);
}
break;
@@ -509,7 +510,7 @@ readheaders()
if (strncasecmp(p, "junk", 4) == 0 ||
strncasecmp(p, "bulk", 4) == 0 ||
strncasecmp(p, "list", 4) == 0)
- EXITIT(EX_OK);
+ EXITIT(EX_NOUSER);
break;
case 'C': /* "Cc:" */
@@ -540,12 +541,13 @@ findme:
}
}
if (!tome)
- EXITIT(EX_OK);
+ EXITIT(EX_NOUSER);
if (*From == '\0')
{
msglog(LOG_NOTICE, "vacation: no initial \"From \" line.\n");
EXITIT(EX_DATAERR);
}
+ EXITIT(EX_OK);
}
/*
@@ -600,52 +602,142 @@ nsearch(name, str)
** is this some automated/junk/bulk/list mail?
**
*/
+
+struct ignore
+{
+ char *name;
+ size_t len;
+};
+
+typedef struct ignore IGNORE_T;
+
+#define MAX_USER_LEN 256 /* maximum length of local part (sender) */
+
+/* delimiters for the local part of an address */
+#define isdelim(c) ((c) == '%' || (c) == '@' || (c) == '+')
+
bool
junkmail(from)
char *from;
{
- register size_t len;
- register char *p;
- register struct ignore *cur;
- static struct ignore
- {
- char *name;
- size_t len;
- } ignore[] =
+ bool quot;
+ char *e;
+ size_t len;
+ IGNORE_T *cur;
+ char sender[MAX_USER_LEN];
+ static IGNORE_T ignore[] =
{
- { "-request", 8 },
{ "postmaster", 10 },
{ "uucp", 4 },
{ "mailer-daemon", 13 },
{ "mailer", 6 },
+ { NULL, 0 }
+ };
+
+ static IGNORE_T ignorepost[] =
+ {
+ { "-request", 8 },
{ "-relay", 6 },
+ { "-owner", 6 },
+ { NULL, 0 }
+ };
+
+ static IGNORE_T ignorepre[] =
+ {
+ { "owner-", 6 },
{ NULL, 0 }
};
/*
- * This is mildly amusing, and I'm not positive it's right; trying
- * to find the "real" name of the sender, assuming that addresses
- * will be some variant of:
- *
- * From site!site!SENDER%site.domain%site.domain@site.domain
- */
- if ((p = strchr(from, '%')) == NULL &&
- (p = strchr(from, '@')) == NULL)
+ ** This is mildly amusing, and I'm not positive it's right; trying
+ ** to find the "real" name of the sender, assuming that addresses
+ ** will be some variant of:
+ **
+ ** From site!site!SENDER%site.domain%site.domain@site.domain
+ */
+
+ quot = FALSE;
+ e = from;
+ len = 0;
+ while (*e != '\0' && (quot || !isdelim(*e)))
{
- if ((p = strrchr(from, '!')) != NULL)
- ++p;
- else
- p = from;
- for (; *p; ++p)
+ if (*e == '"')
+ {
+ quot = !quot;
+ ++e;
continue;
+ }
+ if (*e == '\\')
+ {
+ if (*(++e) == '\0')
+ {
+ /* '\\' at end of string? */
+ break;
+ }
+ if (len < MAX_USER_LEN)
+ sender[len++] = *e;
+ ++e;
+ continue;
+ }
+ if (*e == '!' && !quot)
+ {
+ len = 0;
+ sender[len] = '\0';
+ }
+ else
+ if (len < MAX_USER_LEN)
+ sender[len++] = *e;
+ ++e;
}
- len = p - from;
+ if (len < MAX_USER_LEN)
+ sender[len] = '\0';
+ else
+ sender[MAX_USER_LEN - 1] = '\0';
+
+ if (len <= 0)
+ return FALSE;
+#if 0
+ if (quot)
+ return FALSE; /* syntax error... */
+#endif /* 0 */
+
+ /* test prefixes */
+ for (cur = ignorepre; cur->name != NULL; ++cur)
+ {
+ if (len >= cur->len &&
+ strncasecmp(cur->name, sender, cur->len) == 0)
+ return TRUE;
+ }
+
+ /*
+ ** If the name is truncated, don't test the rest.
+ ** We could extract the "tail" of the sender address and
+ ** compare it it ignorepost, however, it seems not worth
+ ** the effort.
+ ** The address surely can't match any entry in ignore[]
+ ** (as long as all of them are shorter than MAX_USER_LEN).
+ */
+
+ if (len > MAX_USER_LEN)
+ return FALSE;
+
+ /* test full local parts */
for (cur = ignore; cur->name != NULL; ++cur)
{
+ if (len == cur->len &&
+ strncasecmp(cur->name, sender, cur->len) == 0)
+ return TRUE;
+ }
+
+ /* test postfixes */
+ for (cur = ignorepost; cur->name != NULL; ++cur)
+ {
if (len >= cur->len &&
- strncasecmp(cur->name, p - cur->len, cur->len) == 0)
+ strncasecmp(cur->name, e - cur->len - 1,
+ cur->len) == 0)
return TRUE;
}
+
return FALSE;
}
@@ -675,27 +767,27 @@ recent()
memset(&data, '\0', sizeof data);
/* get interval time */
- key.data.data = VIT;
- key.data.size = sizeof(VIT);
+ key.data = VIT;
+ key.size = sizeof(VIT);
st = Db->smdb_get(Db, &key, &data, 0);
if (st != SMDBE_OK)
next = SECSPERDAY * DAYSPERWEEK;
else
- memmove(&next, data.data.data, sizeof(next));
+ memmove(&next, data.data, sizeof(next));
memset(&data, '\0', sizeof data);
/* get record for this address */
- key.data.data = From;
- key.data.size = strlen(From);
+ key.data = From;
+ key.size = strlen(From);
do
{
st = Db->smdb_get(Db, &key, &data, 0);
if (st == SMDBE_OK)
{
- memmove(&then, data.data.data, sizeof(then));
+ memmove(&then, data.data, sizeof(then));
if (next == ONLY_ONCE || then == ONLY_ONCE ||
then + next > time(NULL))
return TRUE;
@@ -703,8 +795,8 @@ recent()
if ((trydomain = !trydomain) &&
(domain = strchr(From, '@')) != NULL)
{
- key.data.data = domain;
- key.data.size = strlen(domain);
+ key.data = domain;
+ key.size = strlen(domain);
}
} while (trydomain);
return FALSE;
@@ -732,11 +824,11 @@ setinterval(interval)
memset(&key, '\0', sizeof key);
memset(&data, '\0', sizeof data);
- key.data.data = VIT;
- key.data.size = sizeof(VIT);
- data.data.data = (char*) &interval;
- data.data.size = sizeof(interval);
- (void)(Db->smdb_put)(Db, &key, &data, 0);
+ key.data = VIT;
+ key.size = sizeof(VIT);
+ data.data = (char*) &interval;
+ data.size = sizeof(interval);
+ (void) (Db->smdb_put)(Db, &key, &data, 0);
}
/*
@@ -763,11 +855,11 @@ setreply(from, when)
memset(&key, '\0', sizeof key);
memset(&data, '\0', sizeof data);
- key.data.data = from;
- key.data.size = strlen(from);
- data.data.data = (char*) &when;
- data.data.size = sizeof(when);
- (void)(Db->smdb_put)(Db, &key, &data, 0);
+ key.data = from;
+ key.size = strlen(from);
+ data.data = (char*) &when;
+ data.size = sizeof(when);
+ (void) (Db->smdb_put)(Db, &key, &data, 0);
}
/*
@@ -932,28 +1024,26 @@ listdb()
SMDB_CURSOR_GET_NEXT)) == SMDBE_OK)
{
/* skip magic VIT entry */
- if ((int)db_key.data.size -1 == strlen(VIT) &&
- strncmp((char *)db_key.data.data, VIT,
- (int)db_key.data.size - 1) == 0)
+ if ((int)db_key.size -1 == strlen(VIT) &&
+ strncmp((char *)db_key.data, VIT,
+ (int)db_key.size - 1) == 0)
continue;
/* skip bogus values */
- if (db_value.data.size != sizeof t)
+ if (db_value.size != sizeof t)
{
fprintf(stderr, "vacation: %.*s invalid time stamp\n",
- (int) db_key.data.size,
- (char *) db_key.data.data);
+ (int) db_key.size, (char *) db_key.data);
continue;
}
- memcpy(&t, db_value.data.data, sizeof t);
+ memcpy(&t, db_value.data, sizeof t);
- if (db_key.data.size > 40)
- db_key.data.size = 40;
+ if (db_key.size > 40)
+ db_key.size = 40;
printf("%-40.*s %-10s",
- (int) db_key.data.size, (char *) db_key.data.data,
- ctime(&t));
+ (int) db_key.size, (char *) db_key.data, ctime(&t));
memset(&db_key, '\0', sizeof db_key);
memset(&db_value, '\0', sizeof db_value);
OpenPOWER on IntegriCloud