shithub: riscv

Download patch

ref: 1bd467fc0e3622f4dc12ac14bede208e73fa4445
parent: 654450bc1da238c42bee28e9fccba57323a48884
author: mischief <mischief@offblast.org>
date: Mon Jan 5 15:21:40 EST 2015

vncs: turn off auth with -A, do not require -c for -x

--- a/sys/man/1/vnc
+++ b/sys/man/1/vnc
@@ -130,10 +130,9 @@
 .TP
 .B -x \fInet
 announce on an alternate network interface.
-Because of the weak authentication protocol and
-default lack of encryption, this option must
-be accompanied by
-.BR -c .
+.TP
+.B -A
+turn off authentication.
 .PD
 .PP
 The command
--- a/sys/src/cmd/vnc/vncs.c
+++ b/sys/src/cmd/vnc/vncs.c
@@ -55,6 +55,7 @@
 int	shared;
 int	sleeptime = 5;
 int	verbose = 0;
+int	noauth = 0;
 int	kbdin = -1;
 
 char *cert;
@@ -87,7 +88,7 @@
 void
 main(int argc, char **argv)
 {
-	int altnet, baseport, cfd, display, exnum, fd, pid, h, killing, w;
+	int baseport, cfd, display, exnum, fd, pid, h, killing, w;
 	char adir[NETPATHLEN], ldir[NETPATHLEN];
 	char net[NETPATHLEN], *p;
 	char *kbdfs[] = { "/bin/aux/kbdfs", "-dq", nil };
@@ -97,7 +98,6 @@
 	fmtinstall('V', vncsfmt);
 	display = -1;
 	killing = 0;
-	altnet = 0;
 	w = 1024;
 	h = 768;
 	baseport = 5900;
@@ -143,8 +143,10 @@
 	case 'x':
 		p = EARGF(usage());
 		setnetmtpt(net, sizeof net, p);
-		altnet = 1;
 		break;
+	case 'A':
+		noauth = 1;
+		break;
 	}ARGEND
 
 	if(killing){
@@ -152,9 +154,6 @@
 		exits(nil);
 	}
 
-	if(altnet && cert == nil)
-		sysfatal("announcing on alternate network requires TLS (-c)");
-
 	if(argc == 0)
 		argv = rc;
 
@@ -573,11 +572,19 @@
 		fprint(2, "%V: handshake failed; hanging up\n", v);
 		exits(0);
 	}
-	if(verbose)
-		fprint(2, "%V: auth\n", v);
-	if(vncsrvauth(v) < 0){
-		fprint(2, "%V: auth failed; hanging up\n", v);
-		exits(0);
+
+	if(noauth){
+		if(verbose)
+			fprint(2, "%V: noauth\n", v);
+		vncwrlong(v, ANoAuth);
+		vncflush(v);
+	} else {
+		if(verbose)
+			fprint(2, "%V: auth\n", v);
+		if(vncsrvauth(v) < 0){
+			fprint(2, "%V: auth failed; hanging up\n", v);
+			exits(0);
+		}
 	}
 
 	shared = vncrdchar(v);