dovecot-2.2: auth: Code cleanup: Removed unnecessary userdb_ pre...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jan 30 19:08:08 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/3fac9306be3e
changeset: 15681:3fac9306be3e
user: Timo Sirainen <tss at iki.fi>
date: Wed Jan 30 18:40:49 2013 +0200
description:
auth: Code cleanup: Removed unnecessary userdb_ prefix checks.
The userdb_ fields are nowadays placed to userdb_reply immediately.
diffstat:
src/auth/auth-request-handler.c | 24 ++++--------------------
src/auth/auth-request.h | 3 +--
2 files changed, 5 insertions(+), 22 deletions(-)
diffs (55 lines):
diff -r 55d20120b348 -r 3fac9306be3e src/auth/auth-request-handler.c
--- a/src/auth/auth-request-handler.c Wed Jan 30 18:35:02 2013 +0200
+++ b/src/auth/auth-request-handler.c Wed Jan 30 18:40:49 2013 +0200
@@ -156,34 +156,18 @@
static void get_client_extra_fields(struct auth_request *request,
struct auth_stream_reply *reply)
{
- const char **fields, *extra_fields;
- unsigned int src;
- bool seen_pass = FALSE;
+ const char *extra_fields;
if (auth_stream_is_empty(request->extra_fields))
return;
extra_fields = auth_stream_reply_export(request->extra_fields);
-
- if (!request->proxy && strstr(extra_fields, "userdb_") == NULL) {
- /* optimization: there are no userdb_* fields, we can just
- import */
- auth_stream_reply_import(reply, extra_fields);
- return;
- }
-
- fields = t_strsplit_tab(extra_fields);
- for (src = 0; fields[src] != NULL; src++) {
- if (strncmp(fields[src], "userdb_", 7) != 0) {
- if (!seen_pass && strncmp(fields[src], "pass=", 5) == 0)
- seen_pass = TRUE;
- auth_stream_reply_import(reply, fields[src]);
- }
- }
+ auth_stream_reply_import(reply, extra_fields);
if (request->proxy && !request->auth_only) {
/* we're proxying */
- if (!seen_pass && request->mech_password != NULL) {
+ if (!auth_stream_reply_exists(reply, "pass") &&
+ request->mech_password != NULL) {
/* send back the password that was sent by user
(not the password in passdb). */
auth_stream_reply_add(reply, "pass",
diff -r 55d20120b348 -r 3fac9306be3e src/auth/auth-request.h
--- a/src/auth/auth-request.h Wed Jan 30 18:35:02 2013 +0200
+++ b/src/auth/auth-request.h Wed Jan 30 18:40:49 2013 +0200
@@ -48,8 +48,7 @@
char *mech_password; /* set if verify_plain() is called */
char *passdb_password; /* set after password lookup if successful */
/* extra_fields are returned in authentication reply. Fields prefixed
- with "userdb_" are skipped. If prefetch userdb is used, it uses
- the "userdb_" prefixed fields. */
+ with "userdb_" are automatically placed to userdb_reply instead. */
struct auth_stream_reply *extra_fields;
/* extra_fields that aren't supposed to be sent to the client, but
are supposed to be stored to auth cache. */
More information about the dovecot-cvs
mailing list