[dovecot-cvs] dovecot/src/dict Makefile.am, 1.2, 1.3 dict-cache.c, 1.3, 1.4 dict-cache.h, 1.1, 1.2 dict-server.c, 1.9, 1.10 main.c, 1.5, 1.6

cras at dovecot.org cras at dovecot.org
Tue Jan 31 08:05:28 EET 2006


Update of /var/lib/cvs/dovecot/src/dict
In directory talvi:/tmp/cvs-serv10638/dict

Modified Files:
	Makefile.am dict-cache.c dict-cache.h dict-server.c main.c 
Log Message:
Dictionary takes now a username parameter, which is used for private
queries. Made dict-sql use "insert .. on duplicate key update" syntax, which
unfortunately doesn't work with PostgreSQL yet.



Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/dovecot/src/dict/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.am	14 Jan 2006 14:09:05 -0000	1.2
+++ Makefile.am	31 Jan 2006 06:05:22 -0000	1.3
@@ -5,6 +5,7 @@
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib \
 	-I$(top_srcdir)/src/lib-dict \
+	-I$(top_srcdir)/src/lib-sql \
 	-DPKG_RUNDIR=\""$(rundir)"\"
 
 libs = \

Index: dict-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/dict/dict-cache.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dict-cache.c	14 Jan 2006 18:47:21 -0000	1.3
+++ dict-cache.c	31 Jan 2006 06:05:22 -0000	1.4
@@ -31,14 +31,15 @@
 	i_free(cache);
 }
 
-struct dict *dict_cache_get(struct dict_cache *cache, const char *uri)
+struct dict *dict_cache_get(struct dict_cache *cache, const char *uri,
+			    const char *username)
 {
 	struct dict_entry *entry;
 
 	entry = hash_lookup(cache->dicts, uri);
 	if (entry == NULL) {
 		entry = i_new(struct dict_entry, 1);
-		entry->dict = dict_init(uri);
+		entry->dict = dict_init(uri, username);
 		entry->uri = i_strdup(uri);
 		hash_insert(cache->dicts, entry->uri, entry);
 	}

Index: dict-cache.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/dict/dict-cache.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dict-cache.h	30 Dec 2005 22:09:03 -0000	1.1
+++ dict-cache.h	31 Jan 2006 06:05:22 -0000	1.2
@@ -4,7 +4,8 @@
 struct dict_cache *dict_cache_init(void);
 void dict_cache_deinit(struct dict_cache *cache);
 
-struct dict *dict_cache_get(struct dict_cache *cache, const char *uri);
+struct dict *dict_cache_get(struct dict_cache *cache, const char *uri,
+			    const char *username);
 void dict_cache_unref(struct dict_cache *cache, const char *uri);
 
 #endif

Index: dict-server.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/dict/dict-server.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dict-server.c	29 Jan 2006 12:14:45 -0000	1.9
+++ dict-server.c	31 Jan 2006 06:05:22 -0000	1.10
@@ -294,11 +294,12 @@
 	if (*line++ != '\t')
 		return -1;
 
-	conn->username = i_strdup(username);
+	conn->username = i_strdup_until(username, line - 1);
 
 	/* the rest is dict URI */
 	conn->uri = i_strdup(line);
-	conn->dict = dict_cache_get(conn->server->cache, conn->uri);
+	conn->dict = dict_cache_get(conn->server->cache, conn->uri,
+				    conn->username);
 	if (conn->dict == NULL)
 		return -1;
 

Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/dict/main.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- main.c	14 Jan 2006 18:47:21 -0000	1.5
+++ main.c	31 Jan 2006 06:05:22 -0000	1.6
@@ -6,6 +6,7 @@
 #include "fd-close-on-exec.h"
 #include "restrict-access.h"
 #include "randgen.h"
+#include "sql-api.h"
 #include "dict-sql.h"
 #include "dict-client.h"
 #include "dict-server.h"
@@ -39,6 +40,10 @@
 	   chrooting. */
 	random_init();
 
+	/* Load built-in SQL drivers (if any) */
+	sql_drivers_init();
+	sql_drivers_register_all();
+
 	restrict_access_by_env(FALSE);
 }
 
@@ -76,6 +81,7 @@
 	dict_sql_unregister();
 	dict_client_unregister();
 
+	sql_drivers_deinit();
 	random_deinit();
 	lib_signals_deinit();
 	closelog();



More information about the dovecot-cvs mailing list