changeset 3667:b7569a6a4ada HEAD

Renamed userdb passdb to prefetch.
author Timo Sirainen <tss@iki.fi>
date Wed, 19 Oct 2005 16:38:36 +0300
parents b381c9b899a2
children c9f1bd1e1ec2
files configure.in dovecot-example.conf src/auth/Makefile.am src/auth/userdb-passdb.c src/auth/userdb-prefetch.c src/auth/userdb.c
diffstat 6 files changed, 118 insertions(+), 118 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Wed Oct 19 16:37:22 2005 +0300
+++ b/configure.in	Wed Oct 19 16:38:36 2005 +0300
@@ -145,14 +145,14 @@
 	fi,
 	want_static_userdb=yes)
 
-AC_ARG_WITH(passdb-userdb,
-[  --with-passdb-userdb    Build with passdb userdb support (default)],
+AC_ARG_WITH(prefetch-userdb,
+[  --with-prefetch-userdb  Build with prefetch userdb support (default)],
 	if test x$withval = xno; then
-		want_passdb_userdb=no
+		want_prefetch_userdb=no
 	else
-		want_passdb_userdb=yes
+		want_prefetch_userdb=yes
 	fi,
-	want_passdb_userdb=yes)
+	want_prefetch_userdb=yes)
 
 AC_ARG_WITH(pgsql,
 [  --with-pgsql            Build with PostgreSQL support],
@@ -1119,9 +1119,9 @@
 	userdb="$userdb static"
 fi
 
-if test $want_passdb_userdb = yes; then
-        AC_DEFINE(USERDB_PASSDB,, Build with passdb userdb support)
-	userdb="$userdb passdb"
+if test $want_prefetch_userdb = yes; then
+        AC_DEFINE(USERDB_PREFETCH,, Build with prefetch userdb support)
+	userdb="$userdb prefetch"
 fi
 
 if test $want_passwd = yes; then
--- a/dovecot-example.conf	Wed Oct 19 16:37:22 2005 +0300
+++ b/dovecot-example.conf	Wed Oct 19 16:38:36 2005 +0300
@@ -641,7 +641,7 @@
   #}
 
   # checkpassword executable authentication
-  # NOTE: You will probably want to use "userdb passdb" with this.
+  # NOTE: You will probably want to use "userdb prefetch" with this.
   #passdb checkpassword {
     # Path for checkpassword binary
     #args = 
@@ -714,11 +714,11 @@
   #userdb vpopmail {
   #}
 
-  # "passdb" user database means that the passdb already provided the
+  # "prefetch" user database means that the passdb already provided the
   # needed information and there's no need to do a separate userdb lookup.
   # This can be made to work with SQL and LDAP databases.
   # http://wiki.dovecot.org/AuthSpecials
-  userdb passdb {
+  userdb prefetch {
   }
 
   # User to use for the process. This user needs access to only user and
--- a/src/auth/Makefile.am	Wed Oct 19 16:37:22 2005 +0300
+++ b/src/auth/Makefile.am	Wed Oct 19 16:38:36 2005 +0300
@@ -71,9 +71,9 @@
 	userdb.c \
 	userdb-blocking.c \
 	userdb-ldap.c \
-	userdb-passdb.c \
 	userdb-passwd.c \
 	userdb-passwd-file.c \
+	userdb-prefetch.c \
 	userdb-static.c \
 	userdb-vpopmail.c \
 	userdb-sql.c
--- a/src/auth/userdb-passdb.c	Wed Oct 19 16:37:22 2005 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/* Copyright (C) 2004 Timo Sirainen */
-
-#include "common.h"
-
-#ifdef USERDB_PASSDB
-
-#include "str.h"
-#include "var-expand.h"
-#include "userdb.h"
-
-#include <stdlib.h>
-
-static void passdb_lookup(struct auth_request *auth_request,
-			  userdb_callback_t *callback)
-{
-	const char *const *args;
-	string_t *str;
-	uid_t uid;
-	gid_t gid;
-	int uid_seen, gid_seen;
-
-	if (auth_request->extra_fields == NULL) {
-		auth_request_log_error(auth_request, "passdb",
-				       "passdb didn't return userdb entries");
-		callback(NULL, auth_request);
-		return;
-	}
-
-	t_push();
-
-	uid = (uid_t)-1; gid = (gid_t)-1;
-	uid_seen = gid_seen = FALSE;
-
-	str = t_str_new(256);
-	str_append(str, auth_request->user);
-
-	/* export the request. keep all keys starting with userdb_ but strip
-	   the userdb_ away. */
-	args = t_strsplit(auth_stream_reply_export(auth_request->extra_fields),
-		"\t");
-	for (; *args != NULL; args++) {
-		const char *arg = *args;
-
-		if (strncmp(arg, "userdb_", 7) != 0)
-			continue;
-		arg += 7;
-
-		str_append_c(str, '\t');
-		if (strncmp(arg, "uid=", 4) == 0) {
-			uid_seen = TRUE;
-			uid = userdb_parse_uid(auth_request, arg+4);
-			if (uid == (uid_t)-1)
-				break;
-
-			str_append(str, "uid=");
-			str_append(str, dec2str(uid));
-		} else if (strncmp(arg, "gid=", 4) == 0) {
-			gid_seen = TRUE;
-			gid = userdb_parse_gid(auth_request, arg+4);
-			if (gid == (gid_t)-1)
-				break;
-
-			str_append(str, "gid=");
-			str_append(str, dec2str(gid));
-		} else {
-			str_append(str, arg);
-		}
-	}
-
-	if (!uid_seen) {
-		auth_request_log_error(auth_request, "passdb",
-				       "userdb_uid not returned");
-	}
-	if (!gid_seen) {
-		auth_request_log_error(auth_request, "passdb",
-				       "userdb_gid not returned");
-	}
-
-	if (uid == (uid_t)-1 || gid == (gid_t)-1)
-		callback(NULL, auth_request);
-	else {
-		struct auth_stream_reply *reply;
-
-		/* import the string into request. since the values were
-		   exported they are already in escaped form in the string. */
-		reply = auth_stream_reply_init(auth_request);
-		auth_stream_reply_import(reply, str_c(str));
-		callback(reply, auth_request);
-	}
-	t_pop();
-}
-
-struct userdb_module_interface userdb_passdb = {
-	"passdb",
-
-	NULL,
-	NULL,
-	NULL,
-
-	passdb_lookup
-};
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/auth/userdb-prefetch.c	Wed Oct 19 16:38:36 2005 +0300
@@ -0,0 +1,103 @@
+/* Copyright (C) 2004 Timo Sirainen */
+
+#include "common.h"
+
+#ifdef USERDB_PREFETCH
+
+#include "str.h"
+#include "var-expand.h"
+#include "userdb.h"
+
+#include <stdlib.h>
+
+static void prefetch_lookup(struct auth_request *auth_request,
+			    userdb_callback_t *callback)
+{
+	const char *const *args;
+	string_t *str;
+	uid_t uid;
+	gid_t gid;
+	int uid_seen, gid_seen;
+
+	if (auth_request->extra_fields == NULL) {
+		auth_request_log_error(auth_request, "prefetch",
+				       "passdb didn't return userdb entries");
+		callback(NULL, auth_request);
+		return;
+	}
+
+	t_push();
+
+	uid = (uid_t)-1; gid = (gid_t)-1;
+	uid_seen = gid_seen = FALSE;
+
+	str = t_str_new(256);
+	str_append(str, auth_request->user);
+
+	/* export the request. keep all keys starting with userdb_ but strip
+	   the userdb_ away. */
+	args = t_strsplit(auth_stream_reply_export(auth_request->extra_fields),
+		"\t");
+	for (; *args != NULL; args++) {
+		const char *arg = *args;
+
+		if (strncmp(arg, "userdb_", 7) != 0)
+			continue;
+		arg += 7;
+
+		str_append_c(str, '\t');
+		if (strncmp(arg, "uid=", 4) == 0) {
+			uid_seen = TRUE;
+			uid = userdb_parse_uid(auth_request, arg+4);
+			if (uid == (uid_t)-1)
+				break;
+
+			str_append(str, "uid=");
+			str_append(str, dec2str(uid));
+		} else if (strncmp(arg, "gid=", 4) == 0) {
+			gid_seen = TRUE;
+			gid = userdb_parse_gid(auth_request, arg+4);
+			if (gid == (gid_t)-1)
+				break;
+
+			str_append(str, "gid=");
+			str_append(str, dec2str(gid));
+		} else {
+			str_append(str, arg);
+		}
+	}
+
+	if (!uid_seen) {
+		auth_request_log_error(auth_request, "prefetch",
+				       "userdb_uid not returned");
+	}
+	if (!gid_seen) {
+		auth_request_log_error(auth_request, "prefetch",
+				       "userdb_gid not returned");
+	}
+
+	if (uid == (uid_t)-1 || gid == (gid_t)-1)
+		callback(NULL, auth_request);
+	else {
+		struct auth_stream_reply *reply;
+
+		/* import the string into request. since the values were
+		   exported they are already in escaped form in the string. */
+		reply = auth_stream_reply_init(auth_request);
+		auth_stream_reply_import(reply, str_c(str));
+		callback(reply, auth_request);
+	}
+	t_pop();
+}
+
+struct userdb_module_interface userdb_prefetch = {
+	"prefetch",
+
+	NULL,
+	NULL,
+	NULL,
+
+	prefetch_lookup
+};
+
+#endif
--- a/src/auth/userdb.c	Wed Oct 19 16:37:22 2005 +0300
+++ b/src/auth/userdb.c	Wed Oct 19 16:38:36 2005 +0300
@@ -9,7 +9,7 @@
 #include <pwd.h>
 #include <grp.h>
 
-extern struct userdb_module_interface userdb_passdb;
+extern struct userdb_module_interface userdb_prefetch;
 extern struct userdb_module_interface userdb_static;
 extern struct userdb_module_interface userdb_passwd;
 extern struct userdb_module_interface userdb_passwd_file;
@@ -24,8 +24,8 @@
 #ifdef USERDB_PASSWD_FILE
 	&userdb_passwd_file,
 #endif
-#ifdef USERDB_PASSDB
-	&userdb_passdb,
+#ifdef USERDB_PREFETCH
+	&userdb_prefetch,
 #endif
 #ifdef USERDB_STATIC
 	&userdb_static,