[dovecot-cvs] dovecot/src/auth auth-cache.c,1.6,1.7

cras at dovecot.org cras at dovecot.org
Wed Dec 15 21:31:09 EET 2004


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv24451/auth

Modified Files:
	auth-cache.c 
Log Message:
Auth cache key was built wrong if any modifiers were used for %vars.
Added var_get_key() function which skips over any modifiers and returns the
actual key.



Index: auth-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-cache.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- auth-cache.c	15 Dec 2004 18:06:47 -0000	1.6
+++ auth-cache.c	15 Dec 2004 19:31:06 -0000	1.7
@@ -31,6 +31,7 @@
 {
 	string_t *str;
 	char key_seen[256];
+	uint8_t key;
 
 	memset(key_seen, 0, sizeof(key_seen));
 
@@ -38,14 +39,15 @@
 	for (; *query != '\0'; query++) {
 		if (*query == '%' && query[1] != '\0') {
 			query++;
-			if (*query != '%' && !key_seen[(uint8_t)*query]) {
+                        key = var_get_key(query);
+			if (key != '\0' && key != '%' && !key_seen[key]) {
 				if (str_len(str) != 0)
 					str_append_c(str, '\t');
 				str_append_c(str, '%');
-				str_append_c(str, *query);
+				str_append_c(str, key);
 
 				/* @UNSAFE */
-                                key_seen[(uint8_t)*query] = 1;
+                                key_seen[key] = 1;
 			}
 		}
 	}



More information about the dovecot-cvs mailing list