return -1;
}
} else {
- struct auth *auth_default = auth_default_service();
+ struct auth *auth_default = auth_default_protocol();
mech = mech_register_find(auth_default->reg, args[1]);
if (mech == NULL) {
/* unsupported mechanism */
struct auth *auth_request_get_auth(struct auth_request *request)
{
- return auth_find_service(request->fields.service);
+ return auth_find_protocol(request->fields.service);
}
void auth_request_success(struct auth_request *request,
const char *host,
auth_request_proxy_cb_t *callback)
{
- struct auth *auth = auth_default_service();
+ struct auth *auth = auth_default_protocol();
struct event *proxy_event;
struct auth_request_proxy_dns_lookup_ctx *ctx;
const char *value;
i_fatal("%s", error);
}
-const struct auth_settings *auth_settings_get(const char *service)
+const struct auth_settings *auth_settings_get(const char *protocol)
{
struct event *event = event_create(NULL);
- event_add_str(event, "protocol", service);
+ event_add_str(event, "protocol", protocol);
const struct auth_settings *set =
settings_get_or_fatal(event, &auth_setting_parser_info);
event_unref(&event);
extern const struct auth_settings *global_auth_settings;
void auth_settings_read(struct master_service_settings_output *output_r);
-const struct auth_settings *auth_settings_get(const char *service);
+const struct auth_settings *auth_settings_get(const char *protocol);
#endif
}
static struct auth * ATTR_NULL(2)
-auth_preinit(const struct auth_settings *set, const char *service,
+auth_preinit(const struct auth_settings *set, const char *protocol,
const struct mechanisms_register *reg)
{
const struct auth_passdb_settings *const *passdbs;
pool_t pool = pool_alloconly_create("auth", 128);
auth = p_new(pool, struct auth, 1);
auth->pool = pool;
- auth->service = p_strdup(pool, service);
+ auth->protocol = p_strdup(pool, protocol);
auth->set = set;
pool_ref(set->pool);
auth->reg = reg;
dns_client_deinit(&auth->dns_client);
}
-struct auth *auth_find_service(const char *name)
+struct auth *auth_find_protocol(const char *name)
{
struct auth *const *a;
unsigned int i, count;
a = array_get(&auths, &count);
if (name != NULL) {
for (i = 1; i < count; i++) {
- if (strcmp(a[i]->service, name) == 0)
+ if (strcmp(a[i]->protocol, name) == 0)
return a[i];
}
- /* not found. maybe we can instead find a !service */
+ /* not found. maybe we can instead find a !protocol */
for (i = 1; i < count; i++) {
- if (a[i]->service[0] == '!' &&
- strcmp(a[i]->service + 1, name) != 0)
+ if (a[i]->protocol[0] == '!' &&
+ strcmp(a[i]->protocol + 1, name) != 0)
return a[i];
}
}
return a[0];
}
-struct auth *auth_default_service(void)
+struct auth *auth_default_protocol(void)
{
struct auth *const *a;
unsigned int count;
void auths_preinit(const struct auth_settings *set,
const struct mechanisms_register *reg,
- const char *const *services)
+ const char *const *protocols)
{
- const struct auth_settings *service_set;
+ const struct auth_settings *protocol_set;
struct auth *auth;
unsigned int i;
- const char *not_service = NULL;
+ const char *not_protocol = NULL;
bool check_default = TRUE;
auth_event = event_create(NULL);
auth = auth_preinit(set, NULL, reg);
array_push_back(&auths, &auth);
- for (i = 0; services[i] != NULL; i++) {
- if (services[i][0] == '!') {
- if (not_service != NULL) {
- i_fatal("Can't have multiple protocol "
- "!services (seen %s and %s)",
- not_service, services[i]);
+ for (i = 0; protocols[i] != NULL; i++) {
+ if (protocols[i][0] == '!') {
+ if (not_protocol != NULL) {
+ i_fatal("Can't have multiple !protocols "
+ "(seen %s and %s)",
+ not_protocol, protocols[i]);
}
- not_service = services[i];
+ not_protocol = protocols[i];
}
- service_set = auth_settings_get(services[i]);
- auth = auth_preinit(service_set, services[i], reg);
+ protocol_set = auth_settings_get(protocols[i]);
+ auth = auth_preinit(protocol_set, protocols[i], reg);
array_push_back(&auths, &auth);
- settings_free(service_set);
+ settings_free(protocol_set);
}
- if (not_service != NULL && str_array_find(services, not_service+1))
+ if (not_protocol != NULL && str_array_find(protocols, not_protocol+1))
check_default = FALSE;
array_foreach_elem(&auths, auth) {
- if (auth->service != NULL || check_default)
+ if (auth->protocol != NULL || check_default)
auth_mech_list_verify_passdb(auth);
}
}
struct auth {
pool_t pool;
- const char *service;
+ const char *protocol;
const struct auth_settings *set;
const struct mechanisms_register *reg;
};
-struct auth *auth_find_service(const char *name);
-struct auth *auth_default_service(void);
+struct auth *auth_find_protocol(const char *name);
+struct auth *auth_default_protocol(void);
void auths_preinit(const struct auth_settings *set,
const struct mechanisms_register *reg,
- const char *const *services);
+ const char *const *protocols);
void auths_init(void);
void auths_deinit(void);
void auths_free(void);
static void main_preinit(void)
{
struct module_dir_load_settings mod_set;
- const char *const *services;
+ const char *const *protocols;
/* Load built-in SQL drivers (if any) */
sql_drivers_init();
/* init schemes before plugins are loaded */
password_schemes_init();
- services = read_global_settings();
+ protocols = read_global_settings();
i_zero(&mod_set);
mod_set.abi_version = DOVECOT_ABI_VERSION;
mech_init(global_auth_settings);
mech_reg = mech_register_init(global_auth_settings);
dict_drivers_register_builtin();
- auths_preinit(global_auth_settings, mech_reg, services);
+ auths_preinit(global_auth_settings, mech_reg, protocols);
listeners_init();
if (!worker)
}
master_service_client_connection_accept(conn);
- (void)auth_worker_server_create(auth_default_service(), conn);
+ (void)auth_worker_server_create(auth_default_protocol(), conn);
}
static void client_connected(struct master_service_connection *conn)
l->path = i_strdup(conn->name);
type = master_service_connection_get_type(conn);
- auth = auth_default_service();
+ auth = auth_default_protocol();
switch (auth_socket_type_get(type)) {
case AUTH_SOCKET_MASTER:
(void)auth_master_connection_create(auth, conn->fd,
static void auth_client_connected(int *server_fd)
{
- struct auth *auth = auth_default_service();
+ struct auth *auth = auth_default_protocol();
int fd = net_accept(*server_fd, NULL, NULL);
auth_client_connection_create(auth, fd, TEST_AUTH_CLIENT_SOCKET, FALSE, FALSE);
}
{
struct stat st;
i_zero(&st);
- struct auth *auth = auth_default_service();
+ struct auth *auth = auth_default_protocol();
int fd = net_accept(*server_fd, NULL, NULL);
i_assert(fd > 0);
auth_master_connection_create(auth, fd, socket, &st, FALSE);
const struct test_case *test_case)
{
test_auth_set.ssl_username_from_cert = test_case->set_cert_username;
- struct auth *auth = auth_default_service();
+ struct auth *auth = auth_default_protocol();
struct auth_request *request = auth_request_new(mech, NULL);
request->handler = handler;