Commit Graph

25 Commits

Author SHA1 Message Date
Devin Carraway
20154f7094 If the PID file already exists at startup, truncate to zero-length before
attempting to re-use it.  Otherwise if the new PID is shorter than the
previous one the file will be corrupted by the rewrite (harmlessly the way it
is being read by this code, but problematically for anything that expects to
be able to run something similar to /bin/kill `cat /path/to/pid.file`)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@493 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-10 11:46:15 +00:00
Devin Carraway
58cce1ab30 Clean up PID file on exit, if enabled
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@492 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-10 11:38:40 +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
Matt Sergeant
dae911cec8 When REAPER is called by SIGCHLD, it can start in the middle of the loop
over values %childstatus in the MAXCONNIP block.  This can cause $rip to be
deleted by REAPER while we're using it.  Perl will die saying "Use of freed
value in iteration".
 -- brian@SoftHome.net


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@286 958fd67b-6ff1-0310-b445-bb7760255be9
2004-08-09 08:13:26 +00:00
Robert Spier
606df3773c Switch to a simpler and known good seeding algorithm
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@274 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-18 01:29:00 +00:00
Matt Sergeant
ce59fc98b6 srand after the fork.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@272 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-17 08:45:09 +00:00
Matt Sergeant
b82536df19 Support per-IP throttling (Hanno Hecker <hah@uu-x.de>)
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@259 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-05 19:20:15 +00:00
Devin Carraway
29ac28601b - Enable taint checking
- Allow most operating parameters (bind address, port, etc) to be overriden
  on the commandline
- Drop an unused scalar
- Minor logging improvements


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@251 958fd67b-6ff1-0310-b445-bb7760255be9
2004-06-28 03:05:03 +00:00
Matt Sergeant
5d40964053 Make signal handling slightly more stable
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@246 958fd67b-6ff1-0310-b445-bb7760255be9
2004-06-16 20:27:51 +00:00
Robert Spier
d8c8d40ef6 - move configuration to top. (still suboptimal)
- child limiting
- logging helper


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@229 958fd67b-6ff1-0310-b445-bb7760255be9
2004-04-15 02:19:01 +00:00
Matt Sergeant
f84bd18601 Slightly better signal handling - may help stability issues for some people
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@228 958fd67b-6ff1-0310-b445-bb7760255be9
2004-03-18 23:02:43 +00:00
Matt Sergeant
04dacc4488 Pure perl forking qpsmtpd
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@227 958fd67b-6ff1-0310-b445-bb7760255be9
2004-03-15 08:59:02 +00:00