Adds the ability to config setlogsock() prior to openlog.

--- qpsmtpd-0.32/plugins/logging/syslog 2006-02-26 06:22:16.000000000 -0600
+++ qpsmtpd/plugins/logging/syslog      2006-10-20 14:26:54.000000000 -0500
@@ -17,7 +17,7 @@ configuration file:
 
 =over
 
-logging/syslog [loglevel l] [priority p] [ident str] [facility f]
+logging/syslog [loglevel l] [priority p] [ident str] [facility f] [logsock
t]
 
 For example:
 
@@ -74,11 +74,27 @@ The default is 'qpsmtpd'.
 The syslog facility to which logged mesages will be directed.  See
syslog(3)
 for details.  The default is LOG_MAIL.
 
+=item B<logsock>
+
+The syslog socket where messages should be sent via syslogsock().  The
valid
+options are 'udp', 'tcp', 'unix', 'stream' and 'console'.  Not all are
+available on all systems.  See Sys::Syslog for details.  The default is
+the above list in that order.  To select specific sockets, use a comma to
+separate the types.
+
+=over 
+
+    logsock udp,unix
+    logsock stream
+
+=back
+
 =back
 
 =head1 AUTHOR
 
 Devin Carraway <[EMAIL PROTECTED]>
+Peter Eisch <[EMAIL PROTECTED]> (logsock support)
 
 =head1 LICENSE
 
@@ -92,7 +108,7 @@ Please see the LICENSE file included wit
 use strict;
 use warnings;
 
-use Sys::Syslog;
+use Sys::Syslog qw(:DEFAULT setlogsock);
 
 sub register {
     my ($self, $qp, @args) = @_;
@@ -133,6 +149,11 @@ sub register {
         $facility = $1;
     }
 
+    if ($args{logsock}) {
+       my @logopt = split(/,/, $args{logsock});
+       setlogsock(@logopt);
+    }
+
     unless (openlog $ident, $logopt, $facility) {
         warn "Error opening syslog output";
         return;


Reply via email to