> Hi List,
>
> I have a big problem here setting up my first RA. The compilation and
> installation worked fine but when I try to start the ra by issuing
> openca_rc start I receive this error and the ra does not start up. My
> system is a Debian 3.0 Woody and I use a self compiled  oppenssl 0.9.7c
>  in /usr/local/ssl. Can anyone help me, or do I need to specify my
> module configuration, please?
>
> Starting OpenCA ...
> unix dgram connect: No such file or directory at
> /usr/local/openca/modules/perl5/OpenCA/Logger/Syslog/Sys.pm line 52 PKI

This signals a problem with Sys.pm. I never see such a problem but I
attached a changed version of Sys.pm with a better errordetection.
Nevertheless an error from Sys::Syslog during openlog means that there is
a general problem with your system log.

You can deactivate this logging facility in etc/log.xml.

Michael

## OpenCA::Logger::Syslog::Sys.pm 
##
## Copyright (C) 2003 Michael Bell <[EMAIL PROTECTED]>
## All rights reserved.
##
##    This library is free software; you can redistribute it and/or
##    modify it under the terms of the GNU Lesser General Public
##    License as published by the Free Software Foundation; either
##    version 2.1 of the License, or (at your option) any later version.
##
##    This library is distributed in the hope that it will be useful,
##    but WITHOUT ANY WARRANTY; without even the implied warranty of
##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
##    Lesser General Public License for more details.
##
##    You should have received a copy of the GNU Lesser General Public
##    License along with this library; if not, write to the Free Software
##    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
##

use strict;

package OpenCA::Logger::Syslog::Sys;

use Sys::Syslog qw(:DEFAULT setlogsock);

($OpenCA::Logger::Syslog::Sys::VERSION = '$Revision: 1.2 $' )=~ s/(?:^.*: 
(\d+))|(?:\s+\$$)/defined $1?"0\.9":""/eg;

# Preloaded methods go here.

## Create an instance of the Class
sub new {
    my $that = shift;
    my $class = ref($that) || $that;

    my $self = {};

    bless $self, $class;

    my $keys = { @_ };

    ## load config
    $self->{prefix}      = $keys->{prefix};
    $self->{socket_type} = 'unix';
    $self->{socket_type} = $keys->{socket_type} if $keys->{socket_type};
    $self->{facility}    = $keys->{facility};

    my $header = "OpenCA MASTER ALERT: OpenCA::Logger::Syslog::Sys";

    if (not setlogsock $self->{socket_type}) {
        print STDERR "$header: Cannot set the logging socket (socket_type: ".
                     $self->{socket_type}.")\n";
        return undef;
    }

    if (not openlog $self->{prefix}, 'pid,perror,ndelay', $self->{facility})
    {
        print STDERR "$header: Cannot open the logging system\n";
        print STDERR "$header: ident: ".$self->{prefix}."\n";
        print STDERR "$header: logopt: pid,perror,ndelay\n";
        print STDERR "$header: facility: ".$self->{facility}."\n";
        return undef;
    }

    return $self;
}

sub addMessage {
    my $self     = shift;
    my $msg      = $_[0];

    return undef if (not ref $msg);

    ## build priority
    $_ = $msg->getLevel;
    SWITCH : {
        $self->{priority} = "";
        $self->{priority} = "|emerg"   if (/EMERG/i);
        $self->{priority} = "|alert"   if (/ALERT/i);
        $self->{priority} = "|crit"    if (/CRIT/i);
        $self->{priority} = "|err"     if (/ERR/i);
        $self->{priority} = "|warning" if (/WARNING/i);
        $self->{priority} = "|notice"  if (/NOTICE/i);
        $self->{priority} = "|info"    if (/INFO/i);
        $self->{priority} = "|debug"   if (/DEBUG/i);
    }
    $self->{priority} =~ s/^\|//;

    return undef if (not syslog $self->{priority}, $msg->getXML);

    return 1;
}

sub DESTROY {
    my $self = shift;
    
    return undef if (not closelog);

    return 1;
}

1;

__END__

Reply via email to