[pve-devel] r5453 - in qemu-server/pve2: . PVE PVE/API2/Qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Jan 28 06:22:35 CET 2011


Author: dietmar
Date: 2011-01-28 06:22:35 +0100 (Fri, 28 Jan 2011)
New Revision: 5453

Modified:
   qemu-server/pve2/ChangeLog
   qemu-server/pve2/PVE/API2/Qemu/Status.pm
   qemu-server/pve2/PVE/API2/Qemu/VNC.pm
   qemu-server/pve2/PVE/QemuServer.pm
   qemu-server/pve2/qm
Log:
remove old vncticket code


Modified: qemu-server/pve2/ChangeLog
===================================================================
--- qemu-server/pve2/ChangeLog	2011-01-28 05:12:25 UTC (rev 5452)
+++ qemu-server/pve2/ChangeLog	2011-01-28 05:22:35 UTC (rev 5453)
@@ -1,3 +1,7 @@
+2011-01-28  Proxmox Support Team  <support at proxmox.com>
+
+	* qm (vncticket): removed - we don't need that anymore 
+
 2010-10-13  Proxmox Support Team  <support at proxmox.com>
 
 	* qmrestore: set bs=256k for 'dd' 

Modified: qemu-server/pve2/PVE/API2/Qemu/Status.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu/Status.pm	2011-01-28 05:12:25 UTC (rev 5452)
+++ qemu-server/pve2/PVE/API2/Qemu/Status.pm	2011-01-28 05:22:35 UTC (rev 5453)
@@ -86,9 +86,8 @@
 	    },
 	    command => { 
 		type => 'string',
-		enum => [qw(start stop reset shutdown cad suspend resume vncticket) ],
+		enum => [qw(start stop reset shutdown cad suspend resume) ],
 	    },
-	    ticket => get_standard_option('pve-vncticket', { optional => 1 }), 
 	},
     },
     returns => { type => 'null'},
@@ -129,9 +128,6 @@
 	    PVE::QemuServer::vm_resume($vmid, $skiplock);
 	} elsif ($command eq 'cad') {
 	    PVE::QemuServer::vm_cad($vmid, $skiplock);
-	} elsif ($command eq 'vncticket') {
-	    my $ticket = $param->{ticket};
-	    PVE::QemuServer::vm_monitor_command ($vmid, "change vnc ticket $ticket", 1);
 	} else {
 	    raise_param_exc({ command => "unknown command '$command'" }) 
 	}

Modified: qemu-server/pve2/PVE/API2/Qemu/VNC.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu/VNC.pm	2011-01-28 05:12:25 UTC (rev 5452)
+++ qemu-server/pve2/PVE/API2/Qemu/VNC.pm	2011-01-28 05:22:35 UTC (rev 5453)
@@ -46,7 +46,7 @@
 	my $rpcenv = PVE::RPCEnvironment::get();
 
 	my $user = $rpcenv->get_user();
-	# fixme: creat eticket witch short timeout
+	# fixme: create ticket witch short timeout
 	my $ticket = PVE::AccessControl::assemble_ticket($user);
 
 	my ($vmid) = $param->{vmid} =~ m/^(\d+)$/; #untaint

Modified: qemu-server/pve2/PVE/QemuServer.pm
===================================================================
--- qemu-server/pve2/PVE/QemuServer.pm	2011-01-28 05:12:25 UTC (rev 5452)
+++ qemu-server/pve2/PVE/QemuServer.pm	2011-01-28 05:22:35 UTC (rev 5453)
@@ -474,13 +474,6 @@
     $confdesc->{"unused$i"} = $unuseddesc;
 }
 
-PVE::JSONSchema::register_standard_option('pve-vncticket', { 
-    description => "Secret VNC ticket.",
-    type => 'string',
-    minLength => 8, # just to improve security
-    pattern => '[A-Za-z0-9\+\/\=]+', # base64 characters
-});
-
 my $kvm_api_version = 0;
 
 sub kvm_version {
@@ -2167,17 +2160,6 @@
     return $res;
 }
 
-sub vm_vncticket {
-    my ($vmid, $ticket) = @_;
-
-    # generate ticket, olny first 8 character used by vnc
-    $ticket = Digest::SHA1::sha1_base64 (rand(), time()) if !$ticket;
-
-    vm_monitor_command ($vmid, "change vnc ticket $ticket", 1);
-
-    return $ticket;
-}
-
 sub vm_commandline {
     my ($storecfg, $vmid) = @_;
 

Modified: qemu-server/pve2/qm
===================================================================
--- qemu-server/pve2/qm	2011-01-28 05:12:25 UTC (rev 5452)
+++ qemu-server/pve2/qm	2011-01-28 05:22:35 UTC (rev 5453)
@@ -37,42 +37,42 @@
 sub run_vnc_proxy {
     my ($vmid) = @_;
 
-    my $path = PVE::QemuServer::vnc_socket ($vmid);
+    my $path = PVE::QemuServer::vnc_socket($vmid);
 
-    my $s = IO::Socket::UNIX->new (Peer => $path, Timeout => 120);
+    my $s = IO::Socket::UNIX->new(Peer => $path, Timeout => 120);
 
     die "unable to connect to socket '$path' - $!" if !$s;
 
     my $select = new IO::Select;
 
-    $select->add (\*STDIN);
-    $select->add ($s);
+    $select->add(\*STDIN);
+    $select->add($s);
 
     my $timeout = 60*15; # 15 minutes
 
     my @handles;
     while ($select->count && 
-	   scalar (@handles = $select->can_read ($timeout))) {
+	   scalar(@handles = $select->can_read ($timeout))) {
 	foreach my $h (@handles) {
 	    my $buf;
-	    my $n = $h->sysread ($buf, 4096);
+	    my $n = $h->sysread($buf, 4096);
 
 	    if ($h == \*STDIN) {
 		if ($n) {
-		    syswrite ($s, $buf);
+		    syswrite($s, $buf);
 		} else {
-		    exit (0);
+		    exit(0);
 		}
 	    } elsif ($h == $s) {
 		if ($n) {
-		    syswrite (\*STDOUT, $buf);
+		    syswrite(\*STDOUT, $buf);
 		} else {
-		    exit (0);
+		    exit(0);
 		}
 	    }
 	}
     }
-    exit (0);
+    exit(0);
 }
 
 __PACKAGE__->register_method ({
@@ -127,29 +127,6 @@
     }});
 
 __PACKAGE__->register_method ({
-    name => 'vncticket', 
-    path => 'vncticket', 
-    method => 'PUT',
-    description => "Create and set a VNC authentication ticket.",
-    parameters => {
-    	additionalProperties => 0,
-	properties => {
-	    vmid => get_standard_option('pve-vmid'),
-	},
-    },
-    returns => { type => 'null'},
-    code => sub {
-	my ($param) = @_;
-
-	my $vmid = $param->{vmid};
-
-	my $ticket = PVE::QemuServer::vm_vncticket ($vmid);
-	print "TICKET:$ticket\n";
-
-	return undef;
-    }});
-
-__PACKAGE__->register_method ({
     name => 'vncproxy', 
     path => 'vncproxy', 
     method => 'PUT',
@@ -158,7 +135,6 @@
     	additionalProperties => 0,
 	properties => {
 	    vmid => get_standard_option('pve-vmid'),
-	    ticket => get_standard_option('pve-vncticket', { optional => 1 }), 
 	},
     },
     returns => { type => 'null'},
@@ -166,14 +142,9 @@
 	my ($param) = @_;
 
 	my $vmid = $param->{vmid};
-	my $ticket = $param->{ticket};
 
-	if ($ticket) {
-	    PVE::QemuServer::vm_vncticket ($vmid, $ticket);
-	}
+	run_vnc_proxy ($vmid);
 
-	run_vnc_proxy ($vmid, $ticket);
-
 	return undef;
     }});
 
@@ -404,10 +375,8 @@
 
     status => [ __PACKAGE__, 'status', ['vmid']],
 
-    vncticket => [ __PACKAGE__, 'vncticket', ['vmid']],
+    vncproxy => [ __PACKAGE__, 'vncproxy', ['vmid']],
 
-    vncproxy => [ __PACKAGE__, 'vncproxy', ['vmid', 'ticket']],
-
     wait => [ __PACKAGE__, 'wait', ['vmid']],
 
     unlock => [ __PACKAGE__, 'unlock', ['vmid']],




More information about the pve-devel mailing list