1
1
/* mupdate.c -- cyrus murder database master
3
* $Id: mupdate.c,v 1.89 2004/12/17 16:32:16 ken3 Exp $
3
* $Id: mupdate.c,v 1.92 2005/11/04 13:33:30 murch Exp $
4
4
* Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
6
6
* Redistribution and use in source and binary forms, with or without
465
* The auth_*.c backends called by mysasl_proxy_policy()
466
* use static variables which we need to protect with a mutex.
468
static pthread_mutex_t proxy_policy_mutex = PTHREAD_MUTEX_INITIALIZER;
470
static int mupdate_proxy_policy(sasl_conn_t *conn,
472
const char *requested_user, unsigned rlen,
473
const char *auth_identity, unsigned alen,
474
const char *def_realm,
476
struct propctx *propctx)
480
pthread_mutex_lock(&proxy_policy_mutex); /* LOCK */
482
r = mysasl_proxy_policy(conn, context, requested_user, rlen,
483
auth_identity, alen, def_realm, urlen, propctx);
485
pthread_mutex_unlock(&proxy_policy_mutex); /* UNLOCK */
463
490
static struct sasl_callback mysasl_cb[] = {
464
491
{ SASL_CB_GETOPT, &mysasl_config, NULL },
465
{ SASL_CB_PROXY_POLICY, &mysasl_proxy_policy, NULL },
492
{ SASL_CB_PROXY_POLICY, &mupdate_proxy_policy, NULL },
466
493
{ SASL_CB_LIST_END, NULL, NULL }
952
"Server too busy, droping connection.");
979
"Server too busy, dropping connection.");
953
980
} else if(write(conn_pipe[1], &fd, sizeof(fd)) == -1) {
954
981
/* signal that a new file descriptor is available.
955
982
* If it fails... */
1133
1157
if(need_workers > 0) {
1134
1158
too_many = (need_workers + worker_count) -
1135
1159
config_getint(IMAPOPT_MUPDATE_WORKERS_MAX);
1136
need_workers -= too_many;
1160
if (too_many > 0) need_workers -= too_many;
1139
1163
/* Do we need a new worker (or two, or three...)?