db-dict.c (dovecot-2.3.16) | : | db-dict.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 312 | skipping to change at line 312 | |||
ctx.conn = conn; | ctx.conn = conn; | |||
if (!settings_read(config_path, NULL, parse_setting, | if (!settings_read(config_path, NULL, parse_setting, | |||
parse_section, &ctx, &error)) | parse_section, &ctx, &error)) | |||
i_fatal("dict %s: %s", config_path, error); | i_fatal("dict %s: %s", config_path, error); | |||
db_dict_settings_parse(&conn->set); | db_dict_settings_parse(&conn->set); | |||
if (conn->set.uri == NULL) | if (conn->set.uri == NULL) | |||
i_fatal("dict %s: Empty uri setting", config_path); | i_fatal("dict %s: Empty uri setting", config_path); | |||
i_zero(&dict_set); | i_zero(&dict_set); | |||
dict_set.username = ""; | ||||
dict_set.base_dir = global_auth_settings->base_dir; | dict_set.base_dir = global_auth_settings->base_dir; | |||
dict_set.event_parent = auth_event; | dict_set.event_parent = auth_event; | |||
if (dict_init(conn->set.uri, &dict_set, &conn->dict, &error) < 0) | if (dict_init(conn->set.uri, &dict_set, &conn->dict, &error) < 0) | |||
i_fatal("dict %s: Failed to init dict: %s", config_path, error); | i_fatal("dict %s: Failed to init dict: %s", config_path, error); | |||
conn->next = connections; | conn->next = connections; | |||
connections = conn; | connections = conn; | |||
return conn; | return conn; | |||
} | } | |||
skipping to change at line 412 | skipping to change at line 411 | |||
const char *error; | const char *error; | |||
int ret; | int ret; | |||
/* sort the keys so that we'll first lookup the keys without | /* sort the keys so that we'll first lookup the keys without | |||
default value. if their lookup fails, the user doesn't exist. */ | default value. if their lookup fails, the user doesn't exist. */ | |||
array_sort(&iter->keys, db_dict_iter_key_cmp); | array_sort(&iter->keys, db_dict_iter_key_cmp); | |||
path = t_str_new(128); | path = t_str_new(128); | |||
str_append(path, DICT_PATH_SHARED); | str_append(path, DICT_PATH_SHARED); | |||
struct dict_op_settings set = { | ||||
.username = iter->auth_request->fields.user, | ||||
}; | ||||
array_foreach_modifiable(&iter->keys, key) { | array_foreach_modifiable(&iter->keys, key) { | |||
if (!key->used) | if (!key->used) | |||
continue; | continue; | |||
str_truncate(path, strlen(DICT_PATH_SHARED)); | str_truncate(path, strlen(DICT_PATH_SHARED)); | |||
str_append(path, key->key->key); | str_append(path, key->key->key); | |||
ret = dict_lookup(iter->conn->dict, iter->pool, | ret = dict_lookup(iter->conn->dict, &set, iter->pool, | |||
str_c(path), &key->value, &error); | str_c(path), &key->value, &error); | |||
if (ret > 0) { | if (ret > 0) { | |||
e_debug(authdb_event(iter->auth_request), | e_debug(authdb_event(iter->auth_request), | |||
"Lookup: %s = %s", str_c(path), | "Lookup: %s = %s", str_c(path), | |||
key->value); | key->value); | |||
} else if (ret < 0) { | } else if (ret < 0) { | |||
e_error(authdb_event(iter->auth_request), | e_error(authdb_event(iter->auth_request), | |||
"Failed to lookup key %s: %s", str_c(path), error ); | "Failed to lookup key %s: %s", str_c(path), error ); | |||
return -1; | return -1; | |||
} else if (key->key->default_value != NULL) { | } else if (key->key->default_value != NULL) { | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 5 lines changed or added |