Browse Source

Plan 9 from Bell Labs 2012-05-07

David du Colombier 12 years ago
parent
commit
336ff7833c

+ 1 - 0
lib/namespace

@@ -33,6 +33,7 @@ bind -a #I /net
 mount -a /srv/cs /net
 mount -a /srv/dns /net
 mount -a /srv/net /net
+mount -b /srv/ssh /net
 
 # usbd, mainly disks
 mount /srv/usb /n/usb

File diff suppressed because it is too large
+ 503 - 499
sys/src/cmd/ssh2/dup.out


File diff suppressed because it is too large
+ 319 - 320
sys/src/cmd/ssh2/dup.pro


+ 9 - 9
sys/src/cmd/ssh2/dup.sum

@@ -2,20 +2,20 @@
 Summary:
 Reporting parameterized matches of at least 3 lines.
 15 files
-7217 lines in original code,
-6255 lines after pruning white space and comments.
+7219 lines in original code,
+6258 lines after pruning white space and comments.
 
-2219 lines were involved in 621 matches
+2197 lines were involved in 614 matches
 These constitute 35 percent of the ncsl.
-Approximately 1399 lines are redundant,or 22 percent of the ncsl.
+Approximately 1388 lines are redundant,or 22 percent of the ncsl.
 
 match length: number of matches of that length
-	   3: 269
+	   3: 262
 	   4: 187
-	   5:  36
-	   6:  47
-	   7:  22
-	   8:  14
+	   5:  35
+	   6:  48
+	   7:  23
+	   8:  13
 	   9:  13
 	  10:   6
 	  11:   5

+ 32 - 32
sys/src/cmd/ssh2/dup.xpr

@@ -18,9 +18,9 @@ percent of file involved, #lines in file involved; file2,filename2
       28, 11; 3,cipherrc4.c:
       28, 11; 3,cipherrc4.c:
 
-19, 152, 60; 5,5
-      30, 244; 5,dh.c:
-      30, 244; 5,dh.c:
+18, 150, 60; 5,5
+      29, 240; 5,dh.c:
+      29, 240; 5,dh.c:
 
 7, 28, 9; 6,6
       13, 56; 6,dial.c:
@@ -31,20 +31,20 @@ percent of file involved, #lines in file involved; file2,filename2
       8, 34; 7,dial.thread.c:
 
 22, 646, 316; 9,9
-      34, 998; 9,netssh.c:
-      34, 998; 9,netssh.c:
+      35, 1000; 9,netssh.c:
+      35, 1000; 9,netssh.c:
 
 5, 10, 3; 10,10
       10, 20; 10,pubkey.c:
       10, 20; 10,pubkey.c:
 
-7, 39, 15; 12,12
-      13, 68; 12,ssh.c:
-      13, 68; 12,ssh.c:
+7, 36, 12; 12,12
+      12, 65; 12,ssh.c:
+      12, 65; 12,ssh.c:
 
-7, 28, 7; 13,13
-      13, 54; 13,sshsession.c:
-      13, 54; 13,sshsession.c:
+5, 20, 6; 13,13
+      9, 38; 13,sshsession.c:
+      9, 38; 13,sshsession.c:
 
 6, 12, 3; 14,14
       11, 24; 14,transport.c:
@@ -66,9 +66,9 @@ percent of file involved, #lines in file involved; file2,filename2
       2, 15; 5,dh.c:
       2, 9; 6,dial.c:
 
-29, 252, 33; 6,7
-      58, 247; 6,dial.c:
-      56, 239; 7,dial.thread.c:
+30, 257, 33; 6,7
+      59, 252; 6,dial.c:
+      57, 244; 7,dial.thread.c:
 
 0, 10, 3; 8,9
       40, 6; 8,esmprint.c:
@@ -82,8 +82,8 @@ percent of file involved, #lines in file involved; file2,filename2
       12, 7; 11,rsa2ssh2.c:
       1, 7; 12,ssh.c:
 
-2, 22, 6; 12,13
-      4, 23; 12,ssh.c:
+2, 20, 5; 12,13
+      4, 20; 12,ssh.c:
       5, 20; 13,sshsession.c:
 
 0, 3, 1; 13,14
@@ -122,8 +122,8 @@ percent of file involved, #lines in file involved; file2,filename2
       4, 19; 6,dial.c:
       1, 17; 9,netssh.c:
 
-2, 53, 23; 9,12
-      2, 58; 9,netssh.c:
+2, 54, 23; 9,12
+      2, 59; 9,netssh.c:
       8, 40; 12,ssh.c:
 
 3, 8, 1; 11,14
@@ -142,9 +142,9 @@ percent of file involved, #lines in file involved; file2,filename2
       1, 6; 7,dial.thread.c:
       10, 6; 11,rsa2ssh2.c:
 
-1, 36, 10; 9,13
-      1, 39; 9,netssh.c:
-      7, 32; 13,sshsession.c:
+1, 33, 9; 9,13
+      1, 36; 9,netssh.c:
+      7, 29; 13,sshsession.c:
 
 1, 5, 2; 10,14
       3, 6; 10,pubkey.c:
@@ -154,9 +154,9 @@ percent of file involved, #lines in file involved; file2,filename2
       10, 6; 2,cipherblowfish.c:
       1, 6; 7,dial.thread.c:
 
-1, 5, 2; 7,12
-      1, 3; 7,dial.thread.c:
-      1, 6; 12,ssh.c:
+1, 11, 3; 7,12
+      3, 12; 7,dial.thread.c:
+      2, 10; 12,ssh.c:
 
 0, 6, 2; 9,14
       0, 6; 9,netssh.c:
@@ -170,21 +170,21 @@ percent of file involved, #lines in file involved; file2,filename2
       8, 6; 1,cipheraes.c:
       1, 6; 7,dial.thread.c:
 
-2, 17, 5; 6,12
+2, 16, 5; 6,12
       3, 13; 6,dial.c:
-      4, 20; 12,ssh.c:
+      3, 17; 12,ssh.c:
 
-1, 9, 3; 7,13
-      2, 10; 7,dial.thread.c:
-      2, 7; 13,sshsession.c:
+1, 6, 2; 7,13
+      2, 7; 7,dial.thread.c:
+      1, 4; 13,sshsession.c:
 
 2, 10, 2; 0,7
       23, 10; 0,cipher3des.c:
       2, 10; 7,dial.thread.c:
 
-2, 13, 5; 6,13
-      4, 16; 6,dial.c:
-      2, 10; 13,sshsession.c:
+1, 10, 4; 6,13
+      3, 13; 6,dial.c:
+      2, 7; 13,sshsession.c:
 
 1, 6, 1; 7,14
       1, 6; 7,dial.thread.c:

+ 15 - 14
sys/src/cmd/ssh2/long.funcs

@@ -6,7 +6,7 @@
 125	netssh.c:610,735	stread()
 111	netssh.c:2454,2565	reader0()
 104	netssh.c:1266,1370	writereqremproc()
-98	sshsession.c:182,280	main()
+98	sshsession.c:187,285	main()
 98	dh.c:462,560	dh_server()
 98	netssh.c:1909,2007	dohandshake()
 97	ssh.c:477,574	main()
@@ -15,25 +15,25 @@
 94	dh.c:821,915	genkeys()
 93	netssh.c:3127,3220	shutdown()
 88	netssh.c:1418,1506	stclunk()
-85	dial.c:337,422	csdial()
+85	dial.c:334,419	csdial()
 84	dial.thread.c:337,421	csdial()
 82	netssh.c:1548,1630	alloc_conn()
 81	netssh.c:405,486	stlisconn()
 79	netssh.c:2695,2774	validatekexc()
-76	dial.c:426,502	call()
+76	dial.c:423,499	call()
 75	netssh.c:3009,3084	client_auth()
 74	netssh.c:997,1071	userauth()
 71	netssh.c:490,561	stlischan()
 70	netssh.c:2935,3005	auth_req()
 70	dial.thread.c:426,496	call()
 65	dh.c:315,380	rsa_verify()
-65	sshsession.c:333,398	newchannel()
+65	sshsession.c:338,403	newchannel()
 65	netssh.c:1634,1699	alloc_chan()
 65	netssh.c:326,391	stopen()
 64	netssh.c:2011,2075	send_kexinit()
 62	pubkey.c:142,204	replacekey()
 58	netssh.c:2873,2931	authreqpk()
-53	sshsession.c:444,497	runcmd()
+53	sshsession.c:449,502	runcmd()
 51	ssh.c:345,396	bidircopy()
 50	dh.c:256,306	rsa_sign()
 50	dh.c:631,681	verifyhostkey()
@@ -60,20 +60,21 @@
 31	netssh.c:1782,1813	exchids()
 30	dial.thread.c:284,314	dialmulti()
 30	ssh.c:588,618	doauth()
-30	dial.c:303,333	dialmulti()
+30	dial.c:300,330	dialmulti()
 30	netssh.c:2791,2821	mkcap()
-30	ssh.c:84,114	parseargs()
+30	ssh.c:86,116	parseargs()
 29	dial.thread.c:199,228	callproc()
-28	dial.c:531,559	_dial_string_parse()
+28	dial.c:528,556	_dial_string_parse()
 28	dial.thread.c:525,553	_dial_string_parse()
-27	netssh.c:1877,1904	dohandshake()
 27	netssh.c:240,267	read9pmsg()
-27	netssh.c:1846,1873	deferredinit()
+27	sshsession.c:96,123	mounttunnel()
 27	cipherblowfish.c:16,43	initblowfish()
-26	sshsession.c:152,178	listenloop()
+27	netssh.c:1846,1873	deferredinit()
+27	netssh.c:1877,1904	dohandshake()
+26	sshsession.c:157,183	listenloop()
 26	ssh.c:447,473	remotecmd()
-26	sshsession.c:122,148	authnewns()
+26	sshsession.c:127,153	authnewns()
 26	pubkey.c:112,138	findkey()
-25	netssh.c:1510,1535	stflush()
+25	sshsession.c:420,445	confine()
 25	ssh.c:175,200	starttunnel()
-25	sshsession.c:415,440	confine()
+25	netssh.c:1510,1535	stflush()

+ 6 - 6
sys/src/cmd/ssh2/magic.out

@@ -78,7 +78,7 @@ dial.c:171: char *fields[5];			/* pid + 3 times + error */
 dial.c:177: if (n < 4)
 dial.c:188: strncpy(conn->err, fields[4], sizeof conn->err);
 dial.c:209: char exitsts[2*ERRMAX];
-dial.c:384: bleft = sizeof dp->addrlist - 2;	/* 2 is room for \n\0 */
+dial.c:381: bleft = sizeof dp->addrlist - 2;	/* 2 is room for \n\0 */
 dial.thread.c:22: Defstksize	= 8192,
 dial.thread.c:24: Maxstring	= 128,
 dial.thread.c:25: Maxpath		= 256,
@@ -232,7 +232,7 @@ pubkey.c:221: fprint(fd, "%s %d %.10M %.10M\n", host, mpsignif(key->n),
 rsa2ssh2.c:54: e = strtomp(ep+4, nil, 16, nil);
 rsa2ssh2.c:55: n = strtomp(np+3, nil, 16, nil);
 rsa2ssh2.c:61: sysfatal("base-64 encoding failed\n");
-ssh.c:131: oalarm = alarm(5*1000);		/* don't get stuck here */
+ssh.c:130: oalarm = alarm(5*1000);		/* don't get stuck here */
 ssh.c:163: //		for (fd = 3; fd < 40; fd++)
 ssh.c:219: if (buf[n-1] == ('u' & 037))
 ssh.c:251: write(kconsfd, buf+5, n);
@@ -254,10 +254,10 @@ ssh.c:319: fprint(kconsfd, "%s\n", buf+5);
 ssh.c:405: ds = netmkaddr(remote, dir, "22");		/* tcp port 22 is ssh */
 ssh.c:579: char buf[64];
 ssh.c:583: return strlen(buf) >= 9 && strcmp(buf+strlen(buf)-9, "/dev/cons") == 0;
-sshsession.c:223: errfd = 2;
-sshsession.c:406: q += 4;
-sshsession.c:420: q += 4;
-sshsession.c:470: dup(datafd, 2);
+sshsession.c:228: errfd = 2;
+sshsession.c:411: q += 4;
+sshsession.c:425: q += 4;
+sshsession.c:475: dup(datafd, 2);
 transport.c:42: p->rlength += 4;
 transport.c:50: *data += 4;
 transport.c:68: p->rlength += 4;

+ 14 - 9
sys/src/cmd/ssh2/sshsession.c

@@ -16,7 +16,7 @@ void runcmd(int, int, char *, char *, char *, char *);
 int errfd, toppid, sflag, tflag, prevent;
 int debug;
 char *idstring;
-char *netdir = "/net";
+char *netdir;				/* /net/ssh/<conn> */
 char *nsfile = nil;
 char *restdir;
 char *shell;
@@ -89,32 +89,37 @@ auth(char *buf, int n, int ctlfd)
 }
 
 /*
- * start tunnel if there isn't one, though it's probably too late
- * since caphash will likely be closed.
+ * mount tunnel if there isn't one visible.
  */
 static void
 mounttunnel(int ctlfd)
 {
 	int fd;
-	char *p;
+	char *p, *np, *q;
 
 	if (access(netdir, AEXIST) >= 0)
 		return;
 
 	p = smprint("/srv/%s", srvpt? srvpt: "ssh");
-	fd = -1;
-	if (p)
-		fd = open(p, ORDWR);
+	np = strdup(netdir);
+	if (p == nil || np == nil)
+		sysfatal("out of memory");
+	q = strstr(np, "/ssh");
+	if (q != nil)
+		*q = '\0';
+	fd = open(p, ORDWR);
 	if (fd < 0) {
 		syslog(0, "ssh", "can't open %s: %r", p);
 		hangup(ctlfd);
 		exits("open");
 	}
-	if (mount(fd, -1, netdir, MBEFORE, "") < 0) {
-		syslog(0, "ssh", "can't mount in /net: %r");
+	if (mount(fd, -1, np, MBEFORE, "") < 0) {
+		syslog(0, "ssh", "can't mount %s in %s: %r", p, np);
 		hangup(ctlfd);
 		exits("can't mount");
 	}
+	free(p);
+	free(np);
 }
 
 static int

Some files were not shown because too many files changed in this diff