static int
client_auth_begin_common(struct client *client, const char *mech_name,
- bool private, const char *init_resp)
+ enum sasl_server_auth_flags auth_flags,
+ const char *init_resp)
{
if (!client->secured && strcmp(client->ssl_set->ssl, "required") == 0) {
if (client->set->auth_verbose) {
client_ref(client);
client->auth_initializing = TRUE;
sasl_server_auth_begin(client, login_binary->protocol, mech_name,
- private, init_resp, sasl_callback);
+ auth_flags, init_resp, sasl_callback);
client->auth_initializing = FALSE;
if (!client->authenticating)
return 1;
int client_auth_begin(struct client *client, const char *mech_name,
const char *init_resp)
{
- return client_auth_begin_common(client, mech_name, FALSE, init_resp);
+ return client_auth_begin_common(client, mech_name, 0, init_resp);
}
int client_auth_begin_private(struct client *client, const char *mech_name,
const char *init_resp)
{
- return client_auth_begin_common(client, mech_name, TRUE, init_resp);
+ return client_auth_begin_common(client, mech_name,
+ SASL_SERVER_AUTH_FLAG_PRIVATE,
+ init_resp);
}
bool client_check_plaintext_auth(struct client *client, bool pass_sent)
unsigned int proxy_ttl;
char *auth_mech_name;
+ enum sasl_server_auth_flags auth_flags;
struct auth_client_request *auth_request;
string_t *auth_response;
time_t auth_first_started, auth_finished;
const char *init_resp);
int client_auth_begin_private(struct client *client, const char *mech_name,
const char *init_resp);
+int client_auth_begin_implicit(struct client *client, const char *mech_name,
+ const char *init_resp);
bool client_check_plaintext_auth(struct client *client, bool pass_sent);
int client_auth_read_line(struct client *client);
void sasl_server_auth_begin(struct client *client,
const char *service, const char *mech_name,
- bool private, const char *initial_resp_base64,
+ enum sasl_server_auth_flags flags,
+ const char *initial_resp_base64,
sasl_server_callback_t *callback)
{
struct auth_request_info info;
const struct auth_mech_desc *mech;
+ bool private = HAS_ALL_BITS(flags, SASL_SERVER_AUTH_FLAG_PRIVATE);
const char *error;
i_assert(auth_client_is_connected(auth_client));
i_free(client->auth_mech_name);
client->auth_mech_name = str_ucase(i_strdup(mech_name));
client->auth_anonymous = FALSE;
+ client->auth_flags = flags;
client->sasl_callback = callback;
mech = sasl_server_find_available_mech(client, mech_name);
SASL_SERVER_REPLY_CONTINUE
};
+enum sasl_server_auth_flags {
+ /* Allow the use of private mechanism */
+ SASL_SERVER_AUTH_FLAG_PRIVATE = BIT(0),
+};
+
typedef void sasl_server_callback_t(struct client *client,
enum sasl_server_reply reply,
const char *data, const char *const *args);
void sasl_server_auth_begin(struct client *client,
const char *service, const char *mech_name,
- bool private, const char *initial_resp_base64,
+ enum sasl_server_auth_flags flags,
+ const char *initial_resp_base64,
sasl_server_callback_t *callback);
void sasl_server_auth_failed(struct client *client, const char *reason,
const char *code) ATTR_NULL(3);