[Dovecot] [PATCH, RFC 0/13] OTP: add auth_cache_remove()

Andrey Panin pazke at donpac.ru
Mon Jun 26 15:57:55 EEST 2006


This patchset add support for One-Time-Password authentication mechanisms,
both S/Key (RFC 1731) and OTP (RFC 2444) are implemented.

Tested with mutt (uses cyrus sasl library for authentication).

Patches were made against CVS HEAD. Please take a look.



Add auth_cache_remove() function which will be used by OTP code to evict
old entries from auth cache.

diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/auth-cache.c dovecot/src/auth/auth-cache.c
--- dovecot.vanilla/src/auth/auth-cache.c	2006-06-23 13:42:22.122508080 +0400
+++ dovecot/src/auth/auth-cache.c	2006-06-23 13:44:30.945923944 +0400
@@ -226,3 +226,22 @@ void auth_cache_insert(struct auth_cache
 	cache->size_left -= alloc_size;
 	hash_insert(cache->hash, node->data, node);
 }
+
+void auth_cache_remove(struct auth_cache *cache,
+		       const struct auth_request *request,
+		       const char *key)
+{
+	string_t *str;
+	struct cache_node *node;
+
+	str = t_str_new(256);
+	var_expand(str, key,
+		   auth_request_get_var_expand_table(request,
+		   				     auth_request_str_escape));
+
+	node = hash_lookup(cache->hash, str_c(str));
+	if (node == NULL)
+		return;
+
+	auth_cache_node_destroy(cache, node);
+}
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/auth-cache.h dovecot/src/auth/auth-cache.h
--- dovecot.vanilla/src/auth/auth-cache.h	2006-06-23 13:42:22.122508080 +0400
+++ dovecot/src/auth/auth-cache.h	2006-06-23 13:44:30.945923944 +0400
@@ -27,4 +27,9 @@ void auth_cache_insert(struct auth_cache
 		       const struct auth_request *request,
 		       const char *key, const char *value);
 
+/* Remove key from cache */
+void auth_cache_remove(struct auth_cache *cache,
+		       const struct auth_request *request,
+		       const char *key);
+
 #endif



More information about the dovecot mailing list