From: Dietmar Maurer Date: Fri, 14 Apr 2017 13:08:28 +0000 (+0200) Subject: remove msgquote hack - syslog already work correctly X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=b902c0b8c9851e433379aea3f9b161df581db525;p=pmg-api.git remove msgquote hack - syslog already work correctly This was a workaround for a syslog bug, fixed long time ago ... --- diff --git a/PMG/Config.pm b/PMG/Config.pm index e2c4988..ab468df 100755 --- a/PMG/Config.pm +++ b/PMG/Config.pm @@ -1129,7 +1129,7 @@ sub rewrite_config_spam { PVE::Tools::run_command(['razor-admin', '-register'], timeout => $timeout); }; my $err = $@; - syslog('info', msgquote ("registering razor failed: $err")) if $err; + syslog('info', "registering razor failed: $err") if $err; } } @@ -1208,7 +1208,7 @@ sub rewrite_config_postfix { eval { PMG::Utils::gen_proxmox_tls_cert(); }; - syslog ('info', msgquote ("generating certificate failed: $@")) if $@; + syslog ('info', "generating certificate failed: $@") if $@; } $changes = 1 if $self->rewrite_config_file( diff --git a/PMG/DBTools.pm b/PMG/DBTools.pm index 3763cd4..08be5b0 100644 --- a/PMG/DBTools.pm +++ b/PMG/DBTools.pm @@ -1267,9 +1267,7 @@ sub cluster_sync_status { $dbh->disconnect() if $dbh; - if ($err) { - syslog('err', PMG::Utils::msgquote($err)); - } + syslog('err', $err) if $err; return $minmtime; } diff --git a/PMG/RuleCache.pm b/PMG/RuleCache.pm index 2a2b0b5..8e34672 100644 --- a/PMG/RuleCache.pm +++ b/PMG/RuleCache.pm @@ -155,7 +155,7 @@ sub new { $dbh->rollback; # end transaction - syslog ('err', PMG::Utils::msgquote("unable to load rulecache : $err")) if $err; + syslog ('err', "unable to load rulecache : $err") if $err; $self->{rules} = $rules; diff --git a/PMG/Service/pmgmirror.pm b/PMG/Service/pmgmirror.pm index c8b7d1b..8ffb868 100644 --- a/PMG/Service/pmgmirror.pm +++ b/PMG/Service/pmgmirror.pm @@ -96,7 +96,7 @@ sub run { eval { cluster_sync(); }; if (my $err = $@) { - syslog('err', PMG::Utils::msgquote ("sync error: $err")); + syslog('err', "sync error: $err"); } $cycle++; diff --git a/PMG/Utils.pm b/PMG/Utils.pm index 6711150..13fe18d 100644 --- a/PMG/Utils.pm +++ b/PMG/Utils.pm @@ -94,12 +94,6 @@ PVE::JSONSchema::register_standard_option('username', { maxLength => 64, }); -sub msgquote { - my $msg = shift || ''; - $msg =~ s/%/%%/g; - return $msg; -} - sub lastid { my ($dbh, $seq) = @_; diff --git a/bin/pmg-daily b/bin/pmg-daily index e111935..edbfd00 100755 --- a/bin/pmg-daily +++ b/bin/pmg-daily @@ -84,7 +84,7 @@ if ($statlifetime && $statlifetime > 0) { }; if (my $err = $@) { $dbh->rollback if $dbh; - syslog('err', PMG::Utils::msgquote($err)); + syslog('err', $err); } else { syslog('info', "cleanup removed $srows entries from " . "statistic database ($srows, $rrows)") if $srows; diff --git a/bin/pmg-smtp-filter b/bin/pmg-smtp-filter index b075691..a333163 100755 --- a/bin/pmg-smtp-filter +++ b/bin/pmg-smtp-filter @@ -513,7 +513,7 @@ sub run_dequeue { PMG::Utils::update_node_status_rrd(); }; if ($err = $@) { - $self->log(0, PMG::Utils::msgquote("ERROR: $err")); + $self->log(0, "ERROR: $err"); # continue } @@ -531,7 +531,7 @@ sub run_dequeue { $dbh = PMG::DBTools::open_ruledb($database); }; if ($err = $@) { - $self->log (0, PMG::Utils::msgquote("ERROR: $err")); + $self->log (0, "ERROR: $err"); return; } @@ -544,7 +544,7 @@ sub run_dequeue { my $ptime = int (($csec_end-$csec)*1000 + ($usec_end - $usec)/1000); if ($err) { - $self->log (0, PMG::Utils::msgquote($err)); + $self->log (0, $err); } else { $self->log (2, "end database maintainance ($ptime ms)"); } diff --git a/bin/pmgpolicy b/bin/pmgpolicy index 898f1b4..22f8332 100755 --- a/bin/pmgpolicy +++ b/bin/pmgpolicy @@ -118,7 +118,7 @@ sub run_dequeue { my $err = $@; if ($err) { - $self->log(0, PMG::Utils::msgquote("ERROR: $err")); + $self->log(0, "ERROR: $err"); return; } @@ -209,7 +209,7 @@ sub run_dequeue { # this produces too much log traffic # my $targets = join (", ", @rcvrs); #my $msg = "expire mail $ref->{instance} from $ref->{sender} to $targets"; - #$self->log (0, PMG::Utils::msgquote ($msg)); + #$self->log (0, $msg); } $dbh->do ($cmds) if $cmds; @@ -233,7 +233,7 @@ sub run_dequeue { if ($err) { $dbh->rollback if $dbh; - $self->log(0, PMG::Utils::msgquote($err)); + $self->log(0, $err); } else { $self->log(2, "end greylist database maintainance ($ptime ms)"); } @@ -304,7 +304,7 @@ sub load_config { $self->{rulecache} = PMG::RuleCache->new($self->{ruledb}); }; if (my $err = $@) { - $self->log(0, PMG::Utils::msgquote("ERROR: unable to load database : $err")); + $self->log(0, "ERROR: unable to load database : $err"); } $self->{reload_config} = 0; @@ -344,7 +344,7 @@ sub child_init_hook { hostname => $self->{fqdn}, dns_resolver => $self->{dns_resolver}); }; if (my $err = $@) { - $self->log(0, PMG::Utils::msgquote($err)); + $self->log(0, $err); $self->child_finish_hook; exit(-1); } @@ -482,7 +482,7 @@ sub greylist_value { }; my $err = $@; if ($err) { - $self->log(0, PMG::Utils::msgquote("unable to reconnect to database server: $err")); + $self->log(0, "unable to reconnect to database server: $err"); return 'dunno'; } $self->{ruledb} = PMG::RuleDB->new($dbh); @@ -544,7 +544,7 @@ sub greylist_value { if ($err) { $err = $err->text if UNIVERSAL::isa ($err, 'Mail::SPF::Exception'); - $self->log (0, PMG::Utils::msgquote($err)); + $self->log (0, $err); } else { if ($result && $result eq 'pass') { @@ -587,7 +587,7 @@ sub greylist_value { }; if (my $err = $@) { $dbh->rollback; - $self->log(0, PMG::Utils::msgquote($err)); + $self->log(0, $err); } } } @@ -666,7 +666,7 @@ sub greylist_value { }; if (my $err = $@) { $dbh->rollback; - $self->log (0, PMG::Utils::msgquote($err)); + $self->log (0, $err); } return $res; @@ -719,7 +719,7 @@ sub mux_input { lc ($attribute->{instance})); }; if (my $err = $@) { - $self->log(0, PMG::Utils::msgquote($err)); + $self->log(0, $err); } } @@ -739,7 +739,7 @@ sub mux_input { $$dataref = ''; } - $self->log(0, PMG::Utils::msgquote($err)) if $err; + $self->log(0, $err) if $err; } sub restart_close_hook { @@ -863,7 +863,7 @@ sub run_child { # sometimes the socket is not usable, don't know why my $flags = fcntl($sock, F_GETFL, 0); if (!$flags) { - $self->log(0, PMG::Utils::msgquote("socket not ready - $!")); + $self->log(0, "socket not ready - $!"); exit (-1); } @@ -876,7 +876,7 @@ sub run_child { $mux->loop; }; if (my $err = $@) { - $self->log(0, PMG::Utils::msgquote("ERROR: $err")); + $self->log(0, "ERROR: $err"); } $self->child_finish_hook;