shithub: riscv

Download patch

ref: 1d63115328e8ca2fe06159da5f18bde43adca3df
parent: c9a6a759bebccaccf3662b3fddad4821bd74f26b
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'); )