Subject: pkg/11774: perl5.004_04 doesn't syslog
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mlelstv@serpens.de>
List: netbsd-bugs
Date: 12/19/2000 02:00:15
>Number:         11774
>Category:       pkg
>Synopsis:       perl5.004_04 Sys::Syslog doesn't log to syslogd
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 19 02:00:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Michael van Elst Mlelstv
>Release:        NetBSD-1.5-release
>Organization:
-dis
>Environment:
	
System: NetBSD duffy 1.5.1_ALPHA NetBSD 1.5.1_ALPHA (DUFFY) #0: Mon Dec 18 11:45:51 MET 2000 src@duffy:/home/src/sys/arch/i386/compile/DUFFY i386


>Description:
The perl module Sys::Syslog can use either UDP or a UNIX domain socket
to communicate with syslogd.

In the default setup it uses UDP and log messages are not received by
syslogd because the secure default for syslogd is to accept only
local messages though a UNIX domain socket.

perl5.004_03 added the setlogsock method to specify wether the logging
should be done through UDP or a UNIX domain socket. However, switching
to the latter yields EPROTOTYPE because the UNIX domain socket is opened
as SOCK_STREAM.

>How-To-Repeat:

use Sys::Syslog;

syslog('user|info',"Test 1\n");
Sys::Syslog::setlogsock 'unix';
syslog('user|info',"Test 2\n");

>Fix:

Change /usr/pkg/lib/perl5/Sys/Syslog.pm:251 to:

        socket(SYSLOG,AF_UNIX,SOCK_DGRAM,0)              || croak "open: $!";

and always use setlogsock in your scripts if you use a secured syslogd.

I don't know who is at error. perl for trying to use a SOCK_STREAM socket
or NetBSD for using a SOCK_DGRAM socket. At least this misbehaviour should
be documented with the perl package.

>Release-Note:
>Audit-Trail:
>Unformatted: