}
static bool
-auth_mech_verify_passdb(const struct auth *auth, const struct mech_module_list *list)
+auth_mech_verify_passdb(const struct auth *auth, const struct mech_module *mech)
{
- switch (list->module.passdb_need) {
+ switch (mech->passdb_need) {
case SASL_MECH_PASSDB_NEED_NOTHING:
break;
case SASL_MECH_PASSDB_NEED_VERIFY_PLAIN:
const struct mech_module_list *list;
for (list = auth->reg->modules; list != NULL; list = list->next) {
- if (!auth_mech_verify_passdb(auth, list))
+ if (!auth_mech_verify_passdb(auth, list->module))
break;
}
if (auth->passdbs == NULL) {
i_fatal("No passdbs specified in configuration file. "
"%s mechanism needs one",
- list->module.mech_name);
+ list->module->mech_name);
}
i_fatal("%s mechanism can't be supported with given passdbs",
- list->module.mech_name);
+ list->module->mech_name);
}
}
i_assert(strcmp(module->mech_name, t_str_ucase(module->mech_name)) == 0);
list = i_new(struct mech_module_list, 1);
- list->module = *module;
+ list->module = module;
list->next = mech_modules;
mech_modules = list;
struct mech_module_list **pos, *list;
for (pos = &mech_modules; *pos != NULL; pos = &(*pos)->next) {
- if (strcmp((*pos)->module.mech_name, module->mech_name) == 0) {
+ if (strcmp((*pos)->module->mech_name, module->mech_name) == 0) {
list = *pos;
*pos = (*pos)->next;
i_free(list);
name = t_str_ucase(name);
for (list = mech_modules; list != NULL; list = list->next) {
- if (strcmp(list->module.mech_name, name) == 0)
- return &list->module;
+ if (strcmp(list->module->mech_name, name) == 0)
+ return list->module;
}
return NULL;
}
string_t *handshake;
list = p_new(reg->pool, struct mech_module_list, 1);
- list->module = *mech;
+ list->module = mech;
if ((mech->flags & SASL_MECH_SEC_CHANNEL_BINDING) != 0)
handshake = reg->handshake_cbind;
name = t_str_ucase(name);
for (list = reg->modules; list != NULL; list = list->next) {
- if (strcmp(list->module.mech_name, name) == 0)
- return &list->module;
+ if (strcmp(list->module->mech_name, name) == 0)
+ return list->module;
}
return NULL;
}
bool verifying_token:1;
};
+const struct mech_module mech_oauthbearer;
+const struct mech_module mech_xoauth2;
+
static struct db_oauth2 *db_oauth2 = NULL;
static void
i_assert(failure->status != NULL);
json_ostream_ndescend_object(joutput, NULL);
- if (strcmp(request->mech->mech_name, "XOAUTH2") == 0) {
+ if (request->mech == &mech_xoauth2) {
if (strcmp(failure->status, "invalid_token") == 0)
json_ostream_nwrite_string(joutput, "status", "401");
else if (strcmp(failure->status, "insufficient_scope") == 0)
json_ostream_nwrite_string(joutput, "status", "400");
json_ostream_nwrite_string(joutput, "schemes", "bearer");
} else {
- i_assert(strcmp(request->mech->mech_name, "OAUTHBEARER") == 0);
+ i_assert(request->mech == &mech_oauthbearer);
json_ostream_nwrite_string(joutput, "status", failure->status);
}
if (failure->scope == NULL)
struct mech_module_list {
struct mech_module_list *next;
- struct mech_module module;
+ const struct mech_module *module;
};
struct mechanisms_register {