bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */
16f46efe0e090fe6975acf012a61a160f4787985Andrey Paninvoid mech_register_module(const struct mech_module *module)
6894cb956465bfb921abc7872a48e90c1b632a7eAki Tuomi i_assert(strcmp(module->mech_name, t_str_ucase(module->mech_name)) == 0);
16f46efe0e090fe6975acf012a61a160f4787985Andrey Paninvoid mech_unregister_module(const struct mech_module *module)
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen for (pos = &mech_modules; *pos != NULL; pos = &(*pos)->next) {
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen if (strcmp((*pos)->module.mech_name, module->mech_name) == 0) {
7242e1ce7803b83bc82e239ef111b47c1c72dd4bAndrey Paninconst struct mech_module *mech_module_find(const char *name)
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen for (list = mech_modules; list != NULL; list = list->next) {
e70d5895795732b8247ab9abb045b438e954bc46Timo Sirainenvoid mech_generic_auth_initial(struct auth_request *request,
5965eaa2d972e6264cecaf54091cd43019bc7d1fTimo Sirainen auth_request_handler_reply_continue(request, uchar_empty_ptr, 0);
4051fa1f367553cac34f74c2e332a678390bcee5Timo Sirainen /* initial reply given, even if it was 0 bytes */
e70d5895795732b8247ab9abb045b438e954bc46Timo Sirainen request->mech->auth_continue(request, data, data_size);
e70d5895795732b8247ab9abb045b438e954bc46Timo Sirainenvoid mech_generic_auth_free(struct auth_request *request)
1ddec6312bc6882aeb17d4d46d19cbca1723b68bTimo Sirainenextern const struct mech_module mech_digest_md5;
15cb9549422ccee416b21d26fec97a556ad0fa36Florian Zeitzextern const struct mech_module mech_scram_sha1;
1ddec6312bc6882aeb17d4d46d19cbca1723b68bTimo Sirainenextern const struct mech_module mech_anonymous;
704fbadd78375da18dcaf2c5d93ac8cfe2c61358Timo Sirainenextern const struct mech_module mech_gssapi_spnego;
2c38504860da8a8de915f8e0f5f39d7e7bd00cf8Timo Sirainenextern const struct mech_module mech_winbind_ntlm;
2c38504860da8a8de915f8e0f5f39d7e7bd00cf8Timo Sirainenextern const struct mech_module mech_winbind_spnego;
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainenstatic void mech_register_add(struct mechanisms_register *reg,
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen list = p_new(reg->pool, struct mech_module_list, 1);
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen str_printfa(reg->handshake, "MECH\t%s", mech->mech_name);
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen if ((mech->flags & MECH_SEC_FORWARD_SECRECY) != 0)
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen str_append(reg->handshake, "\tforward-secrecy");
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen if ((mech->flags & MECH_SEC_MUTUAL_AUTH) != 0)
0cc875d28852d15005cff2a77252e7836c862a01Timo Sirainenstatic const char *mech_get_plugin_name(const char *name)
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainenmech_register_init(const struct auth_settings *set)
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen pool = pool_alloconly_create("mechanisms register", 1024);
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen reg = p_new(pool, struct mechanisms_register, 1);
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen mechanisms = t_strsplit_spaces(set->mechanisms, " ");
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen "but anonymous_username not set");
966cb0c1aa58578339cea6f79b4a423a851ab074Timo Sirainen /* maybe it's a plugin. try to load it. */
966cb0c1aa58578339cea6f79b4a423a851ab074Timo Sirainen i_fatal("Unknown authentication mechanism '%s'", name);
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainen i_fatal("No authentication mechanisms configured");
21c317a20c4c3784b54fb3e90ee3751870afdcc3Timo Sirainenvoid mech_register_deinit(struct mechanisms_register **_reg)
4ac2e38bdb450d13b62be41638b12df9e0658009Stephan Boschmech_register_find(const struct mechanisms_register *reg, const char *name)
4ac2e38bdb450d13b62be41638b12df9e0658009Stephan Bosch for (list = reg->modules; list != NULL; list = list->next) {
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainenvoid mech_init(const struct auth_settings *set)
6e873f135368bcfdd1de4458dded791d0c4d00cdTimo Sirainen#if defined(HAVE_GSSAPI_SPNEGO) && defined(BUILTIN_GSSAPI)
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainenvoid mech_deinit(const struct auth_settings *set)
6e873f135368bcfdd1de4458dded791d0c4d00cdTimo Sirainen#if defined(HAVE_GSSAPI_SPNEGO) && defined(BUILTIN_GSSAPI)