shithub: tlsclient

Download patch

ref: 87bd72ba5cbafb99c58e608c335705a98b10ce23
parent: 8add180028dbb7acb76228fc893e9238824a76ae
author: Jacob Moody <moody@posixcafe.org>
date: Tue Jul 5 13:52:32 EDT 2022

Revert "enable posting to remote /srv through -s"

dumb idea and it broke things

--- a/cpu.c
+++ b/cpu.c
@@ -98,7 +98,6 @@
 	int pin[2];
 	int pout[2];
 	int infd, outfd;
-	char *srv = nil;
 	int i;
 	pid_t execc, xferc;
 
@@ -118,10 +117,9 @@
 		case 'a': authserver = EARGF(usage()); break;
 		case 'p': port = EARGF(usage()); break;
 		case 'R': Rflag++; break;
-		case 's': srv = EARGF(usage()); break;
 	} ARGEND
 
-	if(Rflag || srv != nil)
+	if(Rflag)
 		port = "17019";
 
 	if(user == nil || host == nil || authserver == nil || port == nil)
@@ -139,15 +137,7 @@
 		sysfatal("could not init openssl");
 	ssl_conn = SSL_new(ssl_ctx);
 
-
-	fd = unix_dial(host, port);
-	if(fd < 0){
-		sysfatal("Failed to connect to the client");
-	}
-
-	p9authtls(fd);
-
-	if(!Rflag || srv != nil){
+	if(*argv && !Rflag){
 		pipe(pin);
 		pipe(pout);
 		switch((execc = fork())){
@@ -165,13 +155,16 @@
 		close(pin[0]);
 		infd = pout[0];
 		outfd = pin[1];
-		if(srv != nil){
-			snprint(buf, sizeof buf - 1, "bind '#|' /n/p; <>[3]/n/p/data1 { echo 3 > /srv/%s; cat /n/p/data & cat > /n/p/data}\n", srv);
-			goto rcpu;
-		}
 	}
 
-	if(Rflag) {
+	fd = unix_dial(host, port);
+	if(fd < 0){
+		sysfatal("Failed to connect to the client");
+	}
+
+	p9authtls(fd);
+
+	if(*argv && Rflag) {
 		for(i=0,n=0; i<argc; i++)
 			n += snprint(buf+n, sizeof buf - n - 1, "%s ", argv[i]);
 		if(n <= 0)
@@ -178,7 +171,6 @@
 			usage();
 		buf[n-1] = '\n';
 		buf[n] = '\0';
-rcpu:
 		i = strlen(buf);
 		snprint(buf2, sizeof buf2, "%7d\n", i);
 		tls_send(-1, buf2, strlen(buf2));