if (conn->token_auth) {
mechanisms = t_strconcat("MECH\t",
- mech_dovecot_token.mech_name, "\tprivate\n", NULL);
+ mech_dovecot_token.name, "\tprivate\n", NULL);
} else {
mechanisms = str_c(conn->auth->reg->handshake);
if (conn->conn.minor_version >= AUTH_CLIENT_MINOR_VERSION_CHANNEL_BINDING) {
void auth_request_fields_init(struct auth_request *request)
{
if (request->mech != NULL) {
- request->fields.mech_name = request->mech->mech_name;
+ request->fields.mech_name = request->mech->name;
event_add_str(request->event, "mechanism",
- request->mech->mech_name);
+ request->mech->name);
}
}
if (handler->token_auth) {
mech = &mech_dovecot_token;
- if (strcmp(mech_name, mech->mech_name) == 0) {
+ if (strcmp(mech_name, mech->name) == 0) {
*mech_r = mech;
return 0;
}
auth_str_add_keyvalue(dest, "master_user",
request->fields.master_user);
}
- auth_str_add_keyvalue(dest, "auth_mech", request->mech->mech_name);
+ auth_str_add_keyvalue(dest, "auth_mech", request->mech->name);
if (*request->set->anonymous_username != '\0' &&
strcmp(request->fields.user, request->set->anonymous_username) == 0) {
/* this is an anonymous login, either via ANONYMOUS
}
if (auth_request->mech != NULL) {
str_append(str, ",sasl:");
- str_append(str, t_str_lcase(auth_request->mech->mech_name));
+ str_append(str, t_str_lcase(auth_request->mech->name));
}
if (auth_request->fields.requested_login_user != NULL)
str_append(str, ",master");
request->mech = mech;
const char *prefix = t_strconcat(
- t_str_lcase(request->mech->mech_name), ": ", NULL);
+ t_str_lcase(request->mech->name), ": ", NULL);
request->mech_event = event_create(request->event);
event_set_append_log_prefix(request->mech_event, prefix);
if (mech == NULL)
return str_array_icase_find(mechs, "lookup");
/* check if request mechanism is accepted */
- return str_array_icase_find(mechs, mech->mech_name);
+ return str_array_icase_find(mechs, mech->name);
}
/**
};
const struct sasl_server_mech_def mech_apop = {
- .mech_name = "APOP",
+ .name = "APOP",
.flags = SASL_MECH_SEC_PRIVATE | SASL_MECH_SEC_DICTIONARY |
SASL_MECH_SEC_ACTIVE | SASL_MECH_SEC_ALLOW_NULS,
};
const struct sasl_server_mech_def mech_dovecot_token = {
- .mech_name = "DOVECOT-TOKEN",
+ .name = "DOVECOT-TOKEN",
.flags = SASL_MECH_SEC_PRIVATE | SASL_MECH_SEC_ALLOW_NULS,
.passdb_need = SASL_MECH_PASSDB_NEED_NOTHING,
{
const char *mech, *error;
array_foreach_elem(&global_auth_settings->mechanisms, mech) {
- if (strcasecmp(mech, mech_xoauth2.mech_name) == 0 ||
- strcasecmp(mech, mech_oauthbearer.mech_name) == 0) {
+ if (strcasecmp(mech, mech_xoauth2.name) == 0 ||
+ strcasecmp(mech, mech_oauthbearer.name) == 0) {
if (db_oauth2_init(auth_event, FALSE,
&db_oauth2, &error) < 0)
i_fatal("Cannot initialize oauth2: %s", error);
if (auth->passdbs == NULL) {
i_fatal("No passdbs specified in configuration file. "
"%s mechanism needs one",
- list->module->mech_name);
+ list->module->name);
}
i_fatal("%s mechanism can't be supported with given passdbs",
- list->module->mech_name);
+ list->module->name);
}
}
void mech_register_module(const struct sasl_server_mech_def *module)
{
struct mech_module_list *list;
- i_assert(strcmp(module->mech_name, t_str_ucase(module->mech_name)) == 0);
+ i_assert(strcmp(module->name, t_str_ucase(module->name)) == 0);
list = i_new(struct mech_module_list, 1);
list->module = module;
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->name, module->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)
+ if (strcmp(list->module->name, name) == 0)
return list->module;
}
return NULL;
else
handshake = reg->handshake;
- str_printfa(handshake, "MECH\t%s", mech->mech_name);
+ str_printfa(handshake, "MECH\t%s", mech->name);
if ((mech->flags & SASL_MECH_SEC_PRIVATE) != 0)
str_append(handshake, "\tprivate");
if ((mech->flags & SASL_MECH_SEC_ANONYMOUS) != 0)
name = t_str_ucase(name);
for (list = reg->modules; list != NULL; list = list->next) {
- if (strcmp(list->module->mech_name, name) == 0)
+ if (strcmp(list->module->name, name) == 0)
return list->module;
}
return NULL;
};
const struct sasl_server_mech_def mech_anonymous = {
- .mech_name = "ANONYMOUS",
+ .name = "ANONYMOUS",
.flags = SASL_MECH_SEC_ANONYMOUS | SASL_MECH_SEC_ALLOW_NULS,
.passdb_need = SASL_MECH_PASSDB_NEED_NOTHING,
};
const struct sasl_server_mech_def mech_cram_md5 = {
- .mech_name = "CRAM-MD5",
+ .name = "CRAM-MD5",
.flags = SASL_MECH_SEC_DICTIONARY | SASL_MECH_SEC_ACTIVE,
.passdb_need = SASL_MECH_PASSDB_NEED_VERIFY_RESPONSE,
};
const struct sasl_server_mech_def mech_digest_md5 = {
- .mech_name = "DIGEST-MD5",
+ .name = "DIGEST-MD5",
.flags = SASL_MECH_SEC_DICTIONARY | SASL_MECH_SEC_ACTIVE |
SASL_MECH_SEC_MUTUAL_AUTH,
};
const struct sasl_server_mech_def mech_external = {
- .mech_name = "EXTERNAL",
+ .name = "EXTERNAL",
.flags = 0,
.passdb_need = SASL_MECH_PASSDB_NEED_VERIFY_PLAIN,
};
const struct sasl_server_mech_def mech_gssapi = {
- .mech_name = "GSSAPI",
+ .name = "GSSAPI",
.flags = SASL_MECH_SEC_ALLOW_NULS,
.passdb_need = SASL_MECH_PASSDB_NEED_NOTHING,
internally. Nothing else needs to be done here. Note, however, that this does
not support SPNEGO when the only available credential is NTLM. */
const struct sasl_server_mech_def mech_gssapi_spnego = {
- .mech_name = "GSS-SPNEGO",
+ .name = "GSS-SPNEGO",
.flags = SASL_MECH_SEC_ALLOW_NULS,
.passdb_need = SASL_MECH_PASSDB_NEED_NOTHING,
mech_register_module(&mech_gssapi);
#ifdef HAVE_GSSAPI_SPNEGO
/* load if we already didn't load it using winbind */
- if (mech_module_find(mech_gssapi_spnego.mech_name) == NULL)
+ if (mech_module_find(mech_gssapi_spnego.name) == NULL)
mech_register_module(&mech_gssapi_spnego);
#endif
}
#ifdef HAVE_GSSAPI_SPNEGO
const struct sasl_server_mech_def *mech;
- mech = mech_module_find(mech_gssapi_spnego.mech_name);
+ mech = mech_module_find(mech_gssapi_spnego.name);
if (mech != NULL && mech == &mech_gssapi_spnego)
mech_unregister_module(&mech_gssapi_spnego);
#endif
};
const struct sasl_server_mech_def mech_login = {
- .mech_name = "LOGIN",
+ .name = "LOGIN",
.flags = SASL_MECH_SEC_PLAINTEXT,
.passdb_need = SASL_MECH_PASSDB_NEED_VERIFY_PLAIN,
};
const struct sasl_server_mech_def mech_oauthbearer = {
- .mech_name = "OAUTHBEARER",
+ .name = "OAUTHBEARER",
/* while this does not transfer plaintext password,
the token is still considered as password */
};
const struct sasl_server_mech_def mech_xoauth2 = {
- .mech_name = "XOAUTH2",
+ .name = "XOAUTH2",
.flags = SASL_MECH_SEC_PLAINTEXT,
.passdb_need = 0,
};
const struct sasl_server_mech_def mech_otp = {
- .mech_name = "OTP",
+ .name = "OTP",
.flags = SASL_MECH_SEC_DICTIONARY | SASL_MECH_SEC_ACTIVE |
SASL_MECH_SEC_ALLOW_NULS,
};
const struct sasl_server_mech_def mech_plain = {
- .mech_name = "PLAIN",
+ .name = "PLAIN",
.flags = SASL_MECH_SEC_PLAINTEXT | SASL_MECH_SEC_ALLOW_NULS,
.passdb_need = SASL_MECH_PASSDB_NEED_VERIFY_PLAIN,
};
const struct sasl_server_mech_def mech_scram_sha1 = {
- .mech_name = "SCRAM-SHA-1",
+ .name = "SCRAM-SHA-1",
.flags = SASL_MECH_SEC_MUTUAL_AUTH,
.passdb_need = SASL_MECH_PASSDB_NEED_LOOKUP_CREDENTIALS,
};
const struct sasl_server_mech_def mech_scram_sha1_plus = {
- .mech_name = "SCRAM-SHA-1-PLUS",
+ .name = "SCRAM-SHA-1-PLUS",
.flags = SASL_MECH_SEC_MUTUAL_AUTH | SASL_MECH_SEC_CHANNEL_BINDING,
.passdb_need = SASL_MECH_PASSDB_NEED_LOOKUP_CREDENTIALS,
};
const struct sasl_server_mech_def mech_scram_sha256 = {
- .mech_name = "SCRAM-SHA-256",
+ .name = "SCRAM-SHA-256",
.flags = SASL_MECH_SEC_MUTUAL_AUTH,
.passdb_need = SASL_MECH_PASSDB_NEED_LOOKUP_CREDENTIALS,
};
const struct sasl_server_mech_def mech_scram_sha256_plus = {
- .mech_name = "SCRAM-SHA-256-PLUS",
+ .name = "SCRAM-SHA-256-PLUS",
.flags = SASL_MECH_SEC_MUTUAL_AUTH | SASL_MECH_SEC_CHANNEL_BINDING,
.passdb_need = SASL_MECH_PASSDB_NEED_LOOKUP_CREDENTIALS,
};
const struct sasl_server_mech_def mech_winbind_ntlm = {
- .mech_name = "NTLM",
+ .name = "NTLM",
.flags = SASL_MECH_SEC_DICTIONARY | SASL_MECH_SEC_ACTIVE |
SASL_MECH_SEC_ALLOW_NULS,
};
const struct sasl_server_mech_def mech_winbind_spnego = {
- .mech_name = "GSS-SPNEGO",
+ .name = "GSS-SPNEGO",
.flags = SASL_MECH_SEC_ALLOW_NULS,
.passdb_need = SASL_MECH_PASSDB_NEED_NOTHING,
};
struct sasl_server_mech_def {
- const char *mech_name;
+ const char *name;
enum sasl_mech_security_flags flags;
enum sasl_mech_passdb_need passdb_need;
req->mech = mreq;
rctx->mech = mech;
- rctx->mech_name = mech->mech_name;
+ rctx->mech_name = mech->name;
rctx->request = req;
}
const struct sasl_server_mech_def *mech = test_case->mech;
struct auth_request *request;
const char *testname = t_strdup_printf("auth mech %s %d/%zu",
- mech->mech_name,
+ mech->name,
running_test+1,
N_ELEMENTS(tests));
test_begin(testname);