Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4463:193f524562ca HEAD
Moved the <hidden> string into a macro. Hide the password also from LDAP
replies.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 01 Jul 2006 21:40:34 +0300 |
parents | de27599764c1 |
children | b7eaddfbcaad |
files | src/auth/auth-client-connection.c src/auth/auth.h src/auth/passdb-ldap.c |
diffstat | 3 files changed, 16 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-client-connection.c Sat Jul 01 21:33:04 2006 +0300 +++ b/src/auth/auth-client-connection.c Sat Jul 01 21:40:34 2006 +0300 @@ -33,7 +33,8 @@ p += 6; p2 = strchr(p, '\t'); - return t_strconcat(t_strdup_until(line, p), "<hidden>", p2, NULL); + return t_strconcat(t_strdup_until(line, p), PASSWORD_HIDDEN_STR, + p2, NULL); } static void auth_client_send(struct auth_client_connection *conn, @@ -147,7 +148,8 @@ p += 6; p2 = strchr(p, '\t'); - return t_strconcat(t_strdup_until(line, p), "<hidden>", p2, NULL); + return t_strconcat(t_strdup_until(line, p), PASSWORD_HIDDEN_STR, + p2, NULL); } static const char *cont_line_hide_pass(const char *line) @@ -158,7 +160,7 @@ if (p == NULL) return line; - return t_strconcat(t_strdup_until(line, p), "<hidden>", NULL); + return t_strconcat(t_strdup_until(line, p), PASSWORD_HIDDEN_STR, NULL); } static bool
--- a/src/auth/auth.h Sat Jul 01 21:33:04 2006 +0300 +++ b/src/auth/auth.h Sat Jul 01 21:40:34 2006 +0300 @@ -1,6 +1,8 @@ #ifndef __AUTH_H #define __AUTH_H +#define PASSWORD_HIDDEN_STR "<hidden>" + struct auth_passdb { struct auth *auth; struct auth_passdb *next;
--- a/src/auth/passdb-ldap.c Sat Jul 01 21:33:04 2006 +0300 +++ b/src/auth/passdb-ldap.c Sat Jul 01 21:40:34 2006 +0300 @@ -38,6 +38,7 @@ ldap_query_save_result(struct ldap_connection *conn, LDAPMessage *entry, struct auth_request *auth_request) { + struct auth *auth = auth_request->auth; BerElement *ber; const char *name; char *attr, **vals; @@ -49,7 +50,7 @@ name = hash_lookup(conn->pass_attr_map, attr); vals = ldap_get_values(conn->ld, entry, attr); - if (auth_request->auth->verbose_debug) { + if (auth->verbose_debug) { if (debug == NULL) debug = t_str_new(256); else @@ -64,7 +65,13 @@ if (debug != NULL) { if (i != 0) str_append_c(debug, '/'); - str_append(debug, vals[i]); + if (auth->verbose_debug_passwords || + strcmp(name, "password") != 0) + str_append(debug, vals[i]); + else { + str_append(debug, + PASSWORD_HIDDEN_STR); + } } auth_request_set_field(auth_request, name, vals[i],