Used by GSSAPI mechanisms.
set_credentials_callback);
}
+static const char *
+auth_sasl_translate_protocol_name(struct auth_request *request)
+{
+ i_assert(request->fields.protocol != NULL);
+
+ const char *protocol = request->fields.protocol;
+
+ /* Translate to SASL/GSSAPI/Kerberos service name (IANA-registered) */
+ if (strcasecmp(protocol, "POP3") == 0) {
+ /* The standard POP3 service name with SASL/GSSAPI/Kerberos is
+ called just "pop". */
+ return "pop";
+ }
+
+ return t_str_lcase(protocol);
+}
+
void auth_sasl_request_init(struct auth_request *request,
const struct sasl_server_mech_def *mech)
{
sasl_server_request_create(&request->sasl.req, mech,
+ auth_sasl_translate_protocol_name(request),
request->mech_event);
}
string_t *principal_name;
gss_buffer_desc inbuf;
gss_name_t gss_principal;
- const char *service_name;
if (!gssapi_initialized) {
gssapi_initialized = TRUE;
return GSS_S_COMPLETE;
}
- if (strcasecmp(auth_request->request->fields.protocol, "POP3") == 0) {
- /* The standard POP3 service name with GSSAPI is called
- just "pop". */
- service_name = "pop";
- } else {
- service_name = t_str_lcase(auth_request->request->fields.protocol);
- }
-
principal_name = t_str_new(128);
- str_append(principal_name, service_name);
+ str_append(principal_name, auth_request->protocol);
str_append_c(principal_name, '@');
str_append(principal_name, auth_request->request->set->gssapi_hostname);
const struct sasl_server_mech_def *mech;
struct sasl_server_request *req;
struct event *mech_event;
+ const char *protocol;
// FIXME: To be removed
struct auth_request *request;
void sasl_server_request_create(struct sasl_server_req_ctx *rctx,
const struct sasl_server_mech_def *mech,
+ const char *protocol,
struct event *event_parent)
{
struct auth_request *request =
mreq->request = request;
mreq->mech = mech;
mreq->mech_event = event_parent;
+ mreq->protocol = p_strdup(mreq->pool, protocol);
req->mech = mreq;
rctx->mech = mech;
void sasl_server_request_create(struct sasl_server_req_ctx *rctx,
const struct sasl_server_mech_def *mech,
+ const char *protocol,
struct event *event_parent);
void sasl_server_request_destroy(struct sasl_server_req_ctx *rctx);