Commit Graph

187 Commits

Author SHA1 Message Date
John Peacock
1f7ece38f2 r589@jpeacock: jpeacock | 2005-07-10 06:54:32 -0400
Track hooks as array and hash.
 Re-revert changes to logging plugins to use new-style hooking.
 logging/adaptive assumed that register() has been called before hook_logging.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@491 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-10 10:56:55 +00:00
John Peacock
00c53652c9 r547@jpeacock: jpeacock | 2005-07-02 07:20:17 -0400
Replace pithy comment with something more neutral.
 Thanks Gordon Rowell <gordonr@gormand.com.au>
 r548@jpeacock:  jpeacock | 2005-07-02 07:24:21 -0400
 Example patterns for badrcptto plugin - Gordon Rowell <gordonr@gormand.com.au>
 r586@jpeacock:  jpeacock | 2005-07-09 06:54:47 -0400
 Don't use varlog() directly unless you are passing all parameters.
 Don't try to log() anything during loading of logging plugins.
 r587@jpeacock:  jpeacock | 2005-07-09 06:59:57 -0400
 Cannot use new-style hooking with logging plugins (yet).


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@490 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-09 11:03:53 +00:00
Robert Spier
90daeb3786 r483@dog: rspier | 2005-07-06 21:17:00 -0700
The great plugin renaming in the name of inheritance and standardization commit.
 
 1. new concept of standard hook_ names.
 2. Plugin::init
 3. renamed many subroutines in plugins (and cleaned up register subs)
 4. updated README.plugins
 


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@479 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-07 04:17:39 +00:00
Ask Bjørn Hansen
254b4fd2b2 return 500 rather than 521 for DENY in the unrecognized_command hook
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@478 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 22:22:29 +00:00
Matt Sergeant
c3562e256d Allow DENY to be returned from unrecognised_command again
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@476 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 22:16:08 +00:00
Ask Bjørn Hansen
4f0c4d94a1 The unrecognized_command hook now understands the DENY_DISCONNECT return
and the DENY return is deprecated.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@473 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 21:52:45 +00:00
Matt Sergeant
d48cd2e37e No idea what that was doing in there...
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@472 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 20:36:02 +00:00
Matt Sergeant
71f6fc1dff Fix plugin docs to reflect reality
Re-order plugin docs to appear in the order things generally get called
Fix SMTP.pm to reflect what's documented in README.plugins :-)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@471 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 20:30:14 +00:00
Ask Bjørn Hansen
df5a2e9d95 bump version to 0.31-dev
From: 	  hjp@hjp.at
	Subject: 	PATCH: Return 421 if we are going to disconnect
	Date: 	July 3, 2005 1:23:21 PM PDT
	To: 	  qpsmtpd@perl.org

RFC 2821 says we should return 421, if we disconnect, not 450 or 451.

	hp



git-svn-id: https://svn.perl.org/qpsmtpd/trunk@459 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-04 14:39:29 +00:00
Ask Bjørn Hansen
3b7bfe9bce update the MANIFEST
various small tweaks

the README really could use some updating; yikes!


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@457 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-02 02:08:37 +00:00
Ask Bjørn Hansen
9eda52cd2c update changes file for 0.30.
bump version number.

plan to release this on tuesday


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@455 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-02 00:20:21 +00:00
Matt Sergeant
b54c8ec46c Use flatten code instead of the over complex bucket manipulation
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@440 958fd67b-6ff1-0310-b445-bb7760255be9
2005-06-20 21:03:41 +00:00
Matt Sergeant
014efa87c4 Don't delete the buckets
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@437 958fd67b-6ff1-0310-b445-bb7760255be9
2005-06-18 18:58:30 +00:00
Matt Sergeant
8b85efcfe8 There's a hole in my bucket, dear Liza, dear Liza.
There's a hole in my bucket, dear Liza, a hole.

Go fix it, dear Henry, dear Henry, dear Henry.
Go fix it, dear Henry, dear Henry, fix it.

With what shall I fix it, dear Liza ... with what?
With a patch from Joe Schaefer, dear Henry ... with a patch.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@434 958fd67b-6ff1-0310-b445-bb7760255be9
2005-06-17 13:33:57 +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
Matt Sergeant
25f2b302d7 Enforce stricture
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@427 958fd67b-6ff1-0310-b445-bb7760255be9
2005-05-25 16:36:14 +00:00
Matt Sergeant
26c40f989b Fix for in-memory code writing headers twice
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@423 958fd67b-6ff1-0310-b445-bb7760255be9
2005-05-20 12:39:29 +00:00
Ask Bjørn Hansen
6ca4bc388c Fix off-by-one line numbers in warnings from plugins (thanks to
Brian Grossman).

  update changes file with all (?) changes since 0.29


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@411 958fd67b-6ff1-0310-b445-bb7760255be9
2005-05-05 07:44:34 +00:00
John Peacock
a5b362f9ff * lib/Qpsmtpd.pm
Remove needless restriction on temp_file()


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@406 958fd67b-6ff1-0310-b445-bb7760255be9
2005-04-18 14:40:33 +00:00
John Peacock
58ded6369d * lib/Qpsmtpd/Auth.pm
Fix some totally egregious spelling errors
 
 *  plugins/auth/auth_ldap_bind
    New plugin to authenticate against an LDAP database
    Thanks to Elliot Foster <elliotf@gratuitous.net>


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@404 958fd67b-6ff1-0310-b445-bb7760255be9
2005-04-12 19:59:52 +00:00
John Peacock
89fd516d8e Revamp Qpsmtpd::Constants so it is possible to retrieve the text
representation from the numeric (for logging purposes).  Add new logging
plugin, logging/adaptive, which logs at different levels depending on
whether the message was accepted/rejected.
 
 *  lib/Qpsmtpd/Constants.pm
    use hashes for storing return_codes and log_levels
    export accessor methods to retrieve the text representations
 
 *  lib/Qpsmtpd.pm
    Rename log_level() to trace_level() so as to not conflict with the same
    name in Qpsmtpd::Constants.
    Call return_code() to display the text form when logging
 
 *  plugins/logging/adaptive
    Better documentation
    Support named parameters and prefix
    Call return_code() to display the text form when logging
 
 *  plugins/logging/warn
    Include POD

 *  README.logging
    First pass at documenting the logging plugin API

 *  config.sample/loglevel
    New numbering scheme to map directly to syslog levels


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@401 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-29 20:15:53 +00:00
Matt Sergeant
172fee0798 Fix for corruption problem under Apache
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@400 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-27 17:54:35 +00:00
John Peacock
f72647a44c * lib/Qpsmtpd.pm
(_load_plugins): split plugin_line using awk style "magic" whitespace


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@399 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-25 12:30:37 +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
Matt Sergeant
6ecc991a20 body_write patches from Brian Grossman
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@394 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-10 18:18:28 +00:00
Matt Sergeant
321622f0aa Store mail in memory up to a certain threshold (default 10k).
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@385 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-08 18:09:49 +00:00
Ask Bjørn Hansen
3c5d0d93e4 bump version number up
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@384 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-04 19:18:30 +00:00
Ask Bjørn Hansen
db546fe91c prepare 0.29
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@379 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-03 02:30:16 +00:00
John Peacock
ec7aff1415 * lib/Qpsmtpd.pm
Use package lexical to cache spool dir location instead of storing in
    Transaction or other high level object


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@376 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-01 14:33:26 +00:00
John Peacock
f82dffe5ce * lib/Qpsmtpd/SMTP.pm
Copy all lines of incoming message to spool file and keep track of
    where the body lines started (ease use of inplace scanning for
    viruses).

*   lib/Qpsmtpd/Transaction.pm
    New function body_start() to get/set the body in spool file
    Tweak body_resetpos() and body_getline() to use body_start instead of 0


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@375 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-01 14:31:25 +00:00
John Peacock
e503c04ed2 * lib/Qpsmtpd/SMTP.pm
Require a domain/address be given in HELO or EHLO command


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@374 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-25 16:18:08 +00:00
John Peacock
bb36c60b6a Abstracted spool_dir creation and added temp_file() and temp_dir() subs to
make it easier for plugins to manage temporary workspace.  Also add POD and
tests for the new functions.  Still need to add tests to the temp_*() calls
from a plugin.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@369 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-22 02:47:39 +00:00
Ask Bjørn Hansen
d0b9558ce9 APR::Bucket API changed...
From: peter[at]boku.net (Peter Eisch)
Message-ID: <BE3F8D10.1C451%peter[at]boku.net>
Subject: Apache::Qpsmptd.pm patch
Date: Mon, 21 Feb 2005 13:05:20 -0600


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@367 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-21 21:48:45 +00:00
John Peacock
31a8e7d438 Lets the data hook handle missing envelope sender/recipient,
then falls back to the builtin 503 response (Brian Gross)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@359 958fd67b-6ff1-0310-b445-bb7760255be9
2005-01-30 17:40:11 +00:00
Matt Sergeant
d26797c6d2 Make the original string available in the Connection notes
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@357 958fd67b-6ff1-0310-b445-bb7760255be9
2005-01-30 05:40:24 +00:00
John Peacock
c840a1d04f Changes by jpeacock@cpan.org (John Peacock)
o plugins/check_badmailfromto
    - New plugin in the style of check_badmailfrom, which matches a pair
      of FROM/TO and makes it seem like the recipient's address no longer
      exists (but only from the matching sender's point of view).  Useful
      for stalkers and other harassment cases.

o plugins/dns_whitelist_soft
    - New plugin to provide a DNS-based whitelist (good for distributed
      sites).

o various files
    - Replaced tab character with 8 spaces and adjusted line breaks for
      better readability.

Changes by mct@toren.net (Michael C. Toren)

o lib/Qpsmtpd/SMTP.pm

    - Assumes a MAIL FROM value of "<#@[]>" (utilized by qmail to
      indicate a null sender when generating a doublebounce message)
      is equivalent to "<>".  Previously qpsmtpd complained that the
      value could not be parsed.

    - Adds LOGIN to the default list of supported auth mechanisms.
      The documentation in Auth.pm indicated that auth-login was not
      currently supported due to lack of functionality, however I can
      confirm that LOGIN appears to work fine as tested by using msmtp
      (http://msmtp.sourceforge.net/).  Are there any indications that
      LOGIN support is actually broken in the current implementation?

    - Removes the "X-Qpsmtpd-Auth: True" header appended when a message
      has been sent by an authenticated user.  One problem with such a
      header is that it's impossible to say which SMTP hop added it,
      and it provides no information which could be used to backtrack
      the transaction.  I grepped through my mail archives a bit
      looking for how other MTAs handled the problem, and decided it
      would be best to place this information in the Received: header:

        Received: from remotehost (HELO remotehost) (192.168.42.42)
          (smtp-auth username foo, mechanism cram-md5)
          by mail.netisland.net (qpsmtpd/0.28) with ESMTP; <date>


o lib/Qpsmtpd/Auth.pm:

    - Documentation update for the arguments passed to an auth
      handler; previously the $mechanism argument was not mentioned,
      which threw off the argument offsets.

    - Documentation update for auth-login removing the warning
      that auth-login is not currently supported due to lack of
      functionality.

    - Fix to execute a generic auth hook when a more specific
      auth-$mechanism hook does not exist.  (Previously posted
      to the list last week.)

    - Upon authentication, sets $session->{_auth_user} and
      $session->{_auth_mechanism} so that SMTP.pm can include them
      in the Received: header.


o plugins/queue/qmail-queue

    - Added a timestamp and the qmail-queue qp identifier to the
      "Queued!" 250 message, for compatibility with qmail-smtpd, which
      can be very useful for tracking message delivery from machine to
      machine.  For example, the new 250 message might be:

        250 Queued! 1105927468 qp 3210 <1105927457@netisland.net>

      qmail-smtpd returns:

        250 ok 1106546213 qp 7129

      Additionally, for consistency angle brackets are placed around
      the Message-ID displayed in the 250 if they were missing in the
      message header.


o plugins/check_badmailfrom:

    - Changed the error message from "Mail from $bad not accepted
      here" to "sorry, your envelope sender is in my badmailfrom
      list", for compatibility with qmail-smtpd.  I didn't see any
      reason to share with the sender the value of $bad, especially
      for situations where the sender was rejected resulting from a
      wildcard.


o plugins/check_earlytalker:
o plugins/require_resolvable_fromhost:

    - No longer checks for earlytalkers or resolvable senders if the
      connection note "whitelistclient" is set, which is nice for
      helping backup MX hosts empty their queue faster.


o plugins/count_unrecognized_commands:

    - Return code changed from DENY_DISCONNECT, which isn't valid in
      an unrecognized_command hook, to DENY, which in this context
      drops the connection anyway.  (Previously posted to the list
      last week.)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@356 958fd67b-6ff1-0310-b445-bb7760255be9
2005-01-28 03:30:50 +00:00
Robert Spier
0a2fc866de - logging tweaks..
- move some things to more appropriate levels
   - make 'running plugin' more interesting


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@348 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-27 06:46:21 +00:00
Robert Spier
1670530a1a more logging
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@347 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-27 06:41:06 +00:00
Robert Spier
e10bb78cd3 - modify some comments about timeouts
- remove extraneous pid's from log messages


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@346 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-27 06:38:32 +00:00
Robert Spier
ebcb01a54f Subject: [PATCH] Use timeoutsmtpd as well as timeout
from Justin Erenkrantz and John Peacock


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@344 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-25 19:50:18 +00:00
Matt Sergeant
09531ad70c To balance out with the rcpt logging diff'd against the CVS version
(peter@boku.net)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@343 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-22 20:50:57 +00:00
Matt Sergeant
bfd609fb32 Fix timeout config warnings.
Fix alarm not being reset at end of while loop


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@342 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-19 08:44:24 +00:00
Matt Sergeant
4c44510191 Move plugin compile code into the Plugin module
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@341 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-18 19:47:10 +00:00
Matt Sergeant
e2bb53901d Connection handler for mod_perl/apache 2.0
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@334 958fd67b-6ff1-0310-b445-bb7760255be9
2004-10-12 07:39:04 +00:00
John Peacock
f6b01fb36b * lib/Qpsmtpd/Address.pm
Change subdomain regex to match single character subdomains
     (Robert Spier)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@332 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-24 18:56:35 +00:00
John Peacock
b5ef3d3add Couple of minor cleanups
*    lib/Qpsmtpd/Transaction.pm
     Forgot to nuke POD for deprecated relaying()

*    plugins/auth/auth_vpopmail_sql
     Log who actually AUTHenticated

*    plugins/virus/uvscan
     Don't need to unlink the file (Qpsmtpd will take care of it)
     Log the machine that did the actual Antivirus scanning


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@329 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-23 18:54:58 +00:00
John Peacock
03455aff9a Add username for AUTH success/failure log entry
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@328 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-23 16:14:56 +00:00
John Peacock
b9646eef75 Remove the $transaction->relaying() code completely
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@327 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-23 13:51:09 +00:00
John Peacock
f92e99bd9c * plugins/check_relay
*   plugins/rcpt_ok
    Split check_relay into two plugins

*   config/plugins
    Reorder plugins to take advantage of the new check_relay

*   lib/Qpsmtpd/Connection.pm
    Add support for relay_client() method

*   lib/Qpsmtpd/SMTP.pm
    Copy connection relay settings to transaction object when created

*   lib/Qpsmtpd/Auth.pm
    Use the connection->relay_client() instead of setting an env var


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@326 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-22 16:01:16 +00:00
Matt Sergeant
11c12711ee Fix deny plugin which stopped working.
Call deny plugin for _DISCONNECT constants.
Make Plugin.pm %hooks a global rather than lexical so we can do evil things later.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@320 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-19 18:49:05 +00:00