Mercurial > dovecot > core-2.2
changeset 19629:e4ba07869ce4
auth: Avoid unnecessary work if passdb/userdb { override_fields, default_fields } aren't set.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Sun, 24 Jan 2016 22:10:01 +0200 |
parents | 9642acb1940a |
children | 82cf8a00c369 |
files | src/auth/passdb-template.c src/auth/passdb-template.h src/auth/userdb-template.c |
diffstat | 3 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/passdb-template.c Sun Jan 24 22:07:55 2016 +0200 +++ b/src/auth/passdb-template.c Sun Jan 24 22:10:01 2016 +0200 @@ -43,6 +43,9 @@ const char *const *args, *value; unsigned int i, count; + if (passdb_template_is_empty(tmpl)) + return; + str = t_str_new(256); table = auth_request_get_var_expand_table(auth_request, NULL); @@ -79,3 +82,8 @@ } return FALSE; } + +bool passdb_template_is_empty(struct passdb_template *tmpl) +{ + return array_count(&tmpl->args) == 0; +}
--- a/src/auth/passdb-template.h Sun Jan 24 22:07:55 2016 +0200 +++ b/src/auth/passdb-template.h Sun Jan 24 22:10:01 2016 +0200 @@ -8,5 +8,6 @@ struct auth_request *auth_request); bool passdb_template_remove(struct passdb_template *tmpl, const char *key, const char **value_r); +bool passdb_template_is_empty(struct passdb_template *tmpl); #endif
--- a/src/auth/userdb-template.c Sun Jan 24 22:07:55 2016 +0200 +++ b/src/auth/userdb-template.c Sun Jan 24 22:10:01 2016 +0200 @@ -66,6 +66,9 @@ const char *const *args, *value; unsigned int i, count; + if (userdb_template_is_empty(tmpl)) + return; + str = t_str_new(256); table = auth_request_get_var_expand_table(auth_request, NULL);