[dovecot-cvs] dovecot/src/pop3-login client-authenticate.c, 1.30,
1.31
cras at dovecot.org
cras at dovecot.org
Fri Oct 8 20:51:52 EEST 2004
Update of /var/lib/cvs/dovecot/src/pop3-login
In directory talvi:/tmp/cvs-serv10130/pop3-login
Modified Files:
client-authenticate.c
Log Message:
Buffer API change: we no longer support limited sized buffers where
writes past limit wouldn't kill the process. They weren't used hardly
anywhere, they could have hidden bugs and the code for handling them was too
complex.
This also changed base64 and hex-binary APIs.
Index: client-authenticate.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3-login/client-authenticate.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- client-authenticate.c 7 Oct 2004 19:39:24 -0000 1.30
+++ client-authenticate.c 8 Oct 2004 17:51:50 -0000 1.31
@@ -105,8 +105,7 @@
t_push();
- buf = buffer_create_dynamic(pool_datastack_create(),
- size*2, (size_t)-1);
+ buf = buffer_create_dynamic(pool_datastack_create(), size*2);
buffer_append(buf, "+ ", 2);
base64_encode(data, size, buf);
buffer_append(buf, "\r\n", 2);
@@ -283,7 +282,7 @@
linelen = strlen(line);
buf = buffer_create_static_hard(pool_datastack_create(), linelen);
- if (base64_decode(line, linelen, NULL, buf) <= 0) {
+ if (base64_decode(line, linelen, NULL, buf) < 0) {
/* failed */
client_auth_abort(client, "Invalid base64 data");
} else if (client->common.auth_request == NULL) {
@@ -359,7 +358,7 @@
argslen = strlen(args);
buf = buffer_create_static_hard(pool_datastack_create(), argslen);
- if (base64_decode(args, argslen, NULL, buf) <= 0) {
+ if (base64_decode(args, argslen, NULL, buf) < 0) {
/* failed */
client_send_line(client, "-ERR Invalid base64 data.");
return TRUE;
@@ -424,14 +423,13 @@
}
/* APOP challenge \0 username \0 APOP response */
- apop_data = buffer_create_dynamic(pool_datastack_create(),
- 128, (size_t)-1);
+ apop_data = buffer_create_dynamic(pool_datastack_create(), 128);
buffer_append(apop_data, client->apop_challenge,
strlen(client->apop_challenge)+1);
buffer_append(apop_data, args, (size_t)(p-args));
buffer_append_c(apop_data, '\0');
- if (hex_to_binary(p+1, apop_data) <= 0) {
+ if (hex_to_binary(p+1, apop_data) < 0) {
if (verbose_auth) {
client_syslog(client, "APOP failed: "
"Invalid characters in MD5 response");
More information about the dovecot-cvs
mailing list