[dovecot-cvs] dovecot/src/auth passdb-blocking.c,1.10,1.11
tss at dovecot.org
tss at dovecot.org
Sun Oct 15 21:55:15 UTC 2006
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv29985
Modified Files:
passdb-blocking.c
Log Message:
If blocking passdb (ie. MySQL) didn't return any extra fields, we didn't
notice username changes and we didn't cache the password.
Index: passdb-blocking.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-blocking.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- passdb-blocking.c 20 Feb 2006 13:14:58 -0000 1.10
+++ passdb-blocking.c 15 Oct 2006 20:55:12 -0000 1.11
@@ -51,18 +51,24 @@
/* user \t {scheme}password [\t extra] */
p = strchr(reply, '\t');
- p2 = p == NULL ? NULL : strchr(p + 1, '\t');
- if (p2 == NULL) {
+
+ /* username may have changed, update it */
+ auth_request_set_field(request, "user", p == NULL ? reply :
+ t_strdup_until(reply, p), NULL);
+ if (p == NULL) {
+ /* we didn't get a password. */
*password_r = NULL;
*scheme_r = NULL;
return 0;
}
-
- /* username may have changed, update it */
- auth_request_set_field(request, "user", t_strdup_until(reply, p), NULL);
-
- *password_r = t_strdup_until(p + 1, p2);
- reply = p2 + 1;
+ p2 = strchr(++p, '\t');
+ if (p2 == NULL) {
+ *password_r = p;
+ reply = "";
+ } else {
+ *password_r = t_strdup_until(p, p2);
+ reply = p2 + 1;
+ }
if (**password_r == '\0') {
*password_r = NULL;
More information about the dovecot-cvs
mailing list