{
struct auth_userdb *auth_userdb, **dest;
const struct auth_userdb_settings *set;
+ const char *error;
/* Lookup userdb-specific auth_settings */
struct event *event = event_create(auth_event);
auth_userdb = p_new(auth->pool, struct auth_userdb, 1);
auth_userdb->auth_set =
settings_get_or_fatal(event, &auth_setting_parser_info);
+ if (settings_get(event, &auth_userdb_post_setting_parser_info,
+ SETTINGS_GET_FLAG_NO_CHECK |
+ SETTINGS_GET_FLAG_NO_EXPAND,
+ &auth_userdb->unexpanded_post_set, &error) < 0)
+ i_fatal("%s", error);
auth_userdb->name = set->name;
auth_userdb->set = set;
if (userdb->set != &userdb_dummy_set)
settings_free(userdb->set);
settings_free(userdb->auth_set);
+ settings_free(userdb->unexpanded_post_set);
userdb_deinit(userdb->userdb);
}
md5_final(&ctx, md5);
}
+static void
+auth_userdbs_update_md5(struct auth *auth, struct md5_context *ctx)
+{
+ struct auth_userdb *userdb;
+ unsigned int hash;
+
+ for (userdb = auth->userdbs; userdb != NULL; userdb = userdb->next) {
+ md5_update(ctx, &userdb->userdb->id, sizeof(userdb->userdb->id));
+ hash = settings_hash(&auth_userdb_setting_parser_info,
+ userdb->set, NULL);
+ md5_update(ctx, &hash, sizeof(hash));
+ hash = settings_hash(&auth_setting_parser_info,
+ userdb->auth_set, NULL);
+ md5_update(ctx, &hash, sizeof(hash));
+ hash = settings_hash(&auth_userdb_post_setting_parser_info,
+ userdb->unexpanded_post_set, NULL);
+ md5_update(ctx, &hash, sizeof(hash));
+ }
+}
+
+void auth_userdbs_generate_md5(unsigned char md5[STATIC_ARRAY MD5_RESULTLEN])
+{
+ struct auth *auth;
+ struct md5_context ctx;
+
+ md5_init(&ctx);
+ array_foreach_elem(&auths, auth)
+ auth_userdbs_update_md5(auth, &ctx);
+ md5_final(&ctx, md5);
+}
+
struct auth *auth_find_protocol(const char *name)
{
struct auth *const *a;
const char *name;
const struct auth_settings *auth_set;
const struct auth_userdb_settings *set;
+ const struct auth_userdb_post_settings *unexpanded_post_set;
struct userdb_module *userdb;
/* The caching key for this userdb, or NULL if caching isn't wanted. */
struct auth *auth_default_protocol(void);
void auth_passdbs_generate_md5(unsigned char md5[STATIC_ARRAY MD5_RESULTLEN]);
+void auth_userdbs_generate_md5(unsigned char md5[STATIC_ARRAY MD5_RESULTLEN]);
void auths_preinit(struct event *parent_event,
const struct auth_settings *set,
userdb->iface = &userdb_iface_deinit;
}
-void userdbs_generate_md5(unsigned char md5[STATIC_ARRAY MD5_RESULTLEN])
-{
- struct md5_context ctx;
- struct userdb_module *const *userdbs;
- unsigned int i, count;
-
- md5_init(&ctx);
- userdbs = array_get(&userdb_modules, &count);
- for (i = 0; i < count; i++) {
- md5_update(&ctx, &userdbs[i]->id, sizeof(userdbs[i]->id));
- md5_update(&ctx, userdbs[i]->iface->name,
- strlen(userdbs[i]->iface->name));
- md5_update(&ctx, userdbs[i]->args, strlen(userdbs[i]->args));
- }
- md5_final(&ctx, md5);
-}
-
const char *userdb_result_to_string(enum userdb_result result)
{
switch (result) {