File: 03_fix_perl_warnings.patch

package info (click to toggle)
policyd-weight 0.1.15.2-12
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,824 kB
  • ctags: 275
  • sloc: perl: 2,832; sh: 201; makefile: 35
file content (76 lines) | stat: -rw-r--r-- 1,873 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Description: fixes perl warnings in debug mode
Origin: Heiko Schlittermann <hs@schlittermann.de>
Author: Werner Detter <werner@aloah-from-hell.de> 
DEP: 3
Bug-Debian: http://bugs.debian.org/641544
--- a/policyd-weight
+++ b/policyd-weight
@@ -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,12 @@
 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";
     
@@ -2282,7 +2286,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|\]]$/)
     {
@@ -2844,7 +2848,7 @@
     my $sender = shift(@_) || '';
     my $domain = shift(@_) || '';
 
-    $! = '';
+    $! = undef;
     $@ = ();
     if( (!($csock)) || ($csock && (!($csock->connected))) )
     {
@@ -2972,7 +2976,7 @@
         die $!;
     }
 
-    if(!( $( = getpwnam($USER) ))
+    if(!( $( = getgrnam($GROUP) ))
     {
         mylog(warning=>"cache: couldn't change GID to user $GROUP: $!");
     }
@@ -3842,7 +3846,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 );