Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
[Bugfix] fixed name directive is not added when migrating to ProxyNG …
Browse files Browse the repository at this point in the history
…config

Some "Use of uninitialized value" are fixed.

Signed-off-by: Antonio Rendon <[email protected]>

	modified:   usr/local/zevenet/migrating/zproxyng_migration.pl
	modified:   usr/share/perl5/Zevenet/Farm/Config.pm
	modified:   usr/share/perl5/Zevenet/Farm/HTTP/Backend.pm
	modified:   usr/share/perl5/Zevenet/Farm/HTTP/Config.pm
	modified:   usr/share/perl5/Zevenet/Net/Interface.pm
  • Loading branch information
Rendone-zevenet committed Mar 31, 2023
1 parent 77e1e16 commit 42af23d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion usr/local/zevenet/migrating/zproxyng_migration.pl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
$array[$i] .= " 0";
}
}
elsif ( $array[$i] =~ /^ListenHTTP$/ )
elsif ( $array[$i] =~ /^ListenHTTPS?$/ )
{
$name_index = $i;
}
Expand Down
2 changes: 1 addition & 1 deletion usr/share/perl5/Zevenet/Farm/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ sub getPersistence
my $farm_ref;
my $nodestatus = "";
return 1 if $farm_type !~ /l4xnat|http/;
return 1 if ( $nodestatus ne "master" );
return 1 if ( defined $nodestatus and ( $nodestatus ne "master" ) );
if ( $farm_type eq 'l4xnat' )
{
require Zevenet::Farm::L4xNAT::Config;
Expand Down
2 changes: 1 addition & 1 deletion usr/share/perl5/Zevenet/Farm/HTTP/Backend.pm
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ sub getHTTPFarmBackends # ($farm_name,$service,$param_status)
if ( not $param_status or $param_status eq "true" )
{
@be_status = @{ &getHTTPFarmBackendsStatus( $farmname, $service ) };
@be_status = () if $be_status[0] eq -1;
@be_status = () if ( exists $be_status[0] and ( $be_status[0] eq -1 ) );
}
my @out_ba;

Expand Down
18 changes: 9 additions & 9 deletions usr/share/perl5/Zevenet/Farm/HTTP/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2367,7 +2367,7 @@ sub setFarmProxyNGConf # ($proxy_mode,$farm_name)
splice @array, $i, 1;
$i--;
}
elsif ( $array[$i] =~ /^ListenHTTP$/ )
elsif ( $array[$i] =~ /^ListenHTTPS?$/ )
{
$array[$i] .= "\n\tName\t$farm_name";
}
Expand Down Expand Up @@ -2591,15 +2591,15 @@ sub setFarmProxyNGConf # ($proxy_mode,$farm_name)
elsif ( $array[$i] =~ /^\t\t\t(#?)TTL\s(\d+)/ )
{
$cookie_params->{ ttl } = $2;
if ( $cookie_params->{ enabled } == 1 )
if ( $cookie_params->{ enabled } )
{
$array[$i] = "\t\t\t#TTL 120";
}
}
elsif ( $array[$i] =~ /^\t\t\t(#?)ID\s"(.+)"/ )
{
$cookie_params->{ id } = $2;
if ( $cookie_params->{ enabled } == 1 or $2 eq "ZENSESSIONID" )
if ( $cookie_params->{ enabled } or $2 eq "ZENSESSIONID" )
{
$array[$i] = "\t\t\t#ID \"sessionname\"";
}
Expand All @@ -2618,7 +2618,7 @@ sub setFarmProxyNGConf # ($proxy_mode,$farm_name)
}
elsif ( $array[$i] =~ /^\t\tEnd$/ )
{
if ( ( $sw == 1 ) and ( $bw == 0 ) and ( $session_checker == 1 ) )
if ( ( $sw == 1 ) and ( $bw == 0 ) and ( $session_checker ) )
{
if ( $cookie_on eq "true" )
{
Expand All @@ -2642,12 +2642,13 @@ sub setFarmProxyNGConf # ($proxy_mode,$farm_name)
}
}

# if ( exists $cookie_params->{ domain } and $session_checker == 1 )
if ( $cookie_params->{ domain } ne "" and $session_checker == 1 )
if ( exists $cookie_params->{ domain }
and $cookie_params->{ domain } ne ""
and $session_checker )
{
if ( $dw != 0 )
{
if ( $cookie_params->{ enabled } == 1 )
if ( $cookie_params->{ enabled } )
{
$array[$dw] .=
"\n\t\tBackendCookie \"$cookie_params->{ id }\" \"$cookie_params->{ domain }\" \"$cookie_params->{ path }\" $cookie_params->{ ttl }";
Expand All @@ -2658,7 +2659,7 @@ sub setFarmProxyNGConf # ($proxy_mode,$farm_name)
$array[$dw] .=
"\n\t\t#BackendCookie \"ZENSESSIONID\" \"domainname.com\" \"/\" 0";
}
$cookie_on = $cookie_params->{ enabled } == 1 ? "true" : "false";
$cookie_on = $cookie_params->{ enabled } ? "true" : "false";
$cookie_params = undef;
$dw = 0;
}
Expand All @@ -2672,7 +2673,6 @@ sub setFarmProxyNGConf # ($proxy_mode,$farm_name)
}
for ( my $i = 0 ; $i < @array ; $i++ )
{
# if ( $array[$i] =~ /^ListenHTTP$/ )
if ( $array[$i] =~ /^#HTTP\(S\)\sLISTENERS$/ )
{
my $sizewaf = @wafs;
Expand Down
5 changes: 4 additions & 1 deletion usr/share/perl5/Zevenet/Net/Interface.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1455,14 +1455,17 @@ sub getIpAddressExists
{
foreach my $if_ref ( @{ $interface_list } )
{
if ( ( $if_ref->{ addr } eq $ip )
if ( defined $if_ref->{ addr }
and ( $if_ref->{ addr } ne "" )
and ( $if_ref->{ addr } eq $ip )
and ( &ipversion( $if_ref->{ addr } ) eq $ip_ver ) )
{
$output = 1;
last;
}
}
}

elsif ( $ip_ver == 6 )
{
my $addr_ref = NetAddr::IP->new( $ip );
Expand Down

0 comments on commit 42af23d

Please sign in to comment.