public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: [pve-devel] applied: [PATCH http-server] access control: avoid "uninitialized value" warning if using IP ranges
Date: Tue, 30 Jan 2024 11:19:46 +0100	[thread overview]
Message-ID: <1706609977.sixjzonddo.astroid@yuna.none> (raw)
In-Reply-To: <20240124113856.126256-1-f.weber@proxmox.com>

thanks!

On January 24, 2024 12:38 pm, Friedrich Weber wrote:
> ALLOW_FROM/DENY_FROM accept any syntax understood by Net::IP. However,
> if an IP range like "10.1.1.1-10.1.1.3" is configured, a confusing
> Perl warning is printed to the syslog on a match:
> 
>   Use of uninitialized value in concatenation (.) or string at [...]
> 
> The reason is that we use Net::IP::prefix to prepare a debug message,
> but this returns undef if a range was specified. To avoid the warning,
> use Net::IP::print to obtain a string representation instead.
> 
> Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
> ---
>  src/PVE/APIServer/AnyEvent.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
> index cebd9ba..b60b825 100644
> --- a/src/PVE/APIServer/AnyEvent.pm
> +++ b/src/PVE/APIServer/AnyEvent.pm
> @@ -1761,7 +1761,7 @@ sub check_host_access {
>  	foreach my $t (@{$self->{allow_from}}) {
>  	    if ($t->overlaps($cip)) {
>  		$match_allow = 1;
> -		$self->dprint("client IP allowed: ". $t->prefix());
> +		$self->dprint("client IP allowed: ". $t->print());
>  		last;
>  	    }
>  	}
> @@ -1770,7 +1770,7 @@ sub check_host_access {
>      if ($self->{deny_from}) {
>  	foreach my $t (@{$self->{deny_from}}) {
>  	    if ($t->overlaps($cip)) {
> -		$self->dprint("client IP denied: ". $t->prefix());
> +		$self->dprint("client IP denied: ". $t->print());
>  		$match_deny = 1;
>  		last;
>  	    }
> -- 
> 2.39.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




      reply	other threads:[~2024-01-30 10:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 11:38 [pve-devel] " Friedrich Weber
2024-01-30 10:19 ` Fabian Grünbichler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1706609977.sixjzonddo.astroid@yuna.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal