[dovecot-cvs] dovecot/src/auth mech.c,1.36,1.37
    cras at dovecot.org 
    cras at dovecot.org
       
    Tue Oct  5 18:30:06 EEST 2004
    
        - Previous message: [dovecot-cvs] 
	dovecot/src/lib Makefile.am, 1.43, 1.44 str-sanitize.c,
	NONE, 1.1 str-sanitize.h, NONE, 1.1
- Next message: [dovecot-cvs] dovecot/src/imap-login client-authenticate.c, 1.26,
	1.27 client.c, 1.28, 1.29 client.h, 1.9, 1.10
-  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]
         
  
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv32326/auth
Modified Files:
	mech.c 
Log Message:
Use the library function for username string sanitization.
Index: mech.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- mech.c	26 Sep 2004 15:51:57 -0000	1.36
+++ mech.c	5 Oct 2004 15:30:03 -0000	1.37
@@ -6,6 +6,7 @@
 #include "hash.h"
 #include "mech.h"
 #include "str.h"
+#include "str-sanitize.h"
 #include "var-expand.h"
 #include "auth-client-connection.h"
 #include "auth-master-connection.h"
@@ -335,7 +336,7 @@
 const char *get_log_prefix(const struct auth_request *auth_request)
 {
 #define MAX_LOG_USERNAME_LEN 64
-	const char *p, *ip;
+	const char *ip;
 	string_t *str;
 
 	str = t_str_new(64);
@@ -343,25 +344,8 @@
 	if (auth_request->user == NULL)
 		str_append(str, "?");
 	else {
-		/* any control characters in username will be replaced by '?' */
-		for (p = auth_request->user; *p != '\0'; p++) {
-			if ((unsigned char)*p < 32)
-				break;
-		}
-
-		str_append_n(str, auth_request->user,
-			     (size_t)(p - auth_request->user));
-		for (; *p != '\0'; p++) {
-			if ((unsigned char)*p < 32)
-				str_append_c(str, '?');
-			else
-				str_append_c(str, *p);
-		}
-
-		if (str_len(str) > MAX_LOG_USERNAME_LEN) {
-			str_truncate(str, MAX_LOG_USERNAME_LEN);
-			str_append(str, "...");
-		}
+		str_sanitize_append(str, auth_request->user,
+				    MAX_LOG_USERNAME_LEN);
 	}
 
 	ip = net_ip2addr(&auth_request->remote_ip);
    
    
        
	- Previous message: [dovecot-cvs] 
	dovecot/src/lib Makefile.am, 1.43, 1.44 str-sanitize.c,
	NONE, 1.1 str-sanitize.h, NONE, 1.1
- Next message: [dovecot-cvs] dovecot/src/imap-login client-authenticate.c, 1.26,
	1.27 client.c, 1.28, 1.29 client.h, 1.9, 1.10
-  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]
         
More information about the dovecot-cvs
mailing list