Commit Graph

59 Commits

Author SHA1 Message Date
Andreas Erhard d3cf60d2c8
Load plugins in qpsmtpd-forkserver at startup again (#311)
Removes the comment from line 196, which enables the loading of plugins at startup again. Otherwise there would have been the need for a SIGHUP in order to load the plugins initially.

Closes #308 and #288.
2023-09-12 08:10:09 -07:00
Matt Simerson be9f4aef0c update tcpenv and lrpip calls to use -> syntax
don't load plugins twice.

Not exactly sure where that feature crept in some time ago. It was suppressed by checking to see if a queue plugin was already registered, and then bailing out on subsequent register_hook runs. I noticed it in testing, b/c I didn't have a queue plugin loaded. This removes the duplicate calls to register_hook.

* adds caching of the AUTH methods. You can't add new plugins or register new
  hooks w/o restarting QP, so cache the list and avoid having to generate it on every connection.

* other PBP changes (early exits, less indention, fewer unnecessary parens, etc.)
2015-01-28 19:58:58 -08:00
Matt Simerson 4a11e2cb71 Revert "Turn warnings into $qpsmtpd->log() calls" 2015-01-03 21:45:59 -08:00
Jared Johnson d3ec361ab8 Turn warnings into $qpsmtpd->log() calls
This can be convenient, especially when one wants to emit a warning that will
show up when running the test suite but still be properly logged in production
2014-12-15 20:07:45 -06:00
Matt Simerson a2816c50a7 update URL of Qpsmtpd web site to github 2014-05-21 12:44:10 -07:00
Matt Simerson 1e3136a0d0 revert movement of qp bins to bin/
plugin dir, config dir, spool dir, all have different logic about where/how to find their config. The logic needs some untangling and unification before attempting this again.
2013-08-05 15:05:37 -07:00
Matt Simerson 791237841b replace run with separate run for the 2 common
deployment methods. Rather than having to edit the run file, it's much easier to rename the run file.
Moved qpsmtpd* into bin/
2013-08-05 15:05:37 -07:00
Matt Simerson 6b431807c3 perltidy -b qpsmtpd* 2013-08-05 15:05:15 -07:00
Markus Ullmann 6a0fa13ee1 Update qpsmtpd-forkserver
Drop block as it breaks with Net::DNS and should be safe according to http://www.nntp.perl.org/group/perl.qpsmtpd/2012/12/msg9980.html
2013-08-05 15:05:10 -07:00
Matt Simerson 1bfebd0bfd TcpServer, improve IPv6 support, by Michael Holzt 2013-08-05 15:02:17 -07:00
Ask Bjørn Hansen c408aa98ca Update copyright year 2010-04-07 22:32:41 -07:00
Devin Carraway b8958d333b forkserver: accurately report default run-as user 2009-06-02 15:36:41 -07:00
Ask Bjørn Hansen ff0c6134a9 Update URL 2009-04-02 23:35:05 -07:00
Hanno Hecker eff638dd79 forkserver: fix wrong detection of closed connection
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@954 958fd67b-6ff1-0310-b445-bb7760255be9
2008-10-24 17:18:08 +00:00
Matt Sergeant 59b826d4bb Fix to check client is writable before writing to it.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@946 958fd67b-6ff1-0310-b445-bb7760255be9
2008-09-26 17:40:04 +00:00
Hanno Hecker a64742cc7c prefork, forkserver: restart on SIGHUP: * reset to defaults * clear config cache * reload all plugins (includes compiling, register()/init())
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@927 958fd67b-6ff1-0310-b445-bb7760255be9
2008-06-15 09:28:02 +00:00
Hanno Hecker ea243c2f2f add reset() to Qpsmtpd::Connection to clear the connection notes after
the post-connection hooks - needed for -prefork and STARTTLS


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@893 958fd67b-6ff1-0310-b445-bb7760255be9
2008-05-09 17:40:31 +00:00
Hanno Hecker 7d4605fdbc remove the connection / transaction id feature for 0.42 release
- add back in after 0.42 is out? if yes: start implementing in -prefork 


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@809 958fd67b-6ff1-0310-b445-bb7760255be9
2007-10-09 12:00:43 +00:00
Peter J. Holzer af82701fff New id scheme: Start with a unique id for the Qpsmtpd::SMTP object,
then derive ids for connections and transactions from that via
simple counters.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@785 958fd67b-6ff1-0310-b445-bb7760255be9
2007-09-02 10:50:23 +00:00
Peter J. Holzer 5ccdcca7b2 Connection id similar to the transaction id by Matt.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@780 958fd67b-6ff1-0310-b445-bb7760255be9
2007-08-30 20:19:30 +00:00
Matt Sergeant ccf990e032 IPv6 support from issue #7.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@740 958fd67b-6ff1-0310-b445-bb7760255be9
2007-05-17 22:16:27 +00:00
Matt Sergeant 2db48784fe Applied patch from issue #5: qpsmtpd-forkserver 0.32 patches
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@739 958fd67b-6ff1-0310-b445-bb7760255be9
2007-05-17 22:09:33 +00:00
Peter J. Holzer 72da879365 Ensure that each child process in qpsmtpd-forkserver will use a
differenct sequence of ids in DNS requests.
See the thread "dnsbl or spamhaus occassionally blocks wrong IP"
starting at 14 Mar 2006 for details.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@682 958fd67b-6ff1-0310-b445-bb7760255be9
2006-12-16 09:42:52 +00:00
Peter J. Holzer 839eddc558 Older perls don't know constant AF_INET6, but don't mind a function
which is never called.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@673 958fd67b-6ff1-0310-b445-bb7760255be9
2006-11-06 09:06:39 +00:00
Devin Carraway 02bf7b80e5 Fix startup of qpsmtpd-forkserver on hosts lacking Socket6 (it's not enough
to have 'use Socket6' in a conditional, it must be evalled also)


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@670 958fd67b-6ff1-0310-b445-bb7760255be9
2006-11-05 09:47:18 +00:00
Ask Bjørn Hansen 6ef0bf27c7 r4175@embla: ask | 2006-08-28 01:17:10 +0200
Experimental IPv6 support (forkserver only). (Mike Williams)


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@657 958fd67b-6ff1-0310-b445-bb7760255be9
2006-08-27 23:17:33 +00:00
John Peacock 4a824a2e7d Improve support for listening to multiple ports and/or multiple IP addresses.
Document using plugins/tls to handle SMTPS (port 465).

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@625 958fd67b-6ff1-0310-b445-bb7760255be9
2006-03-01 16:44:20 +00:00
John Peacock 2c683f22ef Implement multiple IP:PORT listen in forkserver (Devin Carraway).
Add support in plugins/tls to use SMTPS (John Peacock).

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@624 958fd67b-6ff1-0310-b445-bb7760255be9
2006-02-28 21:10:11 +00:00
John Peacock c0920346e5 the pre-connection and post-connection hooks are not working in
qpsmtpd-forkserver. This patch merges Peter's patch (with the possibilty
to DENY/DENSOFT the connection) and my first attempt. The --max-from-ip
check was moved from core to the hosts_allow plugin. 

Patch by: Hanno Hecker <hah@uu-x.de>

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@599 958fd67b-6ff1-0310-b445-bb7760255be9
2006-01-11 16:21:08 +00:00
Devin Carraway 239daaf55a Drop root privileges before loading plugins, rather than after. This reduces
root exposure, and avoids (e.g.) files being created as root which then won't
be writable by the normal qpsmtpd user.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@584 958fd67b-6ff1-0310-b445-bb7760255be9
2005-12-11 02:19:43 +00:00
John Peacock 9cbf206a4a * lib/Qpsmtpd/TcpServer.pm
Don't try to load the plugins if they are already loaded.

* lib/Qpsmtpd/Transaction.pm
  Get the size_threshold by inheritance.
  Extract the spooling of the body as a new sub.
  Always spool the body when calling body_filename().
  Compare the body_size to the cached size_threshold.

* lib/Qpsmtpd.pm
  Cache the size_threshold and provide an accessor method.

* qpsmtpd-forkserver
  Initialize both the spool_dir and size_threshold caches before forking.

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@547 958fd67b-6ff1-0310-b445-bb7760255be9
2005-09-22 17:14:20 +00:00
Devin Carraway da5c0a74fe Fix unitialized-value warning if the PID file existed but was zero-length
at startup time.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@536 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-30 09:32:36 +00:00
Devin Carraway a4e4c5217c Fix whitespace (spaces for a tab)
git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@526 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-29 07:24:04 +00:00
Devin Carraway 00e06cc612 Remove PID file on exit, if we were told to create one with --pid-file
git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@525 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-29 07:22:36 +00:00
Devin Carraway a2064bc22e Add --detach commandline option to forkserver; if supplied, daemonize just
prior to entering the main accept loop.

Split handling of --pid-file so that preexisting pid files are dealt with and
the file is opened before priveleges are dropped, but the writing out of the
new file happens after dropping privs and (if applicable) forking the
daemonized process, so the correct PID is recorded.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@524 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-29 06:42:00 +00:00
Devin Carraway a3ff03fec9 Merge r493 from trunk to truncate PID file before re-use
git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@523 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-29 06:21:02 +00:00
Matt Sergeant 3fc6a4f318 Make sure we process all servers after select()
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@466 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 12:13:53 +00:00
Devin Carraway 1e68345cf2 Clean up whitespace (mainloop had a swath of 4-space indentation, while everything else used 2-space; also removed some tabs towards the beginning.)
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@465 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 07:53:41 +00:00
Devin Carraway 1fbfe5156b Implement listening on multiple local addresses simultaneously, if specified by
more than one --listen-address commandline argument.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@464 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 07:50:00 +00:00
Matt Sergeant 314625d05a Another small cleanup
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@463 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-05 15:25:54 +00:00
Matt Sergeant 4b72a40100 Minor cleanup
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@462 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-05 15:20:40 +00:00
Matt Sergeant 698fc01595 Make pid-file optional
Use known-safe fork code for forking
No more SIGCHLD for managing zombies (Peter Holzer)
Don't block on accept() so we can call REAPER every second


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@461 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-05 15:16:36 +00:00
Ask Bjørn Hansen 03f8c0d2f8 + qpsmtpd-forkserver: add an option for writing a PID file (pjh)
+
+  qpsmtpd-forkserver: set auxiliary groups (this is needed for the
+  postfix backend, which expects to have write permission to a fifo
+  which usually belongs to group postdrop). (pjh)



git-svn-id: https://svn.perl.org/qpsmtpd/trunk@460 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-04 14:44:51 +00:00
Devin Carraway 2847144641 Fix typo in forkserver commandline help
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@454 958fd67b-6ff1-0310-b445-bb7760255be9
2005-06-29 09:37:10 +00:00
John Peacock 662003437d * qpsmtpd-forkserver
Create a single Qpsmtpd::TcpServer object in the parent process and
     then rely on fork to let each child have it's own copy
     
 *   lib/Qpsmtpd/Plugin.pm
     Add new pre-connection and post-connection hooks
     
 *   README.plugins
     Document the above new hooks

 *   lib/Qpsmtpd.pm
     No longer have local value for trace_level() the first time through, which 
     was masking the global value (due to stupid search/replace error).
     Don't call log() from trace_level() since it is only ever called from
     within the varlog() sub when no logging plugin is registered.

 *   plugins/dnsbl
     Config line option to use DENY_DISCONNECT instead of DENY (since any IP
     on a blacklist should not have a chance to send anything for now).
     Add POD to document the new disconnect behavior

 *   lib/Qpsmtpd.pm
     Compatibility changes so test files continue to work
 
 *   t/Test/Qpsmtpd.pm
     Compatibility sub for core subs which call varlog() directly


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@428 958fd67b-6ff1-0310-b445-bb7760255be9
2005-05-25 20:07:58 +00:00
John Peacock e331f6b248 Add plugable logging support include sample plugin which replicates the
existing core code.  Add OK hook.

*  lib/Qpsmtpd.pm
   (init_logger): replaced with log_level()
   (load_logging): NEW - load logging plugins without calling log()
   (log_level): NEW - set/get global $LogLevel scalar
   (log): now just a wrapper for varlog(); called only by core code
   (varlog): initializes logging if not already done, calls logging plugins
     in turn and falls back to interal logging unless plugins OK or DECLINED
   (_load_plugins): only display "Loading plugin" when actually loading one
   (run_hooks): load logging plugins without calling log(); add OK hook as
     else of the DENY* case
   (spool_dir): use global $Spool_dir scalar to cache location

*  lib/Qpsmtpd/Plugin.pm
   (%hooks): add "logging" and "ok"
   (register_hook): add local _hook to object cache
   (log): call varlog() with additional parameters hook and plugin_name
     except for logging hook
   (compile): add accessor sub for local _hook scalar

*  lib/Qpsmtpd/SMTP.pm
   (mail, rcpt): change loglevel to LOGALERT instead of LOGWARN for from/to

*  qpsmtpd-forkserver
   (REAPER): use package ::log() instead of warn()
   (main): defer calling log until $plugin_loader has been initialized
   (log): call logging using the $plugin_loader object

*  plugins/logging/warn
   NEW: sample plugin which replicates the core logging functionality

*  plugins/logging/devnull
   NEW: sample plugin which logs nothing (for testing multiple logging
     plugin functionality)

*  config.sample/logging
   sample configuration file for logging plugins

*  plugins/virus/uvscan
   plugins/virus/clamav
   Increase loglevel for non-serious warnings to LOGWARN from LOGERROR


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@398 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-24 21:16:35 +00:00
Robert Spier 22a1d99981 From: Jim Winstead
Subject: default port for qpsmtpd-forkserver
Date: Sun, 28 Nov 2004 10:14:20 -0800
Message-ID: <20041128181420.GA17602@trainedmonkey.com>

it's a minor thing, but the default port for qpsmtpd-forkserver is 2525
in the code, but it claims to be 25 in the usage text.

also, the $MAXCONNIP was not settable from the command line.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@354 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-29 03:37:38 +00:00
Robert Spier acbb51a555 - set a sane ALRM handler
- pass more information to the Connection


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@291 958fd67b-6ff1-0310-b445-bb7760255be9
2004-08-29 07:57:07 +00:00
Robert Spier 616aa735b9 fix compilation error
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@288 958fd67b-6ff1-0310-b445-bb7760255be9
2004-08-14 17:42:45 +00:00
Robert Spier 1eefd49c22 slight cleanup
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@287 958fd67b-6ff1-0310-b445-bb7760255be9
2004-08-09 15:40:56 +00:00