You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2010/03/10 03:52:59 UTC
svn commit: r921213 - in /spamassassin/branches/3.3:
lib/Mail/SpamAssassin/Logger/Syslog.pm spamd/spamd.raw
Author: mmartinec
Date: Wed Mar 10 02:52:59 2010
New Revision: 921213
URL: http://svn.apache.org/viewvc?rev=921213&view=rev
Log:
Bug 6267: Solaris 10 requires --syslog-socket=native
Modified:
spamassassin/branches/3.3/lib/Mail/SpamAssassin/Logger/Syslog.pm
spamassassin/branches/3.3/spamd/spamd.raw
Modified: spamassassin/branches/3.3/lib/Mail/SpamAssassin/Logger/Syslog.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.3/lib/Mail/SpamAssassin/Logger/Syslog.pm?rev=921213&r1=921212&r2=921213&view=diff
==============================================================================
--- spamassassin/branches/3.3/lib/Mail/SpamAssassin/Logger/Syslog.pm (original)
+++ spamassassin/branches/3.3/lib/Mail/SpamAssassin/Logger/Syslog.pm Wed Mar 10 02:52:59 2010
@@ -72,12 +72,16 @@ sub init {
my ($self) = @_;
my $log_socket = $self->{log_socket};
+ $log_socket = '' if !defined $log_socket;
- dbg("logger: trying to connect to syslog/$log_socket ...\n");
my $eval_stat;
eval {
- defined(setlogsock($log_socket))
- or die "setlogsock($log_socket) failed: $!";
+ if ($log_socket eq '') {
+ # calling setlogsock is optional, let Sys::Syslog choose a default
+ } else {
+ dbg("logger: calling setlogsock($log_socket)");
+ setlogsock($log_socket) or die "setlogsock($log_socket) failed: $!";
+ }
dbg("logger: opening syslog with $log_socket socket");
# the next call is required to actually open the socket
openlog($self->{ident}, 'cons,pid,ndelay', $self->{log_facility});
@@ -90,11 +94,13 @@ sub init {
# Solaris sometimes doesn't support UNIX-domain syslog sockets apparently;
# the same is true for perl 5.6.0 build on an early version of Red Hat 7!
# In these cases we try it with INET instead.
+ # See also Bug 6267 and Bug 6331.
+
if (defined($eval_stat) && $log_socket ne 'inet') {
- dbg("logger: trying to connect to syslog/inet...");
+ dbg("logger: trying setlogsock('inet')");
undef $eval_stat;
eval {
- defined(setlogsock('inet')) or die "setlogsock('inet') failed: $!";
+ setlogsock('inet') or die "setlogsock('inet') failed: $!";
dbg("logger: opening syslog using inet socket");
openlog($self->{ident}, 'cons,pid,ndelay', $self->{log_facility});
1;
Modified: spamassassin/branches/3.3/spamd/spamd.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.3/spamd/spamd.raw?rev=921213&r1=921212&r2=921213&view=diff
==============================================================================
--- spamassassin/branches/3.3/spamd/spamd.raw (original)
+++ spamassassin/branches/3.3/spamd/spamd.raw Wed Mar 10 02:52:59 2010
@@ -420,14 +420,34 @@ if ( $listen_ssl ) {
# of a specific logfile
my $log_facility = $opt{'syslog'} || 'mail';
-# The socket to log over can be changed on the command line with the
-# --syslog-socket flag. Logging to any file handler (either a specific log
-# file or STDERR) is internally represented by a socket 'file', no logging
-# at all is 'none'. The latter is different from --syslog-socket=none which
-# gets mapped to --syslog=stderr and such --syslog-socket=file. An internal
-# socket of 'none' means as much as --syslog=null. Sounds complicated? It is.
-# But it works.
-my $log_socket = lc($opt{'syslog-socket'}) || 'unix';
+# The --syslog-socket option specifies one of the possible socket types or
+# logging mechanisms as accepted by the Sys::Syslog::setlogsock() subroutine.
+# Depending on a version of Sys::Syslog and on the underlying operating system,
+# one of the following values (or their subset) can be used: native, eventlog,
+# tcp, udp, inet, unix, stream, pipe, console. The value 'eventlog' is
+# specific to Win32 events logger and requires a perl module Win32::EventLog.
+#
+# In addition to values acceptable by Sys::Syslog::setlogsock(),
+# a --syslog-socket=none is mapped to --syslog=stderr and $log_socket='file'.
+#
+# A value 'file' in variable $log_socket implies logging to any file handler
+# (either a specific log file or STDERR), A value 'none' in $log_socket
+# represents no logging, equivalent to --syslog=null.
+#
+# (old text: The socket to log over can be changed on the command line with
+# the --syslog-socket flag. Logging to any file handler (either a specific log
+# file or STDERR) is internally represented by a socket 'file', no logging
+# at all is 'none'. The latter is different from --syslog-socket=none which
+# gets mapped to --syslog=stderr and such --syslog-socket=file. An internal
+# socket of 'none' means as much as --syslog=null. Sounds complicated? It is.
+# But it works.
+# )
+my $log_socket = lc($opt{'syslog-socket'});
+
+if (!defined $log_socket || $log_socket eq '') {
+ $log_socket =
+ Mail::SpamAssassin::Util::am_running_on_windows() ? 'none' : 'unix';
+}
# This is the default log file; it can be changed on the command line
# via a --syslog flag containing non-word characters.
@@ -3033,17 +3053,28 @@ considered a fatal error.)
=item B<--syslog-socket>=I<type>
-Specify how spamd should send messages to syslogd. The options are C<unix>,
-C<inet> or C<none>. The default is to try C<unix> first, falling back to
-C<inet> if perl detects errors in its C<unix> support.
-
-Some platforms, or versions of perl, are shipped with dysfunctional versions of
-the B<Sys::Syslog> package which do not support some socket types, so you may
-need to set this. If you get error messages regarding B<__PATH_LOG> or similar
-from spamd, try changing this setting.
+Specify how spamd should send messages to syslogd. The I<type> can be any
+of the socket types or logging mechanisms as accepted by the subroutine
+Sys::Syslog::setlogsock(). Depending on a version of Sys::Syslog and on the
+underlying operating system, one of the following values (or their subset) can
+be used: C<native>, C<eventlog>, C<tcp>, C<udp>, C<inet>, C<unix>, C<stream>,
+C<pipe>, or C<console>. The value C<eventlog> is specific to Win32 events
+logger and requires a perl module Win32::EventLog to be installed.
+For more information please consult the Sys::Syslog documentation.
+
+A historical setting --syslog-socket=none is mapped to --syslog=stderr.
+
+A default for Windows platforms is C<none>, otherwise the default is
+to try C<unix> first, falling back to C<inet> if perl detects errors
+in its C<unix> support.
+
+Some platforms, or versions of perl, are shipped with old or dysfunctional
+versions of the B<Sys::Syslog> module which do not support some socket types,
+so you may need to set this option explicitly. If you get error messages
+regarding B<__PATH_LOG> or similar spamd, try changing this setting.
-The socket type C<file> is used internally and should not be specified. Use
-the C<-s> switch instead.
+The socket types C<file> is used internally and should not be specified.
+Use the C<-s> switch instead.
=item B<-u> I<username>, B<--username>=I<username>
@@ -3128,7 +3159,7 @@ please see the documentation at:
=item B< --ipv4only>, B<--ipv4-only>, B<--ipv4>
Do not use IPv6 for DNS tests. Use if the existing tests
-for IPv6 availablity produce incorrect results or crashes.
+for IPv6 availability produce incorrect results or crashes.
=item B<-L>, B<--local>