Changeset a051af0


Ignore:
Timestamp:
12/14/20 16:48:13 (3 years ago)
Author:
Edwin Eefting <edwin@datux.nl>
Branches:
master
Children:
31fd825
Parents:
6e9c61f
Message:

updated to 1.06_rob20201204

Location:
npl/mailserver/netqmail
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • npl/mailserver/netqmail/netqmail.SlackBuild

    r6e9c61f ra051af0  
    116116### all important qmail patches
    117117# above is all replaced by the great uberpatch from http://notes.sagredo.eu/en/qmail-notes-185/patching-qmail-82.html THANKS Roberto Puzzanghera!
    118 ROBVERSION="rob20180403"
     118ROBVERSION="rob20201204"
    119119patch < /tmp/build/roberto-netqmail-1.06.patch-latest || exit 1
    120120ln -s /usr/include/srs2.h /usr/local/include/srs2.h
     
    140140#large inode support
    141141sed 's/O2$/O2 -D_FILE_OFFSET_BITS=64/' conf-cc -i || exit 1
    142 make setup check || exit 1
     142make -j1 setup check || exit 1
    143143
    144144# Default qmail rules
  • npl/mailserver/netqmail/netqmail.build

    r6e9c61f ra051af0  
    1 6363
     16364
  • npl/mailserver/netqmail/netqmail.md5

    r6e9c61f ra051af0  
    1126c95bd8faca909f3432c1aa55f251b6  ./netqmail-1.06.tar
    2 fc09f10879e8fd10880d136de5b51a87  ./netqmail.pkg
    3 24b173c1fdd1a05abfbd48a6ccba56f4  ./netqmail.SlackBuild
    4 584232cea7d0ecd5691041e5973edac9  ./netqmail.SlackBuild.log.gz
    5 2fbc85fee68c868ba2a45e7e84a138b7  ./roberto-netqmail-1.06.patch-latest
     2f8967ecfb97c2a65cacf2c2ee0803b82  ./netqmail.pkg
     3679d508316e188608a439ac8ab28a2e2  ./netqmail.SlackBuild
     4100c02924b4c1c5238f5a661ab72e747  ./netqmail.SlackBuild.log.gz
     5353c8724cd1df7c795268528295a274c  ./roberto-netqmail-1.06.patch-latest
  • npl/mailserver/netqmail/netqmail.version

    r6e9c61f ra051af0  
    1 1.06_rob20180403
     11.06_rob20201204
  • npl/mailserver/netqmail/roberto-netqmail-1.06.patch-latest

    r6e9c61f ra051af0  
    1 v. 2018.04.03
    2 Combined patch for netqmail-1.06 by Roberto Puzzanghera [roberto dot puzzanghera at sagredo dot eu]
    3 More info at http://notes.sagredo.eu/node/82
    4 ==========================================================================================================
    5 
    6 = This patch puts together
    7 * Erwin Hoffmann's qmail-authentication patch v. 0.8.3 (23.08.2015), which updates the patches provided by
    8   Krysztof Dabrowski and Bjoern Kalkbrenner.
    9   It provides cram-md5, login, plain authentication support for qmail-smtpd and qmail-remote.
    10   http://www.fehcom.de/qmail/smtpauth.html##PATCHES
    11 * Frederik Vermeulen's qmail-tls patch v. 20160908
    12   implements SSL or TLS encrypted and authenticated SMTP.
    13   http://inoa.net/qmail-tls/
    14   The file update_tmprsadh was modified to chown all .pem files to vpopmail.
    15 * Marcel Telka's force-tls patch v. 2016.05.15
    16   optionally gets qmail to require TLS before authentication to improve security.
    17   You have to declare FORCETLS=0 if you want to allow the auth without TLS
    18   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/roberto-netqmail-1.06_force-tls.patch-2012.10.28
    19 * Antonio Nati's chkuser patch v. 2.0.9
    20   performs, among the other things, a check for the existence of recipients during the SMTP conversation,
    21   bouncing emails of fake senders.
    22   http://www.interazioni.it/opensource/chkuser/
    23 * Flavio Curti's qmail-queue-custom-error patch
    24   enables simscan and qmail-dkim to return the appropriate message for each e-mail it refuses to deliver.
    25   https://no-way.org/uploads/qmail-error/
    26 * Christophe Saout's qmail-SPF rc5 patch
    27   Modified by Manvendra Bhangui to make it IPv4-mapped IPv6 addresses compliant.
    28   checks incoming mails inside the SMTP daemon, add Received-SPF lines and optionally block undesired transfers.
    29   http://www.saout.de/misc/spf/
    30 * Marcelo Coelho's qmail-SRS patch
    31   implements Sender Rewriting Scheme fixing SPF break upon email forwarding.
    32   http://www.mco2.com.br/opensource/qmail/srs/
    33 * Christopher K. Davis' oversize dns patch
    34   enables qmail to handle large DNS packets.
    35   http://www.ckdhr.com/ckd/qmail-103.patch
    36 * Jul's reread-concurrency v.2 patch
    37   rereads control/concurrencylocal and control/concurrencyremote files when qmail-send receives a HUP signal.
    38   http://js.hu/package/qmail/index.html
    39 * Johannes Erdfelt's Big Concurrency patch
    40   sets the spawn limit above 255
    41   http://qmail.org/big-concurrency.patch
    42 * Mihai Secasiu's Big Concurrency fix v.1.0 patch
    43   fixes a compiler error if you set concurrency higher than 509 in conf-spawn.
    44   http://patchlog.com/linux/qmail-big-concurrency/
    45 * Bill Shupp's netqmail-maildir++.patch
    46   adds maildirquota support to qmail-pop3d and qmail-local.
    47   Fixed a bug where the filesize part of the S=<filesize> component of the Maildir++ compatible filename is wrong (tx MG).
    48   More info here: http://notes.sagredo.eu/en/qmail-notes-185/installing-dovecot-and-sieve-on-a-vpopmail-qmail-server-28.html#comment995
    49   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/netqmail-maildir.patch
    50 * Kyle B. Wheeler's "Better qmail-smtpd Logging" v.4 (05 Jan 2010) patch
    51   facilitates diagnostics of qmail-smtpd logging its actions and decisions (search for a line with qmail-smtp:)
    52   http://www.memoryhole.net/qmail/#logging
    53 * John Simpson's (?) Greeting delay patch
    54   adds a user-definable delay after SMTP clients have initiated SMTP sessions, prior to qmail-smtpd responding
    55   with "220 ESMTP". It can reject connections from clients which tried to send commands before greeting.
    56   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/qmail-greetdelay.patch
    57 * Manvendra Bhangui's DKIM and SURBL filter v.1.22 patch
    58   adds DKIM signing & verification and SURBL filtering support to qmail.
    59   qmail-dk is based on Russ Nelson's patch: http//:www.qmail.org/qmail-1.03-dk-0.54.patch
    60   qmail-dkim uses hacked libdkim libraries from libdkim project at http://libdkim.sourceforge.net/
    61   surbfilter is built on djb functions and some functions have been ruthlessly borrowed from qmail surbl
    62   interface by Pieter Droogendijk and the surblhost program at http://surblhost.sourceforge.net/
    63   (file hier.c modified to chown /var/qmail/control/cache and subdirs to vpopmail)
    64   http://sourceforge.net/projects/indimail/files/netqmail-addons/qmail-dkim-1.0/
    65   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/ANNOUNCE.surblfilter
    66 * Claudio Jeker and Andre Oppermann's EXTTODO patch (release 5. Jan. 2003)
    67   addresses a problem known as the silly qmail (queue)  problem
    68   http://www.nrg4u.com/qmail/ext_todo-20030105.patch
    69 * Russell Nelson's big-todo patch
    70   makes qmail use a hashing mechanism in the todo folder similar to that used in the rest of the queue
    71   http://www.qmail.org/big-todo.103.patch
    72 * Stephane Cottin's qmail-inject-null-sender patch (let's call it in this way)
    73   prevents qmail-inject from rewriting the null sender, fixing an issue with sieve vacation/reject messages.
    74   More info here: http://www.dovecot.org/list/dovecot/2009-June/040811.html
    75   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/qmail-inject-null-sender.patch
    76 * Russell Nelson's (modified by Charles Cazabon) doublebounce-trim patch, which updates the original
    77   version by Russel Nelson
    78   prevents double bounces from hitting your queue a second time provided that you delete the first line
    79   from /var/qmail/control/doublebounceto
    80   http://qmail.org/doublebounce-trim.patch
    81 * Will Harris' esmtp-size patch
    82   enables qmail-smtpd to reject messages if they're larger than the maximum number of bytes allowed
    83   according to the /var/qmail/control/databytes control file.
    84   http://will.harris.ch/qmail-smtpd.c.diff
    85 * Inter7's qmail-taps-extended patch
    86   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/qmail-tap.diff
    87   Extended by Michai Secasiu (http://patchlog.com/patches/qmail-taps-extended/)
    88   Provides the ability to archive each email that flows through the system.
    89   Archiving only messages from or to certain email addresses is possible as well.
    90 * Rolf Eike Beer's qmail-remote CRLF patch
    91   enables qmail-remote to handle CR properly, always sending the line breaks as CRLF and avoiding to
    92   double the CR (like qmail-remote normally does)
    93   http://opensource.sf-tec.de/qmail/
    94 * Andy Repton's outgoingip patch (adjusted by Sergio Gelato)
    95   by default all outgoing emails are sent through the first IP address on the interface. In case of a multiple
    96   IP server this patch makes qmail send outgoing emails with the IP eventually stored in control/outgoingip.
    97   The ehlo domain is NOT modified by this patch.
    98   http://www.qmail.org/outgoingip.patch
    99   Robbie Walker provided a patch to correct qmail-qmqpc.c's call to timeoutconn(), because the function
    100   signature was modified by the original outgoingip patch
    101   http://notes.sagredo.eu/node/82#comment-373
    102 * Iain Patterson's qmail-smtpd pid, qp log patch
    103   makes qmail-smtpd log a line similar to the following:
    104   @4000000039b89c95026a89b4 mail recv: pid 8155 from <name@domain.xy> qp 8157
    105   The pid allows you to match the message up with a given tcpserver process and the qp lets you find a
    106   particular delivery.
    107   http://iain.cx/qmail/patches.html#smtpd_pidqp
    108 * Jonathan de Boyne Pollard's any-to-cname patch
    109   avoids qmail getting large amounts of DNS data we have no interest in and that may overflow our response
    110   buffer.
    111   http://www.memoryhole.net/qmail/#any-to-cname
    112 * Matthias Andree's qmail-rfc2821 patch
    113   makes qmail rfc2821 compliant
    114   http://www-dt.e-technik.uni-dortmund.de/~ma/qmail/patch-qmail-1.03-rfc2821.diff
    115 * Jonathan de Boyne Pollard's smtpd-502-to-500 patch
    116   makes qmail rfc2821 compliant
    117   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/smtpd-502-to-500.patch
    118 * Fabio Busatto's qmail-dnsbl patch
    119   allows you to reject spam and virus looking at the sender's ip address.
    120   Modified by Luca Franceschini to add support for whitelists, TXT and A queries, configurable return codes
    121   451 or 553 with custom messages
    122   http://qmail-dnsbl.sourceforge.net/
    123 * Scott Gifford's qmail-moreipme patch v. 0.6
    124   prevents a problem caused by an MX or other mail routing directive instructing qmail to connect to
    125   itself without realizing it's connecting to itself, saving CPU time.
    126   http://www.suspectclass.com/sgifford/qmail/qmail-1.03-moreipme.README
    127   http://www.suspectclass.com/sgifford/qmail/qmail-1.03-moreipme-0.6.patch
    128 * Alex Nee's qmail-hide-ip-headers patch
    129   It will hide your Private or Public IP in the email Headers when you are sending Mail as a Relay Client.
    130   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/qmail-hide-ip-headers.patch
    131 * John Saunders' qmail-date-localtime patch
    132   causes the various qmail programs to generate date stamps in the local timezone.
    133   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/qmail-date-localtime.patch
    134 * Dean Gaudet's qmail-liberal-lf patch v. 0.95
    135   allow qmail-smtpd to accept messages that are terminated with a single \n instead of the required \r\n
    136   sequence.
    137   http://www.arctic.org/~dean/patches/qmail-0.95-liberal-lf.patch
    138 * Michael Samuel's maxrcpt patch
    139   allows you to set a limit on how many recipients are specified for any one email message by setting
    140   control/maxrcpt. RFC 2821 section 4.5.3.1 says that an MTA MUST allow at least 100 recipients for each
    141   message, since this is one of the favourite tricks of the spammer.
    142   http://copilotco.com/mail-archives/qmail.1997/msg03066.html
    143 * Inter7's qmail-eMPF patch
    144   More info: http://www.qmailwiki.org/EMPF
    145   eMPF follows a set of administrator-defined rules describing who can message whom.  With this, companies can segregate
    146   various parts of their organizations email activities, as well as provide a variety of security-enhancing services.
    147 * qregex (by  Andrew St. Jean http://www.arda.homeunix.net/downloads-qmail/, contributors: Jeremy Kitchen, Alex Pleiner,
    148   Thanos Massias. Original patch by Evan Borgstrom)
    149   adds the ability to match address evelopes via Regular Expressions (REs) in the qmail-smtpd process.
    150   Added new control file 'badhelonorelay', control/badmailto renamed control/badrcptto (Tx Luca Franceschini).
    151 * brtlimit
    152   Luca Franceschini derived this patch from http://netdevice.com/qmail/patch/goodrcptto-12.patch
    153   added control/brtlimit and BRTLIMIT variable to limit max invalid recipient errors before closing the connection (man qmail-control)
    154 * validrcptto
    155   http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/validrcptto.README
    156   Luca Franceschini grabbed the code from several patches with additional features: http://qmail.jms1.net/patches/validrcptto cdb.shtml,
    157   http://netdevice.com/qmail/patch/goodrcptto-ms-12.patch, http://patch.be/qmail/badrcptto.html
    158   It works in conjunction with chkuser with both cdb and mysql accounts.
    159 * reject-relay-test by Russell Nelson
    160   http://qmail.org/qmail-smtpd-relay-reject
    161   It gets qmail to reject relay probes generated by so-called anti-spammers. These relay probes have '!', '%' and '@'
    162   in the local (username) part of the address.
    163 * Luca Franceschini
    164   added DISABLETLS environment variable, useful if you want to disable TLS on a desired port
    165   added FORCEAUTHMAILFROM environment variable to REQUIRE that authenticated user and 'mail from' are identical
    166   added SMTPAUTHMETHOD, SMTPAUTHUSER and SMTP_AUTH_USER env variables for external plugins (see http://qmail-spp.sourceforge.net/doc/)
    167 * fixed little bug in 'mail from' address handling
    168   patch by Andre Opperman at http://qmail.cr.yp.narkive.com/kBry6GJl/bug-in-qmail-smtpd-c-addrparse-function
    169 * Luca Franceschini's qlog patch
    170   smtpd logging with fixed format. An entry 'qlogenvelope' is generated after accepting or rejecting every recipients in the envelope phase.
    171 * Luca Franceschini's reject null senders patch
    172   useful in special cases if you temporarily need to reject the null sender (although breaks RFC compatibility).
    173   You just need to put 1 (actually any number different from 0) in your control/rejectnullsenders to reject the null sender with 421 error message.
    174 * dnscname patch
    175   Removes CNAME check in order to avoid getting large amounts of data of no interest in and that may overflow the response buffer.
    176   https://lists.gt.net/qmail/users/138190
    177 * Luca Franceschini's rcptcheck patch
    178   (based on original patch from Jay Soffian (http://www.soffian.org/downloads/qmail/qmail-smtpd-doc.html)
    179   Originally designed for the purpose of receipt validation, it can also be used to limit the numbr of email a given IP and/or auth-user and/or domain che send
    180   in a given time interval. It has to be used in conjuction with the rcptcheck-overlimit.sh LF's script http://notes.sagredo.eu/files/qmail/rcptcheck-overlimit.sh
    181   http://notes.sagredo.eu/files/qmail/patches/rcptcheck.patch
    182 
    183 = Disclaimer
    184 This patch comes with the usual warranty: it works for me, it may not work for you,
    185 use at your own risk etc. etc. :)
    186 Comments, suggestions, criticisms are always welcome!
    187 
    188 = Usage
    189 
    190 * Install libdomainkeys
    191 wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/tar/libdomainkeys-0.69.tar.gz
    192 tar xzf libdomainkeys-0.69.tar.gz
    193 wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/libdomainkeys-0.69.diff
    194 cd libdomainkeys-0.69
    195 chown -R root.root .
    196 patch < ../libdomainkeys-0.69.diff
    197 make
    198 cp libdomainkeys.a /usr/lib
    199 
    200 * Install libsrs2
    201 wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/tar/libsrs2-1.0.18.tar.gz
    202 tar xzf libsrs2-1.0.18.tar.gz
    203 cd libsrs2-1.0.18
    204 ./configure
    205 make
    206 make install
    207 ldconfig
    208 cd ../
    209 
    210 * Apply the patch and compile
    211 wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/roberto-netqmail-1.06.patch-latest.gz
    212 wget http://qmail.org/netqmail-1.06.tar.gz
    213 tar xzf netqmail-1.06.tar.gz
    214 cd netqmail-1.06
    215 chown -R root.root .
    216 gunzip -c ../roberto-netqmail-1.06.patch-latest.gz | patch
    217 make
    218 make setup check
    219 
    220 * You have to export SMTPAUTH in your run file if you want to do the auth
    221 
    222 * You have to export SURBL=1 in your run file if you want to enable SURBL
    223 
    224 * /var/qmail/control/cache must be owned by the user who runs qmail-smtpd, vpopmail.vchkpwd in my case.
    225   Change the permissions according to your qmail configuration.
    226 
    227 =================================================================================================================
    228 
    229 = Changelog
    230 
    231 2018.04.03
    232 -DKIM patch updated to v. 1.22
    233  * openssl 1.1.0 port
    234  * various improvements, bug fixes
    235 
    236 2018.01.10
    237 -maildir++
    238  * fixed a bug where the filesize part of the S=<filesize> component of the Maildir++ compatible filename
    239    is wrong (tx MG). More info here: http://notes.sagredo.eu/en/qmail-notes-185/installing-dovecot-and-sieve-on-a-vpopmail-qmail-server-28.html#comment995
    240 -qmail-queue-extra
    241  * removed, because it was causing more problems than advantages, as the domain of the log@yourdomain.tld
    242    had to match the system domain inside control/me and shouldn't be a virtual domain as well.
    243 
    244 2017.10.11 (tx Luca Franceschini)
    245 -qlogfix
    246  * log strings should terminate with \n to avoid trailing ^M using splogger
    247  * bug reporting custom errors from qmail-queue in qlog
    248 -added dnscname patch
    249 -added rcptcheck patch
    250 
    251 2017.08.18
    252 -qmail-smtpd now retains authentication upon rset
    253  (tx to Andreas http://notes.sagredo.eu/qmail-notes-185/smtp-auth-qmail-tls-forcetls-patch-for-qmail-84.html#comment750)
    254 
    255 2017-05-14
    256 -DKIM patch updated to v. 1.20
    257  It now manages long TXT records, avoiding the rejection of some hotmail.com messages.
    258 
    259 2016-12-19
    260 -Several new patches and improvements added (thanks to Luca Franceschini)
    261 More info here http://notes.sagredo.eu/node/178
    262  -qregex patch
    263  -brtlimit patch
    264  -validrcptto patch
    265  -rbl patch (updates qmail-dnsbl patch)
    266  -reject-relay-test patch
    267  -added DISABLETLS environment variable, useful if you want to disable TLS on a desired port
    268  -added FORCEAUTHMAILFROM environment variable to REQUIRE that authenticated user and 'mail from' are identical
    269  -fixed little bug in 'mail from' address handling (patch by Andre Opperman at http://qmail.cr.yp.narkive.com/kBry6GJl/bug-in-qmail-smtpd-c-addrparse-function)
    270  -added SMTPAUTHMETHOD, SMTPAUTHUSER and SMTP_AUTH_USER env variables for external plugins
    271  -qlog patch
    272  -reject null senders patch
    273  -bouncecontrolmime patch
    274  -qmail-taps-extended (updates qmail-tap)
    275 
    276 2016-12-02
    277 -fixed BUG in qmail-remote.c: in case of remote server who doesn't allow EHLO the response for an alternative
    278 HELO was checked twice, making the connection to die. (Thanks to Luca Franceschini)
    279 Patch applied: http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/fix_sagredo_remotehelo.patch
    280 
    281 2016-09-19
    282 -qmail-tls patch updated to v. 20160918
    283   * bug: qmail-remote accepting any dNSName, without checking that is matches (E. Surovegin)
    284   * bug: documentation regarding RSA and DH keys (K. Peter, G. A. Bofill)
    285 
    286 2016-05-15
    287 -force-tls patch improved (a big thanks to Marcel Telka). Now qmail-smtpd avoids to write the auth verb if the
    288  the STARTTLS command was not sent by the client
    289 
    290 2016-03-09
    291 -DKIM patch upgraded to v. 1.19
    292  * verification will not fail when a dkim signature does not include the subject provided that the
    293    UNSIGNED_SUBJECT environment variable is declared.
    294 
    295 2015-12-26
    296 -qmail-tls patch updated to v. 20151215
    297  * typo in #if OPENSSL_VERSION_NUMBER for 2015-12-08 patch release (V. Smith)
    298  * add ECDH to qmail-smtpd
    299  * increase size of RSA and DH pregenerated keys to 2048 bits
    300  * qmail-smtpd sets RELAYCLIENT if relaying allowed by cert
    301  more info at http://inoa.net/qmail-tls/
    302 
    303 2015-12-15
    304 -DKIM patch by Manvendra Bhangui updated to v. 1.18
    305 
    306 2015-10-03
    307 -qmail-authentication: updated to v. 0.8.3
    308 
    309 2015-08-08
    310 -fixed a bug on qmail-remote.c that was causing the sending of an additionale ehlo greeting (thanks to Cristoph Grover)
    311 
    312 2015-04-11
    313 -qmail-authentication: updated to v. 0.8.2
    314 -qmail-tls: upgraded to v. 20141216 (POODLE vulnerability fixed)
    315 
    316 2015-03-28
    317 -added qmail-eMPF patch
    318 
    319 2014-11-19
    320 -security fix: the SSLv3 connection is now switched off
    321 
    322 2014-11-15
    323 -modified the QUEUE_EXTRA variable in extra.h to improve the qmail-send's log
    324 
    325 2014-04-14
    326 -added maxrcpt patch
    327 
    328 2014-03-10
    329 -added qmail-0.95-liberal-lf patch
    330 
    331 2013-12-30
    332 -added qmail-srs
    333 -the character "=" is now considered valid in the sender address by chkuser in order to accept SRS
    334 
    335 2013-12-18
    336 -added qmail-date-localtime patch
    337 
    338 2013-12-14
    339 -added qmail-hide-ip patch
    340 
    341 2013-12-10
    342 -the original greetdelay by e.h. has been replaced with the improved patch by John Simpson. Now
    343 communications trying to send commands before the greeting will be closed. Premature disconnections will be
    344 logged as well.
    345 -CHKUSER_SENDER_FORMAT enabled to reject fake senders without any domain declared (like <foo>)
    346 -chkuser logging: I slightly modified the log line adding the variables' name just to facilitate its interpretation
    347 -added qmail-moreipme patch
    348 
    349 2013-12-07
    350 -added qmail-dnsbl patch
    351 
    352 2013-12-05
    353 -added two patches to make qmail rfc2821 compliant
    354 
    355 2013-11-23
    356 -added any-to-cname patch
    357 
    358 2013-09-27
    359 -DKIM patch upgraded to v. 1.17. Defined -DHAVE_SHA_256 while compiling dkimverify.cpp in the Makefile.
    360 This solved an issue while verifying signatures using sha256.
    361 
    362 2013-09-16
    363 -Minor fixes to the DKIM patch.
    364 
    365 2013-09-13
    366 -DKIM patch upgraded to v. 1.16. The signing at qmail-remote level has been revised by its author.
    367 
    368 2013-08-25
    369 -qmail-qmqpc.c call to timeoutconn() needed a correction because the function signature was modified by the
    370  outgoingip patch. Thanks to Robbie Walker (diff here http://notes.sagredo.eu/node/82#comment-373)
    371 
    372 2013-08-21
    373 -fixed a bug in hier.c which caused the installation not to build properly the queue/todo dir structure (thanks to
    374  Scott Ramshaw)
    375 
    376 2013-08-18
    377 -DKIM-SURBL patch by Manvendra Bhangui updated to v. 1.14
    378 
    379 2013-08-12
    380 -DKIM patch upgraded to v. 1.12. The new patch adds surblfilter functionality.
    381 -added qmail-smtpd pid, qp log patch
    382 
    383 2013-08-08
    384 -qmail-SPF modified by Manvendra Bhangui to make it IPv6-mapped IPv4 addresses compliant. In order to have it
    385 working with such addresses you have to patch tcpserver.c accordingly. You can use a patch fot ucspi-tcp6-0.98
    386 by Manvendra Bhangui at http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/tcpserver-ipv6mapped_ipv4.patch
    387 or wait for v. 0.99 relase of ucspi-tcp6
    388 -added outgoingip patch
    389 -added qmail-bounce patch
    390 
    391 2013-03-31
    392 qmail-auth updated to latest v. 0.8.1 Added authentication by recipient domain for qmail-remote.
    393 Look at README.auth for further details
    394 
    395 2013-02-11
    396 some code adjustments in qmail-smtpd.c smtpd_ehlo() to restore total compatibility with esmtp-size patch
    397 
    398 2013-02-08
    399 qmail-auth updated to latest v. 0.7.6. Look at README.auth for further details
    400 
    401 2013-01-28
    402 fixed an issue on qmail-pop3d which was causing a double +OK after the pass command (thanks to Rakesh, Orbit
    403 and Simplex for helping in testing and troubleshooting)
    404 
    405 2013-01-06
    406 environment variable GREETDELAY renamed to SMTPD_GREETDELAY
    407 
    408 2012-10-31
    409 qmail-auth updated to latest v. 0.7.5. Look at README.auth for further details
    410 The qmail-forcetls patch was simplyfied accordingly.
    411 You MUST export SMTPAUTH="" in your run file now.
    412 
    413 2012-04-25
    414 -added qmail-remote CRLF (thanks to Pierre Lauriente for the help on testing and troubleshooting)
    415 The qmail-remote CRLF patch solved a problem of broken headers after sieve forwarding that was
    416 caused by a bad handling of the CR (carriage return) by qmail-remote.
    417 The issue is also reported here http://www.dt.e-technik.uni-dortmund.de/~ma/qmail-bugs.html
    418 
    419 2012.04.16
    420 -added qmail-tap
    421 
    422 2012.02.08
    423 -added smtp-size patch
    424 
    425 2012.01.29
    426 -added doublebounce-trim patch
    427 
    428 2011.12.12
    429 -file update_tmprsadh modified to chown the .pem files to vpopmail to avoid hang-ups during the smtp
    430 conversation on port 587 caused by permission problems.
    431 
    432 2011.10.06
    433 -qmail-remote.c: fixed. It was not going into tls on authentication (thanks to Krzysztof Gajdemski)
    434 -force-tls now quits if the starttls command is not provided when required (thanks to Jacekalex)
    435 
    436 =================================================================================================================
    437 
     1diff -ruN ../netqmail-1.06-original/CHANNELS netqmail-1.06/CHANNELS
     2--- ../netqmail-1.06-original/CHANNELS  1970-01-01 01:00:00.000000000 +0100
     3+++ netqmail-1.06/CHANNELS      2019-06-26 16:39:31.572826981 +0200
     4@@ -0,0 +1,100 @@
     5+CHANNELS by Reed Sandberg
     6+Copyright (c) 2007-2008 The SMB Exchange, INC
     7+
     8+This patch is free software; you can redistribute it and/or modify
     9+it under the Artistic License.
     10+
     11+This patch for (net)qmail comes with NO WARRANTY.
     12+
     13+RELEASE: November 15, 2008
     14+
     15+
     16+qmail manages two different queues
     17+with different configurable concurrency settings (rates) based on a set
     18+of domains - those delivered locally (control files: locals,
     19+virtualdomains, concurrencylocal) and those delivered remotely (domains
     20+not listed in  above control files and concurrencyremote). Luckily,
     21+qmail's author (DJB) spent some time abstracting the implementation of
     22+these channels and this patch advances the abstraction to add an
     23+arbitrary number of channels - each with a distinct set of domains and
     24+throttling capabilities.
     25+
     26+BIG PICTURE
     27+With ext_todo patch. Adapted from:
     28+EXTTODO by Claudio Jeker <jeker@n-r-g.com> and
     29+Andre Oppermann <opi@nrg4u.com>
     30+(c) 1998,1999,2000,2001,2002 Internet Business Solutions Ltd.
     31+
     32+
     33+               +-------+   +-------+       +-------+
     34+               | clean |   | clean |       | logger|
     35+               +--0-1--+   +--0-1--+       +---0---+           +-----------+
     36+         trigger  ^ |         ^ |              |             +->0,1 lspawn |
     37+            |     | v         | v              v            /  +-----------+
     38+ +-------+  v  +--2-3--+   +--5-6--------------0-------+   /
     39+ |       |  |  |       0<--7                         1,2<-+
     40+ | queue |--+--| todo  |   | send                      |
     41+ |       |  |  |       1-->8                         3,4<-+
     42+ +-------+     +-------+   +--11,12---...-------X,Y----+   \
     43+                                |                |          \  +-----------+
     44+                                v                v           +->0,1 rspwan |
     45+                            +--0,1-+         +--0,1-+          +-----------+
     46+                            |rspawn|  ...    |rspawn|   
     47+                            +------+         +------+       
     48+
     49+Communication between qmail-send and qmail-todo
     50+
     51+todo -> send:
     52+   D[01]{n}<mesgid>\0
     53+          Start delivery for a new message with id <mesgid>.
     54+          the character '0' or '1' indicates whether this message
     55+          will go through the corresponding channel (false/true)
     56+          by position where n is the number of channels. E.g. D1011<msgid>\0:
     57+          means there are four channels, the first 2 are always
     58+          the local and default remote channels, and the rest are
     59+          an optional number of supplemental channels (defined
     60+          at compile-time by conf-channels). So this message
     61+          has a local recipient, and a recipient on the first and
     62+          second supplemental channels.
     63+   L<string>\0
     64+          Dump string to the logger without adding additional \n or similar.
     65+send -> todo:
     66+   H      Got a SIGHUP, reread ~/control/locals, ~/control/virtualdomains,
     67+          ~/control/concurrencyremote, ~/control/concurrencylocal,
     68+          ~/control/concurrencysupplX, ~/control/supplsX
     69+   X      Quit ASAP.
     70+
     71+qmail-todo sends "\0" terminated messages whereas qmail-send just send one
     72+character to qmail-todo.
     73+
     74+
     75+CAVEATS
     76+qmail-qread ignores all supplemental channels - contributions are welcome!
     77+
     78+Supplemental channels use qmail-rspawn for remote recipients only.
     79+
     80+Dynamic throttling and resource limits
     81+File descriptor limits are imposed on a per-process basis (FD_SET), on a
     82+per-account basis (ulimit -n, /etc/security/limits.conf on Linux, pam limits, etc.)
     83+and then on a system-wide basis by the OS (/proc/sys/fs/file-max on Linux, etc).
     84+concurrencyremote, concurrencysupplX, etc are each subject to the hard limit in
     85+conf-spawn, which in turn is bounded by per-process limits. Note that this limit
     86+applies separately to each queue, not to all queues in total. The sum of all
     87+concurrency limits for each queue in total is bounded on a per-account basis
     88+(ulimit -n). These limits can easily be approached if you are running many
     89+supplemental channels.
     90+
     91+qmail double checks the concurrency limits on startup for each channel (using FD_SET)
     92+and silently curbs them if needed because bad things happen if this limit is breached.
     93+If you're sending qmail-send a HUP signal after editing concurrency limits (dynamic
     94+throttling) be aware that qmail's builtin checks can be circumvented, here's what
     95+qmail's author has to say on the subject (from chkspawn.c):
     96+This means that the qmail daemons could crash if you set the run-time concurrency higher
     97+than [the per-process limit].
     98+
     99+Even if the per-process limits are in check, per-account and system-wide file descriptor
     100+limits may still cause bad things to happen if you're not careful (you've been warned!).
     101+
     102+Enjoy!
     103+Reed Sandberg
     104+
    438105diff -ruN ../netqmail-1.06-original/CHKUSER.automatic_patching netqmail-1.06/CHKUSER.automatic_patching
    439106--- ../netqmail-1.06-original/CHKUSER.automatic_patching        1970-01-01 01:00:00.000000000 +0100
    440 +++ netqmail-1.06/CHKUSER.automatic_patching    2016-11-22 21:04:38.804137924 +0100
     107+++ netqmail-1.06/CHKUSER.automatic_patching    2019-02-27 20:57:13.376025224 +0100
    441108@@ -0,0 +1,94 @@
    442109+Chkuser 2.0.9 automatic patching
     
    536203diff -ruN ../netqmail-1.06-original/CHKUSER.changelog netqmail-1.06/CHKUSER.changelog
    537204--- ../netqmail-1.06-original/CHKUSER.changelog 1970-01-01 01:00:00.000000000 +0100
    538 +++ netqmail-1.06/CHKUSER.changelog     2016-11-22 21:04:38.804137924 +0100
     205+++ netqmail-1.06/CHKUSER.changelog     2019-02-27 20:57:13.376025224 +0100
    539206@@ -0,0 +1,183 @@
    540207+
     
    723390diff -ruN ../netqmail-1.06-original/CHKUSER.copyright netqmail-1.06/CHKUSER.copyright
    724391--- ../netqmail-1.06-original/CHKUSER.copyright 1970-01-01 01:00:00.000000000 +0100
    725 +++ netqmail-1.06/CHKUSER.copyright     2016-11-22 21:04:38.804137924 +0100
     392+++ netqmail-1.06/CHKUSER.copyright     2019-02-27 20:57:13.376025224 +0100
    726393@@ -0,0 +1,15 @@
    727394+
     
    742409diff -ruN ../netqmail-1.06-original/CHKUSER.log_format netqmail-1.06/CHKUSER.log_format
    743410--- ../netqmail-1.06-original/CHKUSER.log_format        1970-01-01 01:00:00.000000000 +0100
    744 +++ netqmail-1.06/CHKUSER.log_format    2016-11-22 21:04:38.804137924 +0100
     411+++ netqmail-1.06/CHKUSER.log_format    2019-02-27 20:57:13.376025224 +0100
    745412@@ -0,0 +1,69 @@
    746413+
     
    815482diff -ruN ../netqmail-1.06-original/CHKUSER.manual_patching netqmail-1.06/CHKUSER.manual_patching
    816483--- ../netqmail-1.06-original/CHKUSER.manual_patching   1970-01-01 01:00:00.000000000 +0100
    817 +++ netqmail-1.06/CHKUSER.manual_patching       2016-11-22 21:04:38.804137924 +0100
     484+++ netqmail-1.06/CHKUSER.manual_patching       2019-02-27 20:57:13.377025213 +0100
    818485@@ -0,0 +1,182 @@
    819486+Chkuser 2.0 manual editing
     
    1001668diff -ruN ../netqmail-1.06-original/CHKUSER.readme netqmail-1.06/CHKUSER.readme
    1002669--- ../netqmail-1.06-original/CHKUSER.readme    1970-01-01 01:00:00.000000000 +0100
    1003 +++ netqmail-1.06/CHKUSER.readme        2016-11-22 21:04:38.804137924 +0100
     670+++ netqmail-1.06/CHKUSER.readme        2019-02-27 20:57:13.377025213 +0100
    1004671@@ -0,0 +1,54 @@
    1005672+chkuser 2.0 - README
     
    1059726diff -ruN ../netqmail-1.06-original/CHKUSER.running netqmail-1.06/CHKUSER.running
    1060727--- ../netqmail-1.06-original/CHKUSER.running   1970-01-01 01:00:00.000000000 +0100
    1061 +++ netqmail-1.06/CHKUSER.running       2016-11-22 21:04:38.804137924 +0100
     728+++ netqmail-1.06/CHKUSER.running       2019-02-27 20:57:13.377025213 +0100
    1062729@@ -0,0 +1,103 @@
    1063730+
     
    1166833diff -ruN ../netqmail-1.06-original/FILES netqmail-1.06/FILES
    1167834--- ../netqmail-1.06-original/FILES     2007-11-30 21:22:54.000000000 +0100
    1168 +++ netqmail-1.06/FILES 2016-11-22 21:03:57.061529799 +0100
     835+++ netqmail-1.06/FILES 2019-06-26 16:39:31.573826970 +0200
    1169836@@ -136,6 +136,8 @@
    1170837 dnsip.c
     
    1202869 tryrsolv.c
    1203870 ip.h
    1204 @@ -432,3 +439,4 @@
     871@@ -432,3 +439,7 @@
    1205872 tcp-environ.5
    1206873 constmap.h
    1207874 constmap.c
    1208875+qmail-todo.c
     876+channels.g
     877+conf-channels
     878+CHANNELS
    1209879diff -ruN ../netqmail-1.06-original/LICENSE.authentication netqmail-1.06/LICENSE.authentication
    1210880--- ../netqmail-1.06-original/LICENSE.authentication    1970-01-01 01:00:00.000000000 +0100
    1211 +++ netqmail-1.06/LICENSE.authentication        2016-11-22 21:03:57.102528432 +0100
     881+++ netqmail-1.06/LICENSE.authentication        2019-02-27 20:57:13.377025213 +0100
    1212882@@ -0,0 +1,43 @@
    1213883+AUTHOR
     
    1256926diff -ruN ../netqmail-1.06-original/MakeArgs.c netqmail-1.06/MakeArgs.c
    1257927--- ../netqmail-1.06-original/MakeArgs.c        1970-01-01 01:00:00.000000000 +0100
    1258 +++ netqmail-1.06/MakeArgs.c    2016-11-22 21:03:57.102528432 +0100
     928+++ netqmail-1.06/MakeArgs.c    2019-02-27 20:57:13.377025213 +0100
    1259929@@ -0,0 +1,144 @@
    1260930+/*
     
    14041074diff -ruN ../netqmail-1.06-original/Makefile netqmail-1.06/Makefile
    14051075--- ../netqmail-1.06-original/Makefile  2007-11-30 21:22:54.000000000 +0100
    1406 +++ netqmail-1.06/Makefile      2018-04-03 15:05:13.390470191 +0200
     1076+++ netqmail-1.06/Makefile      2019-06-26 16:48:00.745225709 +0200
    14071077@@ -1,5 +1,14 @@
    14081078 # Don't edit Makefile! Use conf-* for configuration.
     
    16481318 
    16491319 fs.a: \
    1650 @@ -703,7 +754,7 @@
     1320@@ -702,8 +753,15 @@
     1321        ./compile hfield.c
    16511322 
    16521323 hier.o: \
    1653  compile hier.c auto_qmail.h auto_split.h auto_uids.h fmt.h fifo.h
     1324-compile hier.c auto_qmail.h auto_split.h auto_uids.h fmt.h fifo.h
    16541325-       ./compile hier.c
     1326+compile hier.c auto_qmail.h auto_split.h auto_uids.h fmt.h fifo.h channels.h
    16551327+       ./compile $(DEFINES) hier.c
     1328+
     1329+channels.h: \
     1330+conf-channels channels.g
     1331+       cat channels.g \
     1332+       | sed s}NUMCHANNELS}"`head -1 conf-channels`"}g \
     1333+       > channels.h
     1334+       chmod 644 channels.h
    16561335 
    16571336 home: \
    16581337 home.sh conf-qmail
    1659 @@ -755,7 +806,7 @@
     1338@@ -754,8 +812,8 @@
     1339 
    16601340 install-big.o: \
    16611341 compile install-big.c auto_qmail.h auto_split.h auto_uids.h fmt.h \
    1662  fifo.h
     1342-fifo.h
    16631343-       ./compile install-big.c
     1344+fifo.h channels.h
    16641345+       ./compile $(DEFINES) install-big.c
    16651346 
    16661347 install.o: \
    16671348 compile install.c substdio.h strerr.h error.h open.h readwrite.h \
    1668 @@ -777,38 +828,52 @@
     1349@@ -777,38 +835,52 @@
    16691350        ./compile ip.c
    16701351 
     
    17291410 load: \
    17301411 make-load warn-auto.sh systype
    1731 @@ -890,6 +955,38 @@
     1412@@ -890,6 +962,38 @@
    17321413 readwrite.h open.h headerbody.h maildir.h strerr.h
    17331414        ./compile maildirwatch.c
     
    17681449 warn-auto.sh mailsubj.sh conf-qmail conf-break conf-split
    17691450        cat warn-auto.sh mailsubj.sh \
    1770 @@ -934,8 +1031,9 @@
     1451@@ -934,8 +1038,9 @@
    17711452 preline.0 condredirect.0 bouncesaying.0 except.0 maildirmake.0 \
    17721453 maildir2mbox.0 maildirwatch.0 qmail.0 qmail-limits.0 qmail-log.0 \
     
    17801461 mbox.0: \
    17811462 mbox.5
    1782 @@ -1107,11 +1205,80 @@
     1463@@ -1107,11 +1212,80 @@
    17831464        | sed s}SPAWN}"`head -1 conf-spawn`"}g \
    17841465        > qmail-control.5
     
    18621543 qmail-getpw.0: \
    18631544 qmail-getpw.8
    1864 @@ -1125,6 +1292,28 @@
     1545@@ -1125,6 +1299,28 @@
    18651546        | sed s}SPAWN}"`head -1 conf-spawn`"}g \
    18661547        > qmail-getpw.8
     
    18911572 compile qmail-getpw.c readwrite.h substdio.h subfd.h substdio.h \
    18921573 error.h exit.h byte.h str.h case.h fmt.h auto_usera.h auto_break.h \
    1893 @@ -1136,15 +1325,16 @@
     1574@@ -1136,15 +1332,16 @@
    18941575        nroff -man qmail-header.5 > qmail-header.0
    18951576 
     
    19111592 qmail-inject.0: \
    19121593 qmail-inject.8
    1913 @@ -1171,15 +1361,20 @@
     1594@@ -1171,15 +1368,20 @@
    19141595        > qmail-limits.7
    19151596 
     
    19361617 qmail-local.0: \
    19371618 qmail-local.8
    1938 @@ -1200,11 +1395,11 @@
     1619@@ -1200,11 +1402,11 @@
    19391620 qmail-lspawn: \
    19401621 load qmail-lspawn.o spawn.o prot.o slurpclose.o coe.o sig.a wait.a \
     
    19501631 qmail-lspawn.0: \
    19511632 qmail-lspawn.8
    1952 @@ -1213,9 +1408,22 @@
     1633@@ -1213,9 +1415,22 @@
    19531634 qmail-lspawn.o: \
    19541635 compile qmail-lspawn.c fd.h wait.h prot.h substdio.h stralloc.h \
     
    19741655 load qmail-newmrh.o cdbmss.o getln.a open.a cdbmake.a seek.a case.a \
    19751656 stralloc.a alloc.a strerr.a substdio.a error.a str.a auto_qmail.o
    1976 @@ -1269,11 +1477,13 @@
     1657@@ -1269,11 +1484,13 @@
    19771658 qmail-pop3d: \
    19781659 load qmail-pop3d.o commands.o case.a timeoutread.o timeoutwrite.o \
     
    19901671 qmail-pop3d.0: \
    19911672 qmail-pop3d.8
    1992 @@ -1419,13 +1629,13 @@
     1673@@ -1419,13 +1636,13 @@
    19931674        nroff -man qmail-qstat.8 > qmail-qstat.0
    19941675 
     
    20101691 qmail-queue.0: \
    20111692 qmail-queue.8
    2012 @@ -1439,14 +1649,18 @@
     1693@@ -1439,14 +1656,18 @@
    20131694 
    20141695 qmail-remote: \
     
    20331714 qmail-remote.0: \
    20341715 qmail-remote.8
    2035 @@ -1455,7 +1669,7 @@
     1716@@ -1455,7 +1676,7 @@
    20361717 qmail-remote.o: \
    20371718 compile qmail-remote.c sig.h stralloc.h gen_alloc.h substdio.h \
     
    20421723 tcpto.h readwrite.h timeoutconn.h timeoutread.h timeoutwrite.h
    20431724        ./compile qmail-remote.c
    2044 @@ -1463,11 +1677,11 @@
     1725@@ -1463,11 +1684,11 @@
    20451726 qmail-rspawn: \
    20461727 load qmail-rspawn.o spawn.o tcpto_clean.o now.o coe.o sig.a open.a \
     
    20561737 qmail-rspawn.0: \
    20571738 qmail-rspawn.8
    2058 @@ -1475,20 +1689,21 @@
     1739@@ -1475,31 +1696,33 @@
    20591740 
    20601741 qmail-rspawn.o: \
     
    20701751 datetime.a case.a ndelay.a getln.a wait.a seek.a fd.a sig.a open.a \
    20711752 lock.a stralloc.a alloc.a substdio.a error.a str.a fs.a auto_qmail.o \
    2072  auto_split.o env.a
     1753-auto_split.o env.a
    20731754-       ./load qmail-send qsutil.o control.o constmap.o newfield.o \
     1755+auto_split.o env.a auto_spawn.o
    20741756+       ./load qmail-send rcpthosts.o cdb.a srs.o qsutil.o control.o constmap.o newfield.o \
    20751757        prioq.o trigger.o fmtqfn.o quote.o now.o readsubdir.o \
     
    20771759        wait.a seek.a fd.a sig.a open.a lock.a stralloc.a alloc.a \
    20781760-       substdio.a error.a str.a fs.a auto_qmail.o auto_split.o env.a
    2079 +       substdio.a error.a str.a fs.a auto_qmail.o auto_split.o env.a \
     1761+       substdio.a error.a str.a fs.a auto_qmail.o auto_split.o env.a auto_spawn.o \
    20801762+       -I/usr/local/include -L/usr/local/lib -lsrs2
    20811763 
    20821764 qmail-send.0: \
    20831765 qmail-send.8
    2084 @@ -1509,7 +1724,7 @@
     1766        nroff -man qmail-send.8 > qmail-send.0
     1767 
     1768 qmail-send.8: \
     1769-qmail-send.9 conf-break conf-spawn
     1770+qmail-send.9 conf-break conf-spawn conf-channels
     1771        cat qmail-send.9 \
     1772        | sed s}QMAILHOME}"`head -1 conf-qmail`"}g \
     1773        | sed s}BREAK}"`head -1 conf-break`"}g \
     1774        | sed s}SPAWN}"`head -1 conf-spawn`"}g \
     1775+       | sed s}CHANNELS}"`head -1 conf-channels`"}g \
     1776        > qmail-send.8
     1777 
     1778 qmail-send.o: \
     1779@@ -1508,8 +1731,8 @@
     1780 substdio.h alloc.h error.h stralloc.h gen_alloc.h str.h byte.h fmt.h \
    20851781 scan.h case.h auto_qmail.h trigger.h newfield.h stralloc.h quote.h \
    20861782 qmail.h substdio.h qsutil.h prioq.h datetime.h gen_alloc.h constmap.h \
    2087  fmtqfn.h readsubdir.h direntry.h
     1783-fmtqfn.h readsubdir.h direntry.h
    20881784-       ./compile qmail-send.c
     1785+fmtqfn.h readsubdir.h direntry.h channels.h auto_qmail.h
    20891786+       ./compile $(DEFINES) qmail-send.c
    20901787 
    20911788 qmail-showctl: \
    20921789 load qmail-showctl.o auto_uids.o control.o open.a getln.a stralloc.a \
    2093 @@ -1528,21 +1743,26 @@
     1790@@ -1528,21 +1751,26 @@
    20941791 compile qmail-showctl.c substdio.h subfd.h substdio.h exit.h fmt.h \
    20951792 str.h control.h constmap.h stralloc.h gen_alloc.h direntry.h \
     
    21291826 qmail-smtpd.0: \
    21301827 qmail-smtpd.8
    2131 @@ -1551,9 +1771,10 @@
     1828@@ -1551,9 +1779,10 @@
    21321829 qmail-smtpd.o: \
    21331830 compile qmail-smtpd.c sig.h readwrite.h stralloc.h gen_alloc.h \
     
    21431840 
    21441841 qmail-start: \
    2145 @@ -1574,7 +1795,7 @@
     1842@@ -1573,8 +1802,8 @@
     1843        > qmail-start.8
    21461844 
    21471845 qmail-start.o: \
    2148  compile qmail-start.c fd.h prot.h exit.h fork.h auto_uids.h
     1846-compile qmail-start.c fd.h prot.h exit.h fork.h auto_uids.h
    21491847-       ./compile qmail-start.c
     1848+compile qmail-start.c fd.h prot.h exit.h fork.h auto_uids.h channels.h
    21501849+       ./compile $(DEFINES) qmail-start.c
    21511850 
    21521851 qmail-tcpok: \
    21531852 load qmail-tcpok.o open.a lock.a strerr.a substdio.a error.a str.a \
    2154 @@ -1606,6 +1827,20 @@
     1853@@ -1606,6 +1835,20 @@
    21551854 fmt.h ip.h lock.h error.h exit.h datetime.h now.h datetime.h
    21561855        ./compile qmail-tcpto.c
     
    21671866+compile alloc.h auto_qmail.h byte.h constmap.h control.h direntry.h error.h \
    21681867+exit.h fmt.h fmtqfn.h getln.h open.h ndelay.h now.h readsubdir.h readwrite.h \
    2169 +scan.h select.h str.h stralloc.h substdio.h trigger.h
     1868+scan.h select.h str.h stralloc.h substdio.h trigger.h channels.h
    21701869+       ./compile $(DEFINES) qmail-todo.c
    21711870+
     
    21731872 warn-auto.sh qmail-upq.sh conf-qmail conf-break conf-split
    21741873        cat warn-auto.sh qmail-upq.sh \
    2175 @@ -1639,10 +1874,10 @@
     1874@@ -1639,10 +1882,10 @@
    21761875 qreceipt: \
    21771876 load qreceipt.o headerbody.o hfield.o quote.o token822.o qmail.o \
     
    21861885 qreceipt.0: \
    21871886 qreceipt.1
    2188 @@ -1779,7 +2014,7 @@
     1887@@ -1779,7 +2022,7 @@
    21891888 qmail-qread.c qmail-qstat.sh qmail-queue.c qmail-remote.c \
    21901889 qmail-rspawn.c qmail-send.c qmail-showctl.c qmail-smtpd.c \
     
    21951894 except.c bouncesaying.c condredirect.c maildirmake.c maildir2mbox.c \
    21961895 maildirwatch.c splogger.c qail.sh elq.sh pinq.sh qmail-upq.sh \
    2197 @@ -1813,8 +2048,9 @@
     1896@@ -1813,8 +2056,9 @@
    21981897 trywaitp.c sig.h sig_alarm.c sig_block.c sig_catch.c sig_pause.c \
    21991898 sig_pipe.c sig_child.c sig_term.c sig_hup.c sig_misc.c sig_bug.c \
     
    22071906 getln.h getln.c getln2.3 getln2.c sgetopt.3 sgetopt.h sgetopt.c \
    22081907 subgetopt.3 subgetopt.h subgetopt.c error.3 error_str.3 error_temp.3 \
    2209 @@ -1824,10 +2060,11 @@
     1908@@ -1824,10 +2068,11 @@
    22101909 headerbody.h headerbody.c token822.h token822.c control.h control.c \
    22111910 datetime.3 datetime.h datetime.c datetime_un.c prioq.h prioq.c \
     
    22211920        chmod 400 shar
    22221921 
    2223 @@ -1897,6 +2134,23 @@
     1922@@ -1897,6 +2142,23 @@
    22241923        ./chkspawn
    22251924        ./compile spawn.c
     
    22451944 load splogger.o substdio.a error.a str.a fs.a syslog.lib socket.lib
    22461945        ./load splogger substdio.a error.a str.a fs.a  `cat \
    2247 @@ -1911,13 +2165,33 @@
     1946@@ -1911,13 +2173,33 @@
    22481947 scan.h fmt.h
    22491948        ./compile splogger.c
     
    22851984 str_chr.o: \
    22861985 compile str_chr.c str.h
    2287 @@ -1927,6 +2201,10 @@
     1986@@ -1927,6 +2209,10 @@
    22881987 compile str_cpy.c str.h
    22891988        ./compile str_cpy.c
     
    22961995 compile str_diff.c str.h
    22971996        ./compile str_diff.c
    2298 @@ -2006,6 +2284,11 @@
     1997@@ -2006,6 +2292,11 @@
    22991998 compile strerr_sys.c error.h strerr.h
    23001999        ./compile strerr_sys.c
     
    23082007 compile subfderr.c readwrite.h substdio.h subfd.h substdio.h
    23092008        ./compile subfderr.c
    2310 @@ -2066,11 +2349,11 @@
     2009@@ -2066,11 +2357,11 @@
    23112010 
    23122011 tcp-env: \
     
    23242023 
    23252024 tcp-env.0: \
    2326 @@ -2108,6 +2391,19 @@
     2025@@ -2108,6 +2399,19 @@
    23272026 compile timeoutwrite.c timeoutwrite.h select.h error.h readwrite.h
    23282027        ./compile timeoutwrite.c
     
    23442043 compile token822.c stralloc.h gen_alloc.h alloc.h str.h token822.h \
    23452044 gen_alloc.h gen_allocdefs.h
    2346 @@ -2139,3 +2435,165 @@
     2045@@ -2139,3 +2443,173 @@
    23472046 wait_pid.o: \
    23482047 compile wait_pid.c error.h haswaitp.h
     
    24642163+       > dk-filter
    24652164+
    2466 +DKIMHDRS = dkim.h dkimdns.h dkimbase.h dkimsign.h dkimverify.h
     2165+DKIMHDRS = dkim.h dkimdns.h dkimbase.h dkimsign.h dkimverify.h time_t_size.h
    24672166+DKIMSRCS = dkimfuncs.cpp dkimbase.cpp
    24682167+DKIMOBJS = $(DKIMSRCS:.cpp=.o)
    2469 +dkim : libdkim.a dkim.o dkimdns.o
     2168+dkim: libdkim.a dkim.o dkimdns.o
    24702169+       g++ -o dkim $(LFLAGS) -L. dkim.o dkimdns.o libdkim.a `cat dns.lib` -lcrypto
    24712170+
    2472 +dkimverify.o: dkim.h dkimdns.h dkimverify.h dkimverify.cpp
    2473 +       g++ -DHAVE_CONFIG_H -c dkimverify.cpp
     2171+time_t_size.h: time_t_size.c compile load
     2172+       (./compile time_t_size.c && ./load time_t_size && \
     2173+               ./time_t_size) > time_t_size.h
     2174+       rm -f time_t_size.o time_t_size
     2175+
     2176+dkimfuncs.o: dkimfuncs.cpp time_t_size.h
     2177+       g++ -DHAVE_EVP_SHA256 -c dkimfuncs.cpp
     2178+
     2179+dkimverify.o: dkim.h dkimdns.h dkimverify.h dkimverify.cpp time_t_size.h
     2180+       g++ -DHAVE_EVP_SHA256 -c dkimverify.cpp
    24742181+
    24752182+dkimsign.o: dkim.h dkimsign.h dkimsign.cpp
    2476 +       g++ -DHAVE_CONFIG_H -c dkimsign.cpp
     2183+       g++ -DHAVE_EVP_SHA256 -c dkimsign.cpp
    24772184+
    24782185+dkim.o: dkim.c $(DKIMHDRS)
    2479 +       g++ -DHAVE_CONFIG_H -I. -DHAVE_EVP_SHA256 -c dkim.c
    2480 +
    2481 +libdkim.a: $(DKIMOBJS) dkimverify.o dkimsign.o makelib
     2186+       g++ -DHAVE_EVP_SHA256 -I. -DHAVE_EVP_SHA256 -c dkim.c
     2187+
     2188+libdkim.a: $(DKIMOBJS) dkimverify.o dkimsign.o makelib time_t_size.h
    24822189+       rm -f libdkim.a
    24832190+       ./makelib libdkim.a $(DKIMOBJS) dkimsign.o dkimverify.o
    24842191+.cpp.o:
    2485 +       g++ -I. -DHAVE_CONFIG_H $(CFLAGS) $(INCL) -c $<
     2192+       g++ -I. -DHAVE_EVP_SHA256 $(CFLAGS) $(INCL) -c $<
    24862193+
    24872194+cert cert-req: \
     
    25122219diff -ruN ../netqmail-1.06-original/Makefile-cert.mk netqmail-1.06/Makefile-cert.mk
    25132220--- ../netqmail-1.06-original/Makefile-cert.mk  1970-01-01 01:00:00.000000000 +0100
    2514 +++ netqmail-1.06/Makefile-cert.mk      2016-11-22 21:03:57.103528399 +0100
     2221+++ netqmail-1.06/Makefile-cert.mk      2019-02-27 20:57:13.379025191 +0100
    25152222@@ -0,0 +1,21 @@
    25162223+cert-req: req.pem
     
    25352242+       @echo "Send req.pem to your CA to obtain signed_req.pem, and do:"
    25362243+       @echo "cat signed_req.pem >> QMAIL/control/servercert.pem"
     2244diff -ruN ../netqmail-1.06-original/README.PATCH netqmail-1.06/README.PATCH
     2245--- ../netqmail-1.06-original/README.PATCH      1970-01-01 01:00:00.000000000 +0100
     2246+++ netqmail-1.06/README.PATCH  2020-07-29 21:22:44.084295087 +0200
     2247@@ -0,0 +1,547 @@
     2248+v. 2020.07.29
     2249+Combined patch for netqmail-1.06 by Roberto Puzzanghera [roberto dot puzzanghera at sagredo dot eu]
     2250+More info at https://notes.sagredo.eu/en/qmail-notes-185/patching-qmail-82.html
     2251+==========================================================================================================
     2252+
     2253+= This patch puts together
     2254+* Erwin Hoffmann's qmail-authentication patch v. 0.8.3, which updates the patches provided by
     2255+  Krysztof Dabrowski and Bjoern Kalkbrenner.
     2256+  It provides cram-md5, login, plain authentication support for qmail-smtpd and qmail-remote.
     2257+  http://www.fehcom.de/qmail/smtpauth.html##PATCHES
     2258+* Frederik Vermeulen's qmail-tls patch v. 20200107
     2259+  implements SSL or TLS encrypted and authenticated SMTP.
     2260+  http://inoa.net/qmail-tls/
     2261+  The file update_tmprsadh was modified to chown all .pem files to vpopmail.
     2262+* Marcel Telka's force-tls patch v. 2016.05.15
     2263+  optionally gets qmail to require TLS before authentication to improve security.
     2264+  You have to declare FORCETLS=0 if you want to allow the auth without TLS
     2265+  https://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/roberto-netqmail-1.06_force-tls.patch-2012.10.28
     2266+* Antonio Nati's chkuser patch v. 2.0.9
     2267+  performs, among the other things, a check for the existence of recipients during the SMTP conversation,
     2268+  bouncing emails of fake senders.
     2269+  http://www.interazioni.it/opensource/chkuser/
     2270+* Flavio Curti's qmail-queue-custom-error patch
     2271+  enables simscan and qmail-dkim to return the appropriate message for each e-mail it refuses to deliver.
     2272+  https://no-way.org/uploads/qmail-error/
     2273+* Christophe Saout's qmail-SPF rc5 patch
     2274+  Modified by Manvendra Bhangui to make it IPv4-mapped IPv6 addresses compliant.
     2275+  checks incoming mails inside the SMTP daemon, add Received-SPF lines and optionally block undesired transfers.
     2276+  http://www.saout.de/misc/spf/
     2277+* Marcelo Coelho's qmail-SRS patch
     2278+  implements Sender Rewriting Scheme fixing SPF break upon email forwarding.
     2279+  http://www.mco2.com.br/opensource/qmail/srs/
     2280+* Christopher K. Davis' oversize dns patch
     2281+  enables qmail to handle large DNS packets.
     2282+  http://www.ckdhr.com/ckd/qmail-103.patch
     2283+* Jul's reread-concurrency v.2 patch
     2284+  rereads control/concurrencylocal and control/concurrencyremote files when qmail-send receives a HUP signal.
     2285+  http://js.hu/package/qmail/index.html
     2286+* Johannes Erdfelt's Big Concurrency patch
     2287+  sets the spawn limit above 255
     2288+  http://qmail.org/big-concurrency.patch
     2289+* Mihai Secasiu's Big Concurrency fix v.1.0 patch
     2290+  fixes a compiler error if you set concurrency higher than 509 in conf-spawn.
     2291+  http://patchlog.com/linux/qmail-big-concurrency/
     2292+* Bill Shupp's netqmail-maildir++.patch
     2293+  adds maildirquota support to qmail-pop3d and qmail-local.
     2294+  Fixed a bug where the filesize part of the S=<filesize> component of the Maildir++ compatible filename
     2295+  is wrong (tx MG). More info here:
     2296+  https://notes.sagredo.eu/en/qmail-notes-185/installing-dovecot-and-sieve-on-a-vpopmail-qmail-server-28.html#comment995
     2297+  https://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/netqmail-maildir.patch
     2298+* Kyle B. Wheeler's "Better qmail-smtpd Logging" v.5 patch
     2299+  facilitates diagnostics of qmail-smtpd logging its actions and decisions (search for a line with qmail-smtp:)
     2300+  http://www.memoryhole.net/qmail/#logging
     2301+* John Simpson's (?) Greeting delay patch
     2302+  adds a user-definable delay after SMTP clients have initiated SMTP sessions, prior to qmail-smtpd responding
     2303+  with "220 ESMTP". It can reject connections from clients which tried to send commands before greeting.
     2304+  https://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/qmail-greetdelay.patch
     2305+* Manvendra Bhangui's DKIM and SURBL filter v.1.28 patch
     2306+  adds DKIM signing & verification and SURBL filtering support to qmail.
     2307+  qmail-dk is based on Russ Nelson's patch: http//:www.qmail.org/qmail-1.03-dk-0.54.patch
     2308+  qmail-dkim uses hacked libdkim libraries from libdkim project at http://libdkim.sourceforge.net/
     2309+  surbfilter is built on djb functions and some functions have been ruthlessly borrowed from qmail surbl
     2310+  interface by Pieter Droogendijk and the surblhost program at http://surblhost.sourceforge.net/
     2311+  (file hier.c modified to chown /var/qmail/control/cache and subdirs to vpopmail)
     2312+  http://sourceforge.net/projects/indimail/files/netqmail-addons/qmail-dkim-1.0/
     2313+  http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/ANNOUNCE.surblfilter
     2314+* Claudio Jeker and Andre Oppermann's EXTTODO patch (release 5. Jan. 2003)
     2315+  addresses a problem known as the silly qmail (queue)  problem
     2316+  http://www.nrg4u.com/qmail/ext_todo-20030105.patch
     2317+* Russell Nelson's big-todo patch
     2318+  makes qmail use a hashing mechanism in the todo folder similar to that used in the rest of the queue
     2319+  http://www.qmail.org/big-todo.103.patch
     2320+* Stephane Cottin's qmail-inject-null-sender patch (let's call it in this way)
     2321+  prevents qmail-inject from rewriting the null sender, fixing an issue with sieve vacation/reject messages.
     2322+  More info here: http://www.dovecot.org/list/dovecot/2009-June/040811.html
     2323+  https://notes.sagredo.eu/files/qmail/patches/qmail-inject-null-sender.patch
     2324+* Russell Nelson's (modified by Charles Cazabon) doublebounce-trim patch, which updates the original
     2325+  version by Russel Nelson
     2326+  prevents double bounces from hitting your queue a second time provided that you delete the first line
     2327+  from /var/qmail/control/doublebounceto
     2328+  http://qmail.org/doublebounce-trim.patch
     2329+* Will Harris' esmtp-size patch
     2330+  enables qmail-smtpd to reject messages if they're larger than the maximum number of bytes allowed
     2331+  according to the /var/qmail/control/databytes control file.
     2332+  http://will.harris.ch/qmail-smtpd.c.diff
     2333+* Inter7's qmail-taps-extended patch
     2334+  http://notes.sagredo.eu/files/qmail/patches/qmail-tap.diff
     2335+  Extended by Michai Secasiu (http://patchlog.com/patches/qmail-taps-extended/)
     2336+  Provides the ability to archive each email that flows through the system.
     2337+  Archiving only messages from or to certain email addresses is possible as well.
     2338+* Rolf Eike Beer's qmail-remote CRLF patch
     2339+  enables qmail-remote to handle CR properly, always sending the line breaks as CRLF and avoiding to
     2340+  double the CR (like qmail-remote normally does)
     2341+  http://opensource.sf-tec.de/qmail/
     2342+* Andy Repton's outgoingip patch (adjusted by Sergio Gelato)
     2343+  by default all outgoing emails are sent through the first IP address on the interface. In case of a multiple
     2344+  IP server this patch makes qmail send outgoing emails with the IP eventually stored in control/outgoingip.
     2345+  The ehlo domain is NOT modified by this patch.
     2346+  http://www.qmail.org/outgoingip.patch
     2347+  Robbie Walker provided a patch to correct qmail-qmqpc.c's call to timeoutconn(), because the function
     2348+  signature was modified by the original outgoingip patch
     2349+  https://notes.sagredo.eu/en/qmail-notes-185/patching-qmail-82.html#comment373
     2350+* Iain Patterson's qmail-smtpd pid, qp log patch
     2351+  makes qmail-smtpd log a line similar to the following:
     2352+  @4000000039b89c95026a89b4 mail recv: pid 8155 from <name@domain.xy> qp 8157
     2353+  The pid allows you to match the message up with a given tcpserver process and the qp lets you find a
     2354+  particular delivery.
     2355+  http://iain.cx/qmail/patches.html#smtpd_pidqp
     2356+* Jonathan de Boyne Pollard's any-to-cname patch
     2357+  avoids qmail getting large amounts of DNS data we have no interest in and that may overflow our response
     2358+  buffer.
     2359+  http://www.memoryhole.net/qmail/#any-to-cname
     2360+* Matthias Andree's qmail-rfc2821 patch
     2361+  makes qmail rfc2821 compliant
     2362+  http://www-dt.e-technik.uni-dortmund.de/~ma/qmail/patch-qmail-1.03-rfc2821.diff
     2363+* Jonathan de Boyne Pollard's smtpd-502-to-500 patch
     2364+  makes qmail rfc2821 compliant
     2365+  https://notes.sagredo.eu/files/qmail/patches/smtpd-502-to-500.patch
     2366+* Fabio Busatto's qmail-dnsbl patch
     2367+  allows you to reject spam and virus looking at the sender's ip address.
     2368+  Modified by Luca Franceschini to add support for whitelists, TXT and A queries, configurable return codes
     2369+  451 or 553 with custom messages
     2370+  http://qmail-dnsbl.sourceforge.net/
     2371+* Scott Gifford's qmail-moreipme patch v. 0.6
     2372+  prevents a problem caused by an MX or other mail routing directive instructing qmail to connect to
     2373+  itself without realizing it's connecting to itself, saving CPU time.
     2374+  http://www.suspectclass.com/sgifford/qmail/qmail-1.03-moreipme.README
     2375+  http://www.suspectclass.com/sgifford/qmail/qmail-1.03-moreipme-0.6.patch
     2376+* Alex Nee's qmail-hide-ip-headers patch
     2377+  It will hide your Private or Public IP in the email Headers when you are sending Mail as a Relay Client.
     2378+  https://notes.sagredo.eu/files/qmail/patches/qmail-hide-ip-headers.patch
     2379+* John Saunders' qmail-date-localtime patch
     2380+  causes the various qmail programs to generate date stamps in the local timezone.
     2381+  https://notes.sagredo.eu/files/qmail/patches/qmail-date-localtime.patch
     2382+* Dean Gaudet's qmail-liberal-lf patch v. 0.95
     2383+  allow qmail-smtpd to accept messages that are terminated with a single \n instead of the required \r\n
     2384+  sequence.
     2385+  http://www.arctic.org/~dean/patches/qmail-0.95-liberal-lf.patch
     2386+* Michael Samuel's maxrcpt patch
     2387+  allows you to set a limit on how many recipients are specified for any one email message by setting
     2388+  control/maxrcpt. RFC 2821 section 4.5.3.1 says that an MTA MUST allow at least 100 recipients for each
     2389+  message, since this is one of the favourite tricks of the spammer.
     2390+  http://copilotco.com/mail-archives/qmail.1997/msg03066.html
     2391+* Inter7's qmail-eMPF patch
     2392+  More info: http://www.qmailwiki.org/EMPF
     2393+  eMPF follows a set of administrator-defined rules describing who can message whom.  With this,
     2394+  companies can segregate various parts of their organizations email activities, as well as provide a
     2395+  variety of security-enhancing services.
     2396+* qregex (by  Andrew St. Jean http://www.arda.homeunix.net/downloads-qmail/, contributors: Jeremy Kitchen,
     2397+  Alex Pleiner,
     2398+  Thanos Massias. Original patch by Evan Borgstrom)
     2399+  adds the ability to match address evelopes via Regular Expressions (REs) in the qmail-smtpd process.
     2400+  Added new control file 'badhelonorelay', control/badmailto renamed control/badrcptto (Tx Luca Franceschini).
     2401+* brtlimit
     2402+  Luca Franceschini derived this patch from http://netdevice.com/qmail/patch/goodrcptto-12.patch
     2403+  added control/brtlimit and BRTLIMIT variable to limit max invalid recipient errors before closing
     2404+  the connection (man qmail-control)
     2405+* validrcptto
     2406+  https://notes.sagredo.eu/files/qmail/patches/validrcptto.README
     2407+  Luca Franceschini grabbed the code from several patches with additional features:
     2408+  http://qmail.jms1.net/patches/validrcptto cdb.shtml,
     2409+  http://netdevice.com/qmail/patch/goodrcptto-ms-12.patch, http://patch.be/qmail/badrcptto.html
     2410+  It works in conjunction with chkuser with both cdb and mysql accounts.
     2411+* reject-relay-test by Russell Nelson
     2412+  http://qmail.org/qmail-smtpd-relay-reject
     2413+  It gets qmail to reject relay probes generated by so-called anti-spammers. These relay probes have
     2414+  '!', '%' and '@' in the local (username) part of the address.
     2415+* Luca Franceschini
     2416+  added DISABLETLS environment variable, useful if you want to disable TLS on a desired port
     2417+  added FORCEAUTHMAILFROM environment variable to REQUIRE that authenticated user and 'mail from' are identical
     2418+  added SMTPAUTHMETHOD, SMTPAUTHUSER and SMTP_AUTH_USER env variables for external plugins (see
     2419+  http://qmail-spp.sourceforge.net/doc/)
     2420+* fixed little bug in 'mail from' address handling
     2421+  patch by Andre Opperman at http://qmail.cr.yp.narkive.com/kBry6GJl/bug-in-qmail-smtpd-c-addrparse-function
     2422+* Luca Franceschini's qlog patch
     2423+  smtpd logging with fixed format. An entry 'qlogenvelope' is generated after accepting or rejecting
     2424+  every recipients in the envelope phase.
     2425+* Luca Franceschini's reject null senders patch
     2426+  useful in special cases if you temporarily need to reject the null sender (although breaks RFC compatibility).
     2427+  You just need to put 1 (actually any number different from 0) in your control/rejectnullsenders to reject
     2428+  the null sender with 421 error message.
     2429+* dnscname patch
     2430+  Removes CNAME check in order to avoid getting large amounts of data of no interest in and that may
     2431+  overflow the response buffer.
     2432+  https://lists.gt.net/qmail/users/138190
     2433+* Luca Franceschini's rcptcheck patch
     2434+  (based on original patch from Jay Soffian (http://www.soffian.org/downloads/qmail/qmail-smtpd-doc.html)
     2435+  Originally designed for the purpose of receipt validation, it can also be used to limit the numbr of
     2436+  email a given IP and/or auth-user and/or domain can send in a given time interval. It has to be used
     2437+  in conjuction with the rcptcheck-overlimit.sh LF's script
     2438+  https://notes.sagredo.eu/files/qmail/rcptcheck-overlimit.sh
     2439+  https://notes.sagredo.eu/files/qmail/patches/rcptcheck.patch
     2440+* Reed Sandberg's qmail-channels patch
     2441+  Allows you to add an arbitrary number of supplemental remote queues, each distinguished by a list of
     2442+  recipient domains and separate throttling (concurrency) capabilities. This patch also allows dynamic
     2443+  throttling of the concurrency control files so you can just send qmail-send a HUP signal instead of
     2444+  restarting the service every time.
     2445+  This patch is useful when some email providers complain of too many emails receveid at the same time
     2446+  (in case of news letters for instance). Look here for more info
     2447+  https://notes.sagredo.eu/en/qmail-notes-185/patching-qmail-82.html#comment1328
     2448+  Edit conf-channels before compiling: Total number of channels (queues) available for delivery. Must be at
     2449+  least 2, and anything above 2 are considered supplemental channels.
     2450+  http://www.thesmbexchange.com/eng/qmail-channels_patch.html
     2451+* Endersys R&D team's qmail-remote-logging patch
     2452+  gets qmail-remote to log sender, recipient and IP adddress all together in the "Delivery success/failure" line
     2453+  https://web.archive.org/web/20120530051612/http://blog.endersys.com/2009/12/qmail-canonicalised-recipient-logging-and-more-patch/
     2454+* notqmail.org's cve-2005-1513 patch
     2455+  addresses a vulnerability issue spotted by Georgi Guninski in 2005
     2456+  https://www.qualys.com/2020/05/19/cve-2005-1513/remote-code-execution-qmail.txt
     2457+
     2458+= Disclaimer
     2459+This patch comes with the usual warranty: it works for me, it may not work for you,
     2460+use at your own risk etc. etc. :)
     2461+Comments, suggestions, criticisms are always welcome!
     2462+
     2463+= Usage
     2464+
     2465+* Install libdomainkeys
     2466+wget https://notes.sagredo.eu/files/qmail/tar/libdomainkeys-0.69.tar.gz
     2467+tar xzf libdomainkeys-0.69.tar.gz
     2468+wget https://notes.sagredo.eu/files/qmail/patches/libdomainkeys/libdomainkeys-openssl-1.1.patch
     2469+wget https://notes.sagredo.eu/files/qmail/patches/libdomainkeys-0.69.diff
     2470+cd libdomainkeys-0.69
     2471+chown -R root.root .
     2472+patch -p1 < ../libdomainkeys-openssl-1.1.patch
     2473+patch < ../libdomainkeys-0.69.diff
     2474+make
     2475+cp libdomainkeys.a /usr/lib
     2476+
     2477+* Install libsrs2
     2478+wget https://notes.sagredo.eu/files/qmail/tar/libsrs2-1.0.18.tar.gz
     2479+tar xzf libsrs2-1.0.18.tar.gz
     2480+cd libsrs2-1.0.18
     2481+./configure
     2482+make
     2483+make install
     2484+ldconfig
     2485+cd ../
     2486+
     2487+* Apply the patch and compile
     2488+wget https://notes.sagredo.eu/files/qmail/patches/roberto-netqmail-1.06.patch-latest.gz
     2489+wget http://qmail.org/netqmail-1.06.tar.gz
     2490+tar xzf netqmail-1.06.tar.gz
     2491+cd netqmail-1.06
     2492+chown -R root.root .
     2493+gunzip -c ../roberto-netqmail-1.06.patch-latest.gz | patch
     2494+make
     2495+make setup check
     2496+
     2497+* You have to export SMTPAUTH in your run file if you want to do the auth
     2498+
     2499+* You have to export SURBL=1 in your run file if you want to enable SURBL
     2500+
     2501+* /var/qmail/control/cache must be owned by the user who runs qmail-smtpd, vpopmail.vchkpwd in my case.
     2502+  Change the permissions according to your qmail configuration.
     2503+
     2504+=================================================================================================================
     2505+
     2506+= Changelog
     2507+
     2508+2020.07.29
     2509+-dk-filter: corrected a bug where dk-filter was using DKIMDOMAIN unconditionally. Now it uses DKIMDOMAIN
     2510+ only if _SENDER is null (tx Manvendra Bhangui).
     2511+
     2512+2020.07.27
     2513+-added cve-2005-1513 patch
     2514+
     2515+2020.04.25
     2516+-qmail-smtpd.c: added rcptcount = 0; in smtp_rset function to prevent the maxrcpto error if control/maxrcpt limit
     2517+ has been exceeded in multiple messages sent sequentially rather than in a single mail (tx Alexandre Fonceca).
     2518+ More info here: https://notes.sagredo.eu/en/qmail-notes-185/patching-qmail-82.html#comment1594
     2519+
     2520+2020.04.16
     2521+-qmail-remote-logging patch added
     2522+
     2523+2020.04.10
     2524+-DKIM patch updated to v. 1.28
     2525+ * outgoing messages from null sender ("<>") will be signed as well with the domain in env variable DKIMDOMAIN
     2526+ * declaring NODK env variable disables old domainkeys signature, while defining NODKIM disables DKIM.
     2527+
     2528+2020.01.11
     2529+-qmail-tls patch updated to v. 20200107
     2530+ * working client cert authentication with TLSv1.3 (Rolf Eike Beer)
     2531+
     2532+2019.12.08
     2533+-BUG qmail-smtpd.c: now TLS is defined before chkuser.h call, to avoid errors on closing the db connection
     2534+ (tx ChangHo.Na https://notes.sagredo.eu/en/qmail-notes-185/patching-qmail-82.html#comment1469)
     2535+
     2536+2019.07.12
     2537+-qmail-channels patch added
     2538+ more info here http://www.thesmbexchange.com/eng/qmail-channels_patch.html
     2539+-improved verbosity of die_read function in qmail-smtpd.c (qmail-smtpd: read failure)
     2540+ more info here https://notes.sagredo.eu/files/qmail/patches/roberto-netqmail-1.06/die_read.patch
     2541+
     2542+2019.06.19
     2543+-DKIM patch updated to v. 1.26
     2544+ * BUG - honor body length tag in verification
     2545+
     2546+2019.05.24
     2547+-qmail-tls updated to v. 20190517
     2548+ * bug: qmail-smtpd ssl_free before tls_out error string (K. Wheeler)
     2549+
     2550+2019.05.23
     2551+-DKIM patch updated to v. 1.25
     2552+ * SIGSEGV - when the txt data for domainkeys is very large exposed a bug in the way realloc() was used incorrectly.
     2553+ * On 32 bit systems, variable defined as time_t overflows. Now qmail-dkim will skip expiry check in such conditions.
     2554+
     2555+2019.04.25
     2556+-bug fixed on qmail-smtpd.c: it was selecting the wrong openssl version on line 2331 (tx ChangHo.Na)
     2557+
     2558+2019.04.09
     2559+-qmail-tls updated to v. 20190408
     2560+ * make compatible with openssl 1.1.0 (Rolf Eike Beer, Dirk Engling, Alexander Hof)
     2561+ * compiler warnings on char * casts (Kai Peter)
     2562+
     2563+2019.03.22
     2564+-fixed a bug causing crashes with qmail-remote when using openssl-1.1 (tx Luca Franceschini)
     2565+(https://notes.sagredo.eu/files/qmail//patches//roberto-netqmail-1.06/2019.03.22-fix.patch)
     2566+
     2567+2019.02.13
     2568+-Port to openssl-1.1
     2569+-DKIM patch updated to v. 1.24
     2570+ * bug fix: restored signaturedomains/nosignaturedomains functionalities.
     2571+
     2572+2018.08.25
     2573+-DKIM patch updated to v. 1.23
     2574+ * fixed a bug where including round brackets in the From: field ouside the double quotes, i.e.
     2575+   From: "Name Surname (My Company)" <name.surname@company.com>, results in a DKIMContext structure invalid
     2576+   error (tx Mirko Buffoni).
     2577+ * qmail-dkim and dkim were issuing a failure for emails which had multiple signature with at least one good
     2578+   signature. Now qmail-dkim and dkim will issue a success if at least one good signature is found.
     2579+
     2580+2018.08.23
     2581+-logging patch
     2582+ * fixed a bug in logit and logit2 functions where after a RSET command and a subsequent brutal quit
     2583+   of the smtp conversation '^]' by the client cause a segfault (tx Mirko Buffoni, more info here
     2584+   https://notes.sagredo.eu/en/qmail-notes-185/patching-qmail-82.html#comment1132)
     2585+-patch info moved to 'README.PATCH' file
     2586+
     2587+2018.04.03
     2588+-DKIM patch updated to v. 1.22
     2589+ * openssl 1.1.0 port
     2590+ * various improvements, bug fixes
     2591+
     2592+2018.01.10
     2593+-maildir++
     2594+ * fixed a bug where the filesize part of the S=<filesize> component of the Maildir++ compatible filename
     2595+   is wrong (tx MG). More info here: http://notes.sagredo.eu/en/qmail-notes-185/installing-dovecot-and-sieve-on-a-
     2596+vpopmail-qmail-server-28.html#comment995
     2597+-qmail-queue-extra
     2598+ * removed, because it was causing more problems than advantages, as the domain of the log@yourdomain.tld
     2599+   had to match the system domain inside control/me and shouldn't be a virtual domain as well.
     2600+
     2601+2017.10.11 (tx Luca Franceschini)
     2602+-qlogfix
     2603+ * log strings should terminate with \n to avoid trailing ^M using splogger
     2604+ * bug reporting custom errors from qmail-queue in qlog
     2605+-added dnscname patch
     2606+-added rcptcheck patch
     2607+
     2608+2017.08.18
     2609+-qmail-smtpd now retains authentication upon rset
     2610+ (tx to Andreas http://notes.sagredo.eu/qmail-notes-185/smtp-auth-qmail-tls-forcetls-patch-for-qmail-84.html#comme
     2611+nt750)
     2612+
     2613+2017-05-14
     2614+-DKIM patch updated to v. 1.20
     2615+ It now manages long TXT records, avoiding the rejection of some hotmail.com messages.
     2616+
     2617+2016-12-19
     2618+-Several new patches and improvements added (thanks to Luca Franceschini)
     2619+More info here http://notes.sagredo.eu/node/178
     2620+ -qregex patch
     2621+ -brtlimit patch
     2622+ -validrcptto patch
     2623+ -rbl patch (updates qmail-dnsbl patch)
     2624+ -reject-relay-test patch
     2625+ -added DISABLETLS environment variable, useful if you want to disable TLS on a desired port
     2626+ -added FORCEAUTHMAILFROM environment variable to REQUIRE that authenticated user and 'mail from' are identical
     2627+ -fixed little bug in 'mail from' address handling (patch by Andre Opperman at http://qmail.cr.yp.narkive.com/kBry
     2628+  6GJl/bug-in-qmail-smtpd-c-addrparse-function)
     2629+ -added SMTPAUTHMETHOD, SMTPAUTHUSER and SMTP_AUTH_USER env variables for external plugins
     2630+ -qlog patch
     2631+ -reject null senders patch
     2632+ -bouncecontrolmime patch
     2633+ -qmail-taps-extended (updates qmail-tap)
     2634+
     2635+2016-12-02
     2636+-fixed BUG in qmail-remote.c: in case of remote server who doesn't allow EHLO the response for an alternative
     2637+ HELO was checked twice, making the connection to die. (Thanks to Luca Franceschini)
     2638+ Patch applied: http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/fix_sagredo_remotehelo.patch
     2639+
     2640+2016-09-19
     2641+-qmail-tls patch updated to v. 20160918
     2642+  * bug: qmail-remote accepting any dNSName, without checking that is matches (E. Surovegin)
     2643+  * bug: documentation regarding RSA and DH keys (K. Peter, G. A. Bofill)
     2644+
     2645+2016-05-15
     2646+-force-tls patch improved (a big thanks to Marcel Telka). Now qmail-smtpd avoids to write the auth verb if the
     2647+ the STARTTLS command was not sent by the client
     2648+
     2649+2016-03-09
     2650+-DKIM patch upgraded to v. 1.19
     2651+ * verification will not fail when a dkim signature does not include the subject provided that the
     2652+   UNSIGNED_SUBJECT environment variable is declared.
     2653+
     2654+2015-12-26
     2655+-qmail-tls patch updated to v. 20151215
     2656+ * typo in #if OPENSSL_VERSION_NUMBER for 2015-12-08 patch release (V. Smith)
     2657+ * add ECDH to qmail-smtpd
     2658+ * increase size of RSA and DH pregenerated keys to 2048 bits
     2659+ * qmail-smtpd sets RELAYCLIENT if relaying allowed by cert
     2660+ more info at http://inoa.net/qmail-tls/
     2661+
     2662+2015-12-15
     2663+-DKIM patch by Manvendra Bhangui updated to v. 1.18
     2664+
     2665+2015-10-03
     2666+-qmail-authentication: updated to v. 0.8.3
     2667+
     2668+2015-08-08
     2669+-fixed a bug on qmail-remote.c that was causing the sending of an additionale ehlo greeting (thanks to Cristoph Gr
     2670+over)
     2671+
     2672+2015-04-11
     2673+-qmail-authentication: updated to v. 0.8.2
     2674+-qmail-tls: upgraded to v. 20141216 (POODLE vulnerability fixed)
     2675+
     2676+2015-03-28
     2677+-added qmail-eMPF patch
     2678+
     2679+2014-11-19
     2680+-security fix: the SSLv3 connection is now switched off
     2681+
     2682+2014-11-15
     2683+-modified the QUEUE_EXTRA variable in extra.h to improve the qmail-send's log
     2684+
     2685+2014-04-14
     2686+-added maxrcpt patch
     2687+
     2688+2014-03-10
     2689+-added qmail-0.95-liberal-lf patch
     2690+
     2691+2013-12-30
     2692+-added qmail-srs
     2693+-the character "=" is now considered valid in the sender address by chkuser in order to accept SRS
     2694+
     2695+2013-12-18
     2696+-added qmail-date-localtime patch
     2697+
     2698+2013-12-14
     2699+-added qmail-hide-ip patch
     2700+
     2701+2013-12-10
     2702+-the original greetdelay by e.h. has been replaced with the improved patch by John Simpson. Now
     2703+ communications trying to send commands before the greeting will be closed. Premature disconnections will be
     2704+ logged as well.
     2705+-CHKUSER_SENDER_FORMAT enabled to reject fake senders without any domain declared (like <foo>)
     2706+-chkuser logging: I slightly modified the log line adding the variables' name just to facilitate its interpretation
     2707+-added qmail-moreipme patch
     2708+
     2709+2013-12-07
     2710+-added qmail-dnsbl patch
     2711+
     2712+2013-12-05
     2713+-added two patches to make qmail rfc2821 compliant
     2714+
     2715+2013-11-23
     2716+-added any-to-cname patch
     2717+
     2718+2013-09-27
     2719+-DKIM patch upgraded to v. 1.17. Defined -DHAVE_SHA_256 while compiling dkimverify.cpp in the Makefile.
     2720+ This solved an issue while verifying signatures using sha256.
     2721+
     2722+2013-09-16
     2723+-Minor fixes to the DKIM patch.
     2724+
     2725+2013-09-13
     2726+-DKIM patch upgraded to v. 1.16. The signing at qmail-remote level has been revised by its author.
     2727+
     2728+2013-08-25
     2729+-qmail-qmqpc.c call to timeoutconn() needed a correction because the function signature was modified by the
     2730+ outgoingip patch. Thanks to Robbie Walker (diff here http://notes.sagredo.eu/node/82#comment-373)
     2731+
     2732+2013-08-21
     2733+-fixed a bug in hier.c which caused the installation not to build properly the queue/todo dir structure (thanks to
     2734+ Scott Ramshaw)
     2735+
     2736+2013-08-18
     2737+-DKIM-SURBL patch by Manvendra Bhangui updated to v. 1.14
     2738+
     2739+2013-08-12
     2740+-DKIM patch upgraded to v. 1.12. The new patch adds surblfilter functionality.
     2741+-added qmail-smtpd pid, qp log patch
     2742+
     2743+2013-08-08
     2744+-qmail-SPF modified by Manvendra Bhangui to make it IPv6-mapped IPv4 addresses compliant. In order to have it
     2745+ working with such addresses you have to patch tcpserver.c accordingly. You can use a patch fot ucspi-tcp6-0.98
     2746+ by Manvendra Bhangui at http://notes.sagredo.eu/sites/notes.sagredo.eu/files/qmail/patches/tcpserver-ipv6mapped_ip
     2747+ v4.patch or wait for v. 0.99 relase of ucspi-tcp6
     2748+-added outgoingip patch
     2749+-added qmail-bounce patch
     2750+
     2751+2013-03-31
     2752+qmail-auth updated to latest v. 0.8.1 Added authentication by recipient domain for qmail-remote.
     2753+Look at README.auth for further details
     2754+
     2755+2013-02-11
     2756+some code adjustments in qmail-smtpd.c smtpd_ehlo() to restore total compatibility with esmtp-size patch
     2757+
     2758+2013-02-08
     2759+qmail-auth updated to latest v. 0.7.6. Look at README.auth for further details
     2760+
     2761+2013-01-28
     2762+fixed an issue on qmail-pop3d which was causing a double +OK after the pass command (thanks to Rakesh, Orbit
     2763+and Simplex for helping in testing and troubleshooting)
     2764+
     2765+2013-01-06
     2766+environment variable GREETDELAY renamed to SMTPD_GREETDELAY
     2767+
     2768+2012-10-31
     2769+qmail-auth updated to latest v. 0.7.5. Look at README.auth for further details
     2770+The qmail-forcetls patch was simplyfied accordingly.
     2771+You MUST export SMTPAUTH="" in your run file now.
     2772+
     2773+2012-04-25
     2774+-added qmail-remote CRLF (thanks to Pierre Lauriente for the help on testing and troubleshooting)
     2775+The qmail-remote CRLF patch solved a problem of broken headers after sieve forwarding that was
     2776+caused by a bad handling of the CR (carriage return) by qmail-remote.
     2777+The issue is also reported here http://www.dt.e-technik.uni-dortmund.de/~ma/qmail-bugs.html
     2778+
     2779+2012.04.16
     2780+-added qmail-tap
     2781+
     2782+2012.02.08
     2783+-added smtp-size patch
     2784+
     2785+2012.01.29
     2786+-added doublebounce-trim patch
     2787+
     2788+2011.12.12
     2789+-file update_tmprsadh modified to chown the .pem files to vpopmail to avoid hang-ups during the smtp
     2790+conversation on port 587 caused by permission problems.
     2791+
     2792+2011.10.06
     2793+-qmail-remote.c: fixed. It was not going into tls on authentication (thanks to Krzysztof Gajdemski)
     2794+-force-tls now quits if the starttls command is not provided when required (thanks to Jacekalex)
    25372795diff -ruN ../netqmail-1.06-original/README.auth netqmail-1.06/README.auth
    25382796--- ../netqmail-1.06-original/README.auth       1970-01-01 01:00:00.000000000 +0100
    2539 +++ netqmail-1.06/README.auth   2016-11-22 21:03:57.103528399 +0100
     2797+++ netqmail-1.06/README.auth   2019-02-27 20:57:13.379025191 +0100
    25402798@@ -0,0 +1,154 @@
    25412799+README qmail SMTP Authentication
     
    26952953diff -ruN ../netqmail-1.06-original/README.dnsbl netqmail-1.06/README.dnsbl
    26962954--- ../netqmail-1.06-original/README.dnsbl      1970-01-01 01:00:00.000000000 +0100
    2697 +++ netqmail-1.06/README.dnsbl  2016-11-30 21:50:01.459033083 +0100
     2955+++ netqmail-1.06/README.dnsbl  2019-02-27 20:57:13.379025191 +0100
    26982956@@ -0,0 +1,18 @@
    26992957+Code and logic from rblsmtpd and qmail-dnsbl patch http://qmail-dnsbl.sourceforge.net/
     
    27172975diff -ruN ../netqmail-1.06-original/README.empf netqmail-1.06/README.empf
    27182976--- ../netqmail-1.06-original/README.empf       1970-01-01 01:00:00.000000000 +0100
    2719 +++ netqmail-1.06/README.empf   2016-11-22 21:03:57.103528399 +0100
     2977+++ netqmail-1.06/README.empf   2019-02-27 20:57:13.380025180 +0100
    27202978@@ -0,0 +1,106 @@
    27212979+config file is: /var/qmail/control/policy
     
    28273085diff -ruN ../netqmail-1.06-original/README.exttodo netqmail-1.06/README.exttodo
    28283086--- ../netqmail-1.06-original/README.exttodo    1970-01-01 01:00:00.000000000 +0100
    2829 +++ netqmail-1.06/README.exttodo        2016-11-22 21:03:57.103528399 +0100
     3087+++ netqmail-1.06/README.exttodo        2019-02-27 20:57:13.380025180 +0100
    28303088@@ -0,0 +1,114 @@
    28313089+EXTTODO by Claudio Jeker <jeker@n-r-g.com> and
     
    29453203diff -ruN ../netqmail-1.06-original/README.liberal-lf netqmail-1.06/README.liberal-lf
    29463204--- ../netqmail-1.06-original/README.liberal-lf 1970-01-01 01:00:00.000000000 +0100
    2947 +++ netqmail-1.06/README.liberal-lf     2016-11-22 21:03:57.103528399 +0100
     3205+++ netqmail-1.06/README.liberal-lf     2019-02-27 20:57:13.380025180 +0100
    29483206@@ -0,0 +1,39 @@
    29493207+From dgaudet-list-qmail@arctic.org Fri Jan 17 17:50:19 1997
     
    29883246diff -ruN ../netqmail-1.06-original/README.maxrcpt netqmail-1.06/README.maxrcpt
    29893247--- ../netqmail-1.06-original/README.maxrcpt    1970-01-01 01:00:00.000000000 +0100
    2990 +++ netqmail-1.06/README.maxrcpt        2016-11-22 21:03:57.104528366 +0100
     3248+++ netqmail-1.06/README.maxrcpt        2019-02-27 20:57:13.380025180 +0100
    29913249@@ -0,0 +1,60 @@
    29923250+maxrcpt patch for qmail-smtpd
     
    30523310diff -ruN ../netqmail-1.06-original/README.moreipme netqmail-1.06/README.moreipme
    30533311--- ../netqmail-1.06-original/README.moreipme   1970-01-01 01:00:00.000000000 +0100
    3054 +++ netqmail-1.06/README.moreipme       2016-11-22 21:03:57.104528366 +0100
     3312+++ netqmail-1.06/README.moreipme       2019-02-27 20:57:13.380025180 +0100
    30553313@@ -0,0 +1,154 @@
    30563314+###########
     
    32103468diff -ruN ../netqmail-1.06-original/README.qregex netqmail-1.06/README.qregex
    32113469--- ../netqmail-1.06-original/README.qregex     1970-01-01 01:00:00.000000000 +0100
    3212 +++ netqmail-1.06/README.qregex 2016-11-22 21:04:38.822137319 +0100
     3470+++ netqmail-1.06/README.qregex 2019-02-27 20:57:13.380025180 +0100
    32133471@@ -0,0 +1,203 @@
    32143472+QREGEX (v2) 20060423 - README April 23, 2006
     
    34173675diff -ruN ../netqmail-1.06-original/README.rfc2821 netqmail-1.06/README.rfc2821
    34183676--- ../netqmail-1.06-original/README.rfc2821    1970-01-01 01:00:00.000000000 +0100
    3419 +++ netqmail-1.06/README.rfc2821        2016-11-22 21:03:57.104528366 +0100
     3677+++ netqmail-1.06/README.rfc2821        2019-02-27 20:57:13.380025180 +0100
    34203678@@ -0,0 +1,39 @@
    34213679+This patch is Copyright (C) 2002 - 2003 by Matthias Andree. License below.
     
    34603718diff -ruN ../netqmail-1.06-original/README.srs netqmail-1.06/README.srs
    34613719--- ../netqmail-1.06-original/README.srs        1970-01-01 01:00:00.000000000 +0100
    3462 +++ netqmail-1.06/README.srs    2016-11-22 21:03:57.104528366 +0100
     3720+++ netqmail-1.06/README.srs    2019-02-27 20:57:13.381025169 +0100
    34633721@@ -0,0 +1,93 @@
    34643722+qmail SRS patch
     
    35573815diff -ruN ../netqmail-1.06-original/README.surbl netqmail-1.06/README.surbl
    35583816--- ../netqmail-1.06-original/README.surbl      1970-01-01 01:00:00.000000000 +0100
    3559 +++ netqmail-1.06/README.surbl  2016-11-22 21:03:57.104528366 +0100
     3817+++ netqmail-1.06/README.surbl  2019-02-27 20:57:13.381025169 +0100
    35603818@@ -0,0 +1,34 @@
    35613819+SURBL filter for netqmail
     
    35953853diff -ruN ../netqmail-1.06-original/README.tap netqmail-1.06/README.tap
    35963854--- ../netqmail-1.06-original/README.tap        1970-01-01 01:00:00.000000000 +0100
    3597 +++ netqmail-1.06/README.tap    2016-11-22 21:04:38.822137319 +0100
     3855+++ netqmail-1.06/README.tap    2019-02-27 20:57:13.381025169 +0100
    35983856@@ -0,0 +1,34 @@
    35993857+qmail provides the ability to make a copy of each email that flows through the system.
     
    36333891diff -ruN ../netqmail-1.06-original/README.tls netqmail-1.06/README.tls
    36343892--- ../netqmail-1.06-original/README.tls        1970-01-01 01:00:00.000000000 +0100
    3635 +++ netqmail-1.06/README.tls    2016-11-22 21:03:57.104528366 +0100
    3636 @@ -0,0 +1,100 @@
    3637 +Frederik Vermeulen <qmail-tls akrul inoa.net> 20160918
     3893+++ netqmail-1.06/README.tls    2020-01-10 21:46:22.909448586 +0100
     3894@@ -0,0 +1,98 @@
     3895+Frederik Vermeulen <qmail-tls akrul inoa.net> 20200107
    36383896+http://inoa.net/qmail-tls/
    36393897+
    3640 +This patch implements RFC 3207 (was RFC 2487) in qmail.
     3898+This patch implements RFC 3207 in qmail.
    36413899+This means you can get SSL or TLS encrypted and
    36423900+authenticated SMTP between the MTAs and from MUA to MTA.
     
    36443902+many since its first release on 1999-03-21).
    36453903+
    3646 +Usage: - install OpenSSL-1.0.2 http://www.openssl.org/ or later
    3647 +         (any version since 0.9.6 is presumed to work)
    3648 +       - apply patch to netqmail-1.06 http://qmail.org/netqmail
     3904+Usage: - install OpenSSL-1.1.0 http://www.openssl.org/ or later
     3905+         (any version since 0.9.8 is presumed to work)
     3906+       - apply patch to netqmail-1.06 http://www.usenix.org.uk/mirrors/qmail/netqmail
    36493907+         The patches to qmail-remote.c and qmail-smtpd.c can be applied
    36503908+         separately.
     
    37093967+         - this patch could conflict with other patches (notably those
    37103968+           replacing \n with \r\n, which is a bad idea on encrypted links).
    3711 +         - some broken servers have a problem with TLSv1 compatibility.
    3712 +           Uncomment the line where we set the SSL_OP_NO_TLSv1 option.
    37133969+         - needs working /dev/urandom (or EGD for openssl versions >0.9.7)
    37143970+           for seeding random number generator.
     
    37373993diff -ruN ../netqmail-1.06-original/TARGETS netqmail-1.06/TARGETS
    37383994--- ../netqmail-1.06-original/TARGETS   1998-06-15 12:53:16.000000000 +0200
    3739 +++ netqmail-1.06/TARGETS       2016-11-22 21:04:20.043763470 +0100
     3995+++ netqmail-1.06/TARGETS       2019-06-26 16:45:45.017718421 +0200
    37403996@@ -1,3 +1,4 @@
    37413997+dktest
     
    38524108 qmail-local.0
    38534109 qmail-lspawn.0
    3854 @@ -382,6 +415,51 @@
     4110@@ -382,6 +415,54 @@
    38554111 addresses.0
    38564112 envelopes.0
     
    39044160+dknewkey
    39054161+dktest.8
     4162+time_t_size.h
     4163+channels.h
     4164+
    39064165diff -ruN ../netqmail-1.06-original/alloc.c netqmail-1.06/alloc.c
    39074166--- ../netqmail-1.06-original/alloc.c   1998-06-15 12:53:16.000000000 +0200
    3908 +++ netqmail-1.06/alloc.c       2016-11-22 21:03:57.105528332 +0100
    3909 @@ -1,6 +1,6 @@
     4167+++ netqmail-1.06/alloc.c       2020-07-27 13:06:47.995674192 +0200
     4168@@ -1,6 +1,7 @@
     4169+#include <limits.h>
    39104170 #include "alloc.h"
    39114171 #include "error.h"
     
    39154175 
    39164176 #define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
     4177@@ -15,6 +16,10 @@
     4178 unsigned int n;
     4179 {
     4180   char *x;
     4181+  if (n >= (INT_MAX >> 3)) {
     4182+    errno = error_nomem;
     4183+    return 0;
     4184+  }
     4185   n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
     4186   if (n <= avail) { avail -= n; return space + avail; }
     4187   x = malloc(n);
    39174188diff -ruN ../netqmail-1.06-original/base64.c netqmail-1.06/base64.c
    39184189--- ../netqmail-1.06-original/base64.c  1970-01-01 01:00:00.000000000 +0100
    3919 +++ netqmail-1.06/base64.c      2016-11-22 21:03:57.105528332 +0100
     4190+++ netqmail-1.06/base64.c      2019-02-27 20:57:13.381025169 +0100
    39204191@@ -0,0 +1,124 @@
    39214192+#include "base64.h"
     
    40454316diff -ruN ../netqmail-1.06-original/base64.h netqmail-1.06/base64.h
    40464317--- ../netqmail-1.06-original/base64.h  1970-01-01 01:00:00.000000000 +0100
    4047 +++ netqmail-1.06/base64.h      2016-11-22 21:03:57.105528332 +0100
     4318+++ netqmail-1.06/base64.h      2019-02-27 20:57:13.381025169 +0100
    40484319@@ -0,0 +1,13 @@
    40494320+#ifndef BASE64_H
     
    40624333diff -ruN ../netqmail-1.06-original/base64sub.c netqmail-1.06/base64sub.c
    40634334--- ../netqmail-1.06-original/base64sub.c       1970-01-01 01:00:00.000000000 +0100
    4064 +++ netqmail-1.06/base64sub.c   2016-11-22 21:03:57.105528332 +0100
     4335+++ netqmail-1.06/base64sub.c   2019-02-27 20:57:13.382025158 +0100
    40654336@@ -0,0 +1,170 @@
    40664337+/*
     
    42364507diff -ruN ../netqmail-1.06-original/byte.h netqmail-1.06/byte.h
    42374508--- ../netqmail-1.06-original/byte.h    1998-06-15 12:53:16.000000000 +0200
    4238 +++ netqmail-1.06/byte.h        2016-11-22 21:03:57.105528332 +0100
     4509+++ netqmail-1.06/byte.h        2019-02-27 20:57:13.382025158 +0100
    42394510@@ -3,6 +3,8 @@
    42404511 
     
    42484519diff -ruN ../netqmail-1.06-original/byte_cspn.c netqmail-1.06/byte_cspn.c
    42494520--- ../netqmail-1.06-original/byte_cspn.c       1970-01-01 01:00:00.000000000 +0100
    4250 +++ netqmail-1.06/byte_cspn.c   2016-11-22 21:03:57.105528332 +0100
     4521+++ netqmail-1.06/byte_cspn.c   2019-02-27 20:57:13.382025158 +0100
    42514522@@ -0,0 +1,11 @@
    42524523+#include "byte.h"
     
    42634534diff -ruN ../netqmail-1.06-original/byte_rcspn.c netqmail-1.06/byte_rcspn.c
    42644535--- ../netqmail-1.06-original/byte_rcspn.c      1970-01-01 01:00:00.000000000 +0100
    4265 +++ netqmail-1.06/byte_rcspn.c  2016-11-22 21:03:57.105528332 +0100
     4536+++ netqmail-1.06/byte_rcspn.c  2019-02-27 20:57:13.382025158 +0100
    42664537@@ -0,0 +1,17 @@
    42674538+#include "byte.h"
     
    42844555diff -ruN ../netqmail-1.06-original/caldate.h netqmail-1.06/caldate.h
    42854556--- ../netqmail-1.06-original/caldate.h 1970-01-01 01:00:00.000000000 +0100
    4286 +++ netqmail-1.06/caldate.h     2016-11-22 21:03:57.105528332 +0100
     4557+++ netqmail-1.06/caldate.h     2019-02-27 20:57:13.382025158 +0100
    42874558@@ -0,0 +1,24 @@
    42884559+/*
     
    43124583diff -ruN ../netqmail-1.06-original/caltime.h netqmail-1.06/caltime.h
    43134584--- ../netqmail-1.06-original/caltime.h 1970-01-01 01:00:00.000000000 +0100
    4314 +++ netqmail-1.06/caltime.h     2016-11-22 21:03:57.105528332 +0100
     4585+++ netqmail-1.06/caltime.h     2019-02-27 20:57:13.382025158 +0100
    43154586@@ -0,0 +1,30 @@
    43164587+/*
     
    43464617diff -ruN ../netqmail-1.06-original/case_startb.c netqmail-1.06/case_startb.c
    43474618--- ../netqmail-1.06-original/case_startb.c     1970-01-01 01:00:00.000000000 +0100
    4348 +++ netqmail-1.06/case_startb.c 2016-11-22 21:03:57.106528299 +0100
     4619+++ netqmail-1.06/case_startb.c 2019-02-27 20:57:13.382025158 +0100
    43494620@@ -0,0 +1,31 @@
    43504621+#include "case.h"
     
    43794650+}
    43804651+/* end DKIM 1.10 */
     4652diff -ruN ../netqmail-1.06-original/channels.g netqmail-1.06/channels.g
     4653--- ../netqmail-1.06-original/channels.g        1970-01-01 01:00:00.000000000 +0100
     4654+++ netqmail-1.06/channels.g    2019-06-26 16:39:31.572826981 +0200
     4655@@ -0,0 +1,18 @@
     4656+#ifndef CHANNELS_H
     4657+#define CHANNELS_H
     4658+
     4659+/* total number of channels including canonical "local" and "remote" channels */
     4660+#define CHANNELS NUMCHANNELS
     4661+
     4662+/* supplemental channels are all channels less the canonical "local" and "remote" channels */
     4663+#define SUPPL_CHANNELS (CHANNELS - 2)
     4664+
     4665+/* Not longer than 80 bytes, must also change qmail-upq.sh */
     4666+#define QDIR_BASENAME "suppl"
     4667+
     4668+/* start supplemental channel fd numbers here */
     4669+#define CHANNEL_FD_OFFSET 10
     4670+
     4671+
     4672+#endif
     4673+
    43814674diff -ruN ../netqmail-1.06-original/chkspawn.c netqmail-1.06/chkspawn.c
    43824675--- ../netqmail-1.06-original/chkspawn.c        1998-06-15 12:53:16.000000000 +0200
    4383 +++ netqmail-1.06/chkspawn.c    2016-11-22 21:03:57.106528299 +0100
     4676+++ netqmail-1.06/chkspawn.c    2019-02-27 20:57:13.382025158 +0100
    43844677@@ -22,8 +22,8 @@
    43854678     _exit(1);
     
    43954688diff -ruN ../netqmail-1.06-original/chkuser.c netqmail-1.06/chkuser.c
    43964689--- ../netqmail-1.06-original/chkuser.c 1970-01-01 01:00:00.000000000 +0100
    4397 +++ netqmail-1.06/chkuser.c     2016-11-22 21:04:19.987765257 +0100
    4398 @@ -0,0 +1,1258 @@
     4690+++ netqmail-1.06/chkuser.c     2019-08-05 19:11:16.583873852 +0200
     4691@@ -0,0 +1,1266 @@
    43994692+
    44004693+/*
     
    48785171+                } else if (strcasecmp(starting_string, "DOMAIN") == 0) {
    48795172+                        starting_value = 0;
    4880 +                }
     5173+/*
     5174+  Edit by Roberto Puzzanghera
     5175+  It seems like any other definition of starting_string ends up as "DOMAIN".
     5176+  Instead, if starting_string is otherwise defined, we want to turn off chkuser,
     5177+  just like if the starting_string is "NONE".
     5178+ */
     5179+                } else {
     5180+                       starting_value = -1;
     5181+               }
    48815182+        } else {
    48825183+                starting_string = "";
     
    56575958diff -ruN ../netqmail-1.06-original/chkuser.h netqmail-1.06/chkuser.h
    56585959--- ../netqmail-1.06-original/chkuser.h 1970-01-01 01:00:00.000000000 +0100
    5659 +++ netqmail-1.06/chkuser.h     2016-11-22 21:03:57.106528299 +0100
     5960+++ netqmail-1.06/chkuser.h     2019-02-27 20:57:13.383025147 +0100
    56605961@@ -0,0 +1,55 @@
    56615962+
     
    57166017diff -ruN ../netqmail-1.06-original/chkuser_settings.h netqmail-1.06/chkuser_settings.h
    57176018--- ../netqmail-1.06-original/chkuser_settings.h        1970-01-01 01:00:00.000000000 +0100
    5718 +++ netqmail-1.06/chkuser_settings.h    2016-11-28 17:35:36.567382036 +0100
     6019+++ netqmail-1.06/chkuser_settings.h    2020-06-16 22:27:56.782600304 +0200
    57196020@@ -0,0 +1,468 @@
    57206021+/*
     
    59296230+ * aliases that have a -default extension
    59306231+ */
    5931 +/* #define CHKUSER_ENABLE_ALIAS_DEFAULT */
     6232+#define CHKUSER_ENABLE_ALIAS_DEFAULT
    59326233+
    59336234+
     
    60806381+
    60816382+/* #define CHKUSER_VAUTH_OPEN_CALL vauth_open   */
    6082 +/* #define CHKUSER_VAUTH_OPEN_CALL vauth_open_update */
     6383+#define CHKUSER_VAUTH_OPEN_CALL vauth_open_update
    60836384+
    60846385+/*
     
    61006401+ *
    61016402+ */
    6102 +/* #define CHKUSER_DISABLE_VARIABLE "RELAYCLIENT" */
     6403+#define CHKUSER_DISABLE_VARIABLE "RELAYCLIENT"
    61036404+
    61046405+
     
    61886489diff -ruN ../netqmail-1.06-original/condredirect.c netqmail-1.06/condredirect.c
    61896490--- ../netqmail-1.06-original/condredirect.c    1998-06-15 12:53:16.000000000 +0200
    6190 +++ netqmail-1.06/condredirect.c        2016-11-22 21:03:57.107528266 +0100
     6491+++ netqmail-1.06/condredirect.c        2019-02-27 20:57:13.384025136 +0100
    61916492@@ -10,6 +10,8 @@
    61926493 #include "strerr.h"
     
    62176518diff -ruN ../netqmail-1.06-original/conf-cc netqmail-1.06/conf-cc
    62186519--- ../netqmail-1.06-original/conf-cc   1998-06-15 12:53:16.000000000 +0200
    6219 +++ netqmail-1.06/conf-cc       2016-11-22 21:03:57.107528266 +0100
     6520+++ netqmail-1.06/conf-cc       2020-01-10 21:52:13.080721081 +0100
    62206521@@ -1,3 +1,3 @@
    62216522-cc -O2
    6222 +cc -O2 -g -DEXTERNAL_TODO -DTLS=20160918 -I/usr/local/ssl/include -I/home/vpopmail/include
     6523+cc -O2 -g -DEXTERNAL_TODO -DTLS=20200107 -I/usr/local/ssl/include -I/home/vpopmail/include
    62236524 
    62246525 This will be used to compile .c files.
     6526diff -ruN ../netqmail-1.06-original/conf-channels netqmail-1.06/conf-channels
     6527--- ../netqmail-1.06-original/conf-channels     1970-01-01 01:00:00.000000000 +0100
     6528+++ netqmail-1.06/conf-channels 2019-06-26 19:12:46.033685227 +0200
     6529@@ -0,0 +1,4 @@
     6530+2
     6531+
     6532+Total number of channels (queues) available for delivery. Must be at
     6533+least 2, and anything above 2 are considered supplemental channels.
    62256534diff -ruN ../netqmail-1.06-original/conf-domainkeys netqmail-1.06/conf-domainkeys
    62266535--- ../netqmail-1.06-original/conf-domainkeys   1970-01-01 01:00:00.000000000 +0100
    6227 +++ netqmail-1.06/conf-domainkeys       2016-11-22 21:03:57.107528266 +0100
     6536+++ netqmail-1.06/conf-domainkeys       2019-02-27 20:57:13.384025136 +0100
    62286537@@ -0,0 +1 @@
    62296538+-DDOMAIN_KEYS
    62306539diff -ruN ../netqmail-1.06-original/conf-ld netqmail-1.06/conf-ld
    62316540--- ../netqmail-1.06-original/conf-ld   1998-06-15 12:53:16.000000000 +0200
    6232 +++ netqmail-1.06/conf-ld       2016-11-22 21:03:57.107528266 +0100
     6541+++ netqmail-1.06/conf-ld       2019-02-27 20:57:13.384025136 +0100
    62336542@@ -1,3 +1,3 @@
    62346543-cc -s
     
    62386547diff -ruN ../netqmail-1.06-original/conf-policy netqmail-1.06/conf-policy
    62396548--- ../netqmail-1.06-original/conf-policy       1970-01-01 01:00:00.000000000 +0100
    6240 +++ netqmail-1.06/conf-policy   2016-11-22 21:03:57.107528266 +0100
     6549+++ netqmail-1.06/conf-policy   2019-02-27 20:57:13.384025136 +0100
    62416550@@ -0,0 +1,17 @@
    62426551+-DPOLICY_FILENAME="/var/qmail/control/policy" -DPOLICY_DEALLOCATE -DPOLICY_ENFORCE_AUTHENTICATION
     
    62596568diff -ruN ../netqmail-1.06-original/conf-spawn netqmail-1.06/conf-spawn
    62606569--- ../netqmail-1.06-original/conf-spawn        1998-06-15 12:53:16.000000000 +0200
    6261 +++ netqmail-1.06/conf-spawn    2016-11-22 21:03:57.108528232 +0100
     6570+++ netqmail-1.06/conf-spawn    2019-02-27 20:57:13.384025136 +0100
    62626571@@ -1,4 +1,4 @@
    62636572-120
     
    62686577diff -ruN ../netqmail-1.06-original/config.h netqmail-1.06/config.h
    62696578--- ../netqmail-1.06-original/config.h  1970-01-01 01:00:00.000000000 +0100
    6270 +++ netqmail-1.06/config.h      2016-11-22 21:03:57.108528232 +0100
     6579+++ netqmail-1.06/config.h      2019-02-27 20:57:13.384025136 +0100
    62716580@@ -0,0 +1,10 @@
    62726581+/* config.h.  Generated from config.h.in by configure.  */
     
    62826591diff -ruN ../netqmail-1.06-original/control.c netqmail-1.06/control.c
    62836592--- ../netqmail-1.06-original/control.c 1998-06-15 12:53:16.000000000 +0200
    6284 +++ netqmail-1.06/control.c     2016-11-22 21:03:57.108528232 +0100
     6593+++ netqmail-1.06/control.c     2019-02-27 20:57:13.384025136 +0100
    62856594@@ -85,6 +85,82 @@
    62866595  return 1;
     
    63686677diff -ruN ../netqmail-1.06-original/control.h netqmail-1.06/control.h
    63696678--- ../netqmail-1.06-original/control.h 1998-06-15 12:53:16.000000000 +0200
    6370 +++ netqmail-1.06/control.h     2016-11-22 21:03:57.108528232 +0100
     6679+++ netqmail-1.06/control.h     2019-02-27 20:57:13.384025136 +0100
    63716680@@ -3,8 +3,10 @@
    63726681 
     
    63826691diff -ruN ../netqmail-1.06-original/date822fmt.c netqmail-1.06/date822fmt.c
    63836692--- ../netqmail-1.06-original/date822fmt.c      1998-06-15 12:53:16.000000000 +0200
    6384 +++ netqmail-1.06/date822fmt.c  2016-11-22 21:03:57.108528232 +0100
     6693+++ netqmail-1.06/date822fmt.c  2019-02-27 20:57:13.385025125 +0100
    63856694@@ -1,3 +1,4 @@
    63866695+#include <time.h>
     
    64496758diff -ruN ../netqmail-1.06-original/dk-filter.9 netqmail-1.06/dk-filter.9
    64506759--- ../netqmail-1.06-original/dk-filter.9       1970-01-01 01:00:00.000000000 +0100
    6451 +++ netqmail-1.06/dk-filter.9   2016-11-22 21:03:57.108528232 +0100
    6452 @@ -0,0 +1,102 @@
     6760+++ netqmail-1.06/dk-filter.9   2020-04-10 11:08:43.313802048 +0200
     6761@@ -0,0 +1,98 @@
    64536762+.TH dk-filter 8
    64546763+.SH NAME
     
    64726781+It uses the libdkim and OpenSSL libraries.  To sign a message, set the
    64736782+.B DKIMSIGN
    6474 +or
    6475 +.B DKSIGIN
    6476 +environment variables to the pathname of the private key that will be
     6783+environment variable (for DKIM signing) or
     6784+.B DKSIGN
     6785+environment variable (for DK signing) to the pathname of the private key that will be
    64776786+used to sign the message. If there is a % character in the environment
    64786787+variable, it is removed and replaced by the domain name in the From: header.
     
    64826791+After all substitutions, if the key file does not exist, the message will not be signed.
    64836792+If there is no % and the file does not exist, the message will be rejected with error 35.
     6793+The default private key QMAILHOME/control/domainkeys/default can be overriden by the
     6794+\fBDKIM_DEFAULT_KEY\fR environment variable.
     6795+
    64846796+The selector (s=) will be taken from the basename of the file.
    64856797+The private key should be created by
     
    65196831+.EE
    65206832+
    6521 +.B dk-filter
    6522 +uses the domain found in the Sender: header to set the domain tag. If not it uses the From: header. You can override this by
    6523 +setting
    6524 +.B DKIMDOMAIN
    6525 +environment variable.
    6526 +.B DKIMDOMAIN
    6527 +can be set to an email address or a domain (without the at sign).
    6528 +To verify a message, set the
    6529 +.B DKIMVERIFY
    6530 +or
    6531 +.B DKVERIFY
    6532 +environment variables
    6533 +.B dk-filter
    6534 +always inserts the
    6535 +.B DKIM-Status
    6536 +or
    6537 +.B DomainKey-Status
    6538 +header, so that messages can be
    6539 +rejected later at delivery time, or in the mail reader. In that case you may set
    6540 +.B DKIMVERIFY
    6541 +or
    6542 +.B DKVERIFY
    6543 +to an empty string.
    6544 +.B dk-filter
    6545 +does not use any signing practice byd default. You can override this by setting the SIGN_PRACTICE to ssp or adsp (lowercase).
     6833+when signing \fBdk-filter\fR uses the domain found in the Return-Path, Sender, From headers to set
     6834+the domain tag. If not it uses the value of \fBDKIMDOMAIN\fR environment
     6835+variable. \fBDKIMDOMAIN\fR can be set to an email address or a domain (without the at sign).
     6836+
     6837+To verify a message, set the \fBDKIMVERIFY\fR or \fBDKVERIFY\fR environment variables.
     6838+\fBdk-filter\fR always inserts the \fBDKIM-Status\fR or \fBDomainKey-Status\fR header, so
     6839+that messages can be rejected later at delivery time, or in the mail reader. In that case
     6840+you may set \fBDKIMVERIFY\fR or \fBDKVERIFY\fR to an empty string. The exit code of \fBdk-filter\fR
     6841+can be fine tuned by setting \fBDKIMVERIFY\fR environment variable. See \fBdkim(8)\fR for a detailed
     6842+description on setting the \fBDKIMVERIFY\fR environment variable.
     6843+
     6844+\fBdk-filter\fR does not use any signing practice by default. You can override this by setting
     6845+the \fBSIGN_PRACTICE\fR to ssp or adsp (lowercase).
     6846+
     6847+If neither of these environment variables (\fBDKIMSIGN\fR, \fBDKSIGN\fR, \fBDKIMVERIFY\fR, \fBDKVERIFY\fR) are defined, \fBdk-filter\fR
     6848+will do signing by default.
     6849+
     6850+You can set environment variable \fBNODK\fR to disable domainkeys and \fBNODKIM\fR to disable \fBDKIM\fR.
    65466851+
    65476852+.SH "EXIT CODES"
     
    65556860diff -ruN ../netqmail-1.06-original/dk-filter.sh netqmail-1.06/dk-filter.sh
    65566861--- ../netqmail-1.06-original/dk-filter.sh      1970-01-01 01:00:00.000000000 +0100
    6557 +++ netqmail-1.06/dk-filter.sh  2016-11-22 21:03:57.109528199 +0100
    6558 @@ -0,0 +1,315 @@
     6862+++ netqmail-1.06/dk-filter.sh  2020-07-29 15:59:13.351023490 +0200
     6863@@ -0,0 +1,367 @@
    65596864+#
    65606865+# $Log: dk-filter.sh,v $
     6866+# Revision 1.22  2019-06-24 23:19:57+05:30  Cprogrammer
     6867+# added code for -d option in DKIMSIGNOPTIONS
     6868+#
     6869+# Revision 1.21  2019-01-14 00:10:00+05:30  Cprogrammer
     6870+# added -S, -f option to verify signatures with unsigned subject, unsigned from
     6871+#
     6872+# Revision 1.20  2017-03-09 16:38:15+05:30  Cprogrammer
     6873+# FHS changes
     6874+#
     6875+# Revision 1.19  2016-05-17 23:11:42+05:30  Cprogrammer
     6876+# fix for configurable control directory
     6877+#
     6878+# Revision 1.18  2014-03-12 08:50:48+05:30  Cprogrammer
     6879+# bug - fixed signing when env variables DKSIGN or DKIMSIGN were set
     6880+#
     6881+# Revision 1.17  2013-09-03 23:04:30+05:30  Cprogrammer
     6882+# set signing as default if both DKSIGN and DKIMSIGN are not defined
     6883+#
     6884+# Revision 1.16  2013-08-17 15:59:21+05:30  Cprogrammer
     6885+# do not treat duplicate DomainKey-Signature as an error
     6886+#
     6887+# Revision 1.15  2013-08-17 15:02:06+05:30  Cprogrammer
     6888+# fixed syntax errors and private key lookup
     6889+#
    65616890+# Revision 1.14  2011-02-10 22:47:01+05:30  Cprogrammer
    65626891+# fixed exit code of dk-filter when doing verification
     
    66046933+# Initial revision
    66056934+#
    6606 +# $Id: dk-filter.sh,v 1.14 2011-02-10 22:47:01+05:30 Cprogrammer Stab mbhangui $
     6935+# $Id: dk-filter.sh,v 1.22 2019-06-24 23:19:57+05:30 Cprogrammer Exp mbhangui $
    66076936+#
    66086937+if [ -z "$QMAILREMOTE" -a -z "$QMAILLOCAL" ]; then
     
    66146943+dkverify=0
    66156944+dkimverify=0
    6616 +if [ -z "$DKSIGN" -a -z "$DKVERIFY" ] ; then
    6617 +       DKSIGN=QMAILHOME/control/domainkeys/%/default
    6618 +       dksign=2
     6945+if [ -z "$DEFAULT_DKIM_KEY" ] ; then
     6946+       default_key=QMAILHOME/control/domainkeys/default
     6947+else
     6948+       default_key=$DEFAULT_DKIM_KEY
    66196949+fi
    6620 +if [ -z "$DKIMSIGN" -a -z "$DKIMVERIFY" ] ; then
    6621 +       DKIMSIGN=QMAILHOME/control/domainkeys/%/default
    6622 +       dkimsign=2
     6950+if [ -z "$NODK" -a -x QMAILHOME/bin/dktest -a -z "$DKVERIFY" ] ; then
     6951+       if [ -z "$DKSIGN" ] ; then
     6952+               DKSIGN=QMAILHOME/control/domainkeys/%/default
     6953+               dksign=2
     6954+       elif [ " $DKSIGN" = " QMAILHOME/control/domainkeys/%/default" ] ; then
     6955+               dksign=2
     6956+       fi
    66236957+fi
    6624 +if [ ! -z "$DKSIGN" ] ; then
     6958+if [ -z "$NODKIM" -a -x QMAILHOME/bin/dkim -a -z "$DKIMVERIFY" ] ; then
     6959+       if [ -z "$DKIMSIGN" ] ; then
     6960+               DKIMSIGN=QMAILHOME/control/domainkeys/%/default
     6961+               dkimsign=2
     6962+       elif [ " $DKIMSIGN" = " QMAILHOME/control/domainkeys/%/default" ] ; then
     6963+               dkimsign=2
     6964+       fi
     6965+fi
     6966+if [ -z "$NODK" -a -n "$DKSIGN" ] ; then
    66256967+       if [ ! -f QMAILHOME/bin/dktest ] ; then
    66266968+               echo "QMAILHOME/bin/dktest: No such file or directory" 1>&2
     
    66326974+               percent_found=1
    66336975+       fi
    6634 +       if [ ! " $_SENDER" = " " ] ; then
     6976+       if [ -n "$DKIMDOMAIN" ] && [ -z "$_SENDER" ] ; then
     6977+               dkkeyfn=`echo $DKSIGN | sed s{%{$DKIMDOMAIN{g`
     6978+       elif [ ! " $_SENDER" = " " ] ; then
    66356979+               # replace '%' in filename with domain
    66366980+               domain=`echo $_SENDER | cut -d@ -f2`
     
    66406984+       fi
    66416985+       if [ $dksign -eq 2 -a ! -f $dkkeyfn ] ; then
    6642 +               dkkeyfn=QMAILHOME/control/domainkeys/default
     6986+               dkkeyfn=$default_key
    66436987+       fi
    66446988+       if [ -f $dkkeyfn ] ; then
     
    66526996+       dkselector=`basename $dkkeyfn`
    66536997+fi
    6654 +if [ ! -z "$DKIMSIGN" ] ; then
     6998+if [ -z "$NODKIM" -a -n "$DKIMSIGN" ] ; then
    66556999+       if [ ! -f QMAILHOME/bin/dkim ] ; then
    66567000+               echo "QMAILHOME/bin/dkim: No such file or directory" 1>&2
     
    66627006+               percent_found=1
    66637007+       fi
    6664 +       if [ ! " $_SENDER" = " " ] ; then
     7008+       if [ -n "$DKIMDOMAIN" ] && [ -z "$_SENDER" ] ; then
     7009+               dkimkeyfn=`echo $DKIMSIGN | sed s{%{$DKIMDOMAIN{g`
     7010+       elif [ ! " $_SENDER" = " " ] ; then
    66657011+               # replace '%' in filename with domain
    66667012+               domain=`echo $_SENDER | cut -d@ -f2`
     
    66707016+       fi
    66717017+       if [ $dkimsign -eq 2 -a ! -f $dkimkeyfn ] ; then
    6672 +               dkimkeyfn=QMAILHOME/control/domainkeys/default
     7018+               dkimkeyfn=$default_key
    66737019+       fi
    66747020+       if [ -f $dkimkeyfn ] ; then
     
    66787024+       fi
    66797025+       if [ $dkimsign -eq 0 -a $percent_found -ne 1 ] ; then
    6680 +               exit 32
     7026+               exit 32 # private key does not exist
    66817027+       fi
    66827028+       dkimselector=`basename $dkimkeyfn`
    66837029+fi
    6684 +if [ ! -z "$DKVERIFY" ] ; then
     7030+if [ -z "$NODK" -a -n "$DKVERIFY" ] ; then
    66857031+       if [ ! -f QMAILHOME/bin/dktest ] ; then
    66867032+               echo "QMAILHOME/bin/dktest: No such file or directory" 1>&2
     
    66897035+       dkverify=1
    66907036+fi
    6691 +if [ ! -z "$DKIMVERIFY" ] ; then
     7037+if [ -z "$NODKIM" -a -n "$DKIMVERIFY" ] ; then
    66927038+       if [ ! -f QMAILHOME/bin/dkim ] ; then
    66937039+               echo "QMAILHOME/bin/dkim: No such file or directory" 1>&2
     
    67307076+               -c)
    67317077+               dkimopts="$dkimopts -c $2"
     7078+               shift
     7079+               ;;
     7080+
     7081+               -d)
     7082+               dkimopts="$dkimopts -d $2"
    67327083+               shift
    67337084+               ;;
     
    68247175+       fi
    68257176+       exec 0</tmp/dk.$$
    6826 +       #QMAILHOME/bin/dktest -h -s $dkkeyfn
    68277177+       eval $dkopts
    68287178+       exit_val=$?
    68297179+       # allow error due to duplicate DomainKey-Header
    6830 +       if [ $exit_val -ne 0 -a $exit_val -ne 6 ] ; then
     7180+       if [ $exit_val -ne 0 -a $exit_val -ne 12 ] ; then
    68317181+               /bin/rm -f /tmp/dk.$$
    68327182+               exit $exit_val
     
    68437193+       fi
    68447194+       exec 0</tmp/dk.$$
    6845 +       QMAILHOME/bin/dkim -p $practice -v
     7195+       dkimvargs="-p $practice"
     7196+       if [ -n "$UNSIGNED_SUBJECT" ] ; then
     7197+               dkimvargs="$dkimvargs -S"
     7198+       fi
     7199+       if [ -n "$UNSIGNED_FROM" ] ; then
     7200+               dkimvargs="$dkimvargs -f"
     7201+       fi
     7202+       QMAILHOME/bin/dkim $dkimvargs -v
    68467203+       ret=$?
    68477204+       case $ret in
     
    68747231diff -ruN ../netqmail-1.06-original/dkim.9 netqmail-1.06/dkim.9
    68757232--- ../netqmail-1.06-original/dkim.9    1970-01-01 01:00:00.000000000 +0100
    6876 +++ netqmail-1.06/dkim.9        2018-04-03 14:46:51.362411599 +0200
    6877 @@ -0,0 +1,98 @@
     7233+++ netqmail-1.06/dkim.9        2020-04-09 19:43:56.494473495 +0200
     7234@@ -0,0 +1,108 @@
    68787235+.TH dkim 8
    68797236+.SH NAME
     
    68927249+
    68937250+.EX
    6894 + (./dkim -s QMAILHOME/control/domainkeys/dog </tmp/testmsg; cat /tmp/testmsg)\
     7251+ (./dkim -s INDIMAIL/control/domainkeys/dog </tmp/testmsg; cat /tmp/testmsg)\
    68957252+ | ./dkim -v
    68967253+.EE
     
    69247281+.TP
    69257282+-l
    6926 +include body length tag
     7283+include body length tag when signing. Honor body length tag when verifying
    69277284+.TP
    69287285+-q
     
    69347291+-f
    69357292+issue error if not all message's From headers are in signature
     7293+.TP
     7294+-S
     7295+Allow unsigned subject in signature
    69367296+.TP
    69377297+-h
     
    69467306+-c \fIcanonicalization\fR
    69477307+r for relaxed [DEFAULT], s - simple, t relaxed/simple, u - simple/relaxed
     7308+
     7309+.TP
    69487310+-d \fIdomain\fR
    6949 +the domain tag, if not provided, determined from the sender/from header
     7311+the domain tag, if not provided, determined from the return-path/sender/from header
    69507312+.TP
    69517313+-i \fIidentity\fR
     
    69677329+this help
    69687330+
     7331+.SH Return Value
     7332+When signing, \fBdkim\fR returns 0 on success and non-zero on any failure. For verification, you can set the
     7333+environment varable \fBDKIMVERIFY\fR. Refer to qmail-dkim(8) for a full description of  the \fBDKIMVERIFY\fR
     7334+environment variable
     7335+
    69697336+.SH "SEE ALSO"
    69707337+dktest(8),
     
    69767343diff -ruN ../netqmail-1.06-original/dkim.c netqmail-1.06/dkim.c
    69777344--- ../netqmail-1.06-original/dkim.c    1970-01-01 01:00:00.000000000 +0100
    6978 +++ netqmail-1.06/dkim.c        2018-04-03 14:46:51.363411603 +0200
    6979 @@ -0,0 +1,899 @@
     7345+++ netqmail-1.06/dkim.c        2019-06-19 09:46:59.689809564 +0200
     7346@@ -0,0 +1,871 @@
    69807347+/*
    69817348+ * $Log: dkim.c,v $
     7349+ * Revision 1.23  2019-06-14 21:24:59+05:30  Cprogrammer
     7350+ * BUG - honor body length tag in verification
     7351+ *
     7352+ * Revision 1.22  2019-01-13 10:10:27+05:30  Cprogrammer
     7353+ * added missing usage string for allowing unsigned subject.
     7354+ *
     7355+ * Revision 1.21  2018-08-08 23:57:02+05:30  Cprogrammer
     7356+ * issue success if at lease one one good signature is found
     7357+ *
     7358+ * Revision 1.20  2018-05-22 10:03:26+05:30  Cprogrammer
     7359+ * changed return type of writeHeader() to void
     7360+ *
    69827361+ * Revision 1.19  2016-03-01 16:23:38+05:30  Cprogrammer
    69837362+ * added -S option to allow email with unsigned subject
     
    71097488+       fprintf(stderr, "t                    include a timestamp tag\n");
    71107489+       fprintf(stderr, "h                    include Copied Headers\n");
     7490+       fprintf(stderr, "f                    allow Unsigned From (default is to reject if From field is not signed)\n");
     7491+       fprintf(stderr, "S                    allow Unsigned Subject (default is to reject if Subject field is not signed)\n");
    71117492+       fprintf(stderr, "v                    verify the message\n");
    71127493+       fprintf(stderr, "p <ssp|adsp>         0 - disable practice (default), 1- SSP, or 2 - ADSP verification\n");
     
    71207501+       fprintf(stderr, "z <hash>             1 for sha1, 2 for sha256, 3 for both\n");
    71217502+#endif
    7122 +       fprintf(stderr, "f                    0 = From headers not included in the signature are not allowed\n");
    7123 +       fprintf(stderr, "                     1 = allowed\n");
    71247503+       fprintf(stderr, "y <selector>         the selector tag DEFAULT=private\n");
    71257504+       fprintf(stderr, "s <privkeyfile>      sign the message using the private key in privkeyfile\n");
     7505+       fprintf(stderr, "V                    set verbose mode\n");
    71267506+       fprintf(stderr, "H                    this help\n");
    71277507+       exit(1);
     
    71357515+       ch = c;
    71367516+       t = s;
    7137 +       for (;;)
    7138 +       {
     7517+       for (;;) {
    71397518+               if (!*t)
    71407519+                       break;
     
    71877566+ * Allows you to add the headers contain the results and DKIM ADSP
    71887567+ */
    7189 +int writeHeader(int ret, int resDKIMSSP, int resDKIMADSP, int useSSP, int useADSP )
     7568+void writeHeader(int ret, int resDKIMSSP, int resDKIMADSP, int useSSP, int useADSP )
    71907569+{
    71917570+       char           *dkimStatus, *sspStatus, *adspStatus;
     
    72867665+               }
    72877666+       }
    7288 +       if (useADSP && resDKIMADSP != -1)
    7289 +       {
     7667+       if (useADSP && resDKIMADSP != -1) {
    72907668+               switch(resDKIMADSP)
    72917669+               {
     
    73257703+               values[i] = 0;
    73267704+       key = 0;
    7327 +       for(ptr = list;*ptr;)
    7328 +       {
     7705+       for(ptr = list;*ptr;) {
    73297706+               if ((*ptr == ' ') || (*ptr == '\t') || (*ptr == '\r') || (*ptr == '\n')) /*- FWS */
    73307707+                       *ptr++ = 0;
    73317708+               if (!key)
    73327709+                       key = ptr;
    7333 +               if (*ptr == '=')
    7334 +               {
     7710+               if (*ptr == '=') {
    73357711+                       *ptr = 0;
    7336 +                       for (i = 0;letters[i];i++)
    7337 +                       {
    7338 +                               if (!strcmp(letters[i], key))
    7339 +                               {
     7712+                       for (i = 0;letters[i];i++) {
     7713+                               if (!strcmp(letters[i], key)) {
    73407714+                                       ptr++;
    7341 +                                       for (;*ptr;)
    7342 +                                       {
    7343 +                                               if ((*ptr == ' ') || (*ptr == '\t') || (*ptr == '\r') || (*ptr == '\n'))
    7344 +                                               {
     7715+                                       for (;*ptr;) {
     7716+                                               if ((*ptr == ' ') || (*ptr == '\t') || (*ptr == '\r') || (*ptr == '\n')) {
    73457717+                                                       ptr++;
    73467718+                                                       continue;
     
    73537725+                                       if (*ptr)
    73547726+                                               *ptr++ = 0;
    7355 +                                       for(;tmp != values[i];tmp--) /*- RFC 4871 3.2 */
    7356 +                                       {
    7357 +                                               if ((*tmp == ' ') || (*tmp == '\t') || (*tmp == '\r') || (*tmp == '\n'))
    7358 +                                               {
     7727+                                       for(;tmp != values[i];tmp--) /*- RFC 4871 3.2 */ {
     7728+                                               if ((*tmp == ' ') || (*tmp == '\t') || (*tmp == '\r') || (*tmp == '\n')) {
    73597729+                                                       *tmp = 0;
    73607730+                                                       continue;
     
    73817751+
    73827752+       *bTesting = 0;
    7383 +       if (!(query = (char *) DKIM_MALLOC(strlen("_ssp._domainkey.") + strlen(domain) + 1)))
    7384 +       {
     7753+       if (!(query = (char *) DKIM_MALLOC(strlen("_ssp._domainkey.") + strlen(domain) + 1))) {
    73857754+               fprintf(stderr, "malloc: %d: %s\n", strlen("_ssp._domainkey.") + strlen(domain) + 1,
    73867755+                       strerror(errno));
     
    73907759+       results = dns_text(query);
    73917760+       DKIM_MFREE(query);
    7392 +       if (!strcmp(results, "e=temp;"))
    7393 +       {
     7761+       if (!strcmp(results, "e=temp;")) {
    73947762+               DKIM_MFREE(results);
    73957763+               return DKIM_SSP_TEMPFAIL;
    73967764+       } else
    7397 +       if (!strcmp(results, "e=perm;"))
    7398 +       {
     7765+       if (!strcmp(results, "e=perm;")) {
    73997766+               DKIM_MFREE(results);
    74007767+               results = dns_text(domain);
    7401 +               if (!strcmp(results, "e=temp;"))
    7402 +               {
     7768+               if (!strcmp(results, "e=temp;")) {
    74037769+                       DKIM_MFREE(results);
    74047770+                       return DKIM_SSP_TEMPFAIL;
    74057771+               } else
    7406 +               if (!strcmp(results, "e=perm;"))
    7407 +               {
     7772+               if (!strcmp(results, "e=perm;")) {
    74087773+                       DKIM_MFREE(results);
    74097774+                       return DKIM_SSP_SCOPE;
     
    74117776+               bIsParentSSP = 1;
    74127777+       }
    7413 +       if (!ParseTagValues(results, tags, values))
    7414 +       {
     7778+       if (!ParseTagValues(results, tags, values)) {
    74157779+               DKIM_MFREE(results);
    74167780+               return DKIM_SSP_UNKNOWN;
     
    74277791+       if (values[1] != NULL) {
    74287792+               char           *s, *p;
    7429 +               for (p = values[1], s = values[1]; *p; p++)
    7430 +               {
     7793+               for (p = values[1], s = values[1]; *p; p++) {
    74317794+                       if (*p == '|')
    74327795+                               *p = 0;
     
    74607823+
    74617824+       results = dns_text(domain);
    7462 +       if (!strcmp(results, "e=perm;"))
    7463 +       {
     7825+       if (!strcmp(results, "e=perm;")) {
    74647826+               DKIM_MFREE(results);
    74657827+               return DKIM_ADSP_SCOPE;
    74667828+       } else
    7467 +       if (!strcmp(results, "e=temp;"))
    7468 +       {
     7829+       if (!strcmp(results, "e=temp;")) {
    74697830+               DKIM_MFREE(results);
    74707831+               return DKIM_ADSP_TEMPFAIL;
    74717832+       }
    7472 +       if (!(query = (char *) DKIM_MALLOC(strlen((char *) "_adsp._domainkey.") + strlen(domain) + 1)))
    7473 +       {
     7833+       if (!(query = (char *) DKIM_MALLOC(strlen((char *) "_adsp._domainkey.") + strlen(domain) + 1))) {
    74747834+               fprintf(stderr, "malloc: %d: %s\n", strlen("_adsp._domainkey.") + strlen(domain) + 1,
    74757835+                       strerror(errno));
     
    74797839+       results = dns_text(query);
    74807840+       DKIM_MFREE(query);
    7481 +       if (!strcmp(results, "e=perm;"))
    7482 +       {
     7841+       if (!strcmp(results, "e=perm;")) {
    74837842+               DKIM_MFREE(results);
    74847843+               return DKIM_ADSP_SCOPE;
    74857844+       } else
    7486 +       if (!strcmp(results, "e=temp;"))
    7487 +       {
     7845+       if (!strcmp(results, "e=temp;")) {
    74887846+               DKIM_MFREE(results);
    74897847+               return DKIM_ADSP_TEMPFAIL;
    74907848+       }
    7491 +       if (!ParseTagValues(results, tags, values))
    7492 +       {
     7849+       if (!ParseTagValues(results, tags, values)) {
    74937850+               DKIM_MFREE(results);
    74947851+               return DKIM_ADSP_UNKNOWN;
     
    75417898+       strcpy(opts.szRequiredHeaders, "NonExistent");
    75427899+       opts.pfnHeaderCallback = SignThisHeader;
    7543 +       while (1)
    7544 +       {
     7900+       while (1) {
    75457901+               if ((ch = getopt(argc, argv, "lqtfhHSvVp:b:c:d:i:s:x:y:z:")) == -1)
    75467902+                       break;
     
    75487904+               {
    75497905+               case 'l': /*- body length tag */
     7906+                       vopts.nHonorBodyLengthTag = 1;
    75507907+                       opts.nIncludeBodyLengthTag = 1;
    75517908+                       break;
     
    76848041+       }
    76858042+       if (bSign) { /*- sign */
    7686 +               if (!PrivKeyFile)
    7687 +               {
     8043+               if (!PrivKeyFile) {
    76888044+                       fprintf(stderr, "Private Key not provided\n");
    76898045+                       usage();
     
    77018057+                       return (1);
    77028058+               }
    7703 +               if (fstat(PrivKeyFD, &statbuf) == -1)
    7704 +               {
     8059+               if (fstat(PrivKeyFD, &statbuf) == -1) {
    77058060+                       fprintf(stderr, "fstat: %s: %s\n", PrivKeyFile, strerror(errno));
    77068061+                       return (1);
    77078062+               }
    7708 +               if (!(PrivKey = (char *) DKIM_MALLOC(sizeof(char) * ((nPrivKeyLen = statbuf.st_size) + 1))))
    7709 +               {
     8063+               if (!(PrivKey = (char *) DKIM_MALLOC(sizeof(char) * ((nPrivKeyLen = statbuf.st_size) + 1)))) {
    77108064+                       fprintf(stderr, "malloc: %ld bytes: %s\n", statbuf.st_size + 1, strerror(errno));
    77118065+                       return (1);
    77128066+               }
    7713 +               if (read(PrivKeyFD, PrivKey, nPrivKeyLen) != nPrivKeyLen)
    7714 +               {
     8067+               if (read(PrivKeyFD, PrivKey, nPrivKeyLen) != nPrivKeyLen) {
    77158068+                       fprintf(stderr, "%s: read: %s\n", strerror(errno), program);
    77168069+                       return (1);
     
    77188071+               close(PrivKeyFD);
    77198072+               PrivKey[nPrivKeyLen] = '\0';
    7720 +               if (DKIMSignInit(&ctxt, &opts) != DKIM_SUCCESS)
    7721 +               {
     8073+               if (DKIMSignInit(&ctxt, &opts) != DKIM_SUCCESS) {
    77228074+                       fprintf(stderr, "DKIMSignInit: failed to initialize signature %s\n", PrivKeyFile);
    77238075+                       return (1);
    77248076+               }
    7725 +               for (;;)
    7726 +               {
    7727 +                       if ((ret = read(0, Buffer, sizeof(Buffer) - 1)) == -1)
    7728 +                       {
     8077+               for (;;) {
     8078+                       if ((ret = read(0, Buffer, sizeof(Buffer) - 1)) == -1) {
    77298079+                               fprintf(stderr, "read: %s\n", strerror(errno));
    77308080+                               DKIMSignFree(&ctxt);
     
    77338083+                       if (!ret)
    77348084+                               break;
    7735 +                       if (DKIMSignProcess(&ctxt, Buffer, ret) == DKIM_INVALID_CONTEXT)
    7736 +                       {
     8085+                       if (DKIMSignProcess(&ctxt, Buffer, ret) == DKIM_INVALID_CONTEXT) {
    77378086+                               fprintf(stderr, "DKIMSignProcess: DKIMContext structure invalid for this operation\n");
    77388087+                               DKIMSignFree(&ctxt);
     
    77408089+                       }
    77418090+               }
    7742 +               if (DKIMSignGetSig2(&ctxt, PrivKey, &pSig) == DKIM_INVALID_CONTEXT)
    7743 +               {
     8091+               if (DKIMSignGetSig2(&ctxt, PrivKey, &pSig) == DKIM_INVALID_CONTEXT) {
    77448092+                       fprintf(stderr, "DKIMSignProcess: DKIMContext structure invalid for this operation\n");
    77458093+                       DKIMSignFree(&ctxt);
    77468094+                       return (1);
    77478095+               }
    7748 +               if (pSig)
    7749 +               {
     8096+               if (pSig) {
    77508097+                       fwrite(pSig, 1, strlen(pSig), stdout);
    77518098+                       fwrite("\n", 1, 1, stdout);
     
    77668113+               vopts.nSubjectRequired = nAllowUnsignedSubject;
    77678114+               DKIMVerifyInit(&ctxt, &vopts);          /*- this is always successful */
    7768 +               for (;;)
    7769 +               {
    7770 +                       if ((i = read(0, Buffer, sizeof(Buffer) - 1)) == -1)
    7771 +                       {
     8115+               for (;;) {
     8116+                       if ((i = read(0, Buffer, sizeof(Buffer) - 1)) == -1) {
    77728117+                               fprintf(stderr, "read: %s\n", strerror(errno));
    77738118+                               DKIMVerifyFree(&ctxt);
     
    77838128+                               break;
    77848129+               }
    7785 +               if (!ret)
    7786 +               {
    7787 +                       if ((ret = DKIMVerifyResults(&ctxt, &sCount, &sSize)) != DKIM_SUCCESS)
     8130+               if (!ret) {
     8131+                       ret = DKIMVerifyResults(&ctxt, &sCount, &sSize);
     8132+                       if (ret != DKIM_SUCCESS && ret != DKIM_3PS_SIGNATURE && ret != DKIM_NEUTRAL)
    77888133+                               dkim_error(ret);
    77898134+                       if ((ret = DKIMVerifyGetDetails(&ctxt, &nSigCount, &pDetails, szPolicy)) != DKIM_SUCCESS)
    77908135+                               dkim_error(ret);
    7791 +                       else
    7792 +                       {
    7793 +                               for (ret = 0,i = 0; i < nSigCount; i++) {
     8136+                       else {
     8137+                               for (ret = DKIM_FAIL, i = 0; i < nSigCount; i++) {
    77948138+                                       if (verbose)
    77958139+                                               printf("Signature # %02d: ", i + 1);
    7796 +                                       if (pDetails[i].nResult >= 0)
    7797 +                                       {
     8140+                                       if (pDetails[i].nResult >= 0) {
     8141+                                               ret = 0;
    77988142+                                               if (verbose)
    77998143+                                                       printf("Success\n");
    78008144+                                               continue;
    7801 +                                       } else
    7802 +                                       {
    7803 +                                               ret = pDetails[i].nResult;
     8145+                                       } else {
     8146+                                               if (ret == DKIM_FAIL)
     8147+                                                       ret = pDetails[i].nResult;
    78048148+                                               if (verbose)
    7805 +                                                       printf("Failure %d\n", ret);
     8149+                                                       printf("Failure %d\n", pDetails[i].nResult);
    78068150+                                       }
    78078151+                               }
     
    78118155+               }
    78128156+               if (ret < 0 || ret == DKIM_3PS_SIGNATURE) {
    7813 +                       if (useADSP)
    7814 +                       {
     8157+                       if (useADSP) {
    78158158+                               char           *domain;
    78168159+       
     
    78268169+                               ret = DKIM_NEUTRAL;
    78278170+                       } else
    7828 +                       if (useSSP)
    7829 +                       {
     8171+                       if (useSSP) {
    78308172+                               int             bTestingPractices = 0;
    78318173+                               char           *domain;
     
    78488190+               DKIMVerifyFree(&ctxt);
    78498191+               writeHeader(ret, resDKIMSSP, resDKIMADSP, useSSP, useADSP);
    7850 +               if ((dkimverify = getenv("DKIMVERIFY")))
    7851 +               {
    7852 +                       if (ret < 0)
    7853 +                       {
     8192+               if ((dkimverify = getenv("DKIMVERIFY"))) {
     8193+                       if (ret < 0) {
    78548194+                               if (dkimverify[str_chr(dkimverify, 'F' - ret)])
    78558195+                                       ret = 14; /*- return permanent error */
    78568196+                               if (dkimverify[str_chr(dkimverify, 'f' - ret)])
    78578197+                                       ret = 88; /*- return temporary error */
    7858 +                       } else
    7859 +                       {
     8198+                       } else {
    78608199+                               if (dkimverify[str_chr(dkimverify, 'A' + ret)])
    78618200+                                       ret = 14; /*- return permanent error */
     
    78738212+getversion_dkim_c()
    78748213+{
    7875 +       static char    *x = (char *) "$Id: dkim.c,v 1.19 2016-03-01 16:23:38+05:30 Cprogrammer Exp mbhangui $";
     8214+       static char    *x = (char *) "$Id: dkim.c,v 1.23 2019-06-14 21:24:59+05:30 Cprogrammer Exp mbhangui $";
    78768215+
    78778216+       x++;
     
    78798218diff -ruN ../netqmail-1.06-original/dkim.h netqmail-1.06/dkim.h
    78808219--- ../netqmail-1.06-original/dkim.h    1970-01-01 01:00:00.000000000 +0100
    7881 +++ netqmail-1.06/dkim.h        2018-04-03 14:46:51.364411606 +0200
     8220+++ netqmail-1.06/dkim.h        2019-02-27 20:57:13.386025114 +0100
    78828221@@ -0,0 +1,193 @@
    78838222+/*
     
    80768415diff -ruN ../netqmail-1.06-original/dkimbase.cpp netqmail-1.06/dkimbase.cpp
    80778416--- ../netqmail-1.06-original/dkimbase.cpp      1970-01-01 01:00:00.000000000 +0100
    8078 +++ netqmail-1.06/dkimbase.cpp  2018-04-03 14:46:51.363411603 +0200
    8079 @@ -0,0 +1,336 @@
     8417+++ netqmail-1.06/dkimbase.cpp  2019-06-19 09:46:20.131250010 +0200
     8418@@ -0,0 +1,339 @@
    80808419+/*
    80818420+ * $Log: dkimbase.cpp,v $
     8421+ * Revision 1.5  2019-06-14 21:24:03+05:30  Cprogrammer
     8422+ * BUG - honor body length tag in verification
     8423+ *
    80828424+ * Revision 1.4  2017-09-05 10:58:26+05:30  Cprogrammer
    80838425+ * removed compiler warnings
     
    82428584+                               // process body line
    82438585+                               int Result = ProcessBody(m_Line, m_LinePos, bEOF);
    8244 +                               if (Result != DKIM_SUCCESS) {
     8586+                               if (Result != DKIM_SUCCESS && Result != DKIM_FINISHED_BODY) {
    82458587+                                       m_LinePos = 0;
    82468588+                                       return Result;
     
    84108752+getversion_dkimbase_cpp()
    84118753+{
    8412 +       static char    *x = (char *) "$Id: dkimbase.cpp,v 1.4 2017-09-05 10:58:26+05:30 Cprogrammer Exp mbhangui $";
     8754+       static char    *x = (char *) "$Id: dkimbase.cpp,v 1.5 2019-06-14 21:24:03+05:30 Cprogrammer Exp mbhangui $";
    84138755+
    84148756+       x++;
     
    84168758diff -ruN ../netqmail-1.06-original/dkimbase.h netqmail-1.06/dkimbase.h
    84178759--- ../netqmail-1.06-original/dkimbase.h        1970-01-01 01:00:00.000000000 +0100
    8418 +++ netqmail-1.06/dkimbase.h    2018-04-03 14:46:51.363411603 +0200
     8760+++ netqmail-1.06/dkimbase.h    2019-02-27 20:57:13.386025114 +0100
    84198761@@ -0,0 +1,72 @@
    84208762+/*
     
    84928834diff -ruN ../netqmail-1.06-original/dkimdns.cpp netqmail-1.06/dkimdns.cpp
    84938835--- ../netqmail-1.06-original/dkimdns.cpp       1970-01-01 01:00:00.000000000 +0100
    8494 +++ netqmail-1.06/dkimdns.cpp   2018-04-03 14:46:51.364411606 +0200
    8495 @@ -0,0 +1,322 @@
     8836+++ netqmail-1.06/dkimdns.cpp   2019-05-23 15:12:30.128092884 +0200
     8837@@ -0,0 +1,329 @@
    84968838+/*
    84978839+ * $Log: dns.cpp,v $
     
    86719013+                               n = rrdlen - txtpos;
    86729014+                       if ((*txt_strlen + n + 1) > txtlen) {
    8673 +                               if (!(ptr = (char *) realloc(txt, (*txt_strlen + n) * 2)))
     9015+                               if (!(ptr = (char *) realloc(txt, (*txt_strlen + n) * 2))) {
     9016+                                       free(txt);
     9017+                                       txtlen = 0;
     9018+                                       *txt_strlen = 0;
    86749019+                                       return DNS_MEM;
     9020+                               }
     9021+                               txt = ptr;
    86759022+                               txtlen = (*txt_strlen + n) * 2;
    86769023+                       }
     
    87069053+       total = 0;
    87079054+       if (!dnresultlen) {
    8708 +               if (!(dnresult = (char *) malloc ((2 * PACKETSZ) * sizeof(char))))
     9055+               if (!(dnresult = (char *) malloc((2 * PACKETSZ) * sizeof(char))))
    87099056+                       return DNS_MEM;
    87109057+               dnresultlen = 2 * PACKETSZ;
     
    87219068+                       if ((total + len + 1) >= dnresultlen) {
    87229069+                               if (!(ptr = (char *) realloc(dnresult, (total + len) * 2))) {
     9070+                                       free(dnresult);
    87239071+                                       dnresultlen = 0;
    87249072+                                       if (txtlen) {
     
    87289076+                                       return DNS_MEM;
    87299077+                               }
     9078+                               dnresult = ptr;
    87309079+                               dnresultlen = (total + len) * 2;
    87319080+                       }
     
    88189167diff -ruN ../netqmail-1.06-original/dkimdns.h netqmail-1.06/dkimdns.h
    88199168--- ../netqmail-1.06-original/dkimdns.h 1970-01-01 01:00:00.000000000 +0100
    8820 +++ netqmail-1.06/dkimdns.h     2018-04-03 14:46:51.364411606 +0200
     9169+++ netqmail-1.06/dkimdns.h     2019-02-27 20:57:13.387025103 +0100
    88219170@@ -0,0 +1,54 @@
    88229171+/*
     
    88769225diff -ruN ../netqmail-1.06-original/dkimfuncs.cpp netqmail-1.06/dkimfuncs.cpp
    88779226--- ../netqmail-1.06-original/dkimfuncs.cpp     1970-01-01 01:00:00.000000000 +0100
    8878 +++ netqmail-1.06/dkimfuncs.cpp 2018-04-03 14:46:51.364411606 +0200
     9227+++ netqmail-1.06/dkimfuncs.cpp 2019-02-27 20:57:13.387025103 +0100
    88799228@@ -0,0 +1,236 @@
    88809229+/*
     
    89659314+
    89669315+int             DKIM_CALL
    8967 +DKIMSignGetSig(DKIMContext *pSignContext, char *szPrivKey, char *szSignature, unsigned int nSigLength)
     9316+DKIMSignGetSig(DKIMContext *pSignContext, char *szPrivKey, char *szSignature, int nSigLength)
    89689317+{
    89699318+       CDKIMSign      *pSign = (CDKIMSign *) ValidateContext(pSignContext, true);
     
    90689417+DKIMVersion()
    90699418+{
    9070 +       return (char *) "1.4";
     9419+       return (char *) "1.5";
    90719420+}
    90729421+
     
    91169465diff -ruN ../netqmail-1.06-original/dkimsign.cpp netqmail-1.06/dkimsign.cpp
    91179466--- ../netqmail-1.06-original/dkimsign.cpp      1970-01-01 01:00:00.000000000 +0100
    9118 +++ netqmail-1.06/dkimsign.cpp  2018-04-03 14:46:51.365411610 +0200
    9119 @@ -0,0 +1,1016 @@
     9467+++ netqmail-1.06/dkimsign.cpp  2020-04-10 18:20:19.279077900 +0200
     9468@@ -0,0 +1,1029 @@
    91209469+/*
    91219470+ * $Log: dkimsign.cpp,v $
     9471+ * Revision 1.17  2020-04-10 21:36:20+05:30  Cprogrammer
     9472+ * fixed BUG with domain assignment
     9473+ *
     9474+ * Revision 1.16  2020-04-09 21:21:04+05:30  Cprogrammer
     9475+ * check for null domain after DKIMDOMAIN replacement
     9476+ *
     9477+ * Revision 1.15  2019-06-26 19:08:18+05:30  Cprogrammer
     9478+ * added sBouncedAddr variable for X-Bounced-Address header added by qmail-send for bounces
     9479+ *
     9480+ * Revision 1.14  2019-06-24 22:22:15+05:30  Cprogrammer
     9481+ * use DKIMDOMAIN only if Return-Path, From, Sender header are empty
     9482+ *
     9483+ * Revision 1.13  2018-08-25 18:01:59+05:30  Cprogrammer
     9484+ * fixed dkim signing for From address containing company name
     9485+ *
     9486+ * Revision 1.12  2018-05-23 13:07:58+05:30  Cprogrammer
     9487+ * fixed compiler warnings
     9488+ *
    91229489+ * Revision 1.11  2017-09-05 10:59:03+05:30  Cprogrammer
    91239490+ * removed compiler warnings
     
    93879754+CDKIMSign::GetHeaderParams(const string & sHdr)
    93889755+{
    9389 +       string::size_type pos1, pos2;
    9390 +
     9756+       if (_strnicmp(sHdr.c_str(), "X-Bounced-Address:", 18) == 0)
     9757+               sBouncedAddr.assign(sHdr.c_str() + 21);
     9758+       else
    93919759+       if (_strnicmp(sHdr.c_str(), "X", 1) == 0)
    93929760+               return;
    9393 +       if (_strnicmp(sHdr.c_str(), "From:", 5) == 0) {
     9761+       if (_strnicmp(sHdr.c_str(), "From:", 5) == 0)
    93949762+               sFrom.assign(sHdr.c_str() + 5);
    9395 +               pos1 = sFrom.find('(');
    9396 +               pos2 = sFrom.find(')');
    9397 +               if (pos1 != 0 && pos1 != string::npos && pos2 != 0 && pos2 != string::npos)
    9398 +                       sFrom.erase(pos1, pos2);
    9399 +       }
    9400 +       if (_strnicmp(sHdr.c_str(), "Sender:", 7) == 0) {
     9763+       if (_strnicmp(sHdr.c_str(), "Sender:", 7) == 0)
    94019764+               sSender.assign(sHdr.c_str() + 7);
    9402 +               pos1 = sSender.find('(');
    9403 +               pos2 = sSender.find(')');
    9404 +               if (pos1 != 0 && pos1 != string::npos && pos2 != 0 && pos2 != string::npos)
    9405 +                       sSender.erase(pos1, pos2);
    9406 +       }
    94079765+       if (_strnicmp(sHdr.c_str(), "Return-Path:", 12) == 0)
    94089766+               sReturnPath.assign(sHdr.c_str() + 12);
     
    94529810+                               nSignThisTag = 1;
    94539811+                               IsRequiredHeader(sTag); // remove from required header list
    9454 +                       } 
     9812+                       }
    94559813+                       // is this in the list of headers that must be signed?
    94569814+                       else
     
    95999957+       if (!sFrom.empty())
    96009958+               sAddress.assign(sFrom);
     9959+       else /* use indimail's X-Bounced-Address header to find the domain that injected the bounce */
     9960+       if (!sBouncedAddr.empty())
     9961+               sAddress.assign(sBouncedAddr);
    96019962+       else
    96029963+               return false;
    9603 +       // simple for now, beef it up later
    9604 +       // remove '<' and anything before it
     9964+       /*-
     9965+        * simple for now, beef it up later
     9966+        * remove '<' and anything before it
     9967+        */
    96059968+       pos = sAddress.find('<');
    96069969+       if (pos != string::npos)
    9607 +               sAddress.erase(0, pos);
    9608 +       // remove '>' and anything after it
     9970+               sAddress.erase(0, pos + 1);
     9971+
     9972+       /* remove '>' and anything after it */
    96099973+       pos = sAddress.find('>');
    96109974+       if (pos != string::npos)
    96119975+               sAddress.erase(pos, string::npos);
    9612 +       // look for '@' symbol
    9613 +       pos = sAddress.find('@');
    9614 +       if (pos == string::npos)
    9615 +               return false;
     9976+       /* look for '@' symbol */
    96169977+       if (sDomain.empty()) {
    9617 +               p = getenv("DKIMDOMAIN");
    9618 +               if (p && *p)
    9619 +               {
    9620 +                       if (!(at = strchr(p, '@')))
    9621 +                               at = p;
    9622 +                       else
    9623 +                               at++;
    9624 +                       sDomain.assign(at);
    9625 +               } else
     9978+               pos = sAddress.find('@');
     9979+               if (pos != string::npos)
    96269980+                       sDomain.assign(sAddress.c_str() + pos + 1);
    9627 +               RemoveSWSP(sDomain);
    9628 +       }
     9981+               if (sDomain.empty()) {
     9982+                       p = getenv("DKIMDOMAIN");
     9983+                       if (p && *p) {
     9984+                               if (!(at = strchr(p, '@')))
     9985+                                       at = p;
     9986+                               else
     9987+                                       at++;
     9988+                               sDomain.assign(at);
     9989+                       }
     9990+               }
     9991+       }
     9992+       RemoveSWSP(sDomain);
    96299993+       return true;
    96309994+}
     
    989510259+               for (sptr = ptr, len = 0;*sptr;sptr++) {
    989610260+                       if (*sptr == '%')
    9897 +                               len += (int) strlen(dptr);
     10261+                               len += (int) strlen(dptr) + 1;
    989810262+                       else
    989910263+                               len++;
    990010264+               }
    9901 +               if (!(buf = new char[len])) {
     10265+               if (!(buf = new char[len]))
    990210266+                       return DKIM_OUT_OF_MEMORY;
    9903 +               }
    990410267+               for (cptr = buf, sptr = ptr; *sptr; sptr++) {
    990510268+                       if (*sptr == '%') {
    9906 +                               strncpy(cptr, dptr, (len = strlen(dptr)));
     10269+                               memcpy(cptr, dptr, (len = strlen(dptr)));
    990710270+                               cptr += len;
    9908 +                       } else {
     10271+                       } else
    990910272+                               *cptr++ = *sptr;
    9910 +                       }
    991110273+               }
    991210274+               *cptr = 0;
     
    1013010492+getversion_dkimsign_cpp()
    1013110493+{
    10132 +       static char    *x = (char *) "$Id: dkimsign.cpp,v 1.11 2017-09-05 10:59:03+05:30 Cprogrammer Exp mbhangui $";
     10494+       static char    *x = (char *) "$Id: dkimsign.cpp,v 1.17 2020-04-10 21:36:20+05:30 Cprogrammer Exp mbhangui $";
    1013310495+
    1013410496+       x++;
     
    1013610498diff -ruN ../netqmail-1.06-original/dkimsign.h netqmail-1.06/dkimsign.h
    1013710499--- ../netqmail-1.06-original/dkimsign.h        1970-01-01 01:00:00.000000000 +0100
    10138 +++ netqmail-1.06/dkimsign.h    2018-04-03 14:46:51.366411614 +0200
    10139 @@ -0,0 +1,108 @@
     10500+++ netqmail-1.06/dkimsign.h    2020-04-10 18:39:39.483427628 +0200
     10501@@ -0,0 +1,115 @@
    1014010502+/*
    1014110503+ * $Log: dkimsign.h,v $
     10504+ * Revision 1.5  2019-06-26 19:09:07+05:30  Cprogrammer
     10505+ * added sBouncedAddr variable for X-Bounced-Address header added by qmail-send for bounces
     10506+ *
     10507+ * Revision 1.4  2017-09-05 10:59:20+05:30  Cprogrammer
     10508+ * removed compiler warnings
     10509+ *
    1014210510+ * Revision 1.3  2017-08-09 22:03:09+05:30  Cprogrammer
    1014310511+ * initialized EVP_MD_CTX variables
     
    1022510593+       string          sSelector;
    1022610594+       string          sReturnPath;
     10595+       string          sBouncedAddr; /*- used for bounces */
    1022710596+       string          sDomain;
    1022810597+       string          sIdentity;      // for i= tag, if empty tag will not be included in sig
     
    1024810617diff -ruN ../netqmail-1.06-original/dkimverify.cpp netqmail-1.06/dkimverify.cpp
    1024910618--- ../netqmail-1.06-original/dkimverify.cpp    1970-01-01 01:00:00.000000000 +0100
    10250 +++ netqmail-1.06/dkimverify.cpp        2018-04-03 14:46:51.367411617 +0200
    10251 @@ -0,0 +1,1285 @@
     10619+++ netqmail-1.06/dkimverify.cpp        2019-06-19 09:47:20.017583230 +0200
     10620@@ -0,0 +1,1303 @@
    1025210621+/*
    1025310622+ * $Log: dkimverify.cpp,v $
     10623+ * Revision 1.23  2019-05-22 11:29:09+05:30  Cprogrammer
     10624+ * fix for 32 bit systems where time_t is 4 bytes & encounters year 2038 issue
     10625+ *
     10626+ * Revision 1.22  2019-05-21 22:27:17+05:30  Cprogrammer
     10627+ * increased buffer size
     10628+ *
     10629+ * Revision 1.21  2019-02-17 11:32:05+05:30  Cprogrammer
     10630+ * made scope of sFromDomain static
     10631+ *
     10632+ * Revision 1.20  2018-12-14 11:05:20+05:30  Cprogrammer
     10633+ * fixed 'conversion from 'int' to 'char' inside { }” for cross compiling on arm
     10634+ *
     10635+ * Revision 1.19  2018-08-08 23:56:27+05:30  Cprogrammer
     10636+ * changed comment style
     10637+ *
    1025410638+ * Revision 1.18  2017-09-05 11:00:33+05:30  Cprogrammer
    1025510639+ * removed extra whitespace
     
    1032910713+#include "config.h"
    1033010714+#endif
     10715+#include "time_t_size.h"
    1033110716+#define _strnicmp strncasecmp
    1033210717+#define _stricmp strcasecmp
     
    1034010725+#include "dkimdns.h"
    1034110726+
    10342 +#define MAX_SIGNATURES 10              // maximum number of DKIM signatures to process in a message
     10727+#define MAX_SIGNATURES 10              /*- maximum number of DKIM signatures to process in a message */
    1034310728+
    1034410729+SignatureInfo::SignatureInfo(bool s)
     
    1039710782+
    1039810783+       for (;;) {
    10399 +               // skip whitespace
     10784+               /* skip whitespace */
    1040010785+               while (isswsp(*s))
    1040110786+                       s++;
    10402 +               // if at the end of the string, return success.  note: this allows a list with no entries
     10787+               /* if at the end of the string, return success.  note: this allows a list with no entries */
    1040310788+               if (*s == '\0')
    1040410789+                       return true;
    10405 +               // get tag name
     10790+               /*- get tag name -*/
    1040610791+               if (!isalpha(*s))
    1040710792+                       return false;
     
    1041110796+               } while (isalnum(*s) || *s == '-');
    1041210797+               char           *endtag = s;
    10413 +               // skip whitespace before equals
     10798+               /*- skip whitespace before equals -*/
    1041410799+               while (isswsp(*s))
    1041510800+                       s++;
    10416 +               // next character must be equals
     10801+               /*- next character must be equals -*/
    1041710802+               if (*s != '=')
    1041810803+                       return false;
    1041910804+               s++;
    10420 +               // null-terminate tag name
     10805+               /*- null-terminate tag name -*/
    1042110806+               *endtag = '\0';
    10422 +               // skip whitespace after equals
     10807+               /*- skip whitespace after equals -*/
    1042310808+               while (isswsp(*s))
    1042410809+                       s++;
    10425 +               // get tag value
     10810+               /*- get tag value -*/
    1042610811+               char           *value = s;
    1042710812+               while (*s != ';' && ((*s == '\t' || *s == '\r' || *s == '\n') || (*s >= ' ' && *s <= '~')))
    1042810813+                       s++;
    1042910814+               char           *e = s;
    10430 +               // make sure the next character is the null terminator (which means we're done) or a semicolon (not done)
     10815+               /*- make sure the next character is the null terminator (which means we're done) or a semicolon (not done) -*/
    1043110816+               bool            done = false;
    1043210817+               if (*s == '\0')
     
    1043710822+                       s++;
    1043810823+               }
    10439 +               // skip backwards past any trailing whitespace
     10824+               /*- skip backwards past any trailing whitespace -*/
    1044010825+               while (e > value && isswsp(e[-1]))
    1044110826+                       e--;
    10442 +               // null-terminate tag value
     10827+               /*- null-terminate tag value -*/
    1044310828+               *e = '\0';
    10444 +               // check to see if we want this tag
     10829+               /*- check to see if we want this tag -*/
    1044510830+               for (unsigned i = 0; wanted[i] != NULL; i++) {
    1044610831+                       if (strcmp(wanted[i], tag) == 0) {
    10447 +                               // return failure if we already have a value for this tag (duplicates not allowed)
     10832+                               /*- return failure if we already have a value for this tag (duplicates not allowed) -*/
    1044810833+                               if (values[i] != NULL)
    1044910834+                                       return false;
     
    1045710842+}
    1045810843+
    10459 +// Convert hex char to value (0-15)
     10844+/*- Convert hex char to value (0-15) -*/
    1046010845+char
    1046110846+tohex(char ch)
     
    1051010895+DecodeBase64(char *ptr)
    1051110896+{
    10512 +       static const char base64_table[256] =
     10897+       static const signed char base64_table[256] =
    1051310898+               { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    1051410899+               -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1,
     
    1055310938+WildcardMatch(const char *p, const char *s)
    1055410939+{
    10555 +       // special case: An empty "g=" value never matches any addresses
     10940+       /*- special case: An empty "g=" value never matches any addresses -*/
    1055610941+       if (*p == '\0')
    1055710942+               return false;
     
    1058210967+               char           *from = s;
    1058310968+               char           *to = s;
    10584 +               char           *lt = NULL;      // pointer to less than character (<) which starts the address if found
     10969+               char           *lt = NULL;      /*- pointer to less than character (<) which starts the address if found */
    1058510970+               while (*from != '\0') {
    1058610971+                       if (*from == '(') {
    10587 +                               // skip over comment
     10972+                               /*- skip over comment -*/
    1058810973+                               from++;
    1058910974+                               for (int depth = 1; depth != 0; from++) {
     
    1060210987+                       }
    1060310988+                       else
    10604 +                       if (*from == ')') {
    10605 +                               // ignore closing parenthesis outside of comment
     10989+                       if (*from == ')') /*- ignore closing parenthesis outside of comment -*/
    1060610990+                               from++;
    10607 +                       }
    10608 +
    1060910991+                       else
    1061010992+                       if (*from == ',' || *from == ';') {
    10611 +                               // comma/selicolon ends the address
     10993+                               /*- comma/selicolon ends the address -*/
    1061210994+                               from++;
    1061310995+                               break;
    1061410996+                       }
    1061510997+                       else
    10616 +                       if (*from == ' ' || *from == '\t' || *from == '\r' || *from == '\n') {
    10617 +                               // ignore whitespace
     10998+                       if (*from == ' ' || *from == '\t' || *from == '\r' || *from == '\n') /*- ignore whitespace -*/
    1061810999+                               from++;
    10619 +                       }
    1062011000+                       else
    1062111001+                       if (*from == '"') {
    10622 +                               // copy the contents of a quoted string
     11002+                               /*- copy the contents of a quoted string -*/
    1062311003+                               from++;
    1062411004+                               while (*from != '\0') {
     
    1063511015+                       else
    1063611016+                       if (*from == '\\' && from[1] != '\0') {
    10637 +                               // copy quoted-pair
     11017+                               /*- copy quoted-pair -*/
    1063811018+                               *to++ = *from++;
    1063911019+                               *to++ = *from++;
    1064011020+                       } else {
    10641 +                               // copy any other char
     11021+                               /*- copy any other char -*/
    1064211022+                               *to = *from++;
    1064311023+                               // save pointer to '<' for later...
     
    1064811028+               }
    1064911029+               *to = '\0';
    10650 +               // if there's < > get what's inside
     11030+               /*- if there's < > get what's inside -*/
    1065111031+               if (lt != NULL) {
    1065211032+                       start = lt + 1;
     
    1065511035+                               *gt = '\0';
    1065611036+               } else {
    10657 +                       // look for and strip group name
     11037+                       /*- look for and strip group name -*/
    1065811038+                       char           *colon = strchr(start, ':');
    1065911039+                       if (colon != NULL) {
     
    1068611066+}
    1068711067+
    10688 +// Init - save the options
     11068+/*- Init - save the options -*/
    1068911069+int
    1069011070+CDKIMVerify::Init(DKIMVerifyOptions *pOptions)
     
    1070311083+}
    1070411084+
    10705 +// GetResults - return the pass/fail/neutral verification result
     11085+/*- GetResults - return the pass/fail/neutral verification result -*/
    1070611086+int
    1070711087+CDKIMVerify::GetResults(int *sCount, int *sSize)
     
    1071111091+       int             TestingFailures = 0;
    1071211092+       int             RealFailures = 0;
    10713 +       list <string>   SuccessfulDomains;      // can contain duplicates
    10714 +       /* get the From address's domain if we might need it */
    10715 +       string          sFromDomain;
     11093+       list <string>   SuccessfulDomains;      /* can contain duplicates */
     11094+       string          sFromDomain; /*- get the From address's domain if we might need it -*/
    1071611095+
    1071711096+       for (list < SignatureInfo >::iterator i = Signatures.begin(); i != Signatures.end(); ++i) {
    1071811097+               if (i->Status == DKIM_SUCCESS) {
    10719 +                       if (!i->BodyHashData.empty()) {
    10720 +                               // check the body hash
     11098+                       if (!i->BodyHashData.empty()) { /*- check the body hash -*/
    1072111099+                               unsigned char   md[EVP_MAX_MD_SIZE];
    1072211100+                               unsigned        len = 0;
     
    1072711105+#endif
    1072811106+                               if (!res || len != i->BodyHashData.length() || memcmp(i->BodyHashData.data(), md, len) != 0) {
    10729 +                                       // body hash mismatch
    10730 +                                       // if the selector is in testing mode...
    10731 +                                       if (i->m_pSelector->Testing) {
    10732 +                                               i->Status = DKIM_SIGNATURE_BAD_BUT_TESTING;     // todo: make a new error code for this?
     11107+                                       /* body hash mismatch */
     11108+                                       if (i->m_pSelector->Testing) { /* if the selector is in testing mode... */
     11109+                                               i->Status = DKIM_SIGNATURE_BAD_BUT_TESTING;     /* todo: make a new error code for this? */
    1073311110+                                               TestingFailures++;
    1073411111+                                       } else {
     
    1073911116+                               }
    1074011117+                       } else {
    10741 +                               // hash CRLF separating the body from the signature
     11118+                               /* hash CRLF separating the body from the signature */
    1074211119+                               i->Hash("\r\n", 2);
    1074311120+                       }
    10744 +                       // check the header hash
     11121+                       /*- check the header hash -*/
    1074511122+                       string          sSignedSig = i->Header;
    1074611123+                       string          sSigValue = sSignedSig.substr(sSignedSig.find(':') + 1);
     
    1075611133+                       if (i->HeaderCanonicalization == DKIM_CANON_NOWSP) {
    1075711134+                               RemoveSWSP(sSignedSig);
    10758 +                               // convert "DKIM-Signature" to lower case
     11135+                               /* convert "DKIM-Signature" to lower case */
    1075911136+                               sSignedSig.replace(0, 14, "dkim-signature", 14);
    1076011137+                       }
     
    1077611153+                               SuccessfulDomains.push_back(i->Domain);
    1077711154+                       } else {
    10778 +                               // if the selector is in testing mode...
     11155+                               /* if the selector is in testing mode... */
    1077911156+                               if (i->m_pSelector->Testing) {
    1078011157+                                       i->Status = DKIM_SIGNATURE_BAD_BUT_TESTING;
     
    1078911166+                       || i->Status == DKIM_SELECTOR_ALGORITHM_MISMATCH
    1079011167+                       || i->Status == DKIM_SELECTOR_KEY_REVOKED) {
    10791 +                       // treat these as failures
    10792 +                       // todo: maybe see if the selector is in testing mode?
     11168+                       /*- treat these as failures -*/
     11169+                       /*- todo: maybe see if the selector is in testing mode? -*/
    1079311170+                       RealFailures++;
    1079411171+               }
     
    1079711174+               for (list < string >::iterator i = HeaderList.begin(); i != HeaderList.end(); ++i) {
    1079811175+                       if (_strnicmp(i->c_str(), "From", 4) == 0) {
    10799 +                               // skip over whitespace between the header name and :
     11176+                               /*- skip over whitespace between the header name and : -*/
    1080011177+                               const char     *s = i->c_str() + 4;
    1080111178+                               while (*s == ' ' || *s == '\t')
     
    1081211189+               }
    1081311190+       }
    10814 +       // if a signature from the From domain verified successfully, return success now
    10815 +       // without checking the sender signing practices
     11191+       /*-
     11192+        * if a signature from the From domain verified successfully,
     11193+        * return success now without checking the sender signing practices
     11194+        */
    1081611195+       if (SuccessCount > 0 && !sFromDomain.empty()) {
    1081711196+               for (list < string >::iterator i = SuccessfulDomains.begin(); i != SuccessfulDomains.end(); ++i) {
    10818 +                       // see if the successful domain is the same as or a parent of the From domain
     11197+                       /* see if the successful domain is the same as or a parent of the From domain */
    1081911198+                       if (i->length() > sFromDomain.length())
    1082011199+                               continue;
     
    1087011249+
    1087111250+
    10872 +// ProcessHeaders - Look for DKIM-Signatures and start processing them
     11251+/*- ProcessHeaders - Look for DKIM-Signatures and start processing them -*/
    1087311252+int
    1087411253+CDKIMVerify::ProcessHeaders(void)
    1087511254+{
    1087611255+
    10877 +       // look for DKIM-Signature header(s)
     11256+       /*- look for DKIM-Signature header(s) -*/
    1087811257+       for (list < string >::iterator i = HeaderList.begin(); i != HeaderList.end(); ++i) {
    1087911258+               if (_strnicmp(i->c_str(), "DKIM-Signature", 14) == 0) {
    10880 +                       // skip over whitespace between the header name and :
     11259+                       /*- skip over whitespace between the header name and : -*/
    1088111260+                       const char     *s = i->c_str() + 14;
    1088211261+                       while (*s == ' ' || *s == '\t')
     
    1090511284+                       return (sig.Status);
    1090611285+               } else {
    10907 +                       // check the granularity
     11286+                       /*- check the granularity -*/
    1090811287+                       if (!WildcardMatch(sel.Granularity.c_str(), sig.IdentityLocalPart.c_str()))
    10909 +                               sig.Status = DKIM_SELECTOR_GRANULARITY_MISMATCH;        // this error causes the signature to fail
    10910 +                       // check the hash algorithm
     11288+                               sig.Status = DKIM_SELECTOR_GRANULARITY_MISMATCH;        /* this error causes the signature to fail */
     11289+                       /*- check the hash algorithm -*/
    1091111290+#ifdef HAVE_EVP_SHA256
    1091211291+                       if ((sig.m_nHash == DKIM_HASH_SHA1 && !sel.AllowSHA1) || (sig.m_nHash == DKIM_HASH_SHA256 && !sel.AllowSHA256))
     
    1091411293+                       if ((sig.m_nHash == DKIM_HASH_SHA1 && !sel.AllowSHA1))
    1091511294+#endif
    10916 +                               sig.Status = DKIM_SELECTOR_ALGORITHM_MISMATCH;  // causes signature to fail
    10917 +                       // check for same domain
     11295+                               sig.Status = DKIM_SELECTOR_ALGORITHM_MISMATCH;  /* causes signature to fail */
     11296+                       /*- check for same domain -*/
    1091811297+                       if (sel.SameDomain && _stricmp(sig.Domain.c_str(), sig.IdentityDomain.c_str()) != 0)
    1091911298+                               sig.Status = DKIM_BAD_SYNTAX;
     
    1092111300+               if (sig.Status != DKIM_SUCCESS)
    1092211301+                       continue;
    10923 +               // initialize the hashes
     11302+               /*- initialize the hashes -*/
    1092411303+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
    1092511304+#ifdef HAVE_EVP_SHA256
     
    1094911328+#endif
    1095011329+#endif
    10951 +               // compute the hash of the header
     11330+               /*- compute the hash of the header -*/
    1095211331+               vector < list < string >::reverse_iterator > used;
    1095311332+               for (vector < string >::iterator x = sig.SignedHeaders.begin(); x != sig.SignedHeaders.end(); ++x) {
     
    1095511334+                       for (i = HeaderList.rbegin(); i != HeaderList.rend(); ++i) {
    1095611335+                               if (_strnicmp(i->c_str(), x->c_str(), x->length()) == 0) {
    10957 +                                       // skip over whitespace between the header name and :
     11336+                                       /*- skip over whitespace between the header name and : -*/
    1095811337+                                       const char     *s = i->c_str() + x->length();
    1095911338+                                       while (*s == ' ' || *s == '\t')
     
    1096511344+                       if (i != HeaderList.rend()) {
    1096611345+                               used.push_back(i);
    10967 +                               // hash this header
     11346+                               /*- hash this header -*/
    1096811347+                               if (sig.HeaderCanonicalization == DKIM_CANON_SIMPLE)
    1096911348+                                       sig.Hash(i->c_str(), i->length());
     
    1097611355+                                       string          sTemp = *i;
    1097711356+                                       RemoveSWSP(sTemp);
    10978 +                                       // convert characters before ':' to lower case
     11357+                                       /*- convert characters before ':' to lower case -*/
    1097911358+                                       for (char *s = (char *)sTemp.c_str(); *s != '\0' && *s != ':'; s++) {
    1098011359+                                               if (*s >= 'A' && *s <= 'Z')
     
    1098611365+                       }
    1098711366+               }
    10988 +               if (sig.BodyHashData.empty()) {
    10989 +                       // hash CRLF separating headers from body
     11367+               if (sig.BodyHashData.empty()) /*- hash CRLF separating headers from body -*/
    1099011368+                       sig.Hash("\r\n", 2);
    10991 +               }
    1099211369+               if (!m_AllowUnsignedFromHeaders) {
    10993 +                       // make sure the message has no unsigned From headers
     11370+                       /*- make sure the message has no unsigned From headers -*/
    1099411371+                       list<string>::reverse_iterator i;
    1099511372+                       for( i = HeaderList.rbegin(); i != HeaderList.rend(); ++i ) {
    1099611373+                               if( _strnicmp(i->c_str(), "From", 4 ) == 0 ) {
    10997 +                                       // skip over whitespace between the header name and :
     11374+                                       /*- skip over whitespace between the header name and : -*/
    1099811375+                                       const char *s = i->c_str()+4;
    1099911376+                                       while (*s == ' ' || *s == '\t')
     
    1100111378+                                       if (*s == ':') {
    1100211379+                                               if (find(used.begin(), used.end(), i) == used.end()) {
    11003 +                                                       // this From header was not signed
     11380+                                                       /*- this From header was not signed -*/
    1100411381+                                                       break;
    1100511382+                                               }
     
    1100811385+                       }
    1100911386+                       if (i != HeaderList.rend()) {
    11010 +                               // treat signature as invalid
     11387+                               /*- treat signature as invalid -*/
    1101111388+                               sig.Status = DKIM_UNSIGNED_FROM;
    1101211389+                               continue;
     
    1103511412+       do {
    1103611413+               if (*s < '0' || *s > '9')
    11037 +                       return false;           // returns false for an initial '\0'
     11414+                       return false;   /*- returns false for an initial '\0' */
    1103811415+               temp = temp * 10 + (*s - '0');
    1103911416+               if (temp < last)
     
    1105011427+
    1105111428+
    11052 +// ParseDKIMSignature - Parse a DKIM-Signature header field
     11429+/*- ParseDKIMSignature - Parse a DKIM-Signature header field -*/
    1105311430+int
    1105411431+CDKIMVerify::ParseDKIMSignature(const string &sHeader, SignatureInfo &sig)
    1105511432+{
    1105611433+
    11057 +       // save header for later
     11434+       /*- save header for later -*/
    1105811435+       sig.Header = sHeader;
    1105911436+       string          sValue = sHeader.substr(sHeader.find(':') + 1);
     
    1106411441+       if (!ParseTagValueList((char *) sValue.c_str(), tags, values))
    1106511442+               return DKIM_BAD_SYNTAX;
    11066 +       // check signature version
     11443+       /*- check signature version -*/
    1106711444+       if (values[0] != NULL) {
    1106811445+               if (strcmp(values[0], "1") == 0 || strcmp(values[0], "0.5") == 0 || strcmp(values[0], "0.4") == 0
    1106911446+                       || strcmp(values[0], "0.3") == 0 || strcmp(values[0], "0.2") == 0) {
    1107011447+                       sig.Version = DKIM_SIG_VERSION_02_PLUS;
    11071 +               } else {
    11072 +               // unknown version
     11448+               } else /*- unknown version -*/
    1107311449+                       return DKIM_STAT_INCOMPAT;
    11074 +               }
    1107511450+       } else {
    11076 +               // Note:  DKIM Interop 1 pointed out that v= is now required, but we do
    11077 +               // not enforce that in order to verify signatures made by older drafts.
    11078 +
    11079 +               // prior to 0.2, there MUST NOT have been a v=
    11080 +               // (optionally) support these signatures, for backwards compatibility
     11451+               /*-
     11452+                * Note:  DKIM Interop 1 pointed out that v= is now required, but we do
     11453+                * not enforce that in order to verify signatures made by older drafts.
     11454+                * prior to 0.2, there MUST NOT have been a v=
     11455+                * (optionally) support these signatures, for backwards compatibility
     11456+                */
    1108111457+               if (true) {
    1108211458+                       sig.Version = DKIM_SIG_VERSION_PRE_02;
     
    1108511461+               }
    1108611462+       }
    11087 +       // signature MUST have a=, b=, d=, h=, s=
     11463+       /*- signature MUST have a=, b=, d=, h=, s= -*/
    1108811464+       if (values[1] == NULL || values[2] == NULL || values[3] == NULL || values[4] == NULL || values[5] == NULL)
    1108911465+               return DKIM_BAD_SYNTAX;
    11090 +       // algorithm can be "rsa-sha1" or "rsa-sha256"
     11466+       /*- algorithm can be "rsa-sha1" or "rsa-sha256" -*/
    1109111467+       if (strcmp(values[1], "rsa-sha1") == 0) {
    1109211468+               sig.m_nHash = DKIM_HASH_SHA1;
    1109311469+       }
    1109411470+#ifdef HAVE_EVP_SHA256
    11095 +       else if (strcmp(values[1], "rsa-sha256") == 0) {
     11471+       else
     11472+       if (strcmp(values[1], "rsa-sha256") == 0)
    1109611473+               sig.m_nHash = DKIM_HASH_SHA256;
    11097 +       }
    1109811474+#endif
    11099 +       else {
    11100 +               return DKIM_BAD_SYNTAX; // todo: maybe create a new error code for unknown algorithm
    11101 +       }
    11102 +       // make sure the signature data is not empty
     11475+       else
     11476+               return DKIM_BAD_SYNTAX; /* todo: maybe create a new error code for unknown algorithm */
     11477+       /*- make sure the signature data is not empty -*/
    1110311478+       unsigned SigDataLen = DecodeBase64(values[2]);
    1110411479+       if (SigDataLen == 0)
    1110511480+               return DKIM_BAD_SYNTAX;
    1110611481+       sig.SignatureData.assign(values[2], SigDataLen);
    11107 +       // check for body hash
     11482+       /*- check for body hash -*/
    1110811483+       if (values[12] == NULL) {
    11109 +               // use the old single hash way for backwards compatibility
     11484+               /*- use the old single hash way for backwards compatibility -*/
    1111011485+               if (sig.Version != DKIM_SIG_VERSION_PRE_02)
    1111111486+                       return DKIM_BAD_SYNTAX;
     
    1111611491+               sig.BodyHashData.assign(values[12], BodyHashLen);
    1111711492+       }
    11118 +       // domain must not be empty
     11493+       /*- domain must not be empty -*/
    1111911494+       if (*values[3] == '\0')
    1112011495+               return DKIM_BAD_SYNTAX;
    1112111496+       sig.Domain = values[3];
    11122 +       // signed headers must not be empty (more verification is done later)
     11497+       /*- signed headers must not be empty (more verification is done later) -*/
    1112311498+       if (*values[4] == '\0')
    1112411499+               return DKIM_BAD_SYNTAX;
    11125 +       // selector must not be empty
     11500+       /*- selector must not be empty -*/
    1112611501+       if (*values[5] == '\0')
    1112711502+               return DKIM_BAD_SYNTAX;
    1112811503+       sig.Selector = values[5];
    11129 +       // canonicalization
     11504+       /*- canonicalization -*/
    1113011505+       if (values[6] == NULL) {
    1113111506+               sig.HeaderCanonicalization = sig.BodyCanonicalization = DKIM_CANON_SIMPLE;
    1113211507+       }
    1113311508+       else
    11134 +       if (sig.Version == DKIM_SIG_VERSION_PRE_02 && strcmp(values[6], "nowsp") == 0) {
    11135 +       // for backwards compatibility
     11509+       if (sig.Version == DKIM_SIG_VERSION_PRE_02 && strcmp(values[6], "nowsp") == 0) /*- for backwards compatibility -*/
    1113611510+               sig.HeaderCanonicalization = sig.BodyCanonicalization = DKIM_CANON_NOWSP;
    11137 +       } else {
     11511+       else {
    1113811512+               char           *slash = strchr(values[6], '/');
    1113911513+               if (slash != NULL)
     
    1115411528+                       return DKIM_BAD_SYNTAX;
    1115511529+       }
    11156 +       // identity
     11530+       /*- identity -*/
    1115711531+       if (values[7] == NULL) {
    1115811532+               sig.IdentityLocalPart.erase();
    1115911533+               sig.IdentityDomain = sig.Domain;
    1116011534+       } else {
    11161 +               // quoted-printable decode the value
     11535+               /*- quoted-printable decode the value -*/
    1116211536+               DecodeQuotedPrintable(values[7]);
    11163 +               // must have a '@' separating the local part from the domain
     11537+               /*- must have a '@' separating the local part from the domain -*/
    1116411538+               char           *at = strchr(values[7], '@');
    1116511539+               if (at == NULL)
     
    1116811542+               char           *ilocalpart = values[7];
    1116911543+               char           *idomain = at + 1;
    11170 +               // i= domain must be the same as or a subdomain of the d= domain
     11544+               /*- i= domain must be the same as or a subdomain of the d= domain -*/
    1117111545+               int idomainlen = strlen(idomain);
    1117211546+               int ddomainlen = strlen(values[3]);
    1117311547+
    11174 +               // todo: maybe create a new error code for invalid identity domain
     11548+               /*- todo: maybe create a new error code for invalid identity domain -*/
    1117511549+               if (idomainlen < ddomainlen)
    1117611550+                       return DKIM_BAD_SYNTAX;
     
    1118211556+               sig.IdentityDomain = idomain;
    1118311557+       }
    11184 +       // body count
     11558+       /*- body count -*/
    1118511559+       if (values[8] == NULL || !m_HonorBodyLengthTag) {
    1118611560+               sig.BodyLength = -1;
     
    1118911563+                       return DKIM_BAD_SYNTAX;
    1119011564+       }
    11191 +       // query methods
     11565+       /*- query methods -*/
    1119211566+       if (values[9] != NULL) {
    1119311567+
    11194 +               // make sure "dns" is in the list
     11568+               /*- make sure "dns" is in the list -*/
    1119511569+               bool            HasDNS = false;
    1119611570+               char           *s = strtok_r(values[9], ":", &saveptr);
     
    1120511579+                       return DKIM_BAD_SYNTAX; // todo: maybe create a new error code for unknown query method
    1120611580+       }
    11207 +       // signature time
     11581+#if SIZEOF_TIME_T  == 8
     11582+       /*- signature time -*/
    1120811583+       time_t          SignedTime = -1;
     11584+#else
     11585+       long long       SignedTime = -1;
     11586+#endif
    1120911587+       if (values[10] != NULL) {
    1121011588+               if (!ParseUnsigned(values[10], (unsigned long *) &SignedTime))
    1121111589+                       return DKIM_BAD_SYNTAX;
    1121211590+       }
    11213 +       // expiration time
     11591+       /*- expiration time -*/
    1121411592+       if (values[11] == NULL) {
    1121511593+               sig.ExpireTime = -1;
     
    1121811596+                       return DKIM_BAD_SYNTAX;
    1121911597+               if (sig.ExpireTime != -1) {
    11220 +                       // the value of x= MUST be greater than the value of t= if both are present
     11598+                       /*- the value of x= MUST be greater than the value of t= if both are present -*/
     11599+#if SIZEOF_TIME_T  == 8
    1122111600+                       if (SignedTime != -1 && sig.ExpireTime <= SignedTime)
    1122211601+                               return DKIM_BAD_SYNTAX;
    11223 +                       // todo: if possible, use the received date/time instead of the current time
     11602+#else
     11603+                       if (SignedTime != -1 && (long long) sig.ExpireTime <= SignedTime)
     11604+                               return DKIM_BAD_SYNTAX;
     11605+#endif
     11606+                       /*- todo: if possible, use the received date/time instead of the current time -*/
    1122411607+                       time_t curtime = time(NULL);
     11608+#if SIZEOF_TIME_T  == 8
    1122511609+                       if (curtime > sig.ExpireTime)
    1122611610+                               return DKIM_SIGNATURE_EXPIRED;
     11611+#else /*- handle year 2038 the best we can, beyond which one has to upgrade to a 64 bit os */
     11612+                       if (curtime < 2147483648 && curtime > sig.ExpireTime)
     11613+                               return DKIM_SIGNATURE_EXPIRED;
     11614+#endif
    1122711615+               }
    1122811616+       }
    11229 +       // parse the signed headers list
     11617+       /*- parse the signed headers list -*/
    1123011618+       bool            HasFrom = false, HasSubject = false;
    11231 +       RemoveSWSP(values[4]);          // header names shouldn't have spaces in them so this should be ok...
     11619+       RemoveSWSP(values[4]);          /*- header names shouldn't have spaces in them so this should be ok... */
    1123211620+       char           *s = strtok_r(values[4], ":", &saveptr);
    1123311621+       while (s != NULL) {
     
    1124111629+       }
    1124211630+       if (!HasFrom)
    11243 +               return DKIM_BAD_SYNTAX; // todo: maybe create a new error code for h= missing From
     11631+               return DKIM_BAD_SYNTAX; /*- todo: maybe create a new error code for h= missing From */
    1124411632+       if (m_SubjectIsRequired && !HasSubject)
    11245 +               return DKIM_BAD_SYNTAX; // todo: maybe create a new error code for h= missing Subject
     11633+               return DKIM_BAD_SYNTAX; /*- todo: maybe create a new error code for h= missing Subject */
    1124611634+       return DKIM_SUCCESS;
    1124711635+}
    1124811636+
    1124911637+
    11250 +// ProcessBody - Process message body data
     11638+/*- ProcessBody - Process message body data -*/
    1125111639+int
    1125211640+CDKIMVerify::ProcessBody(char *szBuffer, int nBufLength, bool bEOF)
     
    1133011718+               return DKIM_SELECTOR_INVALID;
    1133111719+       if (values[0] != NULL) {
    11332 +
    11333 +               // make sure the version is "DKIM1"
     11720+               /*- make sure the version is "DKIM1" -*/
    1133411721+               if (strcmp(values[0], "DKIM1") != 0)
    11335 +                       return DKIM_SELECTOR_INVALID;   // todo: maybe create a new error code for unsupported selector version
    11336 +               // make sure v= is the first tag in the response    // todo: maybe don't enforce this, it seems unnecessary
     11722+                       return DKIM_SELECTOR_INVALID;   /*- todo: maybe create a new error code for unsupported selector version */
     11723+               /*- make sure v= is the first tag in the response  */
     11724+               /*- todo: maybe don't enforce this, it seems unnecessary */
    1133711725+               for (unsigned int j = 1; j < sizeof (values) / sizeof (values[0]); j++) {
    1133811726+                       if (values[j] != NULL && values[j] < values[0]) {
     
    1134111729+               }
    1134211730+       }
    11343 +       // selector MUST have p= tag
     11731+       /*- selector MUST have p= tag -*/
    1134411732+       if (values[4] == NULL)
    1134511733+               return DKIM_SELECTOR_INVALID;
    11346 +       // granularity
     11734+       /*- granularity -*/
    1134711735+       if (values[1] == NULL)
    1134811736+               Granularity = "*";
     
    1135011738+       else
    1135111739+               Granularity = values[1];
    11352 +       // hash algorithm
     11740+       /*- hash algorithm -*/
    1135311741+       if (values[2] == NULL) {
    1135411742+               AllowSHA1 = true;
     
    1135911747+#endif
    1136011748+       } else {
    11361 +               // MUST include "sha1" or "sha256"
     11749+               /*- MUST include "sha1" or "sha256" -*/
    1136211750+               char           *s = strtok_r(values[2], ":", &saveptr);
    1136311751+               while (s != NULL) {
     
    1137511763+               if (!AllowSHA1)
    1137611764+#endif
    11377 +                       return DKIM_SELECTOR_INVALID;   // todo: maybe create a new error code for unsupported hash algorithm
    11378 +       }
    11379 +       // key type
     11765+                       return DKIM_SELECTOR_INVALID;   /*- todo: maybe create a new error code for unsupported hash algorithm */
     11766+       }
     11767+       /*- key type -*/
    1138011768+       if (values[3] != NULL) {
    11381 +               // key type MUST be "rsa"
     11769+               /*- key type MUST be "rsa" -*/
    1138211770+               if (strcmp(values[3], "rsa") != 0)
    1138311771+                       return DKIM_SELECTOR_INVALID;
    1138411772+       }
    11385 +       // service type
     11773+       /*- service type -*/
    1138611774+       if (values[5] != NULL) {
    11387 +               // make sure "*" or "email" is in the list
     11775+               /*- make sure "*" or "email" is in the list -*/
    1138811776+               bool            ServiceTypeMatch = false;
    1138911777+               char           *s = strtok_r(values[5], ":", &saveptr);
     
    1139811786+                       return DKIM_SELECTOR_INVALID;
    1139911787+       }
    11400 +       // flags
     11788+       /*- flags -*/
    1140111789+       if (values[6] != NULL) {
    1140211790+               char           *s = strtok_r(values[6], ":", &saveptr);
     
    1141111799+               }
    1141211800+       }
    11413 +#define M_ToConstUCharPtr(p)       reinterpret_cast<const unsigned char*>(p)          // Cast to unsigned char*
     11801+#define M_ToConstUCharPtr(p)       reinterpret_cast<const unsigned char*>(p) /* Cast to unsigned char* */
    1141411802+       /*- public key data */
    1141511803+       unsigned        PublicKeyLen = DecodeBase64(values[4]);
    1141611804+       if (PublicKeyLen == 0)
    11417 +               return DKIM_SELECTOR_KEY_REVOKED;       // this error causes the signature to fail
     11805+               return DKIM_SELECTOR_KEY_REVOKED; /*- this error causes the signature to fail */
    1141811806+       else {
    1141911807+               EVP_PKEY       *pkey;
     
    1144711835+}
    1144811836+
    11449 +// GetSelector - Get a DKIM selector for a domain
     11837+/*- GetSelector - Get a DKIM selector for a domain -*/
    1145011838+SelectorInfo &CDKIMVerify::GetSelector(const string &sSelector, const string &sDomain)
    1145111839+{
    11452 +
    11453 +       // see if we already have this selector
     11840+       /*- see if we already have this selector -*/
    1145411841+       for (list < SelectorInfo >::iterator i = Selectors.begin(); i != Selectors.end(); ++i) {
    1145511842+               if (_stricmp(i->Selector.c_str(), sSelector.c_str()) == 0 && _stricmp(i->Domain.c_str(), sDomain.c_str()) == 0) {
     
    1146211849+       sFQDN += "._domainkey.";
    1146311850+       sFQDN += sDomain;
    11464 +       char            Buffer[1024];
     11851+       char            Buffer[4096];
    1146511852+       int             DNSResult;
    1146611853+
     
    1148711874+}
    1148811875+
    11489 +// GetDetails - Get DKIM verification details (per signature)
     11876+/*- GetDetails - Get DKIM verification details (per signature) -*/
    1149011877+int
    1149111878+CDKIMVerify::GetDetails(int *nSigCount, DKIMVerifyDetails ** pDetails)
     
    1150811895+CDKIMVerify::GetDomain(void)
    1150911896+{
    11510 +       string          sFromDomain;
     11897+       static string   sFromDomain;
    1151111898+       for (list <string>::iterator i = HeaderList.begin(); i != HeaderList.end(); ++i) {
    1151211899+               if (_strnicmp(i->c_str(), "From", 4) == 0) {
    11513 +                       // skip over whitespace between the header name and :
     11900+                       /*- skip over whitespace between the header name and : -*/
    1151411901+                       const char     *s = i->c_str() + 4;
    1151511902+                       while (*s == ' ' || *s == '\t')
     
    1153111918+getversion_dkimverify_cpp()
    1153211919+{
    11533 +       static char    *x = (char *) "$Id: dkimverify.cpp,v 1.18 2017-09-05 11:00:33+05:30 Cprogrammer Exp mbhangui $";
     11920+       static char    *x = (char *) "$Id: dkimverify.cpp,v 1.23 2019-05-22 11:29:09+05:30 Cprogrammer Exp mbhangui $";
    1153411921+
    1153511922+       x++;
     
    1153711924diff -ruN ../netqmail-1.06-original/dkimverify.h netqmail-1.06/dkimverify.h
    1153811925--- ../netqmail-1.06-original/dkimverify.h      1970-01-01 01:00:00.000000000 +0100
    11539 +++ netqmail-1.06/dkimverify.h  2018-04-03 14:46:51.367411617 +0200
    11540 @@ -0,0 +1,139 @@
     11926+++ netqmail-1.06/dkimverify.h  2019-06-19 09:47:30.665464671 +0200
     11927@@ -0,0 +1,150 @@
    1154111928+/*
    1154211929+ * $Log: dkimverify.h,v $
     11930+ * Revision 1.9  2019-06-14 21:25:11+05:30  Cprogrammer
     11931+ * BUG - honor body length tag in verification. Changed data type for BodyLength
     11932+ *
     11933+ * Revision 1.8  2019-05-22 11:30:06+05:30  Cprogrammer
     11934+ * fix for 32 bit systems where time_t is 4 bytes & encounters year 2038 issue
     11935+ *
    1154311936+ * Revision 1.7  2017-08-31 17:07:45+05:30  Cprogrammer
    1154411937+ * fixed g++ compiler warning
     
    1158611979+
    1158711980+#include "dkimbase.h"
     11981+#include "time_t_size.h"
    1158811982+#include <vector>
    1158911983+
     
    1162412018+       string          CanonicalizedData;
    1162512019+       vector <string> SignedHeaders;
    11626 +       int             BodyLength;
     12020+       long            BodyLength;
    1162712021+       unsigned        HeaderCanonicalization;
    1162812022+       unsigned        BodyCanonicalization;
     12023+#if SIZEOF_TIME_T  == 8
    1162912024+       time_t          ExpireTime;
    11630 +       int             VerifiedBodyCount;
    11631 +       unsigned        UnverifiedBodyCount;
     12025+#else
     12026+       long long       ExpireTime;
     12027+#endif
     12028+       long            VerifiedBodyCount;
     12029+       long            UnverifiedBodyCount;
    1163212030+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
    1163312031+       EVP_MD_CTX     *m_Hdr_ctx = NULL;
     
    1168012078diff -ruN ../netqmail-1.06-original/dknewkey.sh netqmail-1.06/dknewkey.sh
    1168112079--- ../netqmail-1.06-original/dknewkey.sh       1970-01-01 01:00:00.000000000 +0100
    11682 +++ netqmail-1.06/dknewkey.sh   2016-11-22 21:03:57.112528099 +0100
     12080+++ netqmail-1.06/dknewkey.sh   2019-02-27 20:57:13.389025081 +0100
    1168312081@@ -0,0 +1,27 @@
    1168412082+#
     
    1171112109diff -ruN ../netqmail-1.06-original/dktest.9 netqmail-1.06/dktest.9
    1171212110--- ../netqmail-1.06-original/dktest.9  1970-01-01 01:00:00.000000000 +0100
    11713 +++ netqmail-1.06/dktest.9      2016-11-22 21:03:57.112528099 +0100
     12111+++ netqmail-1.06/dktest.9      2019-02-27 20:57:13.389025081 +0100
    1171412112@@ -0,0 +1,86 @@
    1171512113+.TH dktest 8
     
    1180112199diff -ruN ../netqmail-1.06-original/dktest.c netqmail-1.06/dktest.c
    1180212200--- ../netqmail-1.06-original/dktest.c  1970-01-01 01:00:00.000000000 +0100
    11803 +++ netqmail-1.06/dktest.c      2016-11-22 21:03:57.112528099 +0100
    11804 @@ -0,0 +1,431 @@
     12201+++ netqmail-1.06/dktest.c      2020-04-09 19:44:51.053935329 +0200
     12202@@ -0,0 +1,434 @@
    1180512203+/*
    1180612204+ * $Log: dktest.c,v $
     
    1220412602+                       status = "bad sender (g=)";
    1220512603+                       break;
     12604+               case DK_STAT_DUPLICATE:
     12605+                       status = "duplicate signature";
     12606+                       break;
    1220612607+               }
    1220712608+#if 0
     
    1223612637diff -ruN ../netqmail-1.06-original/dktrace.c netqmail-1.06/dktrace.c
    1223712638--- ../netqmail-1.06-original/dktrace.c 1970-01-01 01:00:00.000000000 +0100
    12238 +++ netqmail-1.06/dktrace.c     2016-11-22 21:03:57.112528099 +0100
     12639+++ netqmail-1.06/dktrace.c     2019-02-27 20:57:13.389025081 +0100
    1223912640@@ -0,0 +1,277 @@
    1224012641+/*
     
    1251712918diff -ruN ../netqmail-1.06-original/dktrace.h netqmail-1.06/dktrace.h
    1251812919--- ../netqmail-1.06-original/dktrace.h 1970-01-01 01:00:00.000000000 +0100
    12519 +++ netqmail-1.06/dktrace.h     2016-11-22 21:03:57.112528099 +0100
     12920+++ netqmail-1.06/dktrace.h     2019-02-27 20:57:13.389025081 +0100
    1252012921@@ -0,0 +1,26 @@
    1252112922+/* $Id: dktrace.h,v 1.3 2005/06/27 18:47:57 ted46045 Exp $ */
     
    1254712948diff -ruN ../netqmail-1.06-original/dns.c netqmail-1.06/dns.c
    1254812949--- ../netqmail-1.06-original/dns.c     2007-11-30 21:22:54.000000000 +0100
    12549 +++ netqmail-1.06/dns.c 2018-04-02 11:45:03.323768372 +0200
     12950+++ netqmail-1.06/dns.c 2019-04-09 20:53:51.981528338 +0200
    1255012951@@ -1,4 +1,3 @@
    1255112952-#include <stdio.h>
     
    1271013111    case DNS_MEM: return DNS_MEM;
    1271113112    case DNS_SOFT: return DNS_SOFT;
    12712 @@ -254,25 +318,46 @@
     13113@@ -254,25 +318,49 @@
    1271313114    if (r == DNS_SOFT) return DNS_SOFT;
    1271413115    if (r == 1)
     
    1275713158  if (!stralloc_0(&glue)) return DNS_MEM;
    1275813159  if (glue.s[0]) {
    12759 -   ix.pref = 0;
     13160+#ifndef IX_FQDN
     13161    ix.pref = 0;
     13162+#endif
    1276013163    if (!glue.s[ip_scan(glue.s,&ix.ip)] || !glue.s[ip_scanbracket(glue.s,&ix.ip)])
    1276113164     {
    1276213165      if (!ipalloc_append(ia,&ix)) return DNS_MEM;
    12763 @@ -291,9 +376,16 @@
     13166@@ -291,9 +379,16 @@
    1276413167    ix.ip = ip;
    1276513168    ix.pref = pref;
     
    1277913182 }
    1278013183 
    12781 @@ -313,7 +405,7 @@
     13184@@ -313,7 +408,7 @@
    1278213185 {
    1278313186  int r;
     
    1278813191  int i;
    1278913192  int j;
    12790 @@ -325,7 +417,6 @@
     13193@@ -325,7 +420,9 @@
    1279113194  if (!stralloc_copy(&glue,sa)) return DNS_MEM;
    1279213195  if (!stralloc_0(&glue)) return DNS_MEM;
    1279313196  if (glue.s[0]) {
    12794 -   ix.pref = 0;
     13197+#ifndef IX_FQDN
     13198    ix.pref = 0;
     13199+#endif
    1279513200    if (!glue.s[ip_scan(glue.s,&ix.ip)] || !glue.s[ip_scanbracket(glue.s,&ix.ip)])
    1279613201     {
    1279713202      if (!ipalloc_append(ia,&ix)) return DNS_MEM;
    12798 @@ -396,3 +487,49 @@
     13203@@ -396,3 +493,49 @@
    1279913204  alloc_free(mx);
    1280013205  return flagsoft;
     
    1284813253diff -ruN ../netqmail-1.06-original/dns.h netqmail-1.06/dns.h
    1284913254--- ../netqmail-1.06-original/dns.h     1998-06-15 12:53:16.000000000 +0200
    12850 +++ netqmail-1.06/dns.h 2016-11-22 21:03:57.113528065 +0100
     13255+++ netqmail-1.06/dns.h 2019-02-27 20:57:13.390025070 +0100
    1285113256@@ -10,5 +10,6 @@
    1285213257 int dns_mxip();
     
    1285813263diff -ruN ../netqmail-1.06-original/dnsfq.c netqmail-1.06/dnsfq.c
    1285913264--- ../netqmail-1.06-original/dnsfq.c   1998-06-15 12:53:16.000000000 +0200
    12860 +++ netqmail-1.06/dnsfq.c       2016-11-22 21:03:57.113528065 +0100
     13265+++ netqmail-1.06/dnsfq.c       2019-02-27 20:57:13.390025070 +0100
    1286113266@@ -5,15 +5,19 @@
    1286213267 #include "dnsdoe.h"
     
    1289613301diff -ruN ../netqmail-1.06-original/dnsptr.c netqmail-1.06/dnsptr.c
    1289713302--- ../netqmail-1.06-original/dnsptr.c  1998-06-15 12:53:16.000000000 +0200
    12898 +++ netqmail-1.06/dnsptr.c      2016-11-22 21:03:57.113528065 +0100
     13303+++ netqmail-1.06/dnsptr.c      2019-02-27 20:57:13.390025070 +0100
    1289913304@@ -6,22 +6,28 @@
    1290013305 #include "dns.h"
     
    1293213337diff -ruN ../netqmail-1.06-original/dnstxt.c netqmail-1.06/dnstxt.c
    1293313338--- ../netqmail-1.06-original/dnstxt.c  1970-01-01 01:00:00.000000000 +0100
    12934 +++ netqmail-1.06/dnstxt.c      2016-11-22 21:03:57.113528065 +0100
     13339+++ netqmail-1.06/dnstxt.c      2019-02-27 20:57:13.390025070 +0100
    1293513340@@ -0,0 +1,32 @@
    1293613341+#include "substdio.h"
     
    1296813373diff -ruN ../netqmail-1.06-original/domainkeys.h netqmail-1.06/domainkeys.h
    1296913374--- ../netqmail-1.06-original/domainkeys.h      1970-01-01 01:00:00.000000000 +0100
    12970 +++ netqmail-1.06/domainkeys.h  2018-03-31 15:08:54.373109416 +0200
    12971 @@ -0,0 +1,378 @@
     13375+++ netqmail-1.06/domainkeys.h  2020-04-09 19:45:10.589742433 +0200
     13376@@ -0,0 +1,379 @@
    1297213377+/* This file is automatically created from the corresponding .c file */
    1297313378+/* Do not change this file; change the .c file instead. */
     
    1303713442+  DK_STAT_INTERNAL, /* cannot call this routine in this context.  Internal error. */
    1303813443+  DK_STAT_GRANULARITY, /* Granularity mismatch: sender doesn't match g= option. */
     13444+  DK_STAT_DUPLICATE, /* Duplicate Domainkey-Header */
    1303913445+} DK_STAT;
    1304013446+
     
    1335013756diff -ruN ../netqmail-1.06-original/forward.c netqmail-1.06/forward.c
    1335113757--- ../netqmail-1.06-original/forward.c 1998-06-15 12:53:16.000000000 +0200
    13352 +++ netqmail-1.06/forward.c     2016-11-22 21:03:57.114528032 +0100
     13758+++ netqmail-1.06/forward.c     2019-02-27 20:57:13.391025058 +0100
    1335313759@@ -6,11 +6,11 @@
    1335413760 #include "strerr.h"
     
    1338413790diff -ruN ../netqmail-1.06-original/global.h netqmail-1.06/global.h
    1338513791--- ../netqmail-1.06-original/global.h  1970-01-01 01:00:00.000000000 +0100
    13386 +++ netqmail-1.06/global.h      2016-11-22 21:03:57.114528032 +0100
     13792+++ netqmail-1.06/global.h      2019-02-27 20:57:13.391025058 +0100
    1338713793@@ -0,0 +1,51 @@
    1338813794+/* GLOBAL.H - RSAREF types and constants */
     
    1343713843+
    1343813844+#endif /* end _GLOBAL_H_ */
    13439 diff -ruN ../netqmail-1.06-original/goodrcptto-12.patch netqmail-1.06/goodrcptto-12.patch
    13440 --- ../netqmail-1.06-original/goodrcptto-12.patch       1970-01-01 01:00:00.000000000 +0100
    13441 +++ netqmail-1.06/goodrcptto-12.patch   2004-11-09 20:12:53.000000000 +0100
    13442 @@ -0,0 +1,834 @@
    13443 +This is a goodrcptto patch for qmail-1.03 or netqmail-1.05:
    13444 +http://netdevice.com/qmail/patch/goodrcptto-12.patch
    13445 +See http://cr.yp.to/qmail.html or http://qmail.org/netqmail/.
    13446 +
    13447 +A qmail server will normally accept email for any recipient address at a domain.
    13448 +This patch causes the server to reject single recipient email to an invalid
    13449 +recipient, and filter out the invalid recipients from multiple recipient email,
    13450 +while accepting the message for the valid recipients.
    13451 +This occurs during the initial SMTP conversation for a reduction in disk I/O.
    13452 +The server rejects attempts to queue messages to non existent recipients, and
    13453 +joe job bounces to forged recipients, preventing them from becoming double
    13454 +bounces.
    13455 +To prevent dictionary attacks, the transmission channel is closed after the
    13456 +number of bad recipients set in control/brtlimit or BRTLIMIT, two by default.
    13457 +Repeated attempts from the same IPs may be handled by a cron that looks at the
    13458 +logs and updates tcprules accordingly.
    13459 +
    13460 +A goodrcptto list and or moregoodrcptto database is maintained.
    13461 +Relay and accept clients are not held to the address check, control/brtlimit or
    13462 +BRTLIMIT.
    13463 +If you need to wildcard domains, list them one per line like @example.net
    13464 +in control/goodrcptto only.
    13465 +Recipient addresses like name@example.com may be included in control/goodrcptto,
    13466 +but the check will run fastest if you put these into control/moregoodrcptto,
    13467 +then into control/moregoodrcptto.cdb using qmail-newmgrt.
    13468 +A check against a 50,000 address moregoodrcptto.cdb is virtually instantaneous
    13469 +on a 300Mhz machine.
    13470 +
    13471 +A user may want to participate in mailing list discussions, but doesn't want
    13472 +spam or off list replies to her now public address.
    13473 +Set ACCEPTCLIENT="" for the IPs of the mailing list servers with tcprules, and
    13474 +put the recipient address in control/protectedgood instead.
    13475 +
    13476 +For an example of how to automate this process, see the parent directory for an
    13477 +interactive user run script where one can remotely add, remove or list their
    13478 +disposable alias addresses, and the mail server cron that keeps the
    13479 +moregoodrcptto.cdb up to date.
    13480 +The patch assumes a Dave Sill type of installation with regards to extra control
    13481 +files concurrencyincoming and defaultdelivery, see http://lifewithqmail.org.
    13482 +
    13483 +Use http@ to get the patch onto your box, tab characters must be preserved.
    13484 +Here are examples of how to patch.
    13485 +
    13486 +Solaris:
    13487 +# gzip -cd qmail-1.03.tar.gz |tar -xf - ;cd qmail-1.03
    13488 +# gpatch </path/to/goodrcptto-12.patch
    13489 +or
    13490 +# gzip -cd netqmail-1.05.tar.gz |tar -xf - ;cd netqmail-1.05
    13491 +# sh -c "cat collate.sh |sed -e s/patch/gpatch/ >collate.sh"
    13492 +# ./collate.sh ;cd netqmail-1.05
    13493 +# gpatch </path/to/goodrcptto-12.patch
    13494 +
    13495 +Others:
    13496 +# gzip -cd qmail-1.03.tar.gz |tar -xf - ;cd qmail-1.03
    13497 +# patch </path/to/goodrcptto-12.patch
    13498 +or
    13499 +# gzip -cd netqmail-1.05.tar.gz |tar -xf - ;cd netqmail-1.05
    13500 +# ./collate.sh ;cd netqmail-1.05
    13501 +# patch </path/to/goodrcptto-12.patch
    13502 +
    13503 +Log example:
    13504 +2003-06-08 12:56:28.951415500 qmail-smtpd: !ok 29791 Bad recipient user nonexistent@example.com from DealsonWheels@321sm.com by 205.235.78.101 (HELO mx4.321sm.com).
    13505 +
    13506 +2003-06-08 01: Original version, based on John Levine's badrcptto patch:
    13507 +               http://www.iecc.com/bad-rcpt-noisy-patch.txt
    13508 +2003-06-15 02: Added support for domain wildcarding.
    13509 +2003-06-15 03: Running qmail-showctl also shows good recipient addresses.
    13510 +2003-07-01 04: The pid for the connection is included in the log.
    13511 +2003-07-11 05: Experimental.
    13512 +2003-07-13 06: Experimental.
    13513 +2003-07-20 07: Removed the message block on a mix of good and bad recipients.
    13514 +               Allowed for only using a goodrcptto list.
    13515 +               Corrected an error in the qmail-showctl.c patch.
    13516 +2003-09-02 08: Added publicly known recipient address protection using an
    13517 +               ACCEPTCLIENT tcprules variable.
    13518 +2003-10-04 09: Running qmail-showctl also shows protected recipient addresses.
    13519 +2003-11-07 10: Discontinued the non logging version of goodrcptto.
    13520 +               Added dictionary attack prevention within qmail-smtpd using
    13521 +               control/brtlimit and or BRTLIMIT.
    13522 +               Updated the qmail-smtpd.8 man page patch regarding ACCEPTCLIENT,
    13523 +               control/brtlimit and BRTLIMIT.
    13524 +               Updated the qmail-control.9 man page patch regarding brtlimit,
    13525 +               concurrencyincoming, defaultdelivery, goodrcptto, moregoodrcptto
    13526 +               and protectedgood.
    13527 +2004-02-14 11: Code cleanup and standardization with tcpserver logging at
    13528 +               getpid.
    13529 +               This single patch works with both qmail-1.03 and netqmail-1.05.
    13530 +               The brtcount is continued across rsets.
    13531 +2004-03-05 12: No changes, matched version number with goodrcptto-ms-12.patch.
    13532 +
    13533 +Eben Pratt, goodrcptto at netdevice dot com
    13534 +_____
    13535 +
    13536 +diff -ur qmail-1.03.orig/Makefile qmail-1.03/Makefile
    13537 +--- qmail-1.03.orig/Makefile   Mon Jun 15 06:53:16 1998
    13538 ++++ qmail-1.03/Makefile        Sat Feb 14 02:41:03 2004
    13539 +@@ -803,7 +803,7 @@
    13540 + predate datemail mailsubj qmail-upq qmail-showctl qmail-newu \
    13541 + qmail-pw2u qmail-qread qmail-qstat qmail-tcpto qmail-tcpok \
    13542 + qmail-pop3d qmail-popup qmail-qmqpc qmail-qmqpd qmail-qmtpd \
    13543 +-qmail-smtpd sendmail tcp-env qmail-newmrh config config-fast dnscname \
    13544 ++qmail-smtpd sendmail tcp-env qmail-newmrh qmail-newmgrt config config-fast dnscname \
    13545 + dnsptr dnsip dnsmxip dnsfq hostname ipmeprint qreceipt qsmhook qbiff \
    13546 + forward preline condredirect bouncesaying except maildirmake \
    13547 + maildir2mbox maildirwatch qail elq pinq idedit install-big install \
    13548 +@@ -930,8 +930,8 @@
    13549 + qmail-queue.0 qmail-inject.0 mailsubj.0 qmail-showctl.0 qmail-newu.0 \
    13550 + qmail-pw2u.0 qmail-qread.0 qmail-qstat.0 qmail-tcpto.0 qmail-tcpok.0 \
    13551 + qmail-pop3d.0 qmail-popup.0 qmail-qmqpc.0 qmail-qmqpd.0 qmail-qmtpd.0 \
    13552 +-qmail-smtpd.0 tcp-env.0 qmail-newmrh.0 qreceipt.0 qbiff.0 forward.0 \
    13553 +-preline.0 condredirect.0 bouncesaying.0 except.0 maildirmake.0 \
    13554 ++qmail-smtpd.0 tcp-env.0 qmail-newmrh.0 qmail-newmgrt.0 qreceipt.0 qbiff.0 \
    13555 ++forward.0 preline.0 condredirect.0 bouncesaying.0 except.0 maildirmake.0 \
    13556 + maildir2mbox.0 maildirwatch.0 qmail.0 qmail-limits.0 qmail-log.0 \
    13557 + qmail-control.0 qmail-header.0 qmail-users.0 dot-qmail.0 \
    13558 + qmail-command.0 tcp-environ.0 maildir.0 mbox.0 addresses.0 \
    13559 +@@ -1241,6 +1241,31 @@
    13560 + uint32.h substdio.h
    13561 +       ./compile qmail-newmrh.c
    13562 +
    13563 ++qmail-newmgrt: \
    13564 ++load qmail-newmgrt.o cdbmss.o getln.a open.a cdbmake.a seek.a case.a \
    13565 ++stralloc.a alloc.a strerr.a substdio.a error.a str.a auto_qmail.o
    13566 ++      ./load qmail-newmgrt cdbmss.o getln.a open.a cdbmake.a \
    13567 ++      seek.a case.a stralloc.a alloc.a strerr.a substdio.a \
    13568 ++      error.a str.a auto_qmail.o
    13569 ++
    13570 ++qmail-newmgrt.0: \
    13571 ++qmail-newmgrt.8
    13572 ++      nroff -man qmail-newmgrt.8 > qmail-newmgrt.0
    13573 ++
    13574 ++qmail-newmgrt.8: \
    13575 ++qmail-newmgrt.9 conf-break conf-spawn
    13576 ++      cat qmail-newmgrt.9 \
    13577 ++      | sed s}QMAILHOME}"`head -1 conf-qmail`"}g \
    13578 ++      | sed s}BREAK}"`head -1 conf-break`"}g \
    13579 ++      | sed s}SPAWN}"`head -1 conf-spawn`"}g \
    13580 ++      > qmail-newmgrt.8
    13581 ++
    13582 ++qmail-newmgrt.o: \
    13583 ++compile qmail-newmgrt.c strerr.h stralloc.h gen_alloc.h substdio.h \
    13584 ++getln.h exit.h readwrite.h open.h auto_qmail.h cdbmss.h cdbmake.h \
    13585 ++uint32.h substdio.h
    13586 ++      ./compile qmail-newmgrt.c
    13587 ++
    13588 + qmail-newu: \
    13589 + load qmail-newu.o cdbmss.o getln.a open.a seek.a cdbmake.a case.a \
    13590 + stralloc.a alloc.a substdio.a error.a str.a auto_qmail.o
    13591 +@@ -1767,7 +1792,7 @@
    13592 + maildirwatch.1 mailsubj.1 mbox.5 preline.1 qbiff.1 qmail-clean.8 \
    13593 + qmail-command.8 qmail-control.9 qmail-getpw.9 qmail-header.5 \
    13594 + qmail-inject.8 qmail-limits.9 qmail-local.8 qmail-log.5 \
    13595 +-qmail-lspawn.8 qmail-newmrh.9 qmail-newu.9 qmail-pop3d.8 \
    13596 ++qmail-lspawn.8 qmail-newmrh.9 qmail-newmgrt.9 qmail-newu.9 qmail-pop3d.8 \
    13597 + qmail-popup.8 qmail-pw2u.9 qmail-qmqpc.8 qmail-qmqpd.8 qmail-qmtpd.8 \
    13598 + qmail-qread.8 qmail-qstat.8 qmail-queue.8 qmail-remote.8 \
    13599 + qmail-rspawn.8 qmail-send.9 qmail-showctl.8 qmail-smtpd.8 \
    13600 +@@ -1774,7 +1799,7 @@
    13601 + qmail-start.9 qmail-tcpok.8 qmail-tcpto.8 qmail-users.9 qmail.7 \
    13602 + qreceipt.1 splogger.8 tcp-env.1 config.sh config-fast.sh \
    13603 + qmail-clean.c qmail-getpw.c qmail-inject.c qmail-local.c \
    13604 +-qmail-lspawn.c qmail-newmrh.c qmail-newu.c qmail-pop3d.c \
    13605 ++qmail-lspawn.c qmail-newmrh.c qmail-newmgrt.c qmail-newu.c qmail-pop3d.c \
    13606 + qmail-popup.c qmail-pw2u.c qmail-qmqpc.c qmail-qmqpd.c qmail-qmtpd.c \
    13607 + qmail-qread.c qmail-qstat.sh qmail-queue.c qmail-remote.c \
    13608 + qmail-rspawn.c qmail-send.c qmail-showctl.c qmail-smtpd.c \
    13609 +diff -ur qmail-1.03.orig/TARGETS qmail-1.03/TARGETS
    13610 +--- qmail-1.03.orig/TARGETS    Mon Jun 15 06:53:16 1998
    13611 ++++ qmail-1.03/TARGETS Sat Feb 14 02:41:03 2004
    13612 +@@ -257,6 +257,8 @@
    13613 + tcp-env.o
    13614 + remoteinfo.o
    13615 + tcp-env
    13616 ++qmail-newmgrt.o
    13617 ++qmail-newmgrt
    13618 + qmail-newmrh.o
    13619 + qmail-newmrh
    13620 + config
    13621 +@@ -352,6 +354,8 @@
    13622 + qmail-qmtpd.0
    13623 + qmail-smtpd.0
    13624 + tcp-env.0
    13625 ++qmail-newmgrt.8
    13626 ++qmail-newmgrt.0
    13627 + qmail-newmrh.8
    13628 + qmail-newmrh.0
    13629 + qreceipt.0
    13630 +diff -ur qmail-1.03.orig/conf-spawn qmail-1.03/conf-spawn
    13631 +--- qmail-1.03.orig/conf-spawn Mon Jun 15 06:53:16 1998
    13632 ++++ qmail-1.03/conf-spawn      Sat Feb 14 02:41:03 2004
    13633 +@@ -1,4 +1,4 @@
    13634 +-120
    13635 ++255
    13636 +
    13637 + This is a silent concurrency limit. You can't set it above 255. On some
    13638 + systems you can't set it above 125. qmail will refuse to compile if the
    13639 +diff -ur qmail-1.03.orig/hier.c qmail-1.03/hier.c
    13640 +--- qmail-1.03.orig/hier.c     Mon Jun 15 06:53:16 1998
    13641 ++++ qmail-1.03/hier.c  Sat Feb 14 02:41:03 2004
    13642 +@@ -109,6 +109,7 @@
    13643 +   c(auto_qmail,"bin","qmail-clean",auto_uido,auto_gidq,0711);
    13644 +   c(auto_qmail,"bin","qmail-send",auto_uido,auto_gidq,0711);
    13645 +   c(auto_qmail,"bin","splogger",auto_uido,auto_gidq,0711);
    13646 ++  c(auto_qmail,"bin","qmail-newmgrt",auto_uido,auto_gidq,0700);
    13647 +   c(auto_qmail,"bin","qmail-newu",auto_uido,auto_gidq,0700);
    13648 +   c(auto_qmail,"bin","qmail-newmrh",auto_uido,auto_gidq,0700);
    13649 +   c(auto_qmail,"bin","qmail-pw2u",auto_uido,auto_gidq,0711);
    13650 +@@ -221,6 +222,8 @@
    13651 +   c(auto_qmail,"man/cat8","qmail-inject.0",auto_uido,auto_gidq,0644);
    13652 +   c(auto_qmail,"man/man8","qmail-showctl.8",auto_uido,auto_gidq,0644);
    13653 +   c(auto_qmail,"man/cat8","qmail-showctl.0",auto_uido,auto_gidq,0644);
    13654 ++  c(auto_qmail,"man/man8","qmail-newmgrt.8",auto_uido,auto_gidq,0644);
    13655 ++  c(auto_qmail,"man/cat8","qmail-newmgrt.0",auto_uido,auto_gidq,0644);
    13656 +   c(auto_qmail,"man/man8","qmail-newmrh.8",auto_uido,auto_gidq,0644);
    13657 +   c(auto_qmail,"man/cat8","qmail-newmrh.0",auto_uido,auto_gidq,0644);
    13658 +   c(auto_qmail,"man/man8","qmail-newu.8",auto_uido,auto_gidq,0644);
    13659 +diff -ur qmail-1.03.orig/install-big.c qmail-1.03/install-big.c
    13660 +--- qmail-1.03.orig/install-big.c      Mon Jun 15 06:53:16 1998
    13661 ++++ qmail-1.03/install-big.c   Sat Feb 14 02:41:03 2004
    13662 +@@ -109,6 +109,7 @@
    13663 +   c(auto_qmail,"bin","qmail-clean",auto_uido,auto_gidq,0711);
    13664 +   c(auto_qmail,"bin","qmail-send",auto_uido,auto_gidq,0711);
    13665 +   c(auto_qmail,"bin","splogger",auto_uido,auto_gidq,0711);
    13666 ++  c(auto_qmail,"bin","qmail-newmgrt",auto_uido,auto_gidq,0700);
    13667 +   c(auto_qmail,"bin","qmail-newu",auto_uido,auto_gidq,0700);
    13668 +   c(auto_qmail,"bin","qmail-newmrh",auto_uido,auto_gidq,0700);
    13669 +   c(auto_qmail,"bin","qmail-pw2u",auto_uido,auto_gidq,0711);
    13670 +@@ -221,6 +222,8 @@
    13671 +   c(auto_qmail,"man/cat8","qmail-inject.0",auto_uido,auto_gidq,0644);
    13672 +   c(auto_qmail,"man/man8","qmail-showctl.8",auto_uido,auto_gidq,0644);
    13673 +   c(auto_qmail,"man/cat8","qmail-showctl.0",auto_uido,auto_gidq,0644);
    13674 ++  c(auto_qmail,"man/man8","qmail-newmgrt.8",auto_uido,auto_gidq,0644);
    13675 ++  c(auto_qmail,"man/cat8","qmail-newmgrt.0",auto_uido,auto_gidq,0644);
    13676 +   c(auto_qmail,"man/man8","qmail-newmrh.8",auto_uido,auto_gidq,0644);
    13677 +   c(auto_qmail,"man/cat8","qmail-newmrh.0",auto_uido,auto_gidq,0644);
    13678 +   c(auto_qmail,"man/man8","qmail-newu.8",auto_uido,auto_gidq,0644);
    13679 +diff -ur qmail-1.03.orig/qmail-control.9 qmail-1.03/qmail-control.9
    13680 +--- qmail-1.03.orig/qmail-control.9    Mon Jun 15 06:53:16 1998
    13681 ++++ qmail-1.03/qmail-control.9 Sat Feb 14 02:41:03 2004
    13682 +@@ -21,6 +21,7 @@
    13683 + Comments are allowed
    13684 + in
    13685 + .IR badmailfrom ,
    13686 ++.IR goodrcptto ,
    13687 + .IR locals ,
    13688 + .IR percenthack ,
    13689 + .IR qmqpservers ,
    13690 +@@ -43,8 +44,11 @@
    13691 + .I badmailfrom        \fR(none)       \fRqmail-smtpd
    13692 + .I bouncefrom \fRMAILER-DAEMON        \fRqmail-send
    13693 + .I bouncehost \fIme   \fRqmail-send
    13694 ++.I brtlimit   \fR2    \fRqmail-smtpd
    13695 ++.I concurrencyincoming        \fR40   \fRtcpserver
    13696 + .I concurrencylocal   \fR10   \fRqmail-send
    13697 + .I concurrencyremote  \fR20   \fRqmail-send
    13698 ++.I defaultdelivery    \fR(none)       \fRqmail-start
    13699 + .I defaultdomain      \fIme   \fRqmail-inject
    13700 + .I defaulthost        \fIme   \fRqmail-inject
    13701 + .I databytes  \fR0    \fRqmail-smtpd
    13702 +@@ -51,13 +55,16 @@
    13703 + .I doublebouncehost   \fIme   \fRqmail-send
    13704 + .I doublebounceto     \fRpostmaster   \fRqmail-send
    13705 + .I envnoathost        \fIme   \fRqmail-send
    13706 ++.I goodrcptto \fR(none)       \fRqmail-smtpd
    13707 + .I helohost   \fIme   \fRqmail-remote
    13708 + .I idhost     \fIme   \fRqmail-inject
    13709 + .I localiphost        \fIme   \fRqmail-smtpd
    13710 + .I locals     \fIme   \fRqmail-send
    13711 ++.I moregoodrcptto     \fR(none)       \fRqmail-smtpd
    13712 + .I morercpthosts      \fR(none)       \fRqmail-smtpd
    13713 + .I percenthack        \fR(none)       \fRqmail-send
    13714 + .I plusdomain \fIme   \fRqmail-inject
    13715 ++.I protectedgood      \fR(none)       \fRqmail-showctl
    13716 + .I qmqpservers        \fR(none)       \fRqmail-qmqpc
    13717 + .I queuelifetime      \fR604800       \fRqmail-send
    13718 + .I rcpthosts  \fR(none)       \fRqmail-smtpd
    13719 +diff -ur qmail-1.03.orig/qmail-newmgrt.9 qmail-1.03/qmail-newmgrt.9
    13720 +--- qmail-1.03.orig/qmail-newmgrt.9    Thu Jan  1 00:00:00 1970
    13721 ++++ qmail-1.03/qmail-newmgrt.9 Sat Feb 14 02:41:04 2004
    13722 +@@ -0,0 +1,41 @@
    13723 ++.TH qmail-newmgrt 8
    13724 ++.SH NAME
    13725 ++qmail-newmgrt \- prepare moregoodrcptto for qmail-smtpd
    13726 ++.SH SYNOPSIS
    13727 ++.B qmail-newmgrt
    13728 ++.SH DESCRIPTION
    13729 ++.B qmail-newmgrt
    13730 ++reads the instructions in
    13731 ++.B QMAILHOME/control/moregoodrcptto
    13732 ++and writes them into
    13733 ++.B QMAILHOME/control/moregoodrcptto.cdb
    13734 ++in a binary format suited
    13735 ++for quick access by
    13736 ++.BR qmail-smtpd .
    13737 ++
    13738 ++If there is a problem with
    13739 ++.BR control/moregoodrcptto ,
    13740 ++.B qmail-newmgrt
    13741 ++complains and leaves
    13742 ++.B control/moregoodrcptto.cdb
    13743 ++alone.
    13744 ++
    13745 ++.B qmail-newmgrt
    13746 ++ensures that
    13747 ++.B control/moregoodrcptto.cdb
    13748 ++is updated atomically,
    13749 ++so
    13750 ++.B qmail-smtpd
    13751 ++never has to wait for
    13752 ++.B qmail-newmgrt
    13753 ++to finish.
    13754 ++However,
    13755 ++.B qmail-newmgrt
    13756 ++makes no attempt to protect against two simultaneous updates of
    13757 ++.BR control/moregoodrcptto.cdb .
    13758 ++
    13759 ++The binary
    13760 ++.B control/moregoodrcptto.cdb
    13761 ++format is portable across machines.
    13762 ++.SH "SEE ALSO"
    13763 ++qmail-smtpd(8)
    13764 +diff -ur qmail-1.03.orig/qmail-newmgrt.c qmail-1.03/qmail-newmgrt.c
    13765 +--- qmail-1.03.orig/qmail-newmgrt.c    Thu Jan  1 00:00:00 1970
    13766 ++++ qmail-1.03/qmail-newmgrt.c Sat Feb 14 02:41:04 2004
    13767 +@@ -0,0 +1,70 @@
    13768 ++#include "strerr.h"
    13769 ++#include "stralloc.h"
    13770 ++#include "substdio.h"
    13771 ++#include "getln.h"
    13772 ++#include "exit.h"
    13773 ++#include "readwrite.h"
    13774 ++#include "open.h"
    13775 ++#include "auto_qmail.h"
    13776 ++#include "cdbmss.h"
    13777 ++
    13778 ++#define FATAL "qmail-newmgrt: fatal: "
    13779 ++
    13780 ++void die_read()
    13781 ++{
    13782 ++  strerr_die2sys(111,FATAL,"unable to read control/moregoodrcptto: ");
    13783 ++}
    13784 ++void die_write()
    13785 ++{
    13786 ++  strerr_die2sys(111,FATAL,"unable to write to control/moregoodrcptto.tmp: ");
    13787 ++}
    13788 ++
    13789 ++char inbuf[1024];
    13790 ++substdio ssin;
    13791 ++
    13792 ++int fd;
    13793 ++int fdtemp;
    13794 ++
    13795 ++struct cdbmss cdbmss;
    13796 ++stralloc line = {0};
    13797 ++int match;
    13798 ++
    13799 ++void main()
    13800 ++{
    13801 ++  umask(033);
    13802 ++  if (chdir(auto_qmail) == -1)
    13803 ++    strerr_die4sys(111,FATAL,"unable to chdir to ",auto_qmail,": ");
    13804 ++
    13805 ++  fd = open_read("control/moregoodrcptto");
    13806 ++  if (fd == -1) die_read();
    13807 ++
    13808 ++  substdio_fdbuf(&ssin,read,fd,inbuf,sizeof inbuf);
    13809 ++
    13810 ++  fdtemp = open_trunc("control/moregoodrcptto.tmp");
    13811 ++  if (fdtemp == -1) die_write();
    13812 ++
    13813 ++  if (cdbmss_start(&cdbmss,fdtemp) == -1) die_write();
    13814 ++
    13815 ++  for (;;) {
    13816 ++    if (getln(&ssin,&line,&match,'\n') != 0) die_read();
    13817 ++    case_lowerb(line.s,line.len);
    13818 ++    while (line.len) {
    13819 ++      if (line.s[line.len - 1] == ' ') { --line.len; continue; }
    13820 ++      if (line.s[line.len - 1] == '\n') { --line.len; continue; }
    13821 ++      if (line.s[line.len - 1] == '\t') { --line.len; continue; }
    13822 ++      if (line.s[0] != '#')
    13823 ++       if (cdbmss_add(&cdbmss,line.s,line.len,"",0) == -1)
    13824 ++         die_write();
    13825 ++      break;
    13826 ++    }
    13827 ++    if (!match) break;
    13828 ++  }
    13829 ++
    13830 ++  if (cdbmss_finish(&cdbmss) == -1) die_write();
    13831 ++  if (fsync(fdtemp) == -1) die_write();
    13832 ++  if (close(fdtemp) == -1) die_write(); /* NFS stupidity */
    13833 ++  if (rename("control/moregoodrcptto.tmp","control/moregoodrcptto.cdb") == -1)
    13834 ++    strerr_die2sys(111,FATAL,"unable to move control/moregoodrcpto.tmp to control/moregoodrcptto.cdb");
    13835 ++
    13836 ++  _exit(0);
    13837 ++}
    13838 +diff -ur qmail-1.03.orig/qmail-showctl.c qmail-1.03/qmail-showctl.c
    13839 +--- qmail-1.03.orig/qmail-showctl.c    Mon Jun 15 06:53:16 1998
    13840 ++++ qmail-1.03/qmail-showctl.c Sat Feb 14 02:41:04 2004
    13841 +@@ -142,6 +142,8 @@
    13842 +   direntry *d;
    13843 +   struct stat stmrh;
    13844 +   struct stat stmrhcdb;
    13845 ++  struct stat stmgrt;
    13846 ++  struct stat stmgrtcdb;
    13847 +
    13848 +   substdio_puts(subfdout,"qmail home directory: ");
    13849 +   substdio_puts(subfdout,auto_qmail);
    13850 +@@ -217,9 +219,12 @@
    13851 +   do_lst("badmailfrom","Any MAIL FROM is allowed.",""," not accepted in MAIL FROM.");
    13852 +   do_str("bouncefrom",0,"MAILER-DAEMON","Bounce user name is ");
    13853 +   do_str("bouncehost",1,"bouncehost","Bounce host name is ");
    13854 ++  do_int("brtlimit","2","Transmission channel close after "," bad recipients");
    13855 ++  do_int("concurrencyincoming","1","Incoming concurrency is ","");
    13856 +   do_int("concurrencylocal","10","Local concurrency is ","");
    13857 +   do_int("concurrencyremote","20","Remote concurrency is ","");
    13858 +   do_int("databytes","0","SMTP DATA limit is "," bytes");
    13859 ++  do_str("defaultdelivery",1,"defaultdelivery","Default mailbox is ");
    13860 +   do_str("defaultdomain",1,"defaultdomain","Default domain name is ");
    13861 +   do_str("defaulthost",1,"defaulthost","Default host name is ");
    13862 +   do_str("doublebouncehost",1,"doublebouncehost","2B recipient host: ");
    13863 +@@ -235,8 +240,8 @@
    13864 +   do_lst("qmqpservers","No QMQP servers.","QMQP server: ",".");
    13865 +   do_int("queuelifetime","604800","Message lifetime in the queue is "," seconds");
    13866 +
    13867 +-  if (do_lst("rcpthosts","SMTP clients may send messages to any recipient.","SMTP clients may send messages to recipients at ","."))
    13868 +-    do_lst("morercpthosts","No effect.","SMTP clients may send messages to recipients at ",".");
    13869 ++  if (do_lst("rcpthosts","SMTP relay clients may send to any recipient.","SMTP relay clients may send to recipients at ","."))
    13870 ++    do_lst("morercpthosts","No effect.","SMTP relay clients may send to recipients at ",".");
    13871 +   else
    13872 +     do_lst("morercpthosts","No rcpthosts; morercpthosts is irrelevant.","No rcpthosts; doesn't matter that morercpthosts has ",".");
    13873 +   /* XXX: check morercpthosts.cdb contents */
    13874 +@@ -255,6 +260,27 @@
    13875 +       else
    13876 +         substdio_puts(subfdout,"Modified recently enough; hopefully up to date.\n");
    13877 +
    13878 ++  if (do_lst("goodrcptto","Oops? moregoodrcptto must exist if this doesn't.","SMTP clients may send to ","."))
    13879 ++    do_lst("moregoodrcptto","No effect.","SMTP clients may send to ",".");
    13880 ++  else
    13881 ++    do_lst("moregoodrcptto","Oops? goodrcptto must exist if this doesn't.","SMTP clients may send to ",".");
    13882 ++  /* XXX: check moregoodrcptto.cdb contents */
    13883 ++  substdio_puts(subfdout,"\nmoregoodrcptto.cdb: ");
    13884 ++  if (stat("moregoodrcptto",&stmgrt) == -1)
    13885 ++    if (stat("moregoodrcptto.cdb",&stmgrtcdb) == -1)
    13886 ++      substdio_puts(subfdout,"(Default.) No effect.\n");
    13887 ++    else
    13888 ++      substdio_puts(subfdout,"Oops! moregoodrcptto.cdb exists but moregoodrcptto doesn't.\n");
    13889 ++  else
    13890 ++    if (stat("moregoodrcptto.cdb",&stmgrtcdb) == -1)
    13891 ++      substdio_puts(subfdout,"Oops! moregoodrcptto exists but moregoodrcptto.cdb doesn't.\n");
    13892 ++    else
    13893 ++      if (stmgrt.st_mtime > stmgrtcdb.st_mtime)
    13894 ++        substdio_puts(subfdout,"Oops! moregoodrcptto.cdb is older than moregoodrcptto.\n");
    13895 ++      else
    13896 ++        substdio_puts(subfdout,"Modified recently enough; hopefully up to date.\n");
    13897 ++
    13898 ++  do_lst("protectedgood","No accept client addresses.","SMTP accept clients may send to ",".");
    13899 +   do_str("smtpgreeting",1,"smtpgreeting","SMTP greeting: 220 ");
    13900 +   do_lst("smtproutes","No artificial SMTP routes.","SMTP route: ","");
    13901 +   do_int("timeoutconnect","60","SMTP client connection timeout is "," seconds");
    13902 +@@ -265,19 +291,21 @@
    13903 +   while (d = readdir(dir)) {
    13904 +     if (str_equal(d->d_name,".")) continue;
    13905 +     if (str_equal(d->d_name,"..")) continue;
    13906 +-    if (str_equal(d->d_name,"bouncefrom")) continue;
    13907 +-    if (str_equal(d->d_name,"bouncehost")) continue;
    13908 +     if (str_equal(d->d_name,"badmailfrom")) continue;
    13909 +     if (str_equal(d->d_name,"bouncefrom")) continue;
    13910 +     if (str_equal(d->d_name,"bouncehost")) continue;
    13911 ++    if (str_equal(d->d_name,"brtlimit")) continue;
    13912 ++    if (str_equal(d->d_name,"concurrencyincoming")) continue;
    13913 +     if (str_equal(d->d_name,"concurrencylocal")) continue;
    13914 +     if (str_equal(d->d_name,"concurrencyremote")) continue;
    13915 +     if (str_equal(d->d_name,"databytes")) continue;
    13916 ++    if (str_equal(d->d_name,"defaultdelivery")) continue;
    13917 +     if (str_equal(d->d_name,"defaultdomain")) continue;
    13918 +     if (str_equal(d->d_name,"defaulthost")) continue;
    13919 +     if (str_equal(d->d_name,"doublebouncehost")) continue;
    13920 +     if (str_equal(d->d_name,"doublebounceto")) continue;
    13921 +     if (str_equal(d->d_name,"envnoathost")) continue;
    13922 ++    if (str_equal(d->d_name,"goodrcptto")) continue;
    13923 +     if (str_equal(d->d_name,"helohost")) continue;
    13924 +     if (str_equal(d->d_name,"idhost")) continue;
    13925 +     if (str_equal(d->d_name,"localiphost")) continue;
    13926 +@@ -285,8 +313,11 @@
    13927 +     if (str_equal(d->d_name,"me")) continue;
    13928 +     if (str_equal(d->d_name,"morercpthosts")) continue;
    13929 +     if (str_equal(d->d_name,"morercpthosts.cdb")) continue;
    13930 ++    if (str_equal(d->d_name,"moregoodrcptto")) continue;
    13931 ++    if (str_equal(d->d_name,"moregoodrcptto.cdb")) continue;
    13932 +     if (str_equal(d->d_name,"percenthack")) continue;
    13933 +     if (str_equal(d->d_name,"plusdomain")) continue;
    13934 ++    if (str_equal(d->d_name,"protectedgood")) continue;
    13935 +     if (str_equal(d->d_name,"qmqpservers")) continue;
    13936 +     if (str_equal(d->d_name,"queuelifetime")) continue;
    13937 +     if (str_equal(d->d_name,"rcpthosts")) continue;
    13938 +diff -ur qmail-1.03.orig/qmail-smtpd.8 qmail-1.03/qmail-smtpd.8
    13939 +--- qmail-1.03.orig/qmail-smtpd.8      Mon Jun 15 06:53:16 1998
    13940 ++++ qmail-1.03/qmail-smtpd.8   Sat Feb 14 02:41:04 2004
    13941 +@@ -50,6 +50,20 @@
    13942 + meaning every address at
    13943 + .IR host .
    13944 + .TP 5
    13945 ++.I brtlimit
    13946 ++Number of bad recipients before closing the transmission channel.
    13947 ++.B qmail-smtpd
    13948 ++will close the transmission channel after
    13949 ++reaching the number of bad recipients in
    13950 ++.IR brtlimit .
    13951 ++
    13952 ++If the environment variable
    13953 ++.B BRTLIMIT
    13954 ++is set, it overrides
    13955 ++.IR brtlimit .
    13956 ++
    13957 ++Default and minimum: 2.
    13958 ++.TP 5
    13959 + .I databytes
    13960 + Maximum number of bytes allowed in a message,
    13961 + or 0 for no limit.
    13962 +@@ -77,6 +91,50 @@
    13963 + is set, it overrides
    13964 + .IR databytes .
    13965 + .TP 5
    13966 ++.I goodrcptto
    13967 ++Allowed RCPT addresses.
    13968 ++.B qmail-smtpd
    13969 ++will reject
    13970 ++any envelope recipient address not listed in
    13971 ++.I goodrcptto
    13972 ++or
    13973 ++.IR moregoodrcptto .
    13974 ++A line in
    13975 ++.I goodrcptto
    13976 ++may be of the form
    13977 ++.BR @\fIhost ,
    13978 ++meaning every address at
    13979 ++.IR host .
    13980 ++
    13981 ++.I goodrcptto
    13982 ++format:
    13983 ++
    13984 ++.EX
    13985 ++   @heaven.af.mil
    13986 ++   box@heaven.af.mil
    13987 ++.EE
    13988 ++
    13989 ++Exceptions:
    13990 ++If the environment variable
    13991 ++.B RELAYCLIENT
    13992 ++is set,
    13993 ++.B qmail-smtpd
    13994 ++will ignore
    13995 ++.I goodrcptto
    13996 ++and
    13997 ++.IR moregoodrcptto ,
    13998 ++and will append the value of
    13999 ++.B RELAYCLIENT
    14000 ++to each incoming recipient address.
    14001 ++If the environment variable
    14002 ++.B ACCEPTCLIENT
    14003 ++is set,
    14004 ++.B qmail-smtpd
    14005 ++will ignore
    14006 ++.I goodrcptto
    14007 ++and
    14008 ++.IR moregoodrcptto .
    14009 ++.TP 5
    14010 + .I localiphost
    14011 + Replacement host name for local IP addresses.
    14012 + Default:
    14013 +@@ -97,6 +155,38 @@
    14014 + This is done before
    14015 + .IR rcpthosts .
    14016 + .TP 5
    14017 ++.I moregoodrcptto
    14018 ++Extra allowed RCPT addresses.
    14019 ++If
    14020 ++.I goodrcptto
    14021 ++and
    14022 ++.I moregoodrcptto
    14023 ++both exist,
    14024 ++.I moregoodrcptto
    14025 ++is effectively appended to
    14026 ++.IR goodrcptto .
    14027 ++
    14028 ++.I moregoodrcptto
    14029 ++format:
    14030 ++
    14031 ++.EX
    14032 ++   box@heaven.af.mil
    14033 ++.EE
    14034 ++
    14035 ++You must run
    14036 ++.B qmail-newmgrt
    14037 ++whenever
    14038 ++.I moregoodrcptto
    14039 ++changes.
    14040 ++
    14041 ++Rule of thumb:
    14042 ++Put your
    14043 ++.BR @\fIhost
    14044 ++wildcarded domains into
    14045 ++.IR goodrcptto ,
    14046 ++and the rest into
    14047 ++.IR moregoodrcptto .
    14048 ++.TP 5
    14049 + .I morercpthosts
    14050 + Extra allowed RCPT domains.
    14051 + If
    14052 +@@ -150,7 +240,7 @@
    14053 + .EE
    14054 +
    14055 + Envelope recipient addresses without @ signs are
    14056 +-always allowed through.
    14057 ++allowed through if added to goodrcptto or moregoodrcptto.
    14058 + .TP 5
    14059 + .I smtpgreeting
    14060 + SMTP greeting message.
    14061 +@@ -174,6 +264,7 @@
    14062 + tcp-environ(5),
    14063 + qmail-control(5),
    14064 + qmail-inject(8),
    14065 ++qmail-newmgrt(8),
    14066 + qmail-newmrh(8),
    14067 + qmail-queue(8),
    14068 + qmail-remote(8)
    14069 +diff -ur qmail-1.03.orig/qmail-smtpd.c qmail-1.03/qmail-smtpd.c
    14070 +--- qmail-1.03.orig/qmail-smtpd.c      Mon Jun 15 06:53:16 1998
    14071 ++++ qmail-1.03/qmail-smtpd.c   Sat Feb 14 03:12:49 2004
    14072 +@@ -23,11 +23,19 @@
    14073 + #include "timeoutread.h"
    14074 + #include "timeoutwrite.h"
    14075 + #include "commands.h"
    14076 ++#include "cdb.h"
    14077 +
    14078 + #define MAXHOPS 100
    14079 + unsigned int databytes = 0;
    14080 + int timeout = 1200;
    14081 +
    14082 ++char *remoteip;
    14083 ++char *remotehost;
    14084 ++char *remoteinfo;
    14085 ++char *local;
    14086 ++char *relayclient;
    14087 ++char *acceptclient;
    14088 ++
    14089 + int safewrite(fd,buf,len) int fd; char *buf; int len;
    14090 + {
    14091 +   int r;
    14092 +@@ -42,12 +50,39 @@
    14093 + void flush() { substdio_flush(&ssout); }
    14094 + void out(s) char *s; { substdio_puts(&ssout,s); }
    14095 +
    14096 ++char sserrbuf[512];
    14097 ++substdio sserr = SUBSTDIO_FDBUF(safewrite,2,sserrbuf,sizeof sserrbuf);
    14098 ++
    14099 ++char strnum[FMT_ULONG];
    14100 ++void log(s) char *s; { substdio_putsflush(&sserr,s); }
    14101 ++void logs(s1,s2,s3) char *s1; char *s2; char *s3; {
    14102 ++  substdio_putsflush(&sserr,s1);
    14103 ++  substdio_putsflush(&sserr,s2);
    14104 ++  substdio_putsflush(&sserr,s3);
    14105 ++}
    14106 ++void pid() { log("qmail-smtpd: !ok "); strnum[fmt_ulong(strnum,getpid())] = 0; log(strnum); }
    14107 ++
    14108 + void die_read() { _exit(1); }
    14109 +-void die_alarm() { out("451 timeout (#4.4.2)\r\n"); flush(); _exit(1); }
    14110 +-void die_nomem() { out("421 out of memory (#4.3.0)\r\n"); flush(); _exit(1); }
    14111 +-void die_control() { out("421 unable to read controls (#4.3.0)\r\n"); flush(); _exit(1); }
    14112 +-void die_ipme() { out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); _exit(1); }
    14113 +-void straynewline() { out("451 See http://pobox.com/~djb/docs/smtplf.html.\r\n"); flush(); _exit(1); }
    14114 ++void die_alarm() {
    14115 ++  pid(); logs(" Connection to ",remoteip," timed out.\n");
    14116 ++  out("451 timeout (#4.4.2)\r\n"); flush(); _exit(1);
    14117 ++}
    14118 ++void die_nomem() {
    14119 ++  pid(); logs(" Out of memory while connected to ",remoteip,"!\n");
    14120 ++  out("421 out of memory (#4.3.0)\r\n"); flush(); _exit(1);
    14121 ++}
    14122 ++void die_control() {
    14123 ++  pid(); log(" Unable to read controls!\n");
    14124 ++  out("421 unable to read controls (#4.3.0)\r\n"); flush(); _exit(1);
    14125 ++}
    14126 ++void die_ipme() {
    14127 ++  pid(); log(" Unable to figure out my IP addresses!\n");
    14128 ++  out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); _exit(1);
    14129 ++}
    14130 ++void straynewline() {
    14131 ++  pid(); logs(" Stray newline from ",remoteip,".\n");
    14132 ++  out("451 See http://pobox.com/~djb/docs/smtplf.html.\r\n"); flush(); _exit(1);
    14133 ++}
    14134 +
    14135 + void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list (#5.7.1)\r\n"); }
    14136 + void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)\r\n"); }
    14137 +@@ -76,12 +111,6 @@
    14138 +   smtp_greet("221 "); out("\r\n"); flush(); _exit(0);
    14139 + }
    14140 +
    14141 +-char *remoteip;
    14142 +-char *remotehost;
    14143 +-char *remoteinfo;
    14144 +-char *local;
    14145 +-char *relayclient;
    14146 +-
    14147 + stralloc helohost = {0};
    14148 + char *fakehelo; /* pointer into helohost, or 0 */
    14149 +
    14150 +@@ -96,6 +125,11 @@
    14151 + int bmfok = 0;
    14152 + stralloc bmf = {0};
    14153 + struct constmap mapbmf;
    14154 ++int grtok = 0;
    14155 ++stralloc grt = {0};
    14156 ++struct constmap mapgrt;
    14157 ++int fdmgrt;
    14158 ++int brtlimit = 0;
    14159 +
    14160 + void setup()
    14161 + {
    14162 +@@ -117,6 +151,19 @@
    14163 +   if (bmfok)
    14164 +     if (!constmap_init(&mapbmf,bmf.s,bmf.len,0)) die_nomem();
    14165 
    14166 ++  grtok = control_readfile(&grt,"control/goodrcptto",0);
    14167 ++  if (grtok == -1) die_control();
    14168 ++  if (grtok)
    14169 ++    if (!constmap_init(&mapgrt,grt.s,grt.len,0)) die_nomem();
    14170 ++
    14171 ++  fdmgrt = open_read("control/moregoodrcptto.cdb");
    14172 ++  if (fdmgrt == -1) if (errno != error_noent) die_control();
    14173 ++
    14174 ++  if (control_readint(&brtlimit,"control/brtlimit") == -1) die_control();
    14175 ++  x = env_get("BRTLIMIT");
    14176 ++  if (x) { scan_ulong(x,&u); brtlimit = u; };
    14177 ++  if (brtlimit <= 1) brtlimit = 2;
    14178 ++
    14179 +   if (control_readint(&databytes,"control/databytes") == -1) die_control();
    14180 +   x = env_get("DATABYTES");
    14181 +   if (x) { scan_ulong(x,&u); databytes = u; }
    14182 +@@ -131,6 +178,7 @@
    14183 +   if (!remotehost) remotehost = "unknown";
    14184 +   remoteinfo = env_get("TCPREMOTEINFO");
    14185 +   relayclient = env_get("RELAYCLIENT");
    14186 ++  acceptclient = env_get("ACCEPTCLIENT");
    14187 +   dohelo(remotehost);
    14188 + }
    14189 +
    14190 +@@ -197,6 +245,16 @@
    14191 +   return 1;
    14192 + }
    14193 +
    14194 ++void err_brt(s1,s2,s3,s4) char *s1; char *s2; char *s3; char *s4; {
    14195 ++  pid(); log(s1); log(s2); log(s3); log(s4); log(" by ");
    14196 ++  log(remoteip); log(" (HELO "); log(helohost.s); log(").\n");
    14197 ++}
    14198 ++
    14199 ++void die_attack() {
    14200 ++  pid(); logs(" Too many bad recipients from ",remoteip,", closing connection.\n");
    14201 ++  out("421 service shutting down and closing transmission channel (#4.3.0)\r\n"); flush(); _exit(1);
    14202 ++}
    14203 ++
    14204 + int bmfcheck()
    14205 + {
    14206 +   int j;
    14207 +@@ -208,6 +266,24 @@
    14208 +   return 0;
    14209 + }
    14210 +
    14211 ++int grtcheck()
    14212 ++{
    14213 ++  int g;
    14214 ++  case_lowerb(addr.s,addr.len);
    14215 ++  if (grtok) {
    14216 ++    if (constmap(&mapgrt,addr.s,addr.len - 1)) return 1;
    14217 ++    g = byte_rchr(addr.s,addr.len,'@');
    14218 ++    if (g < addr.len)
    14219 ++      if (constmap(&mapgrt,addr.s + g,addr.len - g - 1)) return 1; 
    14220 ++  }
    14221 ++  if (fdmgrt != -1) {
    14222 ++    uint32 dlen;
    14223 ++    g = cdb_seek(fdmgrt, addr.s, addr.len - 1, &dlen);
    14224 ++    if (g) return g;
    14225 ++  }
    14226 ++  return 0;
    14227 ++}
    14228 ++
    14229 + int addrallowed()
    14230 + {
    14231 +   int r;
    14232 +@@ -221,6 +297,7 @@
    14233 + int flagbarf; /* defined if seenmail */
    14234 + stralloc mailfrom = {0};
    14235 + stralloc rcptto = {0};
    14236 ++int brtcount;
    14237 +
    14238 + void smtp_helo(arg) char *arg;
    14239 + {
    14240 +@@ -250,7 +327,10 @@
    14241 + void smtp_rcpt(arg) char *arg; {
    14242 +   if (!seenmail) { err_wantmail(); return; }
    14243 +   if (!addrparse(arg)) { err_syntax(); return; }
    14244 +-  if (flagbarf) { err_bmf(); return; }
    14245 ++  if (flagbarf) {
    14246 ++    err_brt(" Bad envelope sender ",mailfrom.s," to ",addr.s);
    14247 ++    err_bmf(); return;
    14248 ++  }
    14249 +   if (relayclient) {
    14250 +     --addr.len;
    14251 +     if (!stralloc_cats(&addr,relayclient)) die_nomem();
    14252 +@@ -257,7 +337,23 @@
    14253 +     if (!stralloc_0(&addr)) die_nomem();
    14254 +   }
    14255 +   else
    14256 +-    if (!addrallowed()) { err_nogateway(); return; }
    14257 ++    if (!addrallowed()) {
    14258 ++      err_brt(" Bad recipient host ",addr.s," from ",mailfrom.s);
    14259 ++      if (++brtcount == brtlimit) die_attack();
    14260 ++      err_nogateway(); return;
    14261 ++    }
    14262 ++    else
    14263 ++      if (!acceptclient) {
    14264 ++        if (!grtcheck()) {
    14265 ++          if (str_equal(mailfrom.s,"")) {
    14266 ++            err_brt(" Forged recipient user ",addr.s," from ","null");
    14267 ++          }
    14268 ++          else
    14269 ++            err_brt(" Bad recipient user ",addr.s," from ",mailfrom.s);
    14270 ++          if (++brtcount == brtlimit) die_attack();
    14271 ++          out("550 sorry, no mailbox here by that name (#5.1.1)\r\n"); return;
    14272 ++        }
    14273 ++      }
    14274 +   if (!stralloc_cats(&rcptto,"T")) die_nomem();
    14275 +   if (!stralloc_cats(&rcptto,addr.s)) die_nomem();
    14276 +   if (!stralloc_0(&rcptto)) die_nomem();
    1427713845diff -ruN ../netqmail-1.06-original/hier.c netqmail-1.06/hier.c
    1427813846--- ../netqmail-1.06-original/hier.c    1998-06-15 12:53:16.000000000 +0200
    14279 +++ netqmail-1.06/hier.c        2018-01-04 22:33:49.406411066 +0100
    14280 @@ -32,6 +32,7 @@
     13847+++ netqmail-1.06/hier.c        2019-06-26 16:39:31.573826970 +0200
     13848@@ -4,6 +4,9 @@
     13849 #include "fmt.h"
     13850 #include "fifo.h"
     13851 
     13852+#include <stdio.h>
     13853+#include "channels.h"
     13854+
     13855 char buf[100 + FMT_ULONG];
     13856 
     13857 void dsplit(base,uid,mode)
     13858@@ -29,9 +32,12 @@
     13859 
     13860 void hier()
     13861 {
     13862+  int cc;
     13863+
    1428113864   h(auto_qmail,auto_uido,auto_gidq,0755);
    1428213865 
     
    1428613869   d(auto_qmail,"bin",auto_uido,auto_gidq,0755);
    1428713870   d(auto_qmail,"boot",auto_uido,auto_gidq,0755);
    14288 @@ -55,6 +56,8 @@
     13871@@ -55,10 +61,20 @@
    1428913872   d(auto_qmail,"queue/bounce",auto_uids,auto_gidq,0700);
    1429013873 
     
    1429513878   dsplit("queue/local",auto_uids,0700);
    1429613879   dsplit("queue/remote",auto_uids,0700);
    14297 @@ -89,6 +92,7 @@
     13880 
     13881+  for (cc = 0;cc < SUPPL_CHANNELS;++cc)
     13882+  {
     13883+      char adbuf[100];
     13884+
     13885+      sprintf(adbuf,"queue/" QDIR_BASENAME "%d", cc);
     13886+      dsplit(adbuf,auto_uids,0700);
     13887+  }
     13888+
     13889   d(auto_qmail,"queue/lock",auto_uidq,auto_gidq,0750);
     13890   z(auto_qmail,"queue/lock/tcpto",1024,auto_uidr,auto_gidq,0644);
     13891   z(auto_qmail,"queue/lock/sendmutex",0,auto_uids,auto_gidq,0600);
     13892@@ -89,6 +105,7 @@
    1429813893   c(auto_qmail,"doc","TEST.receive",auto_uido,auto_gidq,0644);
    1429913894   c(auto_qmail,"doc","REMOVE.sendmail",auto_uido,auto_gidq,0644);
     
    1430313898   c(auto_qmail,"doc","PIC.local2ext",auto_uido,auto_gidq,0644);
    1430413899   c(auto_qmail,"doc","PIC.local2local",auto_uido,auto_gidq,0644);
    14305 @@ -104,13 +108,26 @@
     13900@@ -104,13 +121,26 @@
    1430613901   c(auto_qmail,"bin","qmail-start",auto_uido,auto_gidq,0700);
    1430713902   c(auto_qmail,"bin","qmail-getpw",auto_uido,auto_gidq,0711);
     
    1433013925   c(auto_qmail,"bin","qmail-inject",auto_uido,auto_gidq,0755);
    1433113926   c(auto_qmail,"bin","predate",auto_uido,auto_gidq,0755);
    14332 @@ -127,6 +144,7 @@
     13927@@ -127,6 +157,7 @@
    1433313928   c(auto_qmail,"bin","qmail-qmqpd",auto_uido,auto_gidq,0755);
    1433413929   c(auto_qmail,"bin","qmail-qmtpd",auto_uido,auto_gidq,0755);
     
    1433813933   c(auto_qmail,"bin","tcp-env",auto_uido,auto_gidq,0755);
    1433913934   c(auto_qmail,"bin","qreceipt",auto_uido,auto_gidq,0755);
    14340 @@ -143,6 +161,9 @@
     13935@@ -143,6 +174,9 @@
    1434113936   c(auto_qmail,"bin","qail",auto_uido,auto_gidq,0755);
    1434213937   c(auto_qmail,"bin","elq",auto_uido,auto_gidq,0755);
     
    1434813943   c(auto_qmail,"man/man5","addresses.5",auto_uido,auto_gidq,0644);
    1434913944   c(auto_qmail,"man/cat5","addresses.0",auto_uido,auto_gidq,0644);
    14350 @@ -198,6 +219,18 @@
     13945@@ -198,6 +232,18 @@
    1435113946   c(auto_qmail,"man/cat1","tcp-env.0",auto_uido,auto_gidq,0644);
    1435213947 
     
    1436913964diff -ruN ../netqmail-1.06-original/hmac_md5.c netqmail-1.06/hmac_md5.c
    1437013965--- ../netqmail-1.06-original/hmac_md5.c        1970-01-01 01:00:00.000000000 +0100
    14371 +++ netqmail-1.06/hmac_md5.c    2016-11-22 21:03:57.114528032 +0100
     13966+++ netqmail-1.06/hmac_md5.c    2019-02-27 20:57:13.391025058 +0100
    1437213967@@ -0,0 +1,76 @@
    1437313968+#include "global.h"
     
    1444914044diff -ruN ../netqmail-1.06-original/hmac_md5.h netqmail-1.06/hmac_md5.h
    1445014045--- ../netqmail-1.06-original/hmac_md5.h        1970-01-01 01:00:00.000000000 +0100
    14451 +++ netqmail-1.06/hmac_md5.h    2016-11-22 21:03:57.114528032 +0100
     14046+++ netqmail-1.06/hmac_md5.h    2019-02-27 20:57:13.391025058 +0100
    1445214047@@ -0,0 +1,11 @@
    1445314048+
     
    1446414059diff -ruN ../netqmail-1.06-original/install-big.c netqmail-1.06/install-big.c
    1446514060--- ../netqmail-1.06-original/install-big.c     1998-06-15 12:53:16.000000000 +0200
    14466 +++ netqmail-1.06/install-big.c 2016-11-22 21:04:38.822137319 +0100
    14467 @@ -89,6 +89,7 @@
     14061+++ netqmail-1.06/install-big.c 2019-06-26 16:39:31.574826959 +0200
     14062@@ -4,6 +4,9 @@
     14063 #include "fmt.h"
     14064 #include "fifo.h"
     14065 
     14066+#include <stdio.h>
     14067+#include "channels.h"
     14068+
     14069 char buf[100 + FMT_ULONG];
     14070 
     14071 void dsplit(base,uid,mode)
     14072@@ -29,6 +32,8 @@
     14073 
     14074 void hier()
     14075 {
     14076+  int cc;
     14077+
     14078   h(auto_qmail,auto_uido,auto_gidq,0755);
     14079 
     14080   d(auto_qmail,"control",auto_uido,auto_gidq,0755);
     14081@@ -59,6 +64,14 @@
     14082   dsplit("queue/local",auto_uids,0700);
     14083   dsplit("queue/remote",auto_uids,0700);
     14084 
     14085+  for (cc = 0;cc < SUPPL_CHANNELS;++cc)
     14086+  {
     14087+      char adbuf[100];
     14088+
     14089+      sprintf(adbuf,"queue/" QDIR_BASENAME "%d", cc);
     14090+      dsplit(adbuf,auto_uids,0700);
     14091+  }
     14092+
     14093   d(auto_qmail,"queue/lock",auto_uidq,auto_gidq,0750);
     14094   z(auto_qmail,"queue/lock/tcpto",1024,auto_uidr,auto_gidq,0644);
     14095   z(auto_qmail,"queue/lock/sendmutex",0,auto_uids,auto_gidq,0600);
     14096@@ -89,6 +102,7 @@
    1446814097   c(auto_qmail,"doc","TEST.receive",auto_uido,auto_gidq,0644);
    1446914098   c(auto_qmail,"doc","REMOVE.sendmail",auto_uido,auto_gidq,0644);
     
    1447314102   c(auto_qmail,"doc","PIC.local2ext",auto_uido,auto_gidq,0644);
    1447414103   c(auto_qmail,"doc","PIC.local2local",auto_uido,auto_gidq,0644);
    14475 @@ -108,9 +109,13 @@
     14104@@ -108,9 +122,13 @@
    1447614105   c(auto_qmail,"bin","qmail-rspawn",auto_uido,auto_gidq,0711);
    1447714106   c(auto_qmail,"bin","qmail-clean",auto_uido,auto_gidq,0711);
     
    1448714116   c(auto_qmail,"bin","qmail-inject",auto_uido,auto_gidq,0755);
    1448814117   c(auto_qmail,"bin","predate",auto_uido,auto_gidq,0755);
    14489 @@ -133,6 +138,7 @@
     14118@@ -133,6 +151,7 @@
    1449014119   c(auto_qmail,"bin","qsmhook",auto_uido,auto_gidq,0755);
    1449114120   c(auto_qmail,"bin","qbiff",auto_uido,auto_gidq,0755);
     
    1449714126diff -ruN ../netqmail-1.06-original/ip.h netqmail-1.06/ip.h
    1449814127--- ../netqmail-1.06-original/ip.h      1998-06-15 12:53:16.000000000 +0200
    14499 +++ netqmail-1.06/ip.h  2016-11-22 21:03:57.115527999 +0100
     14128+++ netqmail-1.06/ip.h  2019-02-27 20:57:13.392025048 +0100
    1450014129@@ -2,6 +2,7 @@
    1450114130 #define IP_H
     
    1450814137diff -ruN ../netqmail-1.06-original/ipalloc.h netqmail-1.06/ipalloc.h
    1450914138--- ../netqmail-1.06-original/ipalloc.h 1998-06-15 12:53:16.000000000 +0200
    14510 +++ netqmail-1.06/ipalloc.h     2016-11-22 21:03:57.115527999 +0100
     14139+++ netqmail-1.06/ipalloc.h     2019-02-27 20:57:13.392025048 +0100
    1451114140@@ -3,7 +3,15 @@
    1451214141 
     
    1452714156diff -ruN ../netqmail-1.06-original/ipme.c netqmail-1.06/ipme.c
    1452814157--- ../netqmail-1.06-original/ipme.c    2007-11-30 21:22:54.000000000 +0100
    14529 +++ netqmail-1.06/ipme.c        2016-11-22 21:03:57.115527999 +0100
     14158+++ netqmail-1.06/ipme.c        2019-02-27 20:57:13.392025048 +0100
    1453014159@@ -14,23 +14,65 @@
    1453114160 #include "ipalloc.h"
     
    1474214371diff -ruN ../netqmail-1.06-original/ipme.h netqmail-1.06/ipme.h
    1474314372--- ../netqmail-1.06-original/ipme.h    1998-06-15 12:53:16.000000000 +0200
    14744 +++ netqmail-1.06/ipme.h        2016-11-22 21:03:57.115527999 +0100
     14373+++ netqmail-1.06/ipme.h        2019-02-27 20:57:13.392025048 +0100
    1474514374@@ -4,7 +4,7 @@
    1474614375 #include "ip.h"
     
    1475414383diff -ruN ../netqmail-1.06-original/ipmeprint.c netqmail-1.06/ipmeprint.c
    1475514384--- ../netqmail-1.06-original/ipmeprint.c       1998-06-15 12:53:16.000000000 +0200
    14756 +++ netqmail-1.06/ipmeprint.c   2016-11-22 21:03:57.115527999 +0100
     14385+++ netqmail-1.06/ipmeprint.c   2019-02-27 20:57:13.392025048 +0100
    1475714386@@ -3,12 +3,15 @@
    1475814387 #include "ip.h"
     
    1479414423diff -ruN ../netqmail-1.06-original/ipmetest.c netqmail-1.06/ipmetest.c
    1479514424--- ../netqmail-1.06-original/ipmetest.c        1970-01-01 01:00:00.000000000 +0100
    14796 +++ netqmail-1.06/ipmetest.c    2016-11-22 21:03:57.115527999 +0100
     14425+++ netqmail-1.06/ipmetest.c    2019-02-27 20:57:13.392025048 +0100
    1479714426@@ -0,0 +1,38 @@
    1479814427+#include "subfd.h"
     
    1483614465diff -ruN ../netqmail-1.06-original/macros.h netqmail-1.06/macros.h
    1483714466--- ../netqmail-1.06-original/macros.h  1970-01-01 01:00:00.000000000 +0100
    14838 +++ netqmail-1.06/macros.h      2016-11-22 21:03:57.115527999 +0100
     14467+++ netqmail-1.06/macros.h      2019-02-27 20:57:13.392025048 +0100
    1483914468@@ -0,0 +1,25 @@
    1484014469+/*
     
    1486514494diff -ruN ../netqmail-1.06-original/maildirflags.c netqmail-1.06/maildirflags.c
    1486614495--- ../netqmail-1.06-original/maildirflags.c    1970-01-01 01:00:00.000000000 +0100
    14867 +++ netqmail-1.06/maildirflags.c        2016-11-22 21:03:57.116527965 +0100
     14496+++ netqmail-1.06/maildirflags.c        2019-02-27 20:57:13.392025048 +0100
    1486814497@@ -0,0 +1,23 @@
    1486914498+/*
     
    1489214521diff -ruN ../netqmail-1.06-original/maildirgetquota.c netqmail-1.06/maildirgetquota.c
    1489314522--- ../netqmail-1.06-original/maildirgetquota.c 1970-01-01 01:00:00.000000000 +0100
    14894 +++ netqmail-1.06/maildirgetquota.c     2016-11-22 21:03:57.116527965 +0100
     14523+++ netqmail-1.06/maildirgetquota.c     2019-02-27 20:57:13.393025036 +0100
    1489514524@@ -0,0 +1,50 @@
    1489614525+/*
     
    1494614575diff -ruN ../netqmail-1.06-original/maildirgetquota.h netqmail-1.06/maildirgetquota.h
    1494714576--- ../netqmail-1.06-original/maildirgetquota.h 1970-01-01 01:00:00.000000000 +0100
    14948 +++ netqmail-1.06/maildirgetquota.h     2016-11-22 21:03:57.116527965 +0100
     14577+++ netqmail-1.06/maildirgetquota.h     2019-02-27 20:57:13.393025036 +0100
    1494914578@@ -0,0 +1,30 @@
    1495014579+#ifndef        maildirgetquota_h
     
    1498014609diff -ruN ../netqmail-1.06-original/maildirmisc.h netqmail-1.06/maildirmisc.h
    1498114610--- ../netqmail-1.06-original/maildirmisc.h     1970-01-01 01:00:00.000000000 +0100
    14982 +++ netqmail-1.06/maildirmisc.h 2016-11-22 21:03:57.116527965 +0100
     14611+++ netqmail-1.06/maildirmisc.h 2019-02-27 20:57:13.393025036 +0100
    1498314612@@ -0,0 +1,145 @@
    1498414613+#ifndef        maildirmisc_h
     
    1512914758diff -ruN ../netqmail-1.06-original/maildiropen.c netqmail-1.06/maildiropen.c
    1513014759--- ../netqmail-1.06-original/maildiropen.c     1970-01-01 01:00:00.000000000 +0100
    15131 +++ netqmail-1.06/maildiropen.c 2016-11-22 21:03:57.116527965 +0100
     14760+++ netqmail-1.06/maildiropen.c 2019-02-27 20:57:13.393025036 +0100
    1513214761@@ -0,0 +1,133 @@
    1513314762+/*
     
    1526614895diff -ruN ../netqmail-1.06-original/maildirparsequota.c netqmail-1.06/maildirparsequota.c
    1526714896--- ../netqmail-1.06-original/maildirparsequota.c       1970-01-01 01:00:00.000000000 +0100
    15268 +++ netqmail-1.06/maildirparsequota.c   2016-11-22 21:03:57.116527965 +0100
     14897+++ netqmail-1.06/maildirparsequota.c   2019-02-27 20:57:13.393025036 +0100
    1526914898@@ -0,0 +1,44 @@
    1527014899+/*
     
    1531414943diff -ruN ../netqmail-1.06-original/maildirquota.c netqmail-1.06/maildirquota.c
    1531514944--- ../netqmail-1.06-original/maildirquota.c    1970-01-01 01:00:00.000000000 +0100
    15316 +++ netqmail-1.06/maildirquota.c        2016-11-22 21:03:57.116527965 +0100
     14945+++ netqmail-1.06/maildirquota.c        2019-02-27 20:57:13.393025036 +0100
    1531714946@@ -0,0 +1,685 @@
    1531814947+/*
     
    1600315632diff -ruN ../netqmail-1.06-original/maildirquota.h netqmail-1.06/maildirquota.h
    1600415633--- ../netqmail-1.06-original/maildirquota.h    1970-01-01 01:00:00.000000000 +0100
    16005 +++ netqmail-1.06/maildirquota.h        2016-11-22 21:03:57.117527932 +0100
     15634+++ netqmail-1.06/maildirquota.h        2019-02-27 20:57:13.393025036 +0100
    1600615635@@ -0,0 +1,45 @@
    1600715636+#ifndef        maildirquota_h
     
    1605215681diff -ruN ../netqmail-1.06-original/md5.h netqmail-1.06/md5.h
    1605315682--- ../netqmail-1.06-original/md5.h     1970-01-01 01:00:00.000000000 +0100
    16054 +++ netqmail-1.06/md5.h 2016-11-22 21:03:57.117527932 +0100
     15683+++ netqmail-1.06/md5.h 2019-02-27 20:57:13.394025025 +0100
    1605515684@@ -0,0 +1,49 @@
    1605615685+/* MD5.H - header file for MD5C.C
     
    1610515734diff -ruN ../netqmail-1.06-original/md5c.c netqmail-1.06/md5c.c
    1610615735--- ../netqmail-1.06-original/md5c.c    1970-01-01 01:00:00.000000000 +0100
    16107 +++ netqmail-1.06/md5c.c        2016-11-22 21:03:57.117527932 +0100
     15736+++ netqmail-1.06/md5c.c        2019-02-27 20:57:13.394025025 +0100
    1610815737@@ -0,0 +1,334 @@
    1610915738+/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
     
    1644316072diff -ruN ../netqmail-1.06-original/mess822.h netqmail-1.06/mess822.h
    1644416073--- ../netqmail-1.06-original/mess822.h 1970-01-01 01:00:00.000000000 +0100
    16445 +++ netqmail-1.06/mess822.h     2016-11-22 21:03:57.117527932 +0100
     16074+++ netqmail-1.06/mess822.h     2019-02-27 20:57:13.394025025 +0100
    1644616075@@ -0,0 +1,55 @@
    1644716076+/*
     
    1650216131diff -ruN ../netqmail-1.06-original/mess822_ok.c netqmail-1.06/mess822_ok.c
    1650316132--- ../netqmail-1.06-original/mess822_ok.c      1970-01-01 01:00:00.000000000 +0100
    16504 +++ netqmail-1.06/mess822_ok.c  2016-11-22 21:03:57.117527932 +0100
     16133+++ netqmail-1.06/mess822_ok.c  2019-02-27 20:57:13.394025025 +0100
    1650516134@@ -0,0 +1,55 @@
    1650616135+/*
     
    1656116190diff -ruN ../netqmail-1.06-original/numlib.h netqmail-1.06/numlib.h
    1656216191--- ../netqmail-1.06-original/numlib.h  1970-01-01 01:00:00.000000000 +0100
    16563 +++ netqmail-1.06/numlib.h      2016-11-22 21:03:57.117527932 +0100
     16192+++ netqmail-1.06/numlib.h      2019-02-27 20:57:13.394025025 +0100
    1656416193@@ -0,0 +1,45 @@
    1656516194+#ifndef        numlib_h
     
    1661016239diff -ruN ../netqmail-1.06-original/overmaildirquota.c netqmail-1.06/overmaildirquota.c
    1661116240--- ../netqmail-1.06-original/overmaildirquota.c        1970-01-01 01:00:00.000000000 +0100
    16612 +++ netqmail-1.06/overmaildirquota.c    2016-11-22 21:03:57.117527932 +0100
     16241+++ netqmail-1.06/overmaildirquota.c    2019-02-27 20:57:13.394025025 +0100
    1661316242@@ -0,0 +1,41 @@
    1661416243+/*
     
    1665516284diff -ruN ../netqmail-1.06-original/policy.c netqmail-1.06/policy.c
    1665616285--- ../netqmail-1.06-original/policy.c  1970-01-01 01:00:00.000000000 +0100
    16657 +++ netqmail-1.06/policy.c      2016-11-22 21:03:57.118527899 +0100
     16286+++ netqmail-1.06/policy.c      2019-02-27 20:57:13.395025014 +0100
    1665816287@@ -0,0 +1,1210 @@
    1665916288+/*
     
    1786917498diff -ruN ../netqmail-1.06-original/policy.h netqmail-1.06/policy.h
    1787017499--- ../netqmail-1.06-original/policy.h  1970-01-01 01:00:00.000000000 +0100
    17871 +++ netqmail-1.06/policy.h      2016-11-22 21:03:57.118527899 +0100
     17500+++ netqmail-1.06/policy.h      2019-02-27 20:57:13.395025014 +0100
    1787217501@@ -0,0 +1,6 @@
    1787317502+#ifndef __POLICY_H_
     
    1787917508diff -ruN ../netqmail-1.06-original/qmail-clean.c netqmail-1.06/qmail-clean.c
    1788017509--- ../netqmail-1.06-original/qmail-clean.c     1998-06-15 12:53:16.000000000 +0200
    17881 +++ netqmail-1.06/qmail-clean.c 2016-11-22 21:03:57.118527899 +0100
     17510+++ netqmail-1.06/qmail-clean.c 2019-02-27 20:57:13.395025014 +0100
    1788217511@@ -73,22 +73,26 @@
    1788317512    if (line.len < 7) { respond("x"); continue; }
     
    1791417543diff -ruN ../netqmail-1.06-original/qmail-control.9 netqmail-1.06/qmail-control.9
    1791517544--- ../netqmail-1.06-original/qmail-control.9   1998-06-15 12:53:16.000000000 +0200
    17916 +++ netqmail-1.06/qmail-control.9       2016-11-28 17:36:57.350660496 +0100
     17545+++ netqmail-1.06/qmail-control.9       2019-02-27 20:57:13.395025014 +0100
    1791717546@@ -20,7 +20,11 @@
    1791817547 
     
    1799117620diff -ruN ../netqmail-1.06-original/qmail-dk.9 netqmail-1.06/qmail-dk.9
    1799217621--- ../netqmail-1.06-original/qmail-dk.9        1970-01-01 01:00:00.000000000 +0100
    17993 +++ netqmail-1.06/qmail-dk.9    2018-04-03 14:46:51.371411632 +0200
     17622+++ netqmail-1.06/qmail-dk.9    2019-02-27 20:57:13.395025014 +0100
    1799417623@@ -0,0 +1,164 @@
    1799517624+.TH qmail-dk 8
     
    1815917788diff -ruN ../netqmail-1.06-original/qmail-dk.c netqmail-1.06/qmail-dk.c
    1816017789--- ../netqmail-1.06-original/qmail-dk.c        1970-01-01 01:00:00.000000000 +0100
    18161 +++ netqmail-1.06/qmail-dk.c    2018-04-03 14:46:51.372411636 +0200
     17790+++ netqmail-1.06/qmail-dk.c    2019-02-27 20:57:13.396025003 +0100
    1816217791@@ -0,0 +1,866 @@
    1816317792+/*
     
    1902918658diff -ruN ../netqmail-1.06-original/qmail-dkim.9 netqmail-1.06/qmail-dkim.9
    1903018659--- ../netqmail-1.06-original/qmail-dkim.9      1970-01-01 01:00:00.000000000 +0100
    19031 +++ netqmail-1.06/qmail-dkim.9  2018-04-03 14:46:51.372411636 +0200
    19032 @@ -0,0 +1,321 @@
     18660+++ netqmail-1.06/qmail-dkim.9  2020-04-09 19:45:28.421566373 +0200
     18661@@ -0,0 +1,322 @@
    1903318662+.TH qmail-dkim 8
    1903418663+.SH NAME
     
    1906118690+variable, it is removed and replaced by the domain name in the From: header.
    1906218691+If, after substituting the %, that file does not exist, the % character will be
    19063 +removed. If the private key file does not exist and does not have a % character,
     18692+removed. If a private key file does not exist and does not have a % character,
    1906418693+the message will be rejected with error 35. The selector (s=) will be taken from
    1906518694+the basename of the file. The private key should be created by
     
    1910718736+.BR DKIMSIGNOPTIONS.
    1910818737+.B qmail-dkim
    19109 +uses the domain found in the Sender: header to set the domain tag. If not it uses the
    19110 +From: header. You can override this by setting
    19111 +.B DKIMDOMAIN
    19112 +environment variable.
    19113 +.B DKIMDOMAIN
     18738+uses the domain found in the Return-Path, Sender, From headers to set the domain tag.
     18739+If not it uses the \fBDKIMDOMAIN\fR environment variable. \fBDKIMDOMAIN\fR
    1911418740+can be set to an email address or a domain (without the at sign).
    1911518741+
     
    1912018746+letter, where A is the first return status (DKIM_SUCCESS), B is the
    1912118747+second (DKIM_FINISHED_BODY), etc.  The letter should be uppercase if you
    19122 +want a permanent error to be returned, and lowercase if
    19123 +you want a temporary error to be returned (exit code 88). If you omit the letter,
    19124 +\fBqmail-dkim\fR will not issue any error inspite of DKIM verification failure. It
    19125 +will return success and the email will get delivered. The complete set of letters
    19126 +with the corresponding return status is given below
     18748+want a permanent error to be returned, and lowercase if you want a temporary
     18749+error to be returned (exit code 88). If you omit the letter, qmail-dkim will
     18750+not issue any error inspite of DKIM verification failure. It will return
     18751+success and the email will get delivered.
     18752+
     18753+The complete set of letters with the corresponding return status is given below
    1912718754+
    1912818755+ A - DKIM_SUCCESS                        - Function executed successfully
     
    1919118818+.B DKIMVERIFY
    1919218819+to an empty string. If you want to check all message's From header in signature set the
    19193 +\fBUNSIGNED_FROM\fR environment variable to an empty string.
     18820+\fBUNSIGNED_FROM\fR environment variable to an empty string. If you want to check messages
     18821+without signed subject header, set \fBUNSIGNED_SUBJECT\fR environment variable. If you want
     18822+to honor body lengh tag (l=), set \fBHONOR_BODYLENGTHTAG\fR environment variable.
    1919418823+
    1919518824+qmail-dkim supports signing practice which can be additonall checked when a signature
     
    1921118840+set the environment variable
    1921218841+.BR DKIMPRACTICE="ST" .
    19213 +If you want automatic behaviour, set DKIMADSPERROR to an empty string. In this case ADSP/SSP will be used when return code
     18842+If you want automatic behaviour, set DKIMPRACTICE to an empty string. In this case ADSP/SSP will be used when return code
    1921418843+matches "FGHIJKLMNPQRSTUVWX".
    1921518844+.B qmail-dkim
     
    1926618895+containing a list of domains which you know are sure not to sign messages using DKIM.
    1926718896+If a message comes from a domain listed in
    19268 +.IR signaturedomains ,
     18897+.IR nosignaturedomains ,
    1926918898+and does not have a DKIM-Signature header,
    1927018899+.B qmail-dkim
     
    1927818907+Typically, you would sign messages generated on-host by setting
    1927918908+.B DKIMSIGN
    19280 +in the environment before running an email program.  DKIMSIGN will be carried
    19281 +through qmail's sendmail emulation through
     18909+in the environment before running an \fBqmail-smtpd\fR(8) or \fBsendmail(1)\fR / \fBqmail-inject\fR(8).  DKIMSIGN will be carried
     18910+through qmail-smtpd or through qmail's sendmail emulation through
    1928218911+.B qmail-inject
    1928318912+to
     
    1933618965+qmail-header(5),
    1933718966+dknewkey(8),
     18967+dkim(8),
    1933818968+dktest(8),
    1933918969+qmail-inject(8),
     
    1935418984diff -ruN ../netqmail-1.06-original/qmail-dkim.c netqmail-1.06/qmail-dkim.c
    1935518985--- ../netqmail-1.06-original/qmail-dkim.c      1970-01-01 01:00:00.000000000 +0100
    19356 +++ netqmail-1.06/qmail-dkim.c  2018-04-03 14:46:51.373411639 +0200
    19357 @@ -0,0 +1,1388 @@
     18986+++ netqmail-1.06/qmail-dkim.c  2019-06-19 09:48:44.632641078 +0200
     18987@@ -0,0 +1,1417 @@
    1935818988+/*
    1935918989+ * $Log: qmail-dkim.c,v $
     18990+ * Revision 1.53  2019-06-14 21:26:37+05:30  Cprogrammer
     18991+ * added env variable HONOR_BODYLENGTHTAG to honor body length tag during verification
     18992+ *
     18993+ * Revision 1.52  2019-02-18 22:18:12+05:30  Cprogrammer
     18994+ * allow DKIMVERIFY env variable in place of DKIMPRACTICE when SIGN_PRACTICE="local"
     18995+ *
     18996+ * Revision 1.51  2019-02-17 11:38:51+05:30  Cprogrammer
     18997+ * set original DKIM error for SIGN_PRACTICE=local
     18998+ *
     18999+ * Revision 1.50  2019-02-15 21:25:04+05:30  Cprogrammer
     19000+ * skip nosignaturedomains if domain is present in signaturedomains
     19001+ *
     19002+ * Revision 1.49  2018-08-08 23:58:01+05:30  Cprogrammer
     19003+ * issue success if at lease one one good signature is found
     19004+ *
     19005+ * Revision 1.48  2017-09-05 12:37:16+05:30  Cprogrammer
     19006+ * added missing DKIM_MFREE()
     19007+ *
    1936019008+ * Revision 1.47  2016-06-03 09:57:59+05:30  Cprogrammer
    1936119009+ * moved qmail-multi to sbin
     
    1981919467+
    1982019468+#include <openssl/evp.h>
    19821 +#define DKIM_MALLOC(s)     OPENSSL_malloc(s)
     19469+#define DKIM_MALLOC(n)     OPENSSL_malloc(n)
    1982219470+#define DKIM_MFREE(s)      OPENSSL_free(s); s = NULL;
    1982319471+char           *dns_text(char *);
     
    1995819606+               DKIM_MFREE(results);
    1995919607+               return DKIM_ADSP_SCOPE;
    19960 +       }
    19961 +       else
     19608+       } else
    1996219609+       if (!str_diff(results, "e=temp;")) {
    1996319610+               DKIM_MFREE(results);
    1996419611+               return DKIM_ADSP_TEMPFAIL;
    1996519612+       }
    19966 +       if (!(query = DKIM_MALLOC(str_len("_adsp._domainkey.") + str_len(domain) + 1)))
     19613+       if (!(query = DKIM_MALLOC(str_len("_adsp._domainkey.") + str_len(domain) + 1))) {
     19614+               DKIM_MFREE(results);
    1996719615+               die(51, 0);
     19616+       }
    1996819617+       sprintf(query, "_adsp._domainkey.%s", domain);
    1996919618+       results = dns_text(query);
     
    2029019939+
    2029119940+int
    20292 +checkPractice(int dkimRet)
     19941+checkPractice(int dkimRet, int useADSP, int useSSP)
    2029319942+{
    2029419943+       char           *ptr;
    2029519944+
    20296 +       if (!(ptr = env_get("DKIMPRACTICE")))
    20297 +               return (0);
    20298 +       else
     19945+       if (!(ptr = env_get("DKIMPRACTICE"))) {
     19946+               /*- if SIGN_PRACTICE="local" then you can use DKIMVERIFY env variable too */
     19947+               if (!useADSP && !useSSP)
     19948+                       dkimpractice = dkimverify; /*- DKIMVERIFY env variable */
     19949+               else
     19950+                       return (0);
     19951+       } else
    2029919952+               dkimpractice = ptr;
    20300 +       if (!*ptr) {
     19953+       if (!*dkimpractice) {
    2030119954+               if (dkimRet < 0 || dkimRet == DKIM_3PS_SIGNATURE)
    2030219955+                       return (1);
     
    2052520178+                       useADSP = 1;
    2052620179+                       accept3ps = 1;
    20527 +               }
    20528 +               else
     20180+               } else
    2052920181+               if (!str_diffn("ssp", x, 3)) {
    2053020182+                       useSSP = 1;
     
    2054820200+                       vopts.nAllowUnsignedFromHeaders = 1;
    2054920201+               vopts.nSubjectRequired = env_get("UNSIGNED_SUBJECT") ? 0 : 1;
     20202+               vopts.nHonorBodyLengthTag = env_get("HONOR_BODYLENGTHTAG") ? 0 : 1;
    2055020203+               DKIMVerifyInit(&ctxt, &vopts);          /*- this is always successful */
    2055120204+       }
     
    2061120264+                                       maybe_die_dkim(ret);
    2061220265+                               else
    20613 +                               for (ret = DKIM_SUCCESS,i = 0; i < nSigCount; i++) {
    20614 +                                       if (pDetails[i].nResult < 0) {
    20615 +                                               ret = pDetails[i].nResult;
    20616 +                                               break; /*- don't know if it is right to break */
     20266+                               for (ret = DKIM_FAIL,i = 0; i < nSigCount; i++) {
     20267+                                       if (pDetails[i].nResult >= 0) {
     20268+                                               ret = 0;
     20269+                                       } else {
     20270+                                               if (ret == DKIM_FAIL)
     20271+                                                       ret = pDetails[i].nResult;
    2061720272+                                       }
    2061820273+                               }
     
    2062120276+                       }
    2062220277+                       /*- what to do if DKIM Verification fails */
    20623 +                       if (checkPractice(ret)) {
     20278+                       if (checkPractice(ret, useADSP, useSSP)) {
    2062420279+                               char           *domain;
     20280+                               int             skip_nosignature_domain = 0;
    2062520281+
    2062620282+                               origRet = ret;
     
    2063520291+                                               len += ((token_len = str_len(p)) + 1); /*- next domain */
    2063620292+                                               if (!case_diffb(p, token_len, domain)) {
    20637 +                                                       ret = DKIM_FAIL;
     20293+                                                       ret = origRet;
     20294+                                                       skip_nosignature_domain = 1;
    2063820295+                                                       useADSP = 0;
    2063920296+                                                       useSSP = 0;
     
    2064220299+                                               p = sigdomains.s + len;
    2064320300+                                       }
    20644 +                                       if (!(p = env_get("NOSIGNATUREDOMAINS"))) {
    20645 +                                               if (control_readfile(&nsigdomains, "nosignaturedomains", 0) == -1)
    20646 +                                                       die(55, 2);
    20647 +                                       } else
    20648 +                                       if (!stralloc_copys(&nsigdomains, p))
    20649 +                                               die(51, 2);
    20650 +                                       for (len = 0, p = nsigdomains.s;len < nsigdomains.len;) {
    20651 +                                               len += ((token_len = str_len(p)) + 1); /*- next domain */
    20652 +                                               if (*p == '*' || !case_diffb(p, token_len, domain)) {
    20653 +                                                       ret = DKIM_NEUTRAL;
    20654 +                                                       useADSP = 0;
    20655 +                                                       useSSP = 0;
    20656 +                                                       break;
     20301+                                       if (!skip_nosignature_domain) {
     20302+                                               if (!(p = env_get("NOSIGNATUREDOMAINS"))) {
     20303+                                                       if (control_readfile(&nsigdomains, "nosignaturedomains", 0) == -1)
     20304+                                                               die(55, 2);
     20305+                                               } else
     20306+                                               if (!stralloc_copys(&nsigdomains, p))
     20307+                                                       die(51, 2);
     20308+                                               for (len = 0, p = nsigdomains.s;len < nsigdomains.len;) {
     20309+                                                       len += ((token_len = str_len(p)) + 1); /*- next domain */
     20310+                                                       if (*p == '*' || !case_diffb(p, token_len, domain)) {
     20311+                                                               ret = DKIM_NEUTRAL;
     20312+                                                               useADSP = 0;
     20313+                                                               useSSP = 0;
     20314+                                                               break;
     20315+                                                       }
     20316+                                                       p = nsigdomains.s + len;
    2065720317+                                               }
    20658 +                                               p = nsigdomains.s + len;
    2065920318+                                       }
    2066020319+                               }
     
    2067720336+                                       int             bTestingPractices = 0;
    2067820337+                                       char           *domain;
    20679 +       
     20338+
    2068020339+                                       if ((domain = DKIMVerifyGetDomain(&ctxt)))
    2068120340+                                               resDKIMSSP = checkSSP(domain, &bTestingPractices);
     
    2074020399+getversion_qmail_dkim_c()
    2074120400+{
    20742 +       static char    *x = "$Id: qmail-dkim.c,v 1.37 2013-01-24 22:37:22+05:30 Cprogrammer Exp mbhangui $";
     20401+       static char    *x = "$Id: qmail-dkim.c,v 1.49 2018-08-08 23:58:01+05:30 Cprogrammer Exp mbhangui $";
    2074320402+
    2074420403+       x++;
     
    2074620405diff -ruN ../netqmail-1.06-original/qmail-inject.c netqmail-1.06/qmail-inject.c
    2074720406--- ../netqmail-1.06-original/qmail-inject.c    1998-06-15 12:53:16.000000000 +0200
    20748 +++ netqmail-1.06/qmail-inject.c        2016-11-22 21:03:57.120527832 +0100
     20407+++ netqmail-1.06/qmail-inject.c        2019-02-27 20:57:13.397024992 +0100
    2074920408@@ -22,6 +22,7 @@
    2075020409 #include "auto_qmail.h"
     
    2079820457diff -ruN ../netqmail-1.06-original/qmail-local.c netqmail-1.06/qmail-local.c
    2079920458--- ../netqmail-1.06-original/qmail-local.c     2007-11-30 21:22:54.000000000 +0100
    20800 +++ netqmail-1.06/qmail-local.c 2018-01-01 12:10:21.981102868 +0100
     20459+++ netqmail-1.06/qmail-local.c 2019-02-27 20:57:13.398024981 +0100
    2080120460@@ -28,6 +28,7 @@
    2080220461 #include "myctime.h"
     
    2087720536diff -ruN ../netqmail-1.06-original/qmail-lspawn.c netqmail-1.06/qmail-lspawn.c
    2087820537--- ../netqmail-1.06-original/qmail-lspawn.c    1998-06-15 12:53:16.000000000 +0200
    20879 +++ netqmail-1.06/qmail-lspawn.c        2016-11-22 21:03:57.120527832 +0100
     20538+++ netqmail-1.06/qmail-lspawn.c        2019-02-27 20:57:13.398024981 +0100
    2088020539@@ -1,4 +1,5 @@
    2088120540 #include "fd.h"
     
    2090620565diff -ruN ../netqmail-1.06-original/qmail-newmvrt.c netqmail-1.06/qmail-newmvrt.c
    2090720566--- ../netqmail-1.06-original/qmail-newmvrt.c   1970-01-01 01:00:00.000000000 +0100
    20908 +++ netqmail-1.06/qmail-newmvrt.c       2016-11-22 21:04:20.041763530 +0100
     20567+++ netqmail-1.06/qmail-newmvrt.c       2019-02-27 20:57:13.398024981 +0100
    2090920568@@ -0,0 +1,70 @@
    2091020569+#include "strerr.h"
     
    2098020639diff -ruN ../netqmail-1.06-original/qmail-pop3d.c netqmail-1.06/qmail-pop3d.c
    2098120640--- ../netqmail-1.06-original/qmail-pop3d.c     2007-11-30 21:22:54.000000000 +0100
    20982 +++ netqmail-1.06/qmail-pop3d.c 2016-11-22 21:03:57.121527799 +0100
     20641+++ netqmail-1.06/qmail-pop3d.c 2019-02-27 20:57:13.398024981 +0100
    2098320642@@ -16,6 +16,11 @@
    2098420643 #include "readwrite.h"
     
    2114020799diff -ruN ../netqmail-1.06-original/qmail-pw2u.c netqmail-1.06/qmail-pw2u.c
    2114120800--- ../netqmail-1.06-original/qmail-pw2u.c      1998-06-15 12:53:16.000000000 +0200
    21142 +++ netqmail-1.06/qmail-pw2u.c  2016-11-22 21:03:57.121527799 +0100
     20801+++ netqmail-1.06/qmail-pw2u.c  2019-02-27 20:57:13.398024981 +0100
    2114320802@@ -1,3 +1,4 @@
    2114420803+#include <unistd.h>
     
    2114820807diff -ruN ../netqmail-1.06-original/qmail-qmqpc.c netqmail-1.06/qmail-qmqpc.c
    2114920808--- ../netqmail-1.06-original/qmail-qmqpc.c     1998-06-15 12:53:16.000000000 +0200
    21150 +++ netqmail-1.06/qmail-qmqpc.c 2016-11-22 21:03:57.121527799 +0100
     20809+++ netqmail-1.06/qmail-qmqpc.c 2019-02-27 20:57:13.398024981 +0100
    2115120810@@ -102,6 +102,8 @@
    2115220811 char *server;
     
    2116920828diff -ruN ../netqmail-1.06-original/qmail-qmtpd.c netqmail-1.06/qmail-qmtpd.c
    2117020829--- ../netqmail-1.06-original/qmail-qmtpd.c     1998-06-15 12:53:16.000000000 +0200
    21171 +++ netqmail-1.06/qmail-qmtpd.c 2016-11-22 21:03:57.121527799 +0100
     20830+++ netqmail-1.06/qmail-qmtpd.c 2019-02-27 20:57:13.399024970 +0100
    2117220831@@ -1,3 +1,5 @@
    2117320832+#include <unistd.h>
     
    2117820837diff -ruN ../netqmail-1.06-original/qmail-qstat.sh netqmail-1.06/qmail-qstat.sh
    2117920838--- ../netqmail-1.06-original/qmail-qstat.sh    1998-06-15 12:53:16.000000000 +0200
    21180 +++ netqmail-1.06/qmail-qstat.sh        2016-11-22 21:03:57.121527799 +0100
     20839+++ netqmail-1.06/qmail-qstat.sh        2019-02-27 20:57:13.399024970 +0100
    2118120840@@ -1,7 +1,7 @@
    2118220841 cd QMAIL
     
    2119120850diff -ruN ../netqmail-1.06-original/qmail-queue.8 netqmail-1.06/qmail-queue.8
    2119220851--- ../netqmail-1.06-original/qmail-queue.8     2007-11-30 21:22:54.000000000 +0100
    21193 +++ netqmail-1.06/qmail-queue.8 2016-12-05 19:24:19.597680897 +0100
     20852+++ netqmail-1.06/qmail-queue.8 2019-02-27 20:57:13.399024970 +0100
    2119420853@@ -46,6 +46,13 @@
    2119520854 will invoke the contents of
     
    2120820867diff -ruN ../netqmail-1.06-original/qmail-queue.c netqmail-1.06/qmail-queue.c
    2120920868--- ../netqmail-1.06-original/qmail-queue.c     1998-06-15 12:53:16.000000000 +0200
    21210 +++ netqmail-1.06/qmail-queue.c 2016-12-05 19:24:19.597680897 +0100
     20869+++ netqmail-1.06/qmail-queue.c 2019-02-27 20:57:13.399024970 +0100
    2121120870@@ -16,6 +16,8 @@
    2121220871 #include "auto_uids.h"
     
    2136021019diff -ruN ../netqmail-1.06-original/qmail-remote.8 netqmail-1.06/qmail-remote.8
    2136121020--- ../netqmail-1.06-original/qmail-remote.8    1998-06-15 12:53:16.000000000 +0200
    21362 +++ netqmail-1.06/qmail-remote.8        2016-11-22 21:03:57.122527765 +0100
     21021+++ netqmail-1.06/qmail-remote.8        2019-02-27 20:57:13.399024970 +0100
    2136321022@@ -100,6 +100,73 @@
    2136421023 After this letter comes a human-readable description of
     
    2164321302diff -ruN ../netqmail-1.06-original/qmail-remote.c netqmail-1.06/qmail-remote.c
    2164421303--- ../netqmail-1.06-original/qmail-remote.c    1998-06-15 12:53:16.000000000 +0200
    21645 +++ netqmail-1.06/qmail-remote.c        2017-08-28 17:51:47.068287985 +0200
     21304+++ netqmail-1.06/qmail-remote.c        2020-04-16 11:23:31.333050380 +0200
    2164621305@@ -28,6 +28,7 @@
    2164721306 #include "timeoutconn.h"
     
    2171621375   if (flagcritical) out("Possible duplicate! ");
    2171721376+#ifdef TLS
    21718 +  if (ssl_err_str) { out(ssl_err_str); out(" "); }
     21377+  if (ssl_err_str) { out((char *)ssl_err_str); out(" "); }
    2171921378+#endif
    2172021379   out("(#4.4.2)\n");
     
    2181321472 {
    2181421473   int i;
    21815 @@ -179,6 +284,11 @@
     21474@@ -179,6 +284,16 @@
    2181621475 char *prepend;
    2181721476 char *append;
     
    2181921478+#ifdef TLS
    2182021479+  /* shouldn't talk to the client unless in an appropriate state */
     21480+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
     21481+  OSSL_HANDSHAKE_STATE state = ssl ? SSL_get_state(ssl) : TLS_ST_BEFORE;
     21482+  if (state & TLS_ST_OK || (!smtps && state & TLS_ST_BEFORE))
     21483+#else
    2182121484+  int state = ssl ? ssl->state : SSL_ST_BEFORE;
    2182221485+  if (state & SSL_ST_OK || (!smtps && state & SSL_ST_BEFORE))
     21486+#endif
    2182321487+#endif
    2182421488   substdio_putsflush(&smtpto,"QUIT\r\n");
    2182521489   /* waiting for remote side is just too ridiculous */
    2182621490   out(prepend);
    21827 @@ -186,6 +296,30 @@
     21491@@ -186,6 +301,30 @@
    2182821492   out(append);
    2182921493   out(".\n");
     
    2185621520 }
    2185721521 
    21858 @@ -201,6 +335,16 @@
     21522@@ -201,6 +340,16 @@
    2185921523     if (ch == '.')
    2186021524       substdio_put(&smtpto,".",1);
     
    2187321537       r = substdio_get(&ssin,&ch,1);
    2187421538       if (r == 0) perm_partialline();
    21875 @@ -214,30 +358,432 @@
     21539@@ -214,30 +363,436 @@
    2187621540   substdio_flush(&smtpto);
    2187721541 }
     
    2188521549+void tls_quit(const char *s1, const char *s2)
    2188621550+{
    21887 +  out(s1); if (s2) { out(": "); out(s2); } TLS_QUIT;
     21551+  out((char *)s1); if (s2) { out(": "); out((char *)s2); } TLS_QUIT;
    2188821552+}
    2188921553+# define tls_quit_error(s) tls_quit(s, ssl_error())
     
    2194921613+    if (!len) {
    2195021614+      if (!servercert) return 0;
    21951 +      out("ZNo TLS achieved while "); out(servercert);
     21615+      out("ZNo TLS achieved while "); out((char *)servercert);
    2195221616+      out(" exists"); smtptext.len = 0; TLS_QUIT;
    2195321617+    }
     
    2198021644+    SSL_CTX_use_RSAPrivateKey_file(ctx, CLIENTCERT, SSL_FILETYPE_PEM);
    2198121645+# undef CLIENTCERT
     21646+
     21647+#if OPENSSL_VERSION_NUMBER >= 0x10101000L
     21648+  SSL_CTX_set_post_handshake_auth(ctx, 1);
     21649+#endif
    2198221650+
    2198321651+  myssl = SSL_new(ctx);
     
    2201121679+      if (!servercert) return 0;
    2201221680+      out("ZSTARTTLS rejected while ");
    22013 +      out(servercert); out(" exists"); TLS_QUIT;
     21681+      out((char *)servercert); out(" exists"); TLS_QUIT;
    2201421682+    }
    2201521683+    smtptext.len = 0;
     
    2206321731+      i = X509_NAME_get_index_by_NID(subj, NID_commonName, -1);
    2206421732+      if (i >= 0) {
    22065 +        const ASN1_STRING *s = X509_NAME_get_entry(subj, i)->value;
     21733+        const ASN1_STRING *s = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subj, i));
    2206621734+        if (s) { peer.len = s->length; peer.s = s->data; }
    2206721735+      }
     
    2231921987   for (i = 0;i < reciplist.len;++i) {
    2232021988     substdio_puts(&smtpto,"RCPT TO:<");
    22321 @@ -297,19 +843,14 @@
     21989@@ -246,15 +801,23 @@
     21990     substdio_flush(&smtpto);
     21991     code = smtpcode();
     21992     if (code >= 500) {
     21993-      out("h"); outhost(); out(" does not like recipient.\n");
     21994+      /* added by Endersys R&D Team */
     21995+      out("h<From:"); outsafe(&sender); out(" To:"); outsafe(&reciplist.sa[i]); out("> ");  outhost(); out(" does not like recipient.\n");
     21996       outsmtptext(); zero();
     21997     }
     21998     else if (code >= 400) {
     21999-      out("s"); outhost(); out(" does not like recipient.\n");
     22000+      /* added by Endersys R&D Team */
     22001+      out("s<From:"); outsafe(&sender); out(" To:"); outsafe(&reciplist.sa[i]);  out("> ");  outhost(); out(" does not like recipient.\n");
     22002       outsmtptext(); zero();
     22003     }
     22004     else {
     22005-      out("r"); zero();
     22006+       /*
     22007+       * James Raftery <james@now.ie>
     22008+       * Log _real_ envelope recipient, post canonicalisation.
     22009+       * and modified by Endersys R&D Team
     22010+       */
     22011+
     22012+      out("r<From:"); outsafe(&sender); out(" To:"); outsafe(&reciplist.sa[i]); out("> "); zero();
     22013       flagbother = 1;
     22014     }
     22015   }
     22016@@ -297,19 +860,14 @@
    2232222017   if (!stralloc_cats(saout,"@")) temp_nomem();
    2232322018 
     
    2234122036   if (control_readint(&timeout,"control/timeoutremote") == -1) temp_control();
    2234222037   if (control_readint(&timeoutconnect,"control/timeoutconnect") == -1)
    22343 @@ -324,48 +865,108 @@
     22038@@ -324,48 +882,108 @@
    2234422039     case 1:
    2234522040       if (!constmap_init(&maproutes,routes.s,routes.len,1)) temp_nomem(); break;
     
    2246922164   if (ipme_init() != 1) temp_oserr();
    2247022165 
    22471 @@ -414,10 +1015,13 @@
     22166@@ -414,10 +1032,13 @@
    2247222167     smtpfd = socket(AF_INET,SOCK_STREAM,0);
    2247322168     if (smtpfd == -1) temp_oserr();
     
    2248722182diff -ruN ../netqmail-1.06-original/qmail-rspawn.c netqmail-1.06/qmail-rspawn.c
    2248822183--- ../netqmail-1.06-original/qmail-rspawn.c    1998-06-15 12:53:16.000000000 +0200
    22489 +++ netqmail-1.06/qmail-rspawn.c        2016-11-22 21:03:57.123527732 +0100
     22184+++ netqmail-1.06/qmail-rspawn.c        2019-02-27 20:57:13.400024959 +0100
    2249022185@@ -1,3 +1,4 @@
    2249122186+#include "env.h"
     
    2251622211diff -ruN ../netqmail-1.06-original/qmail-send.9 netqmail-1.06/qmail-send.9
    2251722212--- ../netqmail-1.06-original/qmail-send.9      1998-06-15 12:53:16.000000000 +0200
    22518 +++ netqmail-1.06/qmail-send.9  2016-11-22 21:03:57.123527732 +0100
    22519 @@ -51,7 +51,9 @@
     22213+++ netqmail-1.06/qmail-send.9  2019-06-26 16:45:05.514152928 +0200
     22214@@ -16,6 +16,15 @@
     22215 .B qmail-send
     22216 leaves it in the queue and tries the addresses again later.
     22217 
     22218+.B Supplemental queues
     22219+allow more than one queue for remote recipients. (CHANNELS - 2) supplemental queues total, because one queue is always
     22220+designated for local deliveries and a second queue is always available for remote deliveries that
     22221+don't match any of the domains listed in the supplemental queue control files.
     22222+This makes it possible to divide remote deliveries into distinct queues at different concurrency
     22223+levels and can be used as a throttling mechanism based on domain.
     22224+Supplemental queues are managed by the supplsX and concurrencysupplX control files, where X is an integer from
     22225+0 to (CHANNELS - 3).
     22226+
     22227 .B qmail-send
     22228 prints a readable record of its activities to descriptor 0.
     22229 It writes commands to
     22230@@ -51,7 +60,13 @@
    2252022231 .B qmail-send
    2252122232 receives a HUP signal,
     
    2252422235+.IR concurrencylocal ,
    2252522236+.IR concurrencyremote ,
    22526 +.IR locals
     22237+.IR locals,
     22238+.IR supplsX,
     22239+.IR concurrencylocal,
     22240+.IR concurrencyremote,
     22241+.IR concurrencysupplX
    2252722242 and
    2252822243 .IR virtualdomains .
    2252922244 .TP 5
    22530 @@ -115,6 +117,10 @@
     22245@@ -93,6 +108,15 @@
     22246 is limited at compile time to
     22247 SPAWN.
     22248 .TP 5
     22249+.I concurrencysupplX
     22250+Maximum number of simultaneous delivery attempts via supplemental
     22251+channel X, where X is an integer starting at 0.
     22252+Default: 20.
     22253+If 0, deliveries via channel X will be put on hold.
     22254+.I concurrencysupplX
     22255+is limited at compile time to
     22256+SPAWN.
     22257+.TP 5
     22258 .I doublebouncehost
     22259 Double-bounce host.
     22260 Default:
     22261@@ -115,6 +139,10 @@
    2253122262 (If that bounces,
    2253222263 .B qmail-send
     
    2253922270 .I envnoathost
    2254022271 Presumed domain name for addresses without @ signs.
     22272@@ -147,6 +175,12 @@
     22273 is listed in
     22274 .IR locals .
     22275 .TP 5
     22276+.I supplsX
     22277+List of domain names that the current host
     22278+will deliver on supplemental channel X where X is an integer starting at 0,
     22279+one per line.
     22280+No default.
     22281+.TP 5
     22282 .I percenthack
     22283 List of domain names where the percent hack is applied.
     22284 If
     22285@@ -164,7 +198,9 @@
     22286 handles
     22287 .I percenthack
     22288 before
     22289-.IR locals .
     22290+.I locals
     22291+and
     22292+.IR supplsX.
     22293 .TP 5
     22294 .I queuelifetime
     22295 Number of seconds
    2254122296diff -ruN ../netqmail-1.06-original/qmail-send.c netqmail-1.06/qmail-send.c
    2254222297--- ../netqmail-1.06-original/qmail-send.c      1998-06-15 12:53:16.000000000 +0200
    22543 +++ netqmail-1.06/qmail-send.c  2016-11-22 21:03:57.124527699 +0100
    22544 @@ -31,6 +31,7 @@
     22298+++ netqmail-1.06/qmail-send.c  2019-06-26 16:42:40.004753618 +0200
     22299@@ -31,6 +31,11 @@
    2254522300 #include "constmap.h"
    2254622301 #include "fmtqfn.h"
    2254722302 #include "readsubdir.h"
    2254822303+#include "srs.h"
     22304+
     22305+#include "auto_spawn.h"
     22306+
     22307+#include "channels.h"
    2254922308 
    2255022309 /* critical timing feature #1: if not triggered, do not busy-loop */
    2255122310 /* critical timing feature #2: if triggered, respond within fixed time */
    22552 @@ -44,6 +45,8 @@
     22311@@ -44,6 +49,8 @@
    2255322312 
    2255422313 int lifetime = 604800;
     
    2255922318 struct constmap mappercenthack;
    2256022319 stralloc locals = {0};
    22561 @@ -55,6 +58,7 @@
     22320@@ -55,17 +62,20 @@
    2256222321 stralloc bouncehost = {0};
    2256322322 stralloc doublebounceto = {0};
     
    2256722326 char strnum2[FMT_ULONG];
    2256822327 char strnum3[FMT_ULONG];
    22569 @@ -82,9 +86,6 @@
     22328 
     22329-#define CHANNELS 2
     22330-char *chanaddr[CHANNELS] = { "local/", "remote/" };
     22331-char *chanstatusmsg[CHANNELS] = { " local ", " remote " };
     22332-char *tochan[CHANNELS] = { " to local ", " to remote " };
     22333-int chanfdout[CHANNELS] = { 1, 3 };
     22334-int chanfdin[CHANNELS] = { 2, 4 };
     22335-int chanskip[CHANNELS] = { 10, 20 };
     22336+char *chanaddr[CHANNELS];
     22337+char *chanstatusmsg[CHANNELS];
     22338+char *tochan[CHANNELS];
     22339+int chanfdout[CHANNELS];
     22340+int chanfdin[CHANNELS];
     22341+int chanskip[CHANNELS];
     22342+struct constmap mapsuppl[SUPPL_CHANNELS];
     22343+stralloc suppls[SUPPL_CHANNELS];
     22344+stralloc newsuppls[SUPPL_CHANNELS];
     22345 
     22346 int flagexitasap = 0; void sigterm() { flagexitasap = 1; }
     22347 int flagrunasap = 0; void sigalrm() { flagrunasap = 1; }
     22348@@ -82,12 +92,10 @@
    2257022349 
    2257122350 datetime_sec recent;
     
    2257722356 stralloc fn2 = {0};
    2257822357 char fnmake_strnum[FMT_ULONG];
    22579 @@ -96,7 +97,7 @@
     22358+stralloc fname = {0};
     22359 
     22360 void fnmake_init()
     22361 {
     22362@@ -96,7 +104,7 @@
    2258022363 }
    2258122364 
     
    2258622369 void fnmake_foop(id) unsigned long id; { fn.len = fmtqfn(fn.s,"foop/",id,0); }
    2258722370 void fnmake_split(id) unsigned long id; { fn.len = fmtqfn(fn.s,"",id,1); }
    22588 @@ -262,6 +263,8 @@
     22371@@ -117,6 +125,7 @@
     22372 {
     22373   int i;
     22374   int j;
     22375+  int c;
     22376   char *x;
     22377   static stralloc addr = {0};
     22378   int at;
     22379@@ -159,6 +168,13 @@
     22380 
     22381   if (!stralloc_cat(&rwline,&addr)) return 0;
     22382   if (!stralloc_0(&rwline)) return 0;
     22383+
     22384+  for (c = 0;c < SUPPL_CHANNELS;++c)
     22385+  {
     22386+      if (constmap(&mapsuppl[c],addr.s + at + 1,addr.len - at - 1))
     22387+          return c + 3;
     22388+  }
     22389+
     22390   return 2;
     22391 }
     22392 
     22393@@ -228,7 +244,8 @@
     22394 
     22395 substdio sstoqc; char sstoqcbuf[1024];
     22396 substdio ssfromqc; char ssfromqcbuf[1024];
     22397-stralloc comm_buf[CHANNELS] = { {0}, {0} };
     22398+
     22399+stralloc comm_buf[CHANNELS];
     22400 int comm_pos[CHANNELS];
     22401 
     22402 void comm_init()
     22403@@ -262,6 +279,8 @@
    2258922404  while (!stralloc_copys(&comm_buf[c],"")) nomem();
    2259022405  ch = delnum;
     
    2259522410  while (!stralloc_cats(&comm_buf[c],fn.s)) nomem();
    2259622411  while (!stralloc_0(&comm_buf[c])) nomem();
    22597 @@ -683,15 +686,39 @@
     22412@@ -382,7 +401,7 @@
     22413 /* this file is too long ----------------------------------- PRIORITY QUEUES */
     22414 
     22415 prioq pqdone = {0}; /* -todo +info; HOPEFULLY -local -remote */
     22416-prioq pqchan[CHANNELS] = { {0}, {0} };
     22417+prioq pqchan[CHANNELS];
     22418 /* pqchan 0: -todo +info +local ?remote */
     22419 /* pqchan 1: -todo +info ?local +remote */
     22420 prioq pqfail = {0}; /* stat() failure; has to be pqadded again */
     22421@@ -683,15 +702,39 @@
    2259822422   }
    2259922423  if (str_equal(sender.s,"#@[]"))
     
    2263822462    qmail_put(&qqt,newfield_date.s,newfield_date.len);
    2263922463    qmail_puts(&qqt,"From: ");
    22640 @@ -740,9 +767,17 @@
     22464@@ -740,9 +783,17 @@
    2264122465      qmail_fail(&qqt);
    2264222466    else
     
    2265722481      if (r == -1)
    2265822482        qmail_fail(&qqt);
    22659 @@ -906,41 +941,42 @@
     22483@@ -780,8 +831,8 @@
     22484 ;
     22485 
     22486 unsigned long masterdelid = 1;
     22487-unsigned int concurrency[CHANNELS] = { 10, 20 };
     22488-unsigned int concurrencyused[CHANNELS] = { 0, 0 };
     22489+unsigned int concurrency[CHANNELS];
     22490+unsigned int concurrencyused[CHANNELS];
     22491 struct del *d[CHANNELS];
     22492 stralloc dline[CHANNELS];
     22493 char delbuf[2048];
     22494@@ -808,9 +859,9 @@
     22495  for (c = 0;c < CHANNELS;++c)
     22496   {
     22497    flagspawnalive[c] = 1;
     22498-   while (!(d[c] = (struct del *) alloc(concurrency[c] * sizeof(struct del))))
     22499+   while (!(d[c] = (struct del *) alloc(auto_spawn * sizeof(struct del))))
     22500      nomem();
     22501-   for (i = 0;i < concurrency[c];++i)
     22502+   for (i = 0;i < auto_spawn;++i)
     22503     { d[c][i].used = 0; d[c][i].recip.s = 0; }
     22504    dline[c].s = 0;
     22505    while (!stralloc_copys(&dline[c],"")) nomem();
     22506@@ -906,41 +957,42 @@
    2266022507      dline[c].len = REPORTMAX;
    2266122508      /* qmail-lspawn and qmail-rspawn are responsible for keeping it short */
     
    2266522512     {
    2266622513      delnum = (unsigned int) (unsigned char) dline[c].s[0];
     22514-     if ((delnum < 0) || (delnum >= concurrency[c]) || !d[c][delnum].used)
    2266722515+     delnum += (unsigned int) ((unsigned int) dline[c].s[1]) << 8;
    22668       if ((delnum < 0) || (delnum >= concurrency[c]) || !d[c][delnum].used)
     22516+     if ((delnum < 0) || (delnum >= auto_spawn) || !d[c][delnum].used)
    2266922517        log1("warning: internal error: delivery report out of range\n");
    2267022518      else
     
    2270822556           --jo[d[c][delnum].j].numtodo;
    2270922557           break;
    22710 @@ -1215,8 +1251,10 @@
     22558@@ -1215,8 +1267,10 @@
    2271122559 
    2271222560 /* this file is too long ---------------------------------------------- TODO */
     
    2272022568 char todobuf[SUBSTDIO_INSIZE];
    2272122569 char todobufinfo[512];
    22722 @@ -1224,7 +1262,7 @@
     22570@@ -1224,7 +1278,7 @@
    2272322571 
    2272422572 void todo_init()
     
    2272922577  trigger_set();
    2273022578 }
    22731 @@ -1236,7 +1274,7 @@
     22579@@ -1236,7 +1290,7 @@
    2273222580 {
    2273322581  if (flagexitasap) return;
     
    2273822586 }
    2273922587 
    22740 @@ -1253,8 +1291,7 @@
     22588@@ -1253,8 +1307,7 @@
    2274122589  char ch;
    2274222590  int match;
     
    2274822596  unsigned long uid;
    2274922597  unsigned long pid;
    22750 @@ -1265,32 +1302,26 @@
     22598@@ -1265,32 +1318,26 @@
    2275122599 
    2275222600  if (flagexitasap) return;
     
    2279022638  fnmake_todo(id);
    2279122639 
    22792 @@ -1438,10 +1469,148 @@
     22640@@ -1363,12 +1410,9 @@
     22641        log1("\n");
     22642        break;
     22643      case 'T':
     22644-       switch(rewrite(todoline.s + 1))
     22645-       {
     22646-        case 0: nomem(); goto fail;
     22647-        case 2: c = 1; break;
     22648-        default: c = 0; break;
     22649-        }
     22650+       c = rewrite(todoline.s + 1);
     22651+       if (c == 0) { nomem(); goto fail; }
     22652+       c--;
     22653        if (fdchan[c] == -1)
     22654        {
     22655         fnmake_chanaddr(id,c);
     22656@@ -1438,17 +1482,175 @@
    2279322657    if (fdchan[c] != -1) close(fdchan[c]);
    2279422658 }
     
    2284522709+
    2284622710+ for (c = 0;c < CHANNELS;++c) flagchan[c] = 0;
    22847 + switch(*s++) {
    22848 +  case 'L':
    22849 +    flagchan[0] = 1;
    22850 +    break;
    22851 +  case 'R':
    22852 +    flagchan[1] = 1;
    22853 +    break;
    22854 +  case 'B':
    22855 +    flagchan[0] = 1;
    22856 +    flagchan[1] = 1;
    22857 +    break;
    22858 +  case 'X':
    22859 +    break;
    22860 +  default:
    22861 +    log1("warning: qmail-send unable to understand qmail-todo\n");
    22862 +    return;
     22711+
     22712+ for (c = 0;c < CHANNELS;++c)
     22713+ {
     22714+  if (!*s)
     22715+  {
     22716+     log1("warning: qmail-send unable to understand qmail-todo\n");
     22717+     return;
     22718+  }
     22719+
     22720+  switch(*s++) {
     22721+   case '0':
     22722+     flagchan[c] = 0;
     22723+     break;
     22724+   case '1':
     22725+     flagchan[c] = 1;
     22726+     break;
     22727+   default:
     22728+     log1("warning: qmail-send unable to understand qmail-todo\n");
     22729+     return;
     22730+  }
    2286322731+ }
    2286422732+
     
    2293422802 /* this file is too long ---------------------------------------------- MAIN */
    2293522803 
    22936  int getcontrols() { if (control_init() == -1) return 0;
    22937 + if (control_readint(&bouncemaxbytes,"control/bouncemaxbytes") == -1) return 0;   
     22804-int getcontrols() { if (control_init() == -1) return 0;
     22805+int getcontrols() {
     22806+ int c;
     22807+ int ck = 0;
     22808+
     22809+ if (control_init() == -1) return 0;
     22810+ if (control_readint(&bouncemaxbytes,"control/bouncemaxbytes") == -1) return 0;
    2293822811  if (control_readint(&lifetime,"control/queuelifetime") == -1) return 0;
    2293922812  if (control_readint(&concurrency[0],"control/concurrencylocal") == -1) return 0;
    2294022813  if (control_readint(&concurrency[1],"control/concurrencyremote") == -1) return 0;
    22941 @@ -1449,6 +1618,8 @@
     22814+
     22815+ for (c = 2,ck = 0;c < CHANNELS;++c)
     22816+ {
     22817+     strnum2[fmt_uint(strnum2,ck++)] = 0;
     22818+     if (!stralloc_copys(&fname,"control/concurrencysuppl")) return 0;
     22819+     if (!stralloc_cats(&fname,strnum2)) return 0;
     22820+     if (!stralloc_0(&fname)) return 0;
     22821+     if (control_readint(&concurrency[c],fname.s) == -1) return 0;
     22822+ }
     22823+
     22824  if (control_rldef(&envnoathost,"control/envnoathost",1,"envnoathost") != 1) return 0;
    2294222825  if (control_rldef(&bouncefrom,"control/bouncefrom",0,"MAILER-DAEMON") != 1) return 0;
    2294322826  if (control_rldef(&bouncehost,"control/bouncehost",1,"bouncehost") != 1) return 0;
     
    2294822831  if (!stralloc_cats(&doublebounceto,"@")) return 0;
    2294922832  if (!stralloc_cat(&doublebounceto,&doublebouncehost)) return 0;
    22950 @@ -1478,6 +1649,10 @@
     22833@@ -1467,6 +1669,21 @@
     22834    case 0: if (!constmap_init(&mapvdoms,"",0,1)) return 0; break;
     22835    case 1: if (!constmap_init(&mapvdoms,vdoms.s,vdoms.len,1)) return 0; break;
     22836   }
     22837+
     22838+ for (c = 0;c < SUPPL_CHANNELS;++c)
     22839+ {
     22840+     strnum2[fmt_uint(strnum2,c)] = 0;
     22841+     if (!stralloc_copys(&fname,"control/suppls")) return 0;
     22842+     if (!stralloc_cats(&fname,strnum2)) return 0;
     22843+     if (!stralloc_0(&fname)) return 0;
     22844+     switch (control_readfile(&suppls[c],fname.s,0))
     22845+     {
     22846+         case -1: return 0;
     22847+         case 0: if (!constmap_init(&mapsuppl[c],"",0,0)) return 0; break;
     22848+         case 1: if (!constmap_init(&mapsuppl[c],suppls[c].s,suppls[c].len,0)) return 0; break;
     22849+     }
     22850+ }
     22851+
     22852  return 1; }
     22853 
     22854 stralloc newlocals = {0};
     22855@@ -1475,9 +1692,33 @@
     22856 void regetcontrols()
     22857 {
     22858  int r;
     22859+ int c;
     22860+ int ck = 0;
     22861+
     22862+ if (control_readint(&concurrency[0],"control/concurrencylocal") == -1)
     22863+  { log1("alert: unable to reread control/concurrencylocal\n"); return; }
     22864+ if (control_readint(&concurrency[1],"control/concurrencyremote") == -1)
     22865+  { log1("alert: unable to reread control/concurrencyremote\n"); return; }
     22866+
     22867+ for (c = 2,ck = 0;c < CHANNELS;++c)
     22868+ {
     22869+     strnum2[fmt_uint(strnum2,ck++)] = 0;
     22870+     if (!stralloc_copys(&fname,"control/concurrencysuppl"))
     22871+         { log3("alert: unable to reread ",fname.s,"\n"); return; }
     22872+     if (!stralloc_cats(&fname,strnum2))
     22873+         { log3("alert: unable to reread ",fname.s,"\n"); return; }
     22874+     if (!stralloc_0(&fname))
     22875+         { log3("alert: unable to reread ",fname.s,"\n"); return; }
     22876+     if (control_readint(&concurrency[c],fname.s) == -1)
     22877+         { log3("alert: unable to reread ",fname.s,"\n"); return; }
     22878+ }
    2295122879 
    2295222880  if (control_readfile(&newlocals,"control/locals",1) != 1)
     
    2295922887  if (r == -1)
    2296022888   { log1("alert: unable to reread control/virtualdomains\n"); return; }
    22961 @@ -1504,6 +1679,9 @@
     22889@@ -1495,6 +1736,28 @@
     22890   }
     22891  else
     22892    while (!constmap_init(&mapvdoms,"",0,1)) nomem();
     22893+
     22894+ for (c = 0;c < SUPPL_CHANNELS;++c)
     22895+ {
     22896+     strnum2[fmt_uint(strnum2,c)] = 0;
     22897+     if (!stralloc_copys(&fname,"control/suppls")) nomem();
     22898+     if (!stralloc_cats(&fname,strnum2)) nomem();
     22899+     if (!stralloc_0(&fname)) nomem();
     22900+     r = control_readfile(&newsuppls[c],fname.s,0);
     22901+     if (r == -1)
     22902+      { log3("alert: qmail-todo: unable to reread ", fname.s, "\n"); return; }
     22903+
     22904+     constmap_free(&mapsuppl[c]);
     22905+
     22906+     if (r)
     22907+      {
     22908+       while (!stralloc_copy(&suppls[c],&newsuppls[c])) nomem();
     22909+       while (!constmap_init(&mapsuppl[c],suppls[c].s,suppls[c].len,0)) nomem();
     22910+      }
     22911+     else
     22912+       while (!constmap_init(&mapsuppl[c],"",0,0)) nomem();
     22913+ }
     22914+
     22915 }
     22916 
     22917 void reread()
     22918@@ -1504,6 +1767,9 @@
    2296222919    log1("alert: unable to reread controls: unable to switch to home directory\n");
    2296322920    return;
     
    2296922926  while (chdir("queue") == -1)
    2297022927   {
    22971 @@ -1544,7 +1722,7 @@
     22928@@ -1512,6 +1778,104 @@
     22929   }
     22930 }
     22931 
     22932+
     22933+static int static_i = 0;
     22934+static int static_j = 0;
     22935+static void channels_init(void)
     22936+{
     22937+    chanaddr[0] = "local/";
     22938+    chanaddr[1] = "remote/";
     22939+    for (static_i=2,static_j=0;static_i<CHANNELS;static_i++,static_j++)
     22940+    {
     22941+        stralloc fnc = {0};
     22942+        strnum2[fmt_uint(strnum2,static_j)] = 0;
     22943+        if (!stralloc_copys(&fname,QDIR_BASENAME)) nomem();
     22944+        if (!stralloc_cats(&fname,strnum2)) nomem();
     22945+        if (!stralloc_cats(&fname,"/")) nomem();
     22946+        if (!stralloc_0(&fname)) nomem();
     22947+        if (!stralloc_copy(&fnc,&fname)) nomem();
     22948+        chanaddr[static_i] = fnc.s;
     22949+    }
     22950+
     22951+    chanstatusmsg[0] = " local ";
     22952+    chanstatusmsg[1] = " remote ";
     22953+    for (static_i=2,static_j=0;static_i<CHANNELS;static_i++,static_j++)
     22954+    {
     22955+        stralloc fnc = {0};
     22956+        strnum2[fmt_uint(strnum2,static_j)] = 0;
     22957+        if (!stralloc_copys(&fname," " QDIR_BASENAME)) nomem();
     22958+        if (!stralloc_cats(&fname,strnum2)) nomem();
     22959+        if (!stralloc_cats(&fname," ")) nomem();
     22960+        if (!stralloc_0(&fname)) nomem();
     22961+        if (!stralloc_copy(&fnc,&fname)) nomem();
     22962+        chanstatusmsg[static_i] = fnc.s;
     22963+    }
     22964+
     22965+    tochan[0] = " to local ";
     22966+    tochan[1] = " to remote ";
     22967+    static_j = 0;
     22968+    for (static_i=2;static_i<CHANNELS;static_i++)
     22969+    {
     22970+        stralloc fnc = {0};
     22971+        strnum2[fmt_uint(strnum2,static_j++)] = 0;
     22972+        if (!stralloc_copys(&fname," to " QDIR_BASENAME)) nomem();
     22973+        if (!stralloc_cats(&fname,strnum2)) nomem();
     22974+        if (!stralloc_cats(&fname," ")) nomem();
     22975+        if (!stralloc_0(&fname)) nomem();
     22976+        if (!stralloc_copy(&fnc,&fname)) nomem();
     22977+        tochan[static_i] = fnc.s;
     22978+    }
     22979+
     22980+    chanfdout[0] = 1;
     22981+    chanfdout[1] = 3;
     22982+    static_j = 1+CHANNEL_FD_OFFSET;
     22983+    for (static_i=2;static_i<CHANNELS;static_i++)
     22984+    {
     22985+        chanfdout[static_i] = static_j;
     22986+        static_j+=2;
     22987+    }
     22988+
     22989+    chanfdin[0] = 2;
     22990+    chanfdin[1] = 4;
     22991+    static_j = 2+CHANNEL_FD_OFFSET;
     22992+    for (static_i=2;static_i<CHANNELS;static_i++)
     22993+    {
     22994+        chanfdin[static_i] = static_j;
     22995+        static_j+=2;
     22996+    }
     22997+
     22998+    chanskip[0] = 10;
     22999+    chanskip[1] = 20;
     23000+    static_j = 20;
     23001+    for (static_i=2;static_i<CHANNELS;static_i++)
     23002+    {
     23003+        chanskip[static_i] = static_j;
     23004+    }
     23005+
     23006+    for (static_i=0;static_i<CHANNELS;static_i++)
     23007+        comm_buf[static_i].s = 0;
     23008+
     23009+    for (static_i=0;static_i<CHANNELS;static_i++)
     23010+        pqchan[static_i].p = 0;
     23011+
     23012+    concurrency[0] = 10;
     23013+    concurrency[1] = 20;
     23014+    for (static_i=2;static_i<CHANNELS;static_i++)
     23015+    {
     23016+        concurrency[static_i] = 20;
     23017+    }
     23018+
     23019+    for (static_i=0;static_i<CHANNELS;static_i++)
     23020+        concurrencyused[static_i] = 0;
     23021+
     23022+    for (static_i=0;static_i<SUPPL_CHANNELS;static_i++)
     23023+        suppls[static_i].s = 0;
     23024+
     23025+    for (static_i=0;static_i<SUPPL_CHANNELS;static_i++)
     23026+        newsuppls[static_i].s = 0;
     23027+
     23028+}
     23029+
     23030 void main()
     23031 {
     23032  int fd;
     23033@@ -1522,6 +1886,8 @@
     23034  struct timeval tv;
     23035  int c;
     23036 
     23037+ channels_init();
     23038+
     23039  if (chdir(auto_qmail) == -1)
     23040   { log1("alert: cannot start: unable to switch to home directory\n"); _exit(111); }
     23041  if (!getcontrols())
     23042@@ -1544,7 +1910,7 @@
    2297223043  numjobs = 0;
    2297323044  for (c = 0;c < CHANNELS;++c)
     
    2297823049    int r;
    2297923050    do
    22980 @@ -1552,7 +1730,13 @@
     23051@@ -1552,7 +1918,13 @@
    2298123052    while ((r == -1) && (errno == error_intr));
    2298223053    if (r < 1)
     
    2299223063    numjobs += concurrency[c];
    2299323064   }
    22994 @@ -1568,7 +1752,11 @@
     23065@@ -1568,7 +1940,11 @@
    2299523066  todo_init();
    2299623067  cleanup_init();
     
    2300623077diff -ruN ../netqmail-1.06-original/qmail-showctl.c netqmail-1.06/qmail-showctl.c
    2300723078--- ../netqmail-1.06-original/qmail-showctl.c   1998-06-15 12:53:16.000000000 +0200
    23008 +++ netqmail-1.06/qmail-showctl.c       2016-11-28 19:39:45.341600337 +0100
     23079+++ netqmail-1.06/qmail-showctl.c       2019-02-27 20:57:13.401024948 +0100
    2300923080@@ -15,6 +15,7 @@
    2301023081 #include "auto_patrn.h"
     
    2312623197diff -ruN ../netqmail-1.06-original/qmail-smtpd.8 netqmail-1.06/qmail-smtpd.8
    2312723198--- ../netqmail-1.06-original/qmail-smtpd.8     1998-06-15 12:53:16.000000000 +0200
    23128 +++ netqmail-1.06/qmail-smtpd.8 2016-12-18 19:08:22.496459855 +0100
     23199+++ netqmail-1.06/qmail-smtpd.8 2019-02-27 20:57:13.402024937 +0100
    2312923200@@ -14,6 +14,15 @@
    2313023201 see
     
    2345023521diff -ruN ../netqmail-1.06-original/qmail-smtpd.c netqmail-1.06/qmail-smtpd.c
    2345123522--- ../netqmail-1.06-original/qmail-smtpd.c     2007-11-30 21:22:54.000000000 +0100
    23452 +++ netqmail-1.06/qmail-smtpd.c 2017-11-07 17:45:04.599607652 +0100
     23523+++ netqmail-1.06/qmail-smtpd.c 2020-04-25 15:15:28.957053097 +0200
    2345323524@@ -12,6 +12,9 @@
    2345423525 #include "ip.h"
     
    2346123532 #include "scan.h"
    2346223533 #include "byte.h"
    23463 @@ -23,44 +26,178 @@
     23534@@ -23,44 +26,180 @@
    2346423535 #include "timeoutread.h"
    2346523536 #include "timeoutwrite.h"
     
    2346723538+#include "dns.h"
    2346823539+#include "wait.h"
    23469 +/* start chkuser code */
    23470 +#include "chkuser.h"
    23471 +/* end chkuser code */
    23472 +#include "spf.h"
    23473 +/* rbl: start */
    23474 +#include "strsalloc.h"
    23475 +/* rbl: end */
    23476 +
    23477 +#define AUTHSLEEP 5
    23478  
    23479  #define MAXHOPS 100
    23480 +
    23481 +#define BMCHECK_BMF 0
    23482 +#define BMCHECK_BMFNR 1
    23483 +#define BMCHECK_BMT 2
    23484 +#define BMCHECK_BMTNR 3
    23485 +#define BMCHECK_BHELO 4
    23486 +#define BMCHECK_BHELONR 5
    23487 +
    23488 +static char strnum[FMT_ULONG];
    23489  unsigned int databytes = 0;
    23490 +unsigned int greetdelay = 0;
    23491 +unsigned int drop_pre_greet = 0;
    23492  int timeout = 1200;
    23493 +int maxrcpt = -1;
    23494 +unsigned int spfbehavior = 0;
    23495 +
    23496 +/* rejectrelaytest: start */
    23497 +unsigned int rejectrelaytest = 0;
    23498 +/* rejecrelayttest: end */
    23499 +/* rejectnullsenders: start */
    23500 +unsigned int rejnsmf = 0;
    23501 +/* rejectnullsenders: end */
    23502 +
    23503 +const char *protocol = "SMTP";
    23504 +
    23505 +/* spf ipv6 fix */
    23506 +char *remoteip4;
    23507 +/* end spf ipv6 fix */
    23508 +
     23540+
     23541+/* chkuser.h will check if TLS_H is defined, so this has to come before chkuser.h */
    2350923542+#ifdef TLS
    2351023543+#include <sys/stat.h>
     
    2351723550+int forcetls = 1;
    2351823551+#endif
     23552+
     23553+/* start chkuser code */
     23554+#include "chkuser.h"
     23555+/* end chkuser code */
     23556+#include "spf.h"
     23557+/* rbl: start */
     23558+#include "strsalloc.h"
     23559+/* rbl: end */
     23560+
     23561+#define AUTHSLEEP 5
     23562 
     23563 #define MAXHOPS 100
     23564+
     23565+#define BMCHECK_BMF 0
     23566+#define BMCHECK_BMFNR 1
     23567+#define BMCHECK_BMT 2
     23568+#define BMCHECK_BMTNR 3
     23569+#define BMCHECK_BHELO 4
     23570+#define BMCHECK_BHELONR 5
     23571+
     23572+static char strnum[FMT_ULONG];
     23573 unsigned int databytes = 0;
     23574+unsigned int greetdelay = 0;
     23575+unsigned int drop_pre_greet = 0;
     23576 int timeout = 1200;
     23577+int maxrcpt = -1;
     23578+unsigned int spfbehavior = 0;
     23579+
     23580+/* rejectrelaytest: start */
     23581+unsigned int rejectrelaytest = 0;
     23582+/* rejecrelayttest: end */
     23583+/* rejectnullsenders: start */
     23584+unsigned int rejnsmf = 0;
     23585+/* rejectnullsenders: end */
     23586+
     23587+static const char *protocol = "SMTP";
     23588+
     23589+/* spf ipv6 fix */
     23590+char *remoteip4;
     23591+/* end spf ipv6 fix */
    2351923592 
    2352023593 int safewrite(fd,buf,len) int fd; char *buf; int len;
     
    2355523628-void die_ipme() { out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); _exit(1); }
    2355623629-void straynewline() { out("451 See http://pobox.com/~djb/docs/smtplf.html.\r\n"); flush(); _exit(1); }
    23557 +void die_read() { logit("read failed"); _exit(1); }
     23630+void die_read(char *reason) { logit2("read failed", reason); flush(); _exit(1); }
    2355823631+void die_alarm() { qlogenvelope("rejected","alarmtimeout","","451"); logit("timeout"); out("451 timeout (#4.4.2)\r\n"); flush(); _exit(1); }
    2355923632+void die_nomem() { qlogenvelope("rejected","outofmemory","","421"); out("421 out of memory (#4.3.0)\r\n"); flush(); _exit(1); }
     
    2364923722 void smtp_greet(code) char *code;
    2365023723 {
    23651 @@ -76,11 +213,33 @@
     23724@@ -76,11 +215,33 @@
    2365223725   smtp_greet("221 "); out("\r\n"); flush(); _exit(0);
    2365323726 }
     
    2368323756 stralloc helohost = {0};
    2368423757 char *fakehelo; /* pointer into helohost, or 0 */
    23685 @@ -91,11 +250,101 @@
     23758@@ -91,11 +252,101 @@
    2368623759   fakehelo = case_diffs(remotehost,helohost.s) ? helohost.s : 0;
    2368723760 }
     
    2378623859 void setup()
    2378723860 {
    23788 @@ -109,21 +358,110 @@
     23861@@ -109,21 +360,110 @@
    2378923862   if (liphostok == -1) die_control();
    2379023863   if (control_readint(&timeout,"control/timeoutsmtpd") == -1) die_control();
     
    2389823971   if (!local) local = env_get("TCPLOCALIP");
    2389923972   if (!local) local = "unknown";
    23900 @@ -131,10 +469,67 @@
     23973@@ -131,10 +471,67 @@
    2390123974   if (!remotehost) remotehost = "unknown";
    2390223975   remoteinfo = env_get("TCPREMOTEINFO");
     
    2396724040 
    2396824041 int addrparse(arg)
    23969 @@ -155,6 +550,7 @@
     24042@@ -155,6 +552,7 @@
    2397024043     terminator = ' ';
    2397124044     arg += str_chr(arg,':');
     
    2397524048   }
    2397624049 
    23977 @@ -197,6 +593,8 @@
     24050@@ -197,6 +595,8 @@
    2397824051   return 1;
    2397924052 }
     
    2398424057 {
    2398524058   int j;
    23986 @@ -207,68 +605,1102 @@
     24059@@ -207,76 +607,1108 @@
    2398724060     if (constmap(&mapbmf,addr.s + j,addr.len - j - 1)) return 1;
    2398824061   return 0;
     
    2445924532+}
    2446024533+
    24461 +void logit(message) const char* message;
     24534+/* logging patch */
     24535+
     24536+void safeloglen(const char* string, const int len) {
     24537+    if (string && len) {
     24538+        if (!stralloc_catb(&log_buf, string, len-1)) die_nomem();
     24539+    } else {
     24540+        if (!stralloc_catb(&log_buf, "(null)", 6)) die_nomem();
     24541+    }
     24542+}
     24543+
     24544+void safelog(const char* string) {
     24545+    if (string) {
     24546+        if (!stralloc_cats(&log_buf, string)) die_nomem();
     24547+    } else {
     24548+        if (!stralloc_catb(&log_buf, "(null)", 6)) die_nomem();
     24549+    }
     24550+}
     24551+
     24552+void logit(const char* message) {
     24553+    logit2(message, (const char*)0);
     24554+}
     24555+
     24556+void logit2(const char* message, const char* reason)
    2446224557+{
    2446324558+  if (!stralloc_copys(&log_buf, "qmail-smtpd: ")) die_nomem();
    24464 +  if (!stralloc_cats(&log_buf, message)) die_nomem();
     24559+  safelog(message);
     24560+  if (reason) {
     24561+      if (!stralloc_cats(&log_buf, " (")) die_nomem();
     24562+      if (!stralloc_cats(&log_buf, reason)) die_nomem();
     24563+      if (!stralloc_cats(&log_buf, ")")) die_nomem();
     24564+  }
    2446524565+  if (!stralloc_catb(&log_buf, ": ", 2)) die_nomem();
    24466 +  if (mailfrom.s) {
    24467 +      if (!stralloc_catb(&log_buf, mailfrom.s, mailfrom.len-1)) die_nomem();
    24468 +  } else
    24469 +      if (!stralloc_catb(&log_buf, "(null)", 6)) die_nomem();
     24566+  safeloglen(mailfrom.s, mailfrom.len);
    2447024567+  if (!stralloc_catb(&log_buf, " from ", 6)) die_nomem();
    24471 if (!stralloc_cats(&log_buf, remoteip)) die_nomem();
     24568safelog(remoteip);
    2447224569+  if (!stralloc_catb(&log_buf, " to ", 4)) die_nomem();
    24473 +  if (addr.s) {
    24474 +      if (!stralloc_catb(&log_buf, addr.s, addr.len-1)) die_nomem();
    24475 +  } else
    24476 +      if (!stralloc_catb(&log_buf, "(null)", 6)) die_nomem();
     24570+  safeloglen(addr.s, addr.len);
    2447724571+  if (!stralloc_catb(&log_buf, " helo ", 6)) die_nomem();
    24478 +  if (helohost.s) {
    24479 +      if (!stralloc_catb(&log_buf, helohost.s, helohost.len-1)) die_nomem();
    24480 +  } else
    24481 +      if (!stralloc_catb(&log_buf, "(null)", 6)) die_nomem();
     24572+  safeloglen(helohost.s, helohost.len);
    2448224573+  if (!stralloc_catb(&log_buf, "\n", 1)) die_nomem();
    2448324574+  substdio_putflush(&sserr, log_buf);
    2448424575+}
    2448524576+
    24486 +void logit2(message, reason)
    24487 +const char* message;
    24488 +const char* reason;
    24489 +{
    24490 +  if (!stralloc_copys(&log_buf,"qmail-smtpd: ")) die_nomem();
    24491 +  if (!stralloc_cats(&log_buf, message)) die_nomem();
    24492 +  if (!stralloc_cats(&log_buf, " (")) die_nomem();
    24493 +  if (!stralloc_cats(&log_buf, reason)) die_nomem();
    24494 +  if (!stralloc_cats(&log_buf, "): ")) die_nomem();
    24495 +  if (mailfrom.s) {
    24496 +      if (!stralloc_catb(&log_buf, mailfrom.s, mailfrom.len-1)) die_nomem();
    24497 +  } else
    24498 +      if (!stralloc_catb(&log_buf, "(null)", 6)) die_nomem();
    24499 +  if (!stralloc_cats(&log_buf," from ")) die_nomem();
    24500 +  if (!stralloc_cats(&log_buf, remoteip)) die_nomem();
    24501 +  if (!stralloc_cats(&log_buf, " to ")) die_nomem();
    24502 +  if (addr.s) {
    24503 +      if (!stralloc_catb(&log_buf, addr.s, addr.len-1)) die_nomem();
    24504 +  } else
    24505 +      if (!stralloc_catb(&log_buf, "(null)", 6)) die_nomem();
    24506 +  if (!stralloc_cats(&log_buf, " helo ")) die_nomem();
    24507 +  if (helohost.s) {
    24508 +      if (!stralloc_catb(&log_buf, helohost.s, helohost.len-1)) die_nomem();
    24509 +  } else
    24510 +      if (!stralloc_catb(&log_buf, "(null)", 6)) die_nomem();
    24511 +  if (!stralloc_catb(&log_buf, "\n", 1)) die_nomem();
    24512 +  substdio_putflush(&sserr, log_buf);
    24513 +}
     24577+/* end logging patch */
    2451424578+
    2451524579+int mailfrom_size(arg) char *arg;
     
    2454324607+  if (!remoteinfo) {
    2454424608+    remoteinfo = fuser.s;
    24545 +    if (!env_unset("TCPREMOTEINFO")) die_read();
     24609+    if (!env_unset("TCPREMOTEINFO")) die_read("TCPREMOTEINFO");
    2454624610+    if (!env_put2("TCPREMOTEINFO",remoteinfo)) die_nomem();
    2454724611+  }
     
    2457724641+  if (bhelook) flagbarfbhelo = bmcheck(BMCHECK_BHELO);
    2457824642+  if ((!flagbarfbhelo) && (bhelonrok) && (!relayclient)) flagbarfbhelo = bmcheck(BMCHECK_BHELONR);
    24579 +}
     24643 }
    2458024644+char size_buf[FMT_ULONG];
    2458124645+void smtp_size()
     
    2458324647+  size_buf[fmt_ulong(size_buf,(unsigned long) databytes)] = 0;
    2458424648+  out("250 SIZE "); out(size_buf); out("\r\n");
    24585  }
     24649+}
    2458624650+
    2458724651+/* ESMTP extensions are published here */
     
    2462024684+  seenmail = 0; /* seenauth = 0; RFC 5321: retain authentication */
    2462124685+  mailfrom.len = 0; rcptto.len = 0;
     24686+  /* prevents the maxrcpto error if control/maxrcpt limit has been exceeded in the same email, but not in multiple messages sequentially */
     24687+  rcptcount = 0;
     24688+  envelopepos = 1;
     24689+  /* end rcptcount adjustment */
    2462224690   out("250 flushed\r\n");
    2462324691 }
     
    2466924737+/* qregex: start */
    2467024738+  /*
    24671 +  flagbarf = bmfcheck();
     24739   flagbarf = bmfcheck();
    2467224740+  */
    2467324741+  flagbarfbmf = 0; /* bmcheck is skipped for empty envelope senders */
     
    2468324751+/* qregex: start */
    2468424752+  /*
    24685    flagbarf = bmfcheck();
     24753+  flagbarf = bmfcheck();
    2468624754+  */
    2468724755+  flagbarfbmf = 0; /* bmcheck is skipped for empty envelope senders */
     
    2509125159   r = timeoutread(timeout,fd,buf,len);
    2509225160   if (r == -1) if (errno == error_timeout) die_alarm();
    25093    if (r <= 0) die_read();
    25094 @@ -277,6 +1709,9 @@
     25161-  if (r <= 0) die_read();
     25162+  if (r <= 0) die_read("hang up before quit cmd");
     25163   return r;
     25164 }
    2509525165 
    2509625166 char ssinbuf[1024];
     
    2510225172 struct qmail qqt;
    2510325173 unsigned int bytestooverflow = 0;
    25104 @@ -300,7 +1735,7 @@
     25174@@ -300,7 +1732,7 @@
    2510525175   int flagmaybex; /* 1 if this line might match RECEIVED, if fih */
    2510625176   int flagmaybey; /* 1 if this line might match \r\n, if fih */
     
    2511125181   *hops = 0;
    2511225182   flaginheader = 1;
    25113 @@ -322,17 +1757,16 @@
     25183@@ -322,17 +1754,16 @@
    2511425184     }
    2511525185     switch(state) {
     
    2513225202         state = 0;
    2513325203         break;
    25134 @@ -351,10 +1785,73 @@
     25204@@ -351,10 +1782,73 @@
    2513525205   }
    2513625206 }
     
    2520625276   out("250 ok ");
    2520725277   accept_buf[fmt_ulong(accept_buf,(unsigned long) when)] = 0;
    25208 @@ -363,22 +1860,32 @@
     25278@@ -363,22 +1857,32 @@
    2520925279   accept_buf[fmt_ulong(accept_buf,qp)] = 0;
    2521025280   out(accept_buf);
     
    2524125311   hops = (hops >= MAXHOPS);
    2524225312   if (hops) qmail_fail(&qqt);
    25243 @@ -386,34 +1893,631 @@
     25313@@ -386,36 +1890,662 @@
    2524425314   qmail_put(&qqt,rcptto.s,rcptto.len);
    2524525315 
     
    2528225352+    if (!stralloc_readyplus(&authin,1)) die_nomem(); /* XXX */
    2528325353+    i = substdio_get(&ssin,authin.s + authin.len,1);
    25284 +    if (i != 1) die_read();
     25354+    if (i != 1) die_read("authgetl");
    2528525355+    if (authin.s[authin.len] == '\n') break;
    2528625356+    ++authin.len;
     
    2546125531+      relayclient = "";
    2546225532+      remoteinfo = user.s;
    25463 +      if (!env_unset("TCPREMOTEINFO")) die_read();
     25533+      if (!env_unset("TCPREMOTEINFO")) die_read("TCPREMOTEINFO");
    2546425534+      if (!env_put2("TCPREMOTEINFO",remoteinfo)) die_nomem();
    2546525535+      if (!env_put2("RELAYCLIENT",relayclient)) die_nomem();
    2546625536+
    25467 +      if (!env_unset("SMTPAUTHMETHOD")) die_read();
     25537+      if (!env_unset("SMTPAUTHMETHOD")) die_read("SMTPAUTHMETHOD");
    2546825538+      if (!env_put2("SMTPAUTHMETHOD", authcmds[i].text)) die_nomem();
    25469 +      if (!env_unset("SMTPAUTHUSER")) die_read();
     25539+      if (!env_unset("SMTPAUTHUSER")) die_read("SMTPAUTHUSER");
    2547025540+      if (!env_put2("SMTPAUTHUSER",user.s)) die_nomem();
    25471 +      if (!env_unset("SMTP_AUTH_USER")) die_read();
     25541+      if (!env_unset("SMTP_AUTH_USER")) die_read("SMTP_AUTH_USER");
    2547225542+      if (!env_put2("SMTP_AUTH_USER",user.s)) die_nomem();
    2547325543+
     
    2549525565+RSA *tmp_rsa_cb(SSL *ssl, int export, int keylen)
    2549625566+{
     25567+  RSA *rsa;
     25568+
    2549725569+  if (!export) keylen = 2048;
    2549825570+  if (keylen == 2048) {
    2549925571+    FILE *in = fopen("control/rsa2048.pem", "r");
    2550025572+    if (in) {
    25501 +      RSA *rsa = PEM_read_RSAPrivateKey(in, NULL, NULL, NULL);
     25573+      rsa = PEM_read_RSAPrivateKey(in, NULL, NULL, NULL);
    2550225574+      fclose(in);
    2550325575+      if (rsa) return rsa;
    2550425576+    }
    2550525577+  }
     25578+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
     25579+  BIGNUM *e; /*exponent */
     25580+  e = BN_new();
     25581+  BN_set_word(e, RSA_F4);
     25582+  if (RSA_generate_key_ex(rsa, keylen, e, NULL) == 1)
     25583+    return rsa;
     25584+  return NULL;
     25585+#else
    2550625586+  return RSA_generate_key(keylen, RSA_F4, NULL, NULL);
     25587+#endif
    2550725588+}
    2550825589+
    2550925590+DH *tmp_dh_cb(SSL *ssl, int export, int keylen)
    2551025591+{
     25592+  DH *dh;
     25593+
    2551125594+  if (!export) keylen = 2048;
    2551225595+  if (keylen == 2048) {
    2551325596+    FILE *in = fopen("control/dh2048.pem", "r");
    2551425597+    if (in) {
    25515 +      DH *dh = PEM_read_DHparams(in, NULL, NULL, NULL);
     25598+      dh = PEM_read_DHparams(in, NULL, NULL, NULL);
    2551625599+      fclose(in);
    2551725600+      if (dh) return dh;
     
    2552625609+    }
    2552725610+  }
     25611+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
     25612+  if((dh = DH_new()) && (DH_generate_parameters_ex(dh, keylen, DH_GENERATOR_2, NULL) == 1))
     25613+    return dh;
     25614+  return NULL;
     25615+#else
    2552825616+  return DH_generate_parameters(keylen, DH_GENERATOR_2, NULL, NULL);
    25529 +}
     25617+#endif
     25618+}
    2553025619+
    2553125620+/* don't want to fail handshake if cert isn't verifiable */
    25532 +int verify_cb(int preverify_ok, X509_STORE_CTX *ctx) { return 1; }
     25621+int verify_cb(int preverify_ok, X509_STORE_CTX *x509_ctx) { return 1; }
    2553325622+
    2553425623+void tls_nogateway()
     
    2554525634+  out(" (#4.3.0)\r\n"); flush();
    2554625635+}
    25547 +void tls_err(const char *s) { tls_out(s, ssl_error()); if (smtps) die_read(); }
     25636+void tls_err(const char *s) { tls_out(s, ssl_error()); if (smtps) die_read("tls_err"); }
    2554825637+
    2554925638+# define CLIENTCA "control/clientca.pem"
     
    2557225661+      if (sk) {
    2557325662+        SSL_set_client_CA_list(ssl, sk);
    25574 +        SSL_set_verify(ssl, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, NULL);
     25663+        SSL_set_verify(ssl, SSL_VERIFY_PEER, verify_cb);
    2557525664+        break;
    2557625665+      }
     
    2558325672+  if (ssl_timeoutrehandshake(timeout, ssl_rfd, ssl_wfd, ssl) <= 0) {
    2558425673+    const char *err = ssl_error_str();
    25585 +    tls_out("rehandshake failed", err); die_read();
     25674+    tls_out("rehandshake failed", err); die_read("rehandshake failed");
    2558625675+  }
    2558725676+
     
    2560025689+    n = X509_NAME_get_index_by_NID(subj, NID_pkcs9_emailAddress, -1);
    2560125690+    if (n >= 0) {
    25602 +      const ASN1_STRING *s = X509_NAME_get_entry(subj, n)->value;
     25691+      const ASN1_STRING *s = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subj, n));
    2560325692+      if (s) { email.len = s->length; email.s = s->data; }
    2560425693+    }
     
    2564025729+  X509_STORE *store;
    2564125730+  X509_LOOKUP *lookup;
     25731+  int session_id_context = 1; /* anything will do */
    2564225732+
    2564325733+  SSL_library_init();
     
    2565025740+  SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
    2565125741+
     25742+  /* renegotiation should include certificate request */
     25743+  SSL_CTX_set_options(ctx, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
     25744+
     25745+  /* never bother the application with retries if the transport is blocking */
     25746+  SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY);
     25747+
     25748+  /* relevant in renegotiation */
     25749+  SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF);
     25750+  if (!SSL_CTX_set_session_id_context(ctx, (void *)&session_id_context,
     25751+                                        sizeof(session_id_context)))
     25752+    { SSL_CTX_free(ctx); tls_err("failed to set session_id_context"); return; }
     25753+
    2565225754+  if (!SSL_CTX_use_certificate_chain_file(ctx, SERVERCERT))
    2565325755+    { SSL_CTX_free(ctx); tls_err("missing certificate"); return; }
    2565425756+  SSL_CTX_load_verify_locations(ctx, CLIENTCA, NULL);
    2565525757+
    25656 +#if OPENSSL_VERSION_NUMBER >= 0x00907000L
    2565725758+  /* crl checking */
    2565825759+  store = SSL_CTX_get_cert_store(ctx);
     
    2566125762+    X509_STORE_set_flags(store, X509_V_FLAG_CRL_CHECK |
    2566225763+                                X509_V_FLAG_CRL_CHECK_ALL);
    25663 +#endif
    2566425764+
    2566525765+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
     
    2566825768+#endif
    2566925769+
    25670 +  /* set the callback here; SSL_set_verify didn't work before 0.9.6c */
    25671 +  SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, verify_cb);
     25770+  SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
    2567225771+
    2567325772+  /* a new SSL object, with the rest added to it directly to avoid copying */
     
    2570525804+    /* neither cleartext nor any other response here is part of a standard */
    2570625805+    const char *err = ssl_error_str();
    25707 +    ssl_free(myssl); tls_out("connection failed", err); die_read();
     25806+    tls_out("connection failed", err); ssl_free(myssl); die_read("tls connection failed");
    2570825807+  }
    2570925808+  ssl = myssl;
     
    2587825977   smtp_greet("220 ");
    2587925978   out(" ESMTP\r\n");
    25880    if (commands(&ssin,&smtpcommands) == 0) die_read();
     25979-  if (commands(&ssin,&smtpcommands) == 0) die_read();
     25980+  if (commands(&ssin,&smtpcommands) == 0) die_read("commands");
     25981   die_nomem();
     25982 }
    2588125983diff -ruN ../netqmail-1.06-original/qmail-start.c netqmail-1.06/qmail-start.c
    2588225984--- ../netqmail-1.06-original/qmail-start.c     1998-06-15 12:53:16.000000000 +0200
    25883 +++ netqmail-1.06/qmail-start.c 2016-11-22 21:03:57.125527665 +0100
    25884 @@ -8,6 +8,9 @@
     25985+++ netqmail-1.06/qmail-start.c 2019-06-26 16:39:31.578826915 +0200
     25986@@ -4,10 +4,15 @@
     25987 #include "fork.h"
     25988 #include "auto_uids.h"
     25989 
     25990+#include "channels.h"
     25991+
     25992 char *(qsargs[]) = { "qmail-send", 0 };
    2588525993 char *(qcargs[]) = { "qmail-clean", 0 };
    2588625994 char *(qlargs[]) = { "qmail-lspawn", "./Mailbox", 0 };
     
    2589226000 void die() { _exit(111); }
    2589326001 
    25894 @@ -18,13 +21,28 @@
     26002@@ -18,19 +23,51 @@
    2589526003 int pi4[2];
    2589626004 int pi5[2];
     
    2590526013+#endif
    2590626014+
     26015+int suppl_pi[SUPPL_CHANNELS*2][2];
     26016+
    2590726017+void close23456() {
     26018+  int c;
    2590826019+  close(2); close(3); close(4); close(5); close(6);
    2590926020+#ifdef EXTERNAL_TODO
    2591026021+  close(7); close(8);
    2591126022+#endif
     26023+  for (c=1+CHANNEL_FD_OFFSET;c<=SUPPL_CHANNELS*2+CHANNEL_FD_OFFSET;c++)
     26024+  {
     26025+      close(c);
     26026+  }
    2591226027+}
    2591326028 
    2591426029 void closepipes() {
     26030+  int c;
     26031+
    2591526032   close(pi1[0]); close(pi1[1]); close(pi2[0]); close(pi2[1]);
    2591626033   close(pi3[0]); close(pi3[1]); close(pi4[0]); close(pi4[1]);
     
    2592026037+       close(pi9[0]); close(pi9[1]); close(pi10[0]); close(pi10[1]);
    2592126038+#endif
     26039+
     26040+  for (c=0;c<SUPPL_CHANNELS*2;c++)
     26041+  {
     26042+      close(suppl_pi[c][0]);
     26043+      close(suppl_pi[c][1]);
     26044+  }
    2592226045 }
    2592326046 
    2592426047 void main(argc,argv)
    25925 @@ -40,6 +58,10 @@
     26048 int argc;
     26049 char **argv;
     26050 {
     26051+  int c, cc;
     26052+
     26053   if (chdir("/") == -1) die();
     26054   umask(077);
     26055   if (prot_gid(auto_gidq) == -1) die();
     26056@@ -40,6 +77,14 @@
    2592626057   if (fd_copy(4,0) == -1) die();
    2592726058   if (fd_copy(5,0) == -1) die();
     
    2593126062+  if (fd_copy(8,0) == -1) die();
    2593226063+#endif
     26064+  for (c=1+CHANNEL_FD_OFFSET;c<=SUPPL_CHANNELS*2+CHANNEL_FD_OFFSET;c++)
     26065+  {
     26066+      if (fd_copy(c,0) == -1) die();
     26067+  }
    2593326068 
    2593426069   if (argv[1]) {
    2593526070     qlargs[1] = argv[1];
    25936 @@ -70,6 +92,12 @@
     26071@@ -70,6 +115,16 @@
    2593726072   if (pipe(pi4) == -1) die();
    2593826073   if (pipe(pi5) == -1) die();
     
    2594426079+  if (pipe(pi10) == -1) die();
    2594526080+#endif
     26081+  for (c=0;c<SUPPL_CHANNELS*2;c++)
     26082+  {
     26083+      if (pipe(suppl_pi[c]) == -1) die();
     26084+  }
    2594626085 
    2594726086   switch(fork()) {
    2594826087     case -1: die();
    25949 @@ -106,6 +134,34 @@
     26088@@ -106,6 +161,57 @@
    2595026089       die();
    2595126090   }
     
    2597826117+  }
    2597926118+#endif
    25980 +
     26119+
     26120+  for (c=0,cc=0;c<SUPPL_CHANNELS;++c,cc+=2)
     26121+  {
     26122+      switch(fork()) {
     26123+        case -1: die();
     26124+        case 0:
     26125+          if (prot_uid(auto_uidr) == -1) die();
     26126+          /* Does not increment cc in parent process */
     26127+          if (fd_copy(0,suppl_pi[cc++][0]) == -1) die();
     26128+          if (fd_copy(1,suppl_pi[cc][1]) == -1) die();
     26129+          close23456();
     26130+          closepipes();
     26131+          /*if (str_equal(channel_types[c],"remote"))
     26132+          {*/
     26133+              execvp(*qrargs,qrargs);
     26134+          /*}
     26135+           else
     26136+          {
     26137+             execvp(*qlargs,qlargs);
     26138+          }*/
     26139+          die();
     26140+      }
     26141+  }
     26142+
    2598126143   if (prot_uid(auto_uids) == -1) die();
    2598226144   if (fd_copy(0,1) == -1) die();
    2598326145   if (fd_copy(1,pi1[1]) == -1) die();
    25984 @@ -114,6 +170,10 @@
     26146@@ -114,6 +220,17 @@
    2598526147   if (fd_copy(4,pi4[0]) == -1) die();
    2598626148   if (fd_copy(5,pi5[1]) == -1) die();
     
    2599026152+  if (fd_copy(8,pi8[0]) == -1) die();
    2599126153+#endif
     26154+
     26155+  for (cc=0,c=1+CHANNEL_FD_OFFSET;c<=SUPPL_CHANNELS*2+CHANNEL_FD_OFFSET;c++)
     26156+  {
     26157+      if (fd_copy(c++,suppl_pi[cc++][1]) == -1) die();
     26158+      if (fd_copy(c,suppl_pi[cc++][0]) == -1) die();
     26159+  }
     26160+
    2599226161   closepipes();
    2599326162   execvp(*qsargs,qsargs);
     
    2599526164diff -ruN ../netqmail-1.06-original/qmail-todo.c netqmail-1.06/qmail-todo.c
    2599626165--- ../netqmail-1.06-original/qmail-todo.c      1970-01-01 01:00:00.000000000 +0100
    25997 +++ netqmail-1.06/qmail-todo.c  2016-11-22 21:03:57.126527632 +0100
    25998 @@ -0,0 +1,703 @@
     26166+++ netqmail-1.06/qmail-todo.c  2019-06-26 16:39:31.579826904 +0200
     26167@@ -0,0 +1,791 @@
    2599926168+#include <sys/types.h>
    2600026169+#include <sys/stat.h>
     
    2602226191+#include "trigger.h"
    2602326192+
     26193+#include "channels.h"
     26194+
    2602426195+/* critical timing feature #1: if not triggered, do not busy-loop */
    2602526196+/* critical timing feature #2: if triggered, respond within fixed time */
     
    2603026201+#define SLEEP_SYSFAIL 123
    2603126202+
     26203+
    2603226204+stralloc percenthack = {0};
    2603326205+struct constmap mappercenthack;
     
    2603726209+struct constmap mapvdoms;
    2603826210+stralloc envnoathost = {0};
     26211+stralloc fname = {0};
    2603926212+
    2604026213+char strnum[FMT_ULONG];
    2604126214+
    26042 +/* XXX not good, if qmail-send.c changes this has to be updated */
    26043 +#define CHANNELS 2
    26044 +char *chanaddr[CHANNELS] = { "local/", "remote/" };
     26215+struct constmap mapsuppl[SUPPL_CHANNELS];
     26216+stralloc suppls[SUPPL_CHANNELS];
     26217+stralloc newsuppls[SUPPL_CHANNELS];
     26218+char *chanaddr[CHANNELS];
    2604526219+
    2604626220+datetime_sec recent;
     
    2609726271+  int i;
    2609826272+  int j;
     26273+  int c;
    2609926274+  char *x;
    2610026275+  static stralloc addr = {0};
     
    2613926314+  if (!stralloc_cat(&rwline,&addr)) return 0;
    2614026315+  if (!stralloc_0(&rwline)) return 0;
     26316+
     26317+  for (c = 0;c < SUPPL_CHANNELS;++c)
     26318+  {
     26319+      if (constmap(&mapsuppl[c],addr.s + at + 1,addr.len - at - 1))
     26320+          return c + 3;
     26321+  }
     26322+
    2614126323+  return 2;
    2614226324+}
     
    2620626388+}
    2620726389+
    26208 +void comm_write(unsigned long id, int local, int remote)
     26390+void comm_write(unsigned long id, int flagchan[])
    2620926391+{
    2621026392+  int pos;
    26211 +  char *s;
     26393+  char s[CHANNELS+1];
     26394+  int c;
    2621226395
    26213 +  if(local && remote) s="B";
    26214 +  else if(local) s="L";
    26215 +  else if(remote) s="R";
    26216 +  else s="X";
     26396+  for (c = 0;c < CHANNELS;++c)
     26397+  {
     26398+      if (flagchan[c])
     26399+      {
     26400+          s[c] = '1';
     26401+      }
     26402+      else
     26403+      {
     26404+          s[c] = '0';
     26405+      }
     26406+  }
     26407+  s[c] = 0;
    2621726408
    2621826409+  pos = comm_buf.len;
     
    2649626687+       break;
    2649726688+     case 'T':
    26498 +       switch(rewrite(todoline.s + 1))
    26499 +       {
    26500 +        case 0: nomem(); goto fail;
    26501 +        case 2: c = 1; break;
    26502 +        default: c = 0; break;
    26503 +        }
     26689+       c = rewrite(todoline.s + 1);
     26690+       if (c == 0) { nomem(); goto fail; }
     26691+       c--;
    2650426692+       if (fdchan[c] == -1)
    2650526693+       {
     
    2655326741+  }
    2655426742+
    26555 + comm_write(id, flagchan[0], flagchan[1]);
     26743+ comm_write(id, flagchan);
    2655626744+
    2655726745+ return;
     
    2656826756+int getcontrols(void)
    2656926757+{
     26758+ int c;
     26759+
    2657026760+ if (control_init() == -1) return 0;
    2657126761+ if (control_rldef(&envnoathost,"control/envnoathost",1,"envnoathost") != 1) return 0;
     
    2658426774+   case 1: if (!constmap_init(&mapvdoms,vdoms.s,vdoms.len,1)) return 0; break;
    2658526775+  }
     26776+
     26777+ for (c = 0;c < SUPPL_CHANNELS;++c)
     26778+ {
     26779+     strnum[fmt_uint(strnum,c)] = 0;
     26780+     if (!stralloc_copys(&fname,"control/suppls")) return 0;
     26781+     if (!stralloc_cats(&fname,strnum)) return 0;
     26782+     if (!stralloc_0(&fname)) return 0;
     26783+     switch (control_readfile(&suppls[c],fname.s,0))
     26784+     {
     26785+         case -1: return 0;
     26786+         case 0: if (!constmap_init(&mapsuppl[c],"",0,0)) return 0; break;
     26787+         case 1: if (!constmap_init(&mapsuppl[c],suppls[c].s,suppls[c].len,0)) return 0; break;
     26788+     }
     26789+ }
     26790+
    2658626791+ return 1;
    2658726792+}
     
    2659326798+{
    2659426799+ int r;
     26800+ int c;
    2659526801+
    2659626802+ if (control_readfile(&newlocals,"control/locals",1) != 1)
     
    2661326819+ else
    2661426820+   while (!constmap_init(&mapvdoms,"",0,1)) nomem();
     26821+
     26822+ for (c = 0;c < SUPPL_CHANNELS;++c)
     26823+ {
     26824+     strnum[fmt_uint(strnum,c)] = 0;
     26825+     if (!stralloc_copys(&fname,"control/suppls")) nomem();
     26826+     if (!stralloc_cats(&fname,strnum)) nomem();
     26827+     if (!stralloc_0(&fname)) nomem();
     26828+     r = control_readfile(&newsuppls[c],fname.s,0);
     26829+     if (r == -1)
     26830+      { log3("alert: qmail-todo: unable to reread ", fname.s, "\n"); return; }
     26831+
     26832+     constmap_free(&mapsuppl[c]);
     26833+
     26834+     if (r)
     26835+      {
     26836+       while (!stralloc_copy(&suppls[c],&newsuppls[c])) nomem();
     26837+       while (!constmap_init(&mapsuppl[c],suppls[c].s,suppls[c].len,0)) nomem();
     26838+      }
     26839+     else
     26840+       while (!constmap_init(&mapsuppl[c],"",0,0)) nomem();
     26841+ }
     26842+
    2661526843+}
    2661626844+
     
    2663026858+}
    2663126859+
     26860+static int static_i = 0;
     26861+static int static_j = 0;
     26862+void channels_init(void)
     26863+{
     26864+    for (static_i=0;static_i<SUPPL_CHANNELS;static_i++)
     26865+        suppls[static_i].s = 0;
     26866+
     26867+    for (static_i=0;static_i<SUPPL_CHANNELS;static_i++)
     26868+        newsuppls[static_i].s = 0;
     26869+
     26870+    chanaddr[0] = "local/";
     26871+    chanaddr[1] = "remote/";
     26872+    static_j = 0;
     26873+    for (static_i=2;static_i<CHANNELS;static_i++)
     26874+    {
     26875+        stralloc fnc = {0};
     26876+        strnum[fmt_uint(strnum,static_j++)] = 0;
     26877+        if (!stralloc_copys(&fname,QDIR_BASENAME)) nomem();
     26878+        if (!stralloc_cats(&fname,strnum)) nomem();
     26879+        if (!stralloc_cats(&fname,"/")) nomem();
     26880+        if (!stralloc_0(&fname)) nomem();
     26881+        if (!stralloc_copy(&fnc,&fname)) nomem();
     26882+        chanaddr[static_i] = fnc.s;
     26883+    }
     26884+}
     26885+
     26886+
    2663226887+void main()
    2663326888+{
     
    2663926894+ int r;
    2664026895+ char c;
     26896+
     26897+ channels_init();
    2664126898+
    2664226899+ if (chdir(auto_qmail) == -1)
     
    2670026957+}
    2670126958+
     26959diff -ruN ../netqmail-1.06-original/qmail-upq.sh netqmail-1.06/qmail-upq.sh
     26960--- ../netqmail-1.06-original/qmail-upq.sh      1998-06-15 12:53:16.000000000 +0200
     26961+++ netqmail-1.06/qmail-upq.sh  2019-06-26 16:39:31.579826904 +0200
     26962@@ -1,6 +1,6 @@
     26963 cd QMAIL
     26964 cd queue
     26965-for dir in mess info local remote
     26966+for dir in mess info local remote suppl*
     26967 do
     26968   ( cd $dir; find . -type f -print ) | (
     26969     cd $dir
    2670226970diff -ruN ../netqmail-1.06-original/qmail.c netqmail-1.06/qmail.c
    2670326971--- ../netqmail-1.06-original/qmail.c   2007-11-30 21:22:54.000000000 +0100
    26704 +++ netqmail-1.06/qmail.c       2016-11-22 21:03:57.126527632 +0100
     26972+++ netqmail-1.06/qmail.c       2019-02-27 20:57:13.404024915 +0100
    2670526973@@ -23,22 +23,32 @@
    2670626974 {
     
    2680027068diff -ruN ../netqmail-1.06-original/qmail.h netqmail-1.06/qmail.h
    2680127069--- ../netqmail-1.06-original/qmail.h   1998-06-15 12:53:16.000000000 +0200
    26802 +++ netqmail-1.06/qmail.h       2016-11-22 21:03:57.126527632 +0100
     27070+++ netqmail-1.06/qmail.h       2019-02-27 20:57:13.404024915 +0100
    2680327071@@ -3,11 +3,13 @@
    2680427072 
     
    2681727085diff -ruN ../netqmail-1.06-original/qregex.c netqmail-1.06/qregex.c
    2681827086--- ../netqmail-1.06-original/qregex.c  1970-01-01 01:00:00.000000000 +0100
    26819 +++ netqmail-1.06/qregex.c      2016-11-22 21:03:57.126527632 +0100
     27087+++ netqmail-1.06/qregex.c      2019-02-27 20:57:13.405024904 +0100
    2682027088@@ -0,0 +1,239 @@
    2682127089+/*
     
    2706027328diff -ruN ../netqmail-1.06-original/qregex.h netqmail-1.06/qregex.h
    2706127329--- ../netqmail-1.06-original/qregex.h  1970-01-01 01:00:00.000000000 +0100
    27062 +++ netqmail-1.06/qregex.h      2016-11-22 21:03:57.126527632 +0100
     27330+++ netqmail-1.06/qregex.h      2019-02-27 20:57:13.405024904 +0100
    2706327331@@ -0,0 +1,24 @@
    2706427332+/*
     
    2708827356diff -ruN ../netqmail-1.06-original/readwrite.h netqmail-1.06/readwrite.h
    2708927357--- ../netqmail-1.06-original/readwrite.h       1998-06-15 12:53:16.000000000 +0200
    27090 +++ netqmail-1.06/readwrite.h   2016-11-22 21:03:57.126527632 +0100
     27358+++ netqmail-1.06/readwrite.h   2019-02-27 20:57:13.405024904 +0100
    2709127359@@ -1,7 +1,6 @@
    2709227360 #ifndef READWRITE_H
     
    2710027368diff -ruN ../netqmail-1.06-original/received.c netqmail-1.06/received.c
    2710127369--- ../netqmail-1.06-original/received.c        1998-06-15 12:53:16.000000000 +0200
    27102 +++ netqmail-1.06/received.c    2016-11-22 21:03:57.127527599 +0100
     27370+++ netqmail-1.06/received.c    2019-02-27 20:57:13.405024904 +0100
    2710327371@@ -21,6 +21,9 @@
    2710427372   return 0;
     
    2712827396diff -ruN ../netqmail-1.06-original/remoteinfo.c netqmail-1.06/remoteinfo.c
    2712927397--- ../netqmail-1.06-original/remoteinfo.c      1998-06-15 12:53:16.000000000 +0200
    27130 +++ netqmail-1.06/remoteinfo.c  2016-11-22 21:03:57.127527599 +0100
     27398+++ netqmail-1.06/remoteinfo.c  2019-02-27 20:57:13.405024904 +0100
    2713127399@@ -44,12 +44,12 @@
    2713227400   s = socket(AF_INET,SOCK_STREAM,0);
     
    2714727415diff -ruN ../netqmail-1.06-original/scan.h netqmail-1.06/scan.h
    2714827416--- ../netqmail-1.06-original/scan.h    1998-06-15 12:53:16.000000000 +0200
    27149 +++ netqmail-1.06/scan.h        2018-03-31 14:54:40.767441567 +0200
     27417+++ netqmail-1.06/scan.h        2019-02-27 20:57:13.405024904 +0100
    2715027418@@ -2,6 +2,7 @@
    2715127419 #define SCAN_H
     
    2715827426diff -ruN ../netqmail-1.06-original/scan_ulong.c netqmail-1.06/scan_ulong.c
    2715927427--- ../netqmail-1.06-original/scan_ulong.c      1998-06-15 12:53:16.000000000 +0200
    27160 +++ netqmail-1.06/scan_ulong.c  2016-11-22 21:03:57.127527599 +0100
     27428+++ netqmail-1.06/scan_ulong.c  2019-02-27 20:57:13.405024904 +0100
    2716127429@@ -9,3 +9,43 @@
    2716227430     { result = result * 10 + c; ++pos; }
     
    2720527473diff -ruN ../netqmail-1.06-original/scan_xlong.c netqmail-1.06/scan_xlong.c
    2720627474--- ../netqmail-1.06-original/scan_xlong.c      1970-01-01 01:00:00.000000000 +0100
    27207 +++ netqmail-1.06/scan_xlong.c  2016-11-22 21:03:57.127527599 +0100
     27475+++ netqmail-1.06/scan_xlong.c  2019-02-27 20:57:13.405024904 +0100
    2720827476@@ -0,0 +1,47 @@
    2720927477+/*
     
    2725627524diff -ruN ../netqmail-1.06-original/select.h2 netqmail-1.06/select.h2
    2725727525--- ../netqmail-1.06-original/select.h2 1998-06-15 12:53:16.000000000 +0200
    27258 +++ netqmail-1.06/select.h2     2016-11-22 21:03:57.127527599 +0100
     27526+++ netqmail-1.06/select.h2     2019-02-27 20:57:13.405024904 +0100
    2725927527@@ -1,6 +1,12 @@
    2726027528 #ifndef SELECT_H
     
    2727227540diff -ruN ../netqmail-1.06-original/socket_v4mappedprefix.c netqmail-1.06/socket_v4mappedprefix.c
    2727327541--- ../netqmail-1.06-original/socket_v4mappedprefix.c   1970-01-01 01:00:00.000000000 +0100
    27274 +++ netqmail-1.06/socket_v4mappedprefix.c       2016-11-22 21:03:57.127527599 +0100
     27542+++ netqmail-1.06/socket_v4mappedprefix.c       2019-02-27 20:57:13.406024893 +0100
    2727527543@@ -0,0 +1,9 @@
    2727627544+/*
     
    2728527553diff -ruN ../netqmail-1.06-original/socket_v6any.c netqmail-1.06/socket_v6any.c
    2728627554--- ../netqmail-1.06-original/socket_v6any.c    1970-01-01 01:00:00.000000000 +0100
    27287 +++ netqmail-1.06/socket_v6any.c        2016-11-22 21:03:57.127527599 +0100
     27555+++ netqmail-1.06/socket_v6any.c        2019-02-27 20:57:13.406024893 +0100
    2728827556@@ -0,0 +1,9 @@
    2728927557+/*
     
    2729827566diff -ruN ../netqmail-1.06-original/softwarelicense1-1.html netqmail-1.06/softwarelicense1-1.html
    2729927567--- ../netqmail-1.06-original/softwarelicense1-1.html   1970-01-01 01:00:00.000000000 +0100
    27300 +++ netqmail-1.06/softwarelicense1-1.html       2016-11-22 21:03:57.128527565 +0100
     27568+++ netqmail-1.06/softwarelicense1-1.html       2019-02-27 20:57:13.406024893 +0100
    2730127569@@ -0,0 +1,59 @@
    2730227570+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     
    2736127629diff -ruN ../netqmail-1.06-original/spawn-filter.9 netqmail-1.06/spawn-filter.9
    2736227630--- ../netqmail-1.06-original/spawn-filter.9    1970-01-01 01:00:00.000000000 +0100
    27363 +++ netqmail-1.06/spawn-filter.9        2016-11-22 21:03:57.128527565 +0100
     27631+++ netqmail-1.06/spawn-filter.9        2019-02-27 20:57:13.406024893 +0100
    2736427632@@ -0,0 +1,103 @@
    2736527633+.TH spawn-filter 8
     
    2746827736diff -ruN ../netqmail-1.06-original/spawn-filter.c netqmail-1.06/spawn-filter.c
    2746927737--- ../netqmail-1.06-original/spawn-filter.c    1970-01-01 01:00:00.000000000 +0100
    27470 +++ netqmail-1.06/spawn-filter.c        2016-11-22 21:03:57.128527565 +0100
    27471 @@ -0,0 +1,546 @@
     27738+++ netqmail-1.06/spawn-filter.c        2020-04-09 19:45:45.390398843 +0200
     27739@@ -0,0 +1,506 @@
    2747227740+/*
    2747327741+ * netqmail-version without spam filter
     
    2763527903+static int      run_mailfilter(char *, char *, char **);
    2763627904+int             wildmat_internal(char *, char *);
    27637 +static int      check_size(char *);
    2763827905+
    2763927906+static int      remotE;
    2764027907+stralloc        sender = { 0 };
    2764127908+stralloc        recipient = { 0 };
    27642 +
    27643 +static int
    27644 +check_size(char *size)
    27645 +{
    27646 +       char           *x;
    27647 +       unsigned long   databytes = -1, msgsize;
    27648 +
    27649 +       if (!(x = env_get("DATABYTES")))
    27650 +       {
    27651 +               if (control_readulong(&databytes, "databytes") == -1)
    27652 +                       report(111, "spawn-filter: Unable to read databytes: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
    27653 +       } else
    27654 +               scan_ulong(x, &databytes);
    27655 +       if (databytes == -1)
    27656 +               return (0);
    27657 +       scan_ulong(size, &msgsize);
    27658 +       if (msgsize > databytes)
    27659 +               return(1);
    27660 +       else
    27661 +               return(0);
    27662 +}
    2766327909+
    2766427910+static void
     
    2792628172+main(int argc, char **argv)
    2792728173+{
    27928 +       char           *ptr, *mailprog, *domain, *errStr = 0, *size = "0", *qqeh, *ext;
    27929 +       char            sizebuf[FMT_ULONG];
    27930 +       struct stat     statbuf;
     28174+       char           *ptr, *mailprog, *domain, *ext;
    2793128175+       int             len;
    2793228176+
     
    2793928183+       {
    2794028184+               mailprog = "bin/qmail-local";
     28185+               ext = argv[6];
    2794128186+               domain = argv[7];
    27942 +               ext = argv[6];
    27943 +               qqeh = argv[10];
    2794428187+               remotE = 0;
    2794528188+               if (!env_unset("QMAILREMOTE"))
    2794628189+                       report(111, "spawn-filter: out of mem: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
    27947 +               if (!fstat(0, &statbuf))
    27948 +               {
    27949 +                       sizebuf[fmt_ulong(sizebuf, statbuf.st_size)] = 0;
    27950 +                       size = sizebuf;
    27951 +               } else
    27952 +                       size = "0";
    2795328190+               /*- sender */
    2795428191+               if (!stralloc_copys(&sender, argv[8]))
     
    2795628193+               if (!stralloc_0(&sender))
    2795728194+                       report(111, "spawn-filter: out of mem: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
    27958 +               if (!env_unset("QMAILREMOTE"))
    27959 +                       report(111, "spawn-filter: out of mem: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
    2796028195+               /*- recipient */
    27961 +               if (*ext) /*- EXT */
    27962 +               {
     28196+               if (*ext) { /*- EXT */
    2796328197+                       if (!stralloc_copys(&recipient, ext))
    2796428198+                               report(111, "spawn-filter: out of mem: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
    2796528199+               } else /*- user */
    27966 +                       if (!stralloc_copys(&recipient, argv[2]))
    27967 +                               report(111, "spawn-filter: out of mem: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
     28200+               if (!stralloc_copys(&recipient, argv[2]))
     28201+                       report(111, "spawn-filter: out of mem: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
    2796828202+               if (!stralloc_cats(&recipient, "@"))
    2796928203+                       report(111, "spawn-filter: out of mem: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
     
    2797728211+               mailprog = "bin/qmail-remote";
    2797828212+               domain = argv[1];
    27979 +               ext = argv[5];
    27980 +               qqeh = argv[3];
    27981 +               size = argv[4];
    2798228213+               remotE = 1;
    2798328214+               if (!env_unset("QMAILLOCAL"))
     
    2798928220+                       report(111, "spawn-filter: out of mem: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
    2799028221+               /*- recipient */
    27991 +               if (!stralloc_copys(&recipient, argv[5]))
     28222+               if (!stralloc_copys(&recipient, argv[3]))
    2799228223+                       report(111, "spawn-filter: out of mem: ", error_str(errno), ". (#4.3.0)", 0, 0, 0);
    2799328224+               if (!stralloc_0(&recipient))
     
    2800028231+       if (chdir(auto_qmail) == -1)
    2800128232+               report(111, "spawn-filter: Unable to switch to ", auto_qmail, ": ", error_str(errno), ". (#4.3.0)", 0);
    28002 +       /*- DATABYTES Check */
    28003 +       if (check_size(size))
    28004 +               report(100, "sorry, that message size exceeds my databytes limit (#5.3.4)", 0, 0, 0, 0, 0);
    2800528233+       run_mailfilter(domain, mailprog, argv);
    2800628234+       report(111, "spawn-filter: could not exec ", mailprog, ": ", error_str(errno), ". (#4.3.0)", 0);
     
    2801828246diff -ruN ../netqmail-1.06-original/spawn.c netqmail-1.06/spawn.c
    2801928247--- ../netqmail-1.06-original/spawn.c   2007-11-30 21:22:54.000000000 +0100
    28020 +++ netqmail-1.06/spawn.c       2016-11-22 21:03:57.128527565 +0100
     28248+++ netqmail-1.06/spawn.c       2019-02-27 20:57:13.407024882 +0100
    2802128249@@ -1,4 +1,4 @@
    2802228250-#include <sys/types.h>
     
    2809728325diff -ruN ../netqmail-1.06-original/spf.c netqmail-1.06/spf.c
    2809828326--- ../netqmail-1.06-original/spf.c     1970-01-01 01:00:00.000000000 +0100
    28099 +++ netqmail-1.06/spf.c 2016-11-22 21:03:57.129527532 +0100
     28327+++ netqmail-1.06/spf.c 2019-02-27 20:57:13.407024882 +0100
    2810028328@@ -0,0 +1,877 @@
    2810128329+#include "stralloc.h"
     
    2897829206diff -ruN ../netqmail-1.06-original/spf.h netqmail-1.06/spf.h
    2897929207--- ../netqmail-1.06-original/spf.h     1970-01-01 01:00:00.000000000 +0100
    28980 +++ netqmail-1.06/spf.h 2016-11-22 21:03:57.129527532 +0100
     29208+++ netqmail-1.06/spf.h 2019-02-27 20:57:13.407024882 +0100
    2898129209@@ -0,0 +1,20 @@
    2898229210+#ifndef SPF_H
     
    2900229230diff -ruN ../netqmail-1.06-original/spfquery.c netqmail-1.06/spfquery.c
    2900329231--- ../netqmail-1.06-original/spfquery.c        1970-01-01 01:00:00.000000000 +0100
    29004 +++ netqmail-1.06/spfquery.c    2016-11-22 21:03:57.129527532 +0100
     29232+++ netqmail-1.06/spfquery.c    2019-02-27 20:57:13.407024882 +0100
    2900529233@@ -0,0 +1,84 @@
    2900629234+#include "substdio.h"
     
    2909029318diff -ruN ../netqmail-1.06-original/srs.c netqmail-1.06/srs.c
    2909129319--- ../netqmail-1.06-original/srs.c     1970-01-01 01:00:00.000000000 +0100
    29092 +++ netqmail-1.06/srs.c 2016-11-22 21:03:57.129527532 +0100
     29320+++ netqmail-1.06/srs.c 2019-02-27 20:57:13.408024870 +0100
    2909329321@@ -0,0 +1,166 @@
    2909429322+#include <sys/types.h>
     
    2926029488diff -ruN ../netqmail-1.06-original/srs.h netqmail-1.06/srs.h
    2926129489--- ../netqmail-1.06-original/srs.h     1970-01-01 01:00:00.000000000 +0100
    29262 +++ netqmail-1.06/srs.h 2016-11-22 21:03:57.129527532 +0100
     29490+++ netqmail-1.06/srs.h 2019-02-27 20:57:13.408024870 +0100
    2926329491@@ -0,0 +1,9 @@
    2926429492+#ifndef SRS_H
     
    2927329501diff -ruN ../netqmail-1.06-original/srsfilter.c netqmail-1.06/srsfilter.c
    2927429502--- ../netqmail-1.06-original/srsfilter.c       1970-01-01 01:00:00.000000000 +0100
    29275 +++ netqmail-1.06/srsfilter.c   2016-11-22 21:03:57.129527532 +0100
     29503+++ netqmail-1.06/srsfilter.c   2019-02-27 20:57:13.408024870 +0100
    2927629504@@ -0,0 +1,137 @@
    2927729505+#include "sig.h"
     
    2941429642diff -ruN ../netqmail-1.06-original/ssl_timeoutio.c netqmail-1.06/ssl_timeoutio.c
    2941529643--- ../netqmail-1.06-original/ssl_timeoutio.c   1970-01-01 01:00:00.000000000 +0100
    29416 +++ netqmail-1.06/ssl_timeoutio.c       2016-11-22 21:03:57.129527532 +0100
    29417 @@ -0,0 +1,95 @@
     29644+++ netqmail-1.06/ssl_timeoutio.c       2020-01-10 21:51:32.057157279 +0100
     29645@@ -0,0 +1,126 @@
     29646+#ifdef TLS
    2941829647+#include "select.h"
    2941929648+#include "error.h"
     
    2948829717+int ssl_timeoutrehandshake(int t, int rfd, int wfd, SSL *ssl)
    2948929718+{
    29490 +  int r;
    29491 +
    29492 +  SSL_renegotiate(ssl);
     29719+  int r=0;
     29720+
     29721+#if OPENSSL_VERSION_NUMBER >= 0x10101000L
     29722+  if (SSL_version(ssl) >= TLS1_3_VERSION){
     29723+    if(SSL_verify_client_post_handshake(ssl) != 1)
     29724+      return -EPROTO;
     29725+  } else
     29726+#endif
     29727+  {
     29728+    r =  SSL_renegotiate(ssl);
     29729+    if (r<=0) return r;
     29730+  }
     29731+
     29732+#if OPENSSL_VERSION_NUMBER >= 0x10001000L
     29733+  char buf[1]; /* dummy read buffer */
     29734+  struct timeval tv;
     29735+  fd_set fds;
     29736+  r = ssl_timeoutio(SSL_do_handshake, t, rfd, wfd, ssl, NULL, 0);
     29737+  if (r <=0) return r;
     29738+#if OPENSSL_VERSION_NUMBER >= 0x10101000L
     29739+  if (SSL_version(ssl) >= TLS1_3_VERSION) return r;
     29740+#endif
     29741+
     29742+  tv.tv_sec = (time_t)t; tv.tv_usec = 0;
     29743+  FD_ZERO(&fds);  FD_SET(rfd, &fds);
     29744+  if ((r = select(rfd + 1, &fds, NULL, NULL, &tv)>0) && FD_ISSET(rfd, &fds)){
     29745+    r = SSL_read(ssl, buf, 1);
     29746+    if (SSL_get_error(ssl, r) == SSL_ERROR_WANT_READ) r = 1; /*ignore */
     29747+  }
     29748+  if (r <=0) return r;
     29749+#else
    2949329750+  r = ssl_timeoutio(SSL_do_handshake, t, rfd, wfd, ssl, NULL, 0);
    2949429751+  if (r <= 0 || ssl->type == SSL_ST_CONNECT) return r;
     
    2949629753+  /* this is for the server only */
    2949729754+  ssl->state = SSL_ST_ACCEPT;
     29755+#endif
    2949829756+  return ssl_timeoutio(SSL_do_handshake, t, rfd, wfd, ssl, NULL, 0);
    2949929757+}
     
    2951129769+  return ssl_timeoutio(SSL_write, t, rfd, wfd, ssl, buf, len);
    2951229770+}
     29771+#endif
    2951329772diff -ruN ../netqmail-1.06-original/ssl_timeoutio.h netqmail-1.06/ssl_timeoutio.h
    2951429773--- ../netqmail-1.06-original/ssl_timeoutio.h   1970-01-01 01:00:00.000000000 +0100
    29515 +++ netqmail-1.06/ssl_timeoutio.h       2016-11-22 21:03:57.130527499 +0100
     29774+++ netqmail-1.06/ssl_timeoutio.h       2019-04-07 13:05:52.192763950 +0200
    2951629775@@ -0,0 +1,21 @@
    2951729776+#ifndef SSL_TIMEOUTIO_H
     
    2952129780+
    2952229781+/* the version is like this: 0xMNNFFPPS: major minor fix patch status */
    29523 +#if OPENSSL_VERSION_NUMBER < 0x00906000L
    29524 +# error "Need OpenSSL version at least 0.9.6"
     29782+#if OPENSSL_VERSION_NUMBER < 0x00908000L
     29783+# error "Need OpenSSL version at least 0.9.8"
    2952529784+#endif
    2952629785+
     
    2953829797diff -ruN ../netqmail-1.06-original/str.h netqmail-1.06/str.h
    2953929798--- ../netqmail-1.06-original/str.h     1998-06-15 12:53:16.000000000 +0200
    29540 +++ netqmail-1.06/str.h 2016-11-22 21:03:57.130527499 +0100
     29799+++ netqmail-1.06/str.h 2019-02-27 20:57:13.408024870 +0100
    2954129800@@ -2,6 +2,11 @@
    2954229801 #define STR_H
     
    2956529824diff -ruN ../netqmail-1.06-original/str_cpyb.c netqmail-1.06/str_cpyb.c
    2956629825--- ../netqmail-1.06-original/str_cpyb.c        1970-01-01 01:00:00.000000000 +0100
    29567 +++ netqmail-1.06/str_cpyb.c    2016-11-22 21:03:57.130527499 +0100
     29826+++ netqmail-1.06/str_cpyb.c    2019-02-27 20:57:13.408024870 +0100
    2956829827@@ -0,0 +1,53 @@
    2956929828+/*
     
    2962229881diff -ruN ../netqmail-1.06-original/str_cspn.c netqmail-1.06/str_cspn.c
    2962329882--- ../netqmail-1.06-original/str_cspn.c        1970-01-01 01:00:00.000000000 +0100
    29624 +++ netqmail-1.06/str_cspn.c    2016-11-22 21:03:57.130527499 +0100
     29883+++ netqmail-1.06/str_cspn.c    2019-02-27 20:57:13.408024870 +0100
    2962529884@@ -0,0 +1,40 @@
    2962629885+/*
     
    2966629925diff -ruN ../netqmail-1.06-original/strpidt.c netqmail-1.06/strpidt.c
    2966729926--- ../netqmail-1.06-original/strpidt.c 1970-01-01 01:00:00.000000000 +0100
    29668 +++ netqmail-1.06/strpidt.c     2016-11-22 21:03:57.130527499 +0100
     29927+++ netqmail-1.06/strpidt.c     2019-02-27 20:57:13.408024870 +0100
    2966929928@@ -0,0 +1,26 @@
    2967029929+/*
     
    2969629955diff -ruN ../netqmail-1.06-original/strsalloc.c netqmail-1.06/strsalloc.c
    2969729956--- ../netqmail-1.06-original/strsalloc.c       1970-01-01 01:00:00.000000000 +0100
    29698 +++ netqmail-1.06/strsalloc.c   2016-11-22 21:03:57.130527499 +0100
     29957+++ netqmail-1.06/strsalloc.c   2019-02-27 20:57:13.409024860 +0100
    2969929958@@ -0,0 +1,7 @@
    2970029959+#include "alloc.h"
     
    2970729966diff -ruN ../netqmail-1.06-original/strsalloc.h netqmail-1.06/strsalloc.h
    2970829967--- ../netqmail-1.06-original/strsalloc.h       1970-01-01 01:00:00.000000000 +0100
    29709 +++ netqmail-1.06/strsalloc.h   2016-11-22 21:03:57.130527499 +0100
     29968+++ netqmail-1.06/strsalloc.h   2019-02-27 20:57:13.409024860 +0100
    2971029969@@ -0,0 +1,12 @@
    2971129970+#ifndef STRSALLOC_H
     
    2972329982diff -ruN ../netqmail-1.06-original/strtimet.c netqmail-1.06/strtimet.c
    2972429983--- ../netqmail-1.06-original/strtimet.c        1970-01-01 01:00:00.000000000 +0100
    29725 +++ netqmail-1.06/strtimet.c    2016-11-22 21:03:57.130527499 +0100
     29984+++ netqmail-1.06/strtimet.c    2019-02-27 20:57:13.409024860 +0100
    2972629985@@ -0,0 +1,26 @@
    2972729986+/*
     
    2975330012diff -ruN ../netqmail-1.06-original/surblfilter.9 netqmail-1.06/surblfilter.9
    2975430013--- ../netqmail-1.06-original/surblfilter.9     1970-01-01 01:00:00.000000000 +0100
    29755 +++ netqmail-1.06/surblfilter.9 2016-11-22 21:03:57.130527499 +0100
    29756 @@ -0,0 +1,80 @@
     30014+++ netqmail-1.06/surblfilter.9 2019-06-19 09:49:02.553441531 +0200
     30015@@ -0,0 +1,82 @@
    2975730016+.TH surblfilter 8
    2975830017+.SH NAME
     
    2978930048+whitelist recipients by having the email addresses in \fIsurblrcpt\fR control file. You can
    2979030049+change the name of this control file by setting \fBSURBLRCPT\fR environment variable.
     30050+
    2979130051+.PP
    2979230052+\fBsurblfilter\fR uses the control file \fIsurbldomainwhite\fR to whitelist a domain.
     
    2979730057+
    2979830058+.PP
    29799 +\fBsurblfilter\fR caches results in QMAILHOME/control/cache. The filename represents the domain.
    29800 +If a file as permission 0600, it means that the domain was blacklisted. The entries are
    29801 +cached for a default of 300 seconds. You can change this by setting \fIcachelifetime\fR
    29802 +control file. This directory should be owned by the uid set for running qmail-smtpd(8).
     30059+\fBsurblfilter\fR caches results in @controldir@/cache directory. The filename of files in this
     30060+directory represents the domain. If a file has permission 0600, it means that the domain was
     30061+blacklisted. The entries are cached for a default of 300 seconds. You can change this by
     30062+setting \fBCACHELIFETIME\fR environment variable or setting this value in \fBcacheliftime\fR
     30063+control file. The cache directory should be owned by the uid of the running qmail-smtpd(8).
    2980330064+
    2980430065+\fBsurblfilter\fR removes all leading host names, subdomains, www., randomized subdomains, etc. In
     
    2983730098diff -ruN ../netqmail-1.06-original/surblfilter.c netqmail-1.06/surblfilter.c
    2983830099--- ../netqmail-1.06-original/surblfilter.c     1970-01-01 01:00:00.000000000 +0100
    29839 +++ netqmail-1.06/surblfilter.c 2017-05-10 21:54:26.719100696 +0200
    29840 @@ -0,0 +1,881 @@
     30100+++ netqmail-1.06/surblfilter.c 2020-04-09 19:46:02.374231173 +0200
     30101@@ -0,0 +1,882 @@
    2984130102+/*
    2984230103+ * $Log: surblfilter.c,v $
     
    3005830319+dns_text(char *dn)
    3005930320+{
    30060 +        u_char          response[PACKETSZ + PACKETSZ + 1];      /* response */
     30321+       u_char          response[PACKETSZ + PACKETSZ + 1];      /* response */
    3006130322+       int             responselen;                    /* buffer length */
    30062 +       int             rc;                             /* misc variables */
     30323+       int             rc;                                             /* misc variables */
    3006330324+       int             ancount, qdcount;               /* answer count and query count */
    3006430325+       u_short         type, rdlength;                 /* fields of records returned */
    3006530326+       u_char         *eom, *cp;
    30066 +       u_char          buf[PACKETSZ + 1];              /* we're storing a TXT record here, not just a DNAME */
     30327+       u_char          buf[PACKETSZ + PACKETSZ + 1];           /* we're storing a TXT record here, not just a DNAME */
    3006730328+       u_char         *bufptr;
    3006830329+
    30069 +        for (rc = 0, responselen = PACKETSZ;rc < 2;rc++) {
    30070 +                if ((responselen = res_query(dn, C_IN, T_TXT, response, responselen)) < 0) {
    30071 +                        if (h_errno == TRY_AGAIN)
    30072 +                                return strdup("e=temp;");
    30073 +                        else
    30074 +                                return strdup("e=perm;");
    30075 +                }
    30076 +                if (responselen <= PACKETSZ)
    30077 +                        break;
     30330+       for (rc = 0, responselen = PACKETSZ;rc < 2;rc++) {
     30331+               if ((responselen = res_query(dn, C_IN, T_TXT, response, responselen)) < 0) {
     30332+                       if (h_errno == TRY_AGAIN)
     30333+                               return strdup("e=temp;");
     30334+                       else
     30335+                               return strdup("e=perm;");
     30336+               }
     30337+               if (responselen <= PACKETSZ)
     30338+                       break;
    3007830339+               else
    30079 +                if (responselen >= (2 * PACKETSZ))
     30340+               if (responselen >= (2 * PACKETSZ))
    3008030341+                       return strdup("e=perm;");
    3008130342+       }
     
    3010830369+
    3010930370+                       cnt = *cp++;            /* http://crynwr.com/rfc1035/rfc1035.html#3.3.14. */
    30110 +                        if (bufptr - buf + cnt + 1 >= (2 * PACKETSZ))
     30371+                       if (bufptr - buf + cnt + 1 >= (2 * PACKETSZ))
    3011130372+                               return strdup("e=perm;");
    3011230373+                       if (cp + cnt > eom)
     
    3020030461+               return (-1);
    3020130462+       }
    30202 +       if (!stralloc_copys(&cachefile, "control/cache", 13))
     30463+       if (!stralloc_copyb(&cachefile, "control/cache", 13))
    3020330464+               die_nomem();
    3020430465+       if (!stralloc_0(&cachefile))
     
    3072030981+       x++;
    3072130982+}
     30983+
    3072230984diff -ruN ../netqmail-1.06-original/surblqueue.sh netqmail-1.06/surblqueue.sh
    3072330985--- ../netqmail-1.06-original/surblqueue.sh     1970-01-01 01:00:00.000000000 +0100
    30724 +++ netqmail-1.06/surblqueue.sh 2016-11-22 21:03:57.131527465 +0100
     30986+++ netqmail-1.06/surblqueue.sh 2019-02-27 20:57:13.409024860 +0100
    3072530987@@ -0,0 +1,33 @@
    3072630988+#!/bin/sh
     
    3075931021diff -ruN ../netqmail-1.06-original/tai.h netqmail-1.06/tai.h
    3076031022--- ../netqmail-1.06-original/tai.h     1970-01-01 01:00:00.000000000 +0100
    30761 +++ netqmail-1.06/tai.h 2016-11-22 21:03:57.131527465 +0100
     31023+++ netqmail-1.06/tai.h 2019-02-27 20:57:13.409024860 +0100
    3076231024@@ -0,0 +1,34 @@
    3076331025+/*
     
    3079731059diff -ruN ../netqmail-1.06-original/tcp-env.c netqmail-1.06/tcp-env.c
    3079831060--- ../netqmail-1.06-original/tcp-env.c 1998-06-15 12:53:16.000000000 +0200
    30799 +++ netqmail-1.06/tcp-env.c     2016-11-22 21:03:57.131527465 +0100
     31061+++ netqmail-1.06/tcp-env.c     2019-02-27 20:57:13.410024849 +0100
    3080031062@@ -10,6 +10,7 @@
    3080131063 #include "scan.h"
     
    3084431106        case_lowers(remotename.s);
    3084531107        if (!env_put2("TCPREMOTEHOST",remotename.s)) die();
     31108diff -ruN ../netqmail-1.06-original/time_t_size.c netqmail-1.06/time_t_size.c
     31109--- ../netqmail-1.06-original/time_t_size.c     1970-01-01 01:00:00.000000000 +0100
     31110+++ netqmail-1.06/time_t_size.c 2019-05-23 15:12:30.140092743 +0200
     31111@@ -0,0 +1,8 @@
     31112+#include <stdio.h>
     31113+#include <time.h>
     31114+int
     31115+main()
     31116+{
     31117+       printf("#define SIZEOF_TIME_T %d\n", sizeof(time_t));
     31118+       return (0);
     31119+}
    3084631120diff -ruN ../netqmail-1.06-original/timeoutconn.c netqmail-1.06/timeoutconn.c
    3084731121--- ../netqmail-1.06-original/timeoutconn.c     1998-06-15 12:53:16.000000000 +0200
    30848 +++ netqmail-1.06/timeoutconn.c 2016-11-22 21:03:57.131527465 +0100
     31122+++ netqmail-1.06/timeoutconn.c 2019-02-27 20:57:13.410024849 +0100
    3084931123@@ -10,9 +10,10 @@
    3085031124 #include "byte.h"
     
    3087531149diff -ruN ../netqmail-1.06-original/tls.c netqmail-1.06/tls.c
    3087631150--- ../netqmail-1.06-original/tls.c     1970-01-01 01:00:00.000000000 +0100
    30877 +++ netqmail-1.06/tls.c 2016-11-22 21:03:57.131527465 +0100
    30878 @@ -0,0 +1,25 @@
     31151+++ netqmail-1.06/tls.c 2019-04-09 20:56:31.139694929 +0200
     31152@@ -0,0 +1,27 @@
     31153+#ifdef TLS
    3087931154+#include "exit.h"
    3088031155+#include "error.h"
     
    3090231177+  return (errno == error_timeout) ? "timed out" : error_str(errno);
    3090331178+}
     31179+#endif
    3090431180diff -ruN ../netqmail-1.06-original/tls.h netqmail-1.06/tls.h
    3090531181--- ../netqmail-1.06-original/tls.h     1970-01-01 01:00:00.000000000 +0100
    30906 +++ netqmail-1.06/tls.h 2016-11-22 21:03:57.132527432 +0100
     31182+++ netqmail-1.06/tls.h 2019-02-27 20:57:13.410024849 +0100
    3090731183@@ -0,0 +1,16 @@
    3090831184+#ifndef TLS_H
     
    3092431200diff -ruN ../netqmail-1.06-original/tryulong64.c netqmail-1.06/tryulong64.c
    3092531201--- ../netqmail-1.06-original/tryulong64.c      1970-01-01 01:00:00.000000000 +0100
    30926 +++ netqmail-1.06/tryulong64.c  2016-11-22 21:03:57.132527432 +0100
     31202+++ netqmail-1.06/tryulong64.c  2019-02-27 20:57:13.410024849 +0100
    3092731203@@ -0,0 +1,47 @@
    3092831204+/*
     
    3097531251diff -ruN ../netqmail-1.06-original/uint64.h1 netqmail-1.06/uint64.h1
    3097631252--- ../netqmail-1.06-original/uint64.h1 1970-01-01 01:00:00.000000000 +0100
    30977 +++ netqmail-1.06/uint64.h1     2016-11-22 21:03:57.132527432 +0100
     31253+++ netqmail-1.06/uint64.h1     2019-02-27 20:57:13.410024849 +0100
    3097831254@@ -0,0 +1,12 @@
    3097931255+/*
     
    3099131267diff -ruN ../netqmail-1.06-original/uint64.h2 netqmail-1.06/uint64.h2
    3099231268--- ../netqmail-1.06-original/uint64.h2 1970-01-01 01:00:00.000000000 +0100
    30993 +++ netqmail-1.06/uint64.h2     2016-11-22 21:03:57.132527432 +0100
     31269+++ netqmail-1.06/uint64.h2     2019-02-27 20:57:13.410024849 +0100
    3099431270@@ -0,0 +1,12 @@
    3099531271+/*
     
    3100731283diff -ruN ../netqmail-1.06-original/update_tmprsadh.sh netqmail-1.06/update_tmprsadh.sh
    3100831284--- ../netqmail-1.06-original/update_tmprsadh.sh        1970-01-01 01:00:00.000000000 +0100
    31009 +++ netqmail-1.06/update_tmprsadh.sh    2016-11-22 21:03:57.132527432 +0100
     31285+++ netqmail-1.06/update_tmprsadh.sh    2019-02-27 20:57:13.410024849 +0100
    3101031286@@ -0,0 +1,22 @@
    3101131287+#!/bin/sh
     
    3103331309diff -ruN ../netqmail-1.06-original/wildmat.c netqmail-1.06/wildmat.c
    3103431310--- ../netqmail-1.06-original/wildmat.c 1970-01-01 01:00:00.000000000 +0100
    31035 +++ netqmail-1.06/wildmat.c     2016-11-22 21:03:57.132527432 +0100
     31311+++ netqmail-1.06/wildmat.c     2019-02-27 20:57:13.410024849 +0100
    3103631312@@ -0,0 +1,173 @@
    3103731313+/*-** wildmat.c.orig   Wed Dec  3 11:46:31 1997
Note: See TracChangeset for help on using the changeset viewer.