shithub: riscv

Download patch

ref: 0aae832ac3f3ae5d136563e980e9c32ceb0d1444
parent: 95114db7e087da60a878df5c3e4cb5f7a1b3b28a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jan 28 11:43:25 EST 2024

ndb/dns: set procname() for tls server

--- a/sys/src/cmd/ndb/dntcpserver.c
+++ b/sys/src/cmd/ndb/dntcpserver.c
@@ -41,13 +41,15 @@
 		return;
 	}
 
-	procsetname("%s: tcp server %s", mntpt, addr);
+	procsetname("%s: %s server %s",
+		mntpt, cert == nil? "tcp": "tls", addr);
 	if((fd = tcpannounce(mntpt, addr, caller, cert)) < 0){
 		warning("can't announce %s on %s: %r", addr, mntpt);
 		_exits(0);
 	}
 	parseip(callip, caller);
-	procsetname("%s: tcp server %s serving %s", mntpt, addr, caller);
+	procsetname("%s: %s server %s serving %s",
+		mntpt, cert == nil? "tcp": "tls", addr, caller);
 
 	memset(&req, 0, sizeof req);
 	req.isslave = 1;
@@ -331,12 +333,12 @@
 				memmove(conn.cert, chain->pem, conn.certlen);
 				conn.chain = chain->next;
 				fd = tlsServer(dfd, &conn);
+				free(conn.cert);
+				free(conn.sessionID);
 				if(fd < 0){
 					close(dfd);
 					_exits(0);
 				}
-				free(conn.cert);
-				free(conn.sessionID);
 				dfd = fd;
 			}
 			/* get the callers ip!port */