]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Fixes, patch by Andrey Panin
authorTimo Sirainen <tss@iki.fi>
Tue, 6 Jul 2004 06:35:30 +0000 (09:35 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 6 Jul 2004 06:35:30 +0000 (09:35 +0300)
--HG--
branch : HEAD

src/auth/mech-apop.c
src/pop3-login/client.c

index 49305c977e3de12c249522a28e2e666138cc9400..b8cdd3a1d9afcd03e583616c92a62cd3ea08122a 100644 (file)
@@ -10,7 +10,6 @@
  */
 
 #include "common.h"
-#include "safe-memset.h"
 #include "mech.h"
 #include "passdb.h"
 #include "md5.h"
@@ -40,14 +39,18 @@ apop_credentials_callback(const char *credentials,
                (struct apop_auth_request *)auth_request;
        unsigned char digest[16];
        struct md5_context ctx;
+       int ret = FALSE;
 
-       md5_init(&ctx);
-       md5_update(&ctx, auth->challenge, strlen(auth->challenge));
-       md5_update(&ctx, credentials, strlen(credentials));
-       md5_final(&ctx, digest);
+       if (credentials != NULL) {
+               md5_init(&ctx);
+               md5_update(&ctx, auth->challenge, strlen(auth->challenge));
+               md5_update(&ctx, credentials, strlen(credentials));
+               md5_final(&ctx, digest);
 
-       mech_auth_finish(auth_request, NULL, 0,
-                        memcmp(digest, auth->digest, 16) == 0);
+               ret = memcmp(digest, auth->digest, 16) == 0;
+       }
+
+       mech_auth_finish(auth_request, NULL, 0, ret);
 }
 
 static int
index c102129745c6a4a4a5608bcaf8eacd84fa3631a7..8c9f0886016abb28917cc9f78075dd30ab4f2f43 100644 (file)
@@ -225,14 +225,14 @@ static void client_destroy_oldest(void)
        }
 }
 
-static char *get_apop_challenge(void)
+static char *get_apop_challenge(struct pop3_client *client)
 {
-       struct auth_connect_id id;
+       struct auth_connect_id *id = &client->auth_id;
 
-       if (!auth_client_reserve_connection(auth_client, "APOP", &id))
+       if (!auth_client_reserve_connection(auth_client, "APOP", id))
                return NULL;
 
-       return i_strdup_printf("<%x.%x.%s@%s>", id.server_pid, id.connect_uid,
+       return i_strdup_printf("<%x.%x.%s@%s>", id->server_pid, id->connect_uid,
                               dec2str(ioloop_time), my_hostname);
 }
 
@@ -241,7 +241,7 @@ static void client_auth_ready(struct pop3_client *client)
        client->common.io =
                io_add(client->common.fd, IO_READ, client_input, client);
 
-       client->apop_challenge = get_apop_challenge();
+       client->apop_challenge = get_apop_challenge(client);
        client_send_line(client, t_strconcat("+OK " PACKAGE " ready.",
                                             client->apop_challenge, NULL));
 }