userdb-passwd.c revision a10ed8c47534b4c6b6bf2711ccfe577e720a47b4
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Copyright (c) 2002-2012 Dovecot authors, see the included COPYING file */
beb6125ee872e7fed57745ab33e6de99639180f3Timo Sirainen#define PASSDB_SLOW_MASTER_WARN_COUNT_INTERVAL 100
beb6125ee872e7fed57745ab33e6de99639180f3Timo Sirainen#define PASSDB_SLOW_MASTER_WARN_MIN_PERCENTAGE 5
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen struct passwd_userdb_iterate_context *next_waiting;
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainenstatic struct passwd_userdb_iterate_context *cur_userdb_iter = NULL;
09c3a491f4f6ccebe290c7709bdc0d79a187610bTimo Sirainenstatic struct timeout *cur_userdb_iter_to = NULL;
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainenpasswd_check_warnings(struct auth_request *auth_request,
aa38d1a0945f0bc13a225d043f53fad2eec666b1Timo Sirainen msecs = timeval_diff_msecs(&end_tv, start_tv);
e06c0b65c16ccce69bbee009ead14d7d3d17a256Timo Sirainen i_warning("passwd: Lookup for %s took %u secs",
687bb904e1bb76c21a6e392f60c990486b298ea4Timo Sirainen if (percentage < PASSDB_SLOW_MASTER_WARN_MIN_PERCENTAGE) {
687bb904e1bb76c21a6e392f60c990486b298ea4Timo Sirainen /* start from beginning */
7c95b03620a03a43dd72d39608cea5fc77393ad6Timo Sirainen i_warning("passwd: %u%% of last %u lookups took over "
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen "%u milliseconds, "
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen "you may want to set blocking=yes for userdb",
aa38d1a0945f0bc13a225d043f53fad2eec666b1Timo Sirainen percentage, PASSDB_SLOW_MASTER_WARN_COUNT_INTERVAL,
a2cbf1d392ee983520451bc9b849a490f28ac298Timo Sirainenstatic void passwd_lookup(struct auth_request *auth_request,
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainen struct userdb_module *_module = auth_request->userdb->userdb;
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen auth_request_log_debug(auth_request, "passwd", "lookup");
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainen passwd_check_warnings(auth_request, module, &start_tv);
static struct userdb_iterate_context *
setpwent();
return FALSE;
return FALSE;
return FALSE;
return TRUE;
errno = 0;
if (errno != 0) {
return ret;
static struct userdb_module *
const char *value;
NULL,
NULL,