Lapo Luchini wrote:
> Or should I roll up my sleeves and learn enough Perl to load the modules
> and call sendPreparedMails("crin") myself?
>   
Well, I did, this seems to work (though suggestions are of course welcome):

#!/usr/bin/perl
## Base requirements
require 5.001;

use lib '/usr/local/openca-02/modules/perl5';

package OpenCA;

use strict;
use vars qw (@ISA);;
no warnings;

use OpenCA::Configuration;
use Cwd;
use POSIX;
use Locale::Messages (':locale_h');
use Locale::Messages (':libintl_h');
use Locale::Messages qw (nl_putenv);

our (%AUTOCONF, $common_libs, $config);
our ($dbconfig, $dbiconfig, $DBCONFIG, $DBICONFIG, $role_config);
our ($crypto_layer, $access_control, %access_control_cache);
our ($cryptoShell, $tools, $db, $cmd, $self, $query, $session);
our ($versions, $errno, $errval, $log, $journal);
our ($xml_cache, $ui_html);

%AUTOCONF = ();
$AUTOCONF {"lib_prefix"}     = "/usr/local/openca-02/openca/lib";
$AUTOCONF {"etc_prefix"}     = "/usr/local/openca-02/openca/etc";
$AUTOCONF {"var_prefix"}     = "/usr/local/openca-02/openca/var";
$AUTOCONF {"config_prefix"}  = "common";
$AUTOCONF {"VERSION"}        = "0.9.2";
$AUTOCONF {"PROGRAM"}        = "OpenCA Server";
$AUTOCONF {"httpd_user"}     = "apache";
$AUTOCONF {"httpd_group"}    = "apache";

my $CONFIG = $AUTOCONF {"etc_prefix"}.'/servers/'.$AUTOCONF
{"config_prefix"}.'.
conf';
if (not -e $CONFIG)
{
    my $pwd = `pwd`;
    chdir $AUTOCONF {"etc_prefix"}."/servers";
    opendir DIR, ".";
    my @list = grep /\.conf$/, readdir DIR;
    closedir DIR;
    symlink $list[0], $CONFIG;
}

$config = new OpenCA::Configuration;
if( not defined (my $ret = $config->loadCfg( "$CONFIG" )) ) {
        print STDERR "Error while loading configuration ($CONFIG)!";
        print "Content-type: text/html\n\n";
        print "Error while loading configuration ($CONFIG)!";
        exit 100;
}

$common_libs  = $config->getParam('CgiLibPath')->{VALUES}->[0];

require "$common_libs/misc-utils.lib";
require "$common_libs/export-import.lib";
require "$common_libs/mail-utils.lib";

sendPreparedMails("default");
sendPreparedMails("crin");

exit 0;

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to