[dovecot-cvs] dovecot/src/auth auth-cache.c,1.5,1.6
cras at dovecot.org
cras at dovecot.org
Wed Dec 15 20:06:49 EET 2004
- Previous message: [dovecot-cvs] dovecot/src/lib-auth auth-server-connection.c, 1.11,
1.12 auth-server-connection.h, 1.7, 1.8
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox Makefile.am, 1.5,
1.6 mbox-md5.c, NONE, 1.1 mbox-md5.h, NONE,
1.1 mbox-sync-parse.c, 1.32, 1.33 mbox-sync-md5.c, 1.1,
NONE mbox-sync-private.h, 1.39, 1.40
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv22762
Modified Files:
auth-cache.c
Log Message:
When building cache key, use each %key only once, more wastes only memory.
This was mostly needed for more complex SQL queries where same key could be
used multiple times.
Index: auth-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-cache.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- auth-cache.c 6 Nov 2004 20:55:31 -0000 1.5
+++ auth-cache.c 15 Dec 2004 18:06:47 -0000 1.6
@@ -30,16 +30,22 @@
char *auth_cache_parse_key(const char *query)
{
string_t *str;
+ char key_seen[256];
+
+ memset(key_seen, 0, sizeof(key_seen));
str = str_new(default_pool, 32);
for (; *query != '\0'; query++) {
if (*query == '%' && query[1] != '\0') {
query++;
- if (*query != '%') {
+ if (*query != '%' && !key_seen[(uint8_t)*query]) {
if (str_len(str) != 0)
str_append_c(str, '\t');
str_append_c(str, '%');
str_append_c(str, *query);
+
+ /* @UNSAFE */
+ key_seen[(uint8_t)*query] = 1;
}
}
}
- Previous message: [dovecot-cvs] dovecot/src/lib-auth auth-server-connection.c, 1.11,
1.12 auth-server-connection.h, 1.7, 1.8
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox Makefile.am, 1.5,
1.6 mbox-md5.c, NONE, 1.1 mbox-md5.h, NONE,
1.1 mbox-sync-parse.c, 1.32, 1.33 mbox-sync-md5.c, 1.1,
NONE mbox-sync-private.h, 1.39, 1.40
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list