[pve-devel] [PATCH] spice migration

Dietmar Maurer dietmar at proxmox.com
Mon Jul 22 08:03:58 CEST 2013


> +    if($conf->{vga} eq 'qxl'){
> +	my $rpcenv = PVE::RPCEnvironment::get();
> +	my $authuser = $rpcenv->get_user();
> +
> +	my ($ticket, $proxyticket) =
> PVE::AccessControl::assemble_spice_ticket($authuser, $vmid, $self-
> >{node});
> +
> +	# read x509 subject
> +	my $filename = "/etc/pve/nodes/".$self->{node}."/pve-ssl.pem";
> +	my $bio = Net::SSLeay::BIO_new_file($filename, 'r');
> +	my $x509 = Net::SSLeay::PEM_read_bio_X509($bio);
> +	Net::SSLeay::BIO_free($bio);
> +	my $nameobj =  Net::SSLeay::X509_get_subject_name($x509);
> +	my $subject = Net::SSLeay::X509_NAME_oneline($nameobj);
> +	Net::SSLeay::X509_free($x509);
> +
> +	# remote-viewer wants comma as seperator (not '/')
> +	$subject =~ s!^/!!;
> +	$subject =~ s!/(\w+=)!,$1!g;
> +

Seem you copied that code from somewhere? If so, please can you try
to factor out the common pieces to avoid code duplication?

(something like read_x509_subject_spice($filename))




More information about the pve-devel mailing list