[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#641544: policyd-weight: debug mode produces several warnings - fixed



Package: policyd-weight
Version: 0.1.15.1-2
Severity: normal
Tags: patch upstream


When using the debug mode several warnings about uninitialized
values are issued. It looks nasty.

I've fixed it, hopefully in a sensible way.


-- System Information:
Debian Release: 6.0.2
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages policyd-weight depends on:
ii  adduser                3.112+nmu2        add and remove users and groups
ii  libnet-dns-perl        0.66-2            Perform DNS queries from a Perl sc
ii  libnet-ip-perl         1.25-2            Perl extension for manipulating IP
ii  perl                   5.10.1-17squeeze2 Larry Wall's Practical Extraction 

Versions of packages policyd-weight recommends:
ii  perl [libsys-syslog-pe 5.10.1-17squeeze2 Larry Wall's Practical Extraction 

policyd-weight suggests no packages.

-- no debconf information
diff -r 61fc719c8e48 policyd-weight
--- a/policyd-weight	Wed Sep 14 11:11:31 2011 +0200
+++ b/policyd-weight	Wed Sep 14 11:50:48 2011 +0200
@@ -582,7 +582,7 @@
 my $my_PTIME;
 my $my_TEMP_PTIME;
 
-if(!($conf))
+if(not defined $conf)
 {
     if( -f "/etc/policyd-weight.conf")
     {
@@ -605,7 +605,7 @@
 my $conf_err;
 my $conf_str;
 our $old_mtime;
-if($conf ne "")
+if(defined $conf)
 {
     if(sprintf("%04o",(stat($conf))[2]) !~ /(7|6|3|2)$/)
     {
@@ -652,8 +652,11 @@
 if($CMD_DEBUG == 1)
 {
     $DEBUG = 1;
-    $conf_str =~ s/\#.*?(\n)/$1/gs;
-    $conf_str =~ s/\n+/\n/g;
+    if (defined $conf_str) {
+	    $conf_str =~ s/\#.*?(\n)/$1/gs;
+	    $conf_str =~ s/\n+/\n/g;
+    }
+    else { $conf_str = "" }
     print "config: $conf\n".$conf_str."\n"; 
     $SPATH   .= ".debug";
     
@@ -2379,7 +2382,7 @@
     }
 
 ## HELO numeric check #########################################################
-    my $glob_numeric_score;
+    my $glob_numeric_score = 0;
     # check /1.2.3.4/ and /[1.2.3.4]/
     if($helo =~ /^[\d|\[][\d\.]+[\d|\]]$/)
     {
@@ -2798,7 +2801,7 @@
     my $sender = shift(@_) || '';
     my $domain = shift(@_) || '';
 
-    $! = '';
+    $! = undef;
     $@ = ();
     if( (!($csock)) || ($csock && (!($csock->connected))) )
     {
@@ -2919,7 +2922,7 @@
         die $!;
     }
 
-    if(!( $( = getpwnam($USER) ))
+    if(!( $( = getgrnam($GROUP) ))
     {
         mylog(warning=>"cache: couldn't change GID to user $GROUP: $!");
     }
@@ -3790,7 +3793,7 @@
     my $helo = shift;
     my $ip   = shift;
 
-    if($$helo !~ /^\[(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\]$/ ) { return }
+    if($$helo !~ /^\[(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\]$/ ) { return 0 }
     my $tmp_helo_ip = $1;
 
     my $tmpip = inet_aton( $tmp_helo_ip );

Reply to: