userdb.c revision 5c99eaa4e3e07ee065580d163240b4ce95b66bef
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen/* Copyright (c) 2002-2009 Dovecot authors, see the included COPYING file */
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainenstatic ARRAY_DEFINE(userdb_interfaces, struct userdb_module_interface *);
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainenstatic struct userdb_module_interface *userdb_interface_find(const char *name)
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen struct userdb_module_interface *const *ifaces;
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen unsigned int i, count;
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen ifaces = array_get(&userdb_interfaces, &count);
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen for (i = 0; i < count; i++) {
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainenvoid userdb_register_module(struct userdb_module_interface *iface)
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen old_iface = userdb_interface_find(iface->name);
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen if (old_iface != NULL && old_iface->lookup == NULL) {
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen /* replacing a "support not compiled in" userdb */
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen i_panic("userdb_register_module(%s): Already registered",
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainenvoid userdb_unregister_module(struct userdb_module_interface *iface)
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen struct userdb_module_interface *const *ifaces;
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen unsigned int i, count;
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen ifaces = array_get(&userdb_interfaces, &count);
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen for (i = 0; i < count; i++) {
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen i_panic("userdb_unregister_module(%s): Not registered", iface->name);
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainenuid_t userdb_parse_uid(struct auth_request *request, const char *str)
return uid;
return gid;
driver);
void userdbs_init(void)
void userdbs_deinit(void)