Skip to content

Commit

Permalink
auth: Add any %variables in passdb/userdb { default_fields } to cache…
Browse files Browse the repository at this point in the history
… key.
  • Loading branch information
sirainen committed Jan 24, 2016
1 parent 80e80d4 commit b76737b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/auth/passdb.c
Expand Up @@ -227,6 +227,13 @@ passdb_preinit(pool_t pool, const struct auth_passdb_settings *set)
passdb_template_build(pool, set->default_fields);
passdb->override_fields_tmpl =
passdb_template_build(pool, set->override_fields);
if (passdb->cache_key != NULL &&
!passdb_template_is_empty(passdb->default_fields_tmpl)) {
/* make sure any %variables in default_fields exist
in cache_key */
passdb->cache_key = p_strconcat(pool, passdb->cache_key,
set->default_fields, NULL);
}

array_append(&passdb_modules, &passdb, 1);
return passdb;
Expand Down
7 changes: 7 additions & 0 deletions src/auth/userdb.c
Expand Up @@ -171,6 +171,13 @@ userdb_preinit(pool_t pool, const struct auth_userdb_settings *set)
userdb->override_fields_tmpl =
userdb_template_build(pool, set->driver,
set->override_fields);
if (userdb->cache_key != NULL &&
!userdb_template_is_empty(userdb->default_fields_tmpl)) {
/* make sure any %variables in default_fields exist
in cache_key */
userdb->cache_key = p_strconcat(pool, userdb->cache_key,
set->default_fields, NULL);
}

array_append(&userdb_modules, &userdb, 1);
return userdb;
Expand Down

0 comments on commit b76737b

Please sign in to comment.