Skip to content

Commit

Permalink
doveadm: Make doveadm_password safe against timing attacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Apr 12, 2017
1 parent 4e11e0a commit fb7a68e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/doveadm/client-connection.c
Expand Up @@ -365,7 +365,9 @@ client_connection_authenticate(struct client_connection *conn)
return -1;
}
pass = t_strndup(data + 9, size - 9);
if (strcmp(pass, conn->set->doveadm_password) != 0) {
if (strlen(pass) != strlen(conn->set->doveadm_password) ||
!mem_equals_timing_safe(pass, conn->set->doveadm_password,
strlen(pass))) {
i_error("doveadm client authenticated with wrong password");
return -1;
}
Expand Down

0 comments on commit fb7a68e

Please sign in to comment.