git: 9front

Download patch

ref: 22fee295c28b9918c1c7a51f270a40ff07770530
parent: 8bb2fb45685252bdb01c6adba092a63687d6721f
author: mia soweli <inbox@tachibana-labs.org>
date: Wed Jun 28 15:39:09 EDT 2023

upas/imap4d: fix bad censorship of the password when debug is enabled.

this was plain wrong, the password and username are allowed to be quoted,
and contain spaces. simply don't log the login command instead.

--- a/sys/src/cmd/upas/imap4d/imap4d.c
+++ b/sys/src/cmd/upas/imap4d/imap4d.c
@@ -2217,7 +2217,7 @@
 static void
 logit(char *o)
 {
-	char *s, *p, *q;
+	char *s, *p;
 
 	if(!debug)
 		return;
@@ -2225,15 +2225,9 @@
 	p = strchr(s, ' ');
 	if(!p)
 		goto emit;
-	q = strchr(++p, ' ');
-	if(!q)
-		goto emit;
-	if(!cistrncmp(p, "login", 5)){
-		q = strchr(++q, ' ');
-		if(!q)
-			goto emit;
-		for(q = q + 1; *q != ' ' && *q; q++)
-			*q = '*';
+	if(cistrncmp(p, "login ", 6) == 0){
+		free(s);
+		return;
 	}
 emit:
 	for(p = s + strlen(s) - 1; p >= s && (/**p == '\r' ||*/ *p == '\n'); )
--