view src/auth/userdb-prefetch.c @ 7086:7ed926ed7aa4 HEAD

Updated copyright notices to include year 2008.
author Timo Sirainen <tss@iki.fi>
date Tue, 01 Jan 2008 22:05:21 +0200
parents 65c69a53a7be
children ea275bc7c8a1
line wrap: on
line source

/* Copyright (c) 2004-2008 Dovecot authors, see the included COPYING file */

#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)
{
	/* auth_request_set_field() should have already placed the userdb_*
	   values to userdb_reply. */
	if (auth_request->userdb_reply == NULL) {
		if (auth_request->auth->userdbs->next == NULL) {
			/* no other userdbs */
			auth_request_log_error(auth_request, "prefetch",
				"passdb didn't return userdb entries");
		} else {
			/* more userdbs, they may know the user */
			auth_request_log_info(auth_request, "prefetch",
				"passdb didn't return userdb entries");
		}
		callback(USERDB_RESULT_USER_UNKNOWN, auth_request);
		return;
	}

	auth_request_log_debug(auth_request, "prefetch", "success");
	callback(USERDB_RESULT_OK, auth_request);
}

struct userdb_module_interface userdb_prefetch = {
	"prefetch",

	NULL,
	NULL,
	NULL,

	prefetch_lookup
};

#endif