Author: jpeacock
Date: Thu Sep 14 12:48:37 2006
New Revision: 659

Added:
   branches/0.3x/plugins/relay_only
Modified:
   branches/0.3x/Changes
   branches/0.3x/lib/Qpsmtpd/TcpServer/Prefork.pm
   branches/0.3x/plugins/auth/auth_vpopmail_sql
   branches/0.3x/plugins/count_unrecognized_commands
   branches/0.3x/qpsmtpd-prefork

Log:
Ask and ye shall receive

Modified: branches/0.3x/Changes
==============================================================================
--- branches/0.3x/Changes       (original)
+++ branches/0.3x/Changes       Thu Sep 14 12:48:37 2006
@@ -1,4 +1,5 @@
 0.33
+  relay_only plugin for smart relay host. (John Peacock)
 
   Experimental IPv6 support (forkserver only). (Mike Williams)
 

Modified: branches/0.3x/lib/Qpsmtpd/TcpServer/Prefork.pm
==============================================================================
--- branches/0.3x/lib/Qpsmtpd/TcpServer/Prefork.pm      (original)
+++ branches/0.3x/lib/Qpsmtpd/TcpServer/Prefork.pm      Thu Sep 14 12:48:37 2006
@@ -30,7 +30,7 @@
       $_ =~ s/\r?\n$//s; # advanced chomp
       $self->log(LOGDEBUG, "dispatching $_");
       $self->connection->notes('original_string', $_);
-      defined $self->dispatch(split / +/, $_)
+      defined $self->dispatch(split / +/, $_, 2)
         or $self->respond(502, "command unrecognized: '$_'");
       alarm $timeout;
     }

Modified: branches/0.3x/plugins/auth/auth_vpopmail_sql
==============================================================================
--- branches/0.3x/plugins/auth/auth_vpopmail_sql        (original)
+++ branches/0.3x/plugins/auth/auth_vpopmail_sql        Thu Sep 14 12:48:37 2006
@@ -65,7 +65,7 @@
 
     my $connect  = "dbi:mysql:dbname=vpopmail";
     my $dbuser   = "vpopmailuser";
-    my $dbpasswd = "**********";
+    my $dbpasswd = "vpoppasswd";
 
     my $dbh = DBI->connect( $connect, $dbuser, $dbpasswd );
     $dbh->{ShowErrorStatement} = 1;

Modified: branches/0.3x/plugins/count_unrecognized_commands
==============================================================================
--- branches/0.3x/plugins/count_unrecognized_commands   (original)
+++ branches/0.3x/plugins/count_unrecognized_commands   Thu Sep 14 12:48:37 2006
@@ -25,8 +25,13 @@
     $self->{_unrec_cmd_max} = 4;
   }
 
-  $qp->connection->notes('unrec_cmd_count', 0);
+}
+
+sub hook_connect {
+  my ($self, $transaction) = @_;
 
+  $self->qp->connection->notes('unrec_cmd_count', 0);
+  return DECLINED;
 }
 
 sub hook_unrecognized_command {

Added: branches/0.3x/plugins/relay_only
==============================================================================
--- (empty file)
+++ branches/0.3x/plugins/relay_only    Thu Sep 14 12:48:37 2006
@@ -0,0 +1,35 @@
+#!/usr/bin/perl -w
+=head1 NAME
+
+relay_only - this plugin only permits relaying
+
+=head1 SYNOPSIS
+
+# in config/plugins
+
+check_relay
+
+relay_only
+
+# other rcpt hooks go here
+
+=head1 DESCRIPTION
+
+This plugin can be used for the case where a server is used as the smart
+relay host for internal users and external/authenticated users, but should
+not be considered a normal inbound MX server
+
+It should be configured to be run _AFTER_ check_relay and before other
+RCPT hooks!  Only clients that have authenticated or are listed in the
+relayclient file will be allowed to send mail.
+
+=cut
+
+sub hook_rcpt {
+  if ( shift->qp->connection->relay_client ) {
+    return (OK);
+  }
+  else {
+    return (DENY);
+  }
+}

Modified: branches/0.3x/qpsmtpd-prefork
==============================================================================
--- branches/0.3x/qpsmtpd-prefork       (original)
+++ branches/0.3x/qpsmtpd-prefork       Thu Sep 14 12:48:37 2006
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -Tw
 # High performance pre-forking qpsmtpd daemon, Copyright (C) 2006 SoftScan
 # http://www.softscan.co.uk
 #
@@ -96,6 +96,8 @@
     'help'            => \&usage,
   ) || &usage;
 
+$user  = $1 if ($user  =~ /(\w+)/);
+
 # set max from ip to max number of children if option is set to disabled
 $maxconnip = $max_children if ($maxconnip == 0);
 
@@ -336,7 +338,7 @@
     # continue to accept connections until "old age" is reached
     for (my $i = 0 ; $i < $child_lifetime ; $i++) {
         # accept a connection
-        $0 = 'qpsmtpd child';    # set pretty child name in process listing
+        #$0 = 'qpsmtpd child';    # set pretty child name in process listing
         my ($client, $iinfo) = $d->accept()
           or die
           "failed to create new object - $!";  # wait here until client 
connects

Reply via email to