[pve-devel] pve-access-control : check_volume_access : use parse_volname instead path

Dietmar Maurer dietmar at proxmox.com
Tue Oct 1 12:38:14 CEST 2013


applied, but I additionally removed all path related code.

Instead, I added a new helper to PVE::Storage:

sub abs_filesystem_path {
    my ($cfg, $volid) = @_;

    my $path;
    if (PVE::Storage::parse_volume_id ($volid, 1)) {
	PVE::Storage::activate_volumes($cfg, [ $volid ]);
	$path = PVE::Storage::path($cfg, $volid);
    } else {
	if (-f $volid) {
	    my $abspath = abs_path($volid);
	    if ($abspath && $abspath =~ m|^(/.+)$|) {
		$path = $1; # untaint any path
	    }
	}
    }

    die "can't find file '$volid'\n" if !($path && -f $path);

    return $path;
}


> -----Original Message-----
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
> bounces at pve.proxmox.com] On Behalf Of Alexandre Derumier
> Sent: Mittwoch, 25. September 2013 10:28
> To: pve-devel at pve.proxmox.com
> Subject: [pve-devel] pve-access-control : check_volume_access : use
> parse_volname instead path
> 
> see commit
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel





More information about the pve-devel mailing list