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

This commit is contained in:
mischief 2015-01-05 20:21:40 -08:00
parent 654450bc1d
commit 1bd467fc0e
2 changed files with 21 additions and 15 deletions

View file

@ -130,10 +130,9 @@ print verbose output to standard error.
.TP .TP
.B -x \fInet .B -x \fInet
announce on an alternate network interface. announce on an alternate network interface.
Because of the weak authentication protocol and .TP
default lack of encryption, this option must .B -A
be accompanied by turn off authentication.
.BR -c .
.PD .PD
.PP .PP
The command The command

View file

@ -55,6 +55,7 @@ struct {
int shared; int shared;
int sleeptime = 5; int sleeptime = 5;
int verbose = 0; int verbose = 0;
int noauth = 0;
int kbdin = -1; int kbdin = -1;
char *cert; char *cert;
@ -87,7 +88,7 @@ usage(void)
void void
main(int argc, char **argv) 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 adir[NETPATHLEN], ldir[NETPATHLEN];
char net[NETPATHLEN], *p; char net[NETPATHLEN], *p;
char *kbdfs[] = { "/bin/aux/kbdfs", "-dq", nil }; char *kbdfs[] = { "/bin/aux/kbdfs", "-dq", nil };
@ -97,7 +98,6 @@ main(int argc, char **argv)
fmtinstall('V', vncsfmt); fmtinstall('V', vncsfmt);
display = -1; display = -1;
killing = 0; killing = 0;
altnet = 0;
w = 1024; w = 1024;
h = 768; h = 768;
baseport = 5900; baseport = 5900;
@ -143,7 +143,9 @@ main(int argc, char **argv)
case 'x': case 'x':
p = EARGF(usage()); p = EARGF(usage());
setnetmtpt(net, sizeof net, p); setnetmtpt(net, sizeof net, p);
altnet = 1; break;
case 'A':
noauth = 1;
break; break;
}ARGEND }ARGEND
@ -152,9 +154,6 @@ main(int argc, char **argv)
exits(nil); exits(nil);
} }
if(altnet && cert == nil)
sysfatal("announcing on alternate network requires TLS (-c)");
if(argc == 0) if(argc == 0)
argv = rc; argv = rc;
@ -573,11 +572,19 @@ vncaccept(Vncs *v)
fprint(2, "%V: handshake failed; hanging up\n", v); fprint(2, "%V: handshake failed; hanging up\n", v);
exits(0); exits(0);
} }
if(verbose)
fprint(2, "%V: auth\n", v); if(noauth){
if(vncsrvauth(v) < 0){ if(verbose)
fprint(2, "%V: auth failed; hanging up\n", v); fprint(2, "%V: noauth\n", v);
exits(0); 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); shared = vncrdchar(v);