develooper Front page | perl.qpsmtpd | Postings from July 2011

exclude plugin from cache 0.84

From:
Aleksandar Lazic
Date:
July 31, 2011 14:47
Subject:
exclude plugin from cache 0.84
Message ID:
20110731214729.GA15318@none.at
Dear listmembers,

please can you point me to the right doc, I think I have somethin
missed.

My Sysadmin have updated qpsmtpd to 0.84.
Now the plugins are deliverd from cache.

I have modified the following plugins like this

###
#diff -u /usr/share/qpsmtpd/plugins/connection_time.orig
#/usr/share/qpsmtpd/plugins/connection_time
--- /usr/share/qpsmtpd/plugins/connection_time.orig	2011-07-31
#23:44:25.000000000 +0200
+++ /usr/share/qpsmtpd/plugins/connection_time	2011-07-31
#23:43:03.000000000 +0200
@@ -19,6 +19,7 @@
  
  use Time::HiRes qw(gettimeofday tv_interval);
  use Qpsmtpd::Constants;
+use OSSP::uuid;
  
  sub register {
      my ($self, $qp, @args) = @_;
@@ -35,6 +36,9 @@
  sub hook_pre_connection {
      my ($self, @foo) = @_;
      $self->{_connection_start} = [gettimeofday];
+    my $uuid = new OSSP::uuid;
+    $uuid->make('v4');
+    $self->{_connection_id} = $uuid->export("str");
      return (DECLINED);
  }
  
@@ -52,6 +56,7 @@
          $self->log($self->{_level},
                     "Connection time from $remote: $elapsed sec.");
      }
+    undef $self->{_connection_id} if $self->{_connection_id};
      return (DECLINED);
  }
###
#diff -u !$ /usr/share/qpsmtpd/plugins/logging/syslog
diff -u /usr/share/qpsmtpd/plugins/logging/syslog.orig
/usr/share/qpsmtpd/plugins/logging/syslog
--- /usr/share/qpsmtpd/plugins/logging/syslog.orig	2011-07-31
23:45:29.000000000 +0200
+++ /usr/share/qpsmtpd/plugins/logging/syslog	2011-07-31
23:43:03.000000000 +0200
@@ -180,7 +180,7 @@
      my $priority = $self->{_priority} ?
                     $self->{_priority} : $priorities_{$trace};
  
-    syslog $priority, '%s', join(' ', @log);
+    syslog $priority, '%s', join(' ',
$self->{_connection_id}?$self->{_connection_id}:'NOID',@log);
      return DECLINED;
  }
###

The problem now is that the connection_time plugin does not execute the
uuid part and therefore I get the NOID string always in the logs.

How can I change this?

Thanks for your help.

BR
Aleks



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About