X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/8768d5483a5894400ae1f70cda1beb44ed9b087c..7556111f007c98f11adfa27c492d73b775886d9d:/src/src/auths/plaintext.c diff --git a/src/src/auths/plaintext.c b/src/src/auths/plaintext.c index bdd05699d..fa05b0ad5 100644 --- a/src/src/auths/plaintext.c +++ b/src/src/auths/plaintext.c @@ -40,8 +40,8 @@ auth_plaintext_options_block auth_plaintext_option_defaults = { /* Dummy values */ void auth_plaintext_init(auth_instance *ablock) {} int auth_plaintext_server(auth_instance *ablock, uschar *data) {return 0;} -int auth_plaintext_client(auth_instance *ablock, smtp_inblock *inblock, - smtp_outblock *outblock, int timeout, uschar *buffer, int buffsize) {return 0;} +int auth_plaintext_client(auth_instance *ablock, void * sx, int timeout, + uschar *buffer, int buffsize) {return 0;} #else /*!MACRO_PREDEF*/ @@ -167,8 +167,7 @@ return auth_check_serv_cond(ablock); int auth_plaintext_client( auth_instance *ablock, /* authenticator block */ - smtp_inblock *inblock, /* connection inblock */ - smtp_outblock *outblock, /* connection outblock */ + void * sx, /* smtp connextion */ int timeout, /* command timeout */ uschar *buffer, /* buffer for reading response */ int buffsize) /* size of buffer */ @@ -201,8 +200,8 @@ while ((s = string_nextinlist(&text, &sep, big_buffer, big_buffer_size))) uschar *ssave = string_copy(s); if (!first) { - if (smtp_write_command(outblock, SCMD_FLUSH, "*\r\n") >= 0) - (void) smtp_read_response(inblock, US buffer, buffsize, '2', timeout); + if (smtp_write_command(sx, SCMD_FLUSH, "*\r\n") >= 0) + (void) smtp_read_response(sx, US buffer, buffsize, '2', timeout); } if (f.expand_string_forcedfail) { @@ -224,11 +223,7 @@ while ((s = string_nextinlist(&text, &sep, big_buffer, big_buffer_size))) if (ss[i+1] != '^') ss[i] = 0; else - { - i++; - len--; - memmove(ss + i, ss + i + 1, len - i); - } + if (--len > ++i) memmove(ss + i, ss + i + 1, len - i); /* The first string is attached to the AUTH command; others are sent unembellished. */ @@ -236,15 +231,13 @@ while ((s = string_nextinlist(&text, &sep, big_buffer, big_buffer_size))) if (first) { first = FALSE; - if (smtp_write_command(outblock, SCMD_FLUSH, "AUTH %s%s%s\r\n", - ablock->public_name, (len == 0)? "" : " ", - b64encode(ss, len)) < 0) + if (smtp_write_command(sx, SCMD_FLUSH, "AUTH %s%s%s\r\n", + ablock->public_name, len == 0 ? "" : " ", b64encode(ss, len)) < 0) return FAIL_SEND; } else { - if (smtp_write_command(outblock, SCMD_FLUSH, "%s\r\n", - b64encode(ss, len)) < 0) + if (smtp_write_command(sx, SCMD_FLUSH, "%s\r\n", b64encode(ss, len)) < 0) return FAIL_SEND; } @@ -252,7 +245,7 @@ while ((s = string_nextinlist(&text, &sep, big_buffer, big_buffer_size))) has succeeded. There may be more data to send, but is there any point in provoking an error here? */ - if (smtp_read_response(inblock, US buffer, buffsize, '2', timeout)) return OK; + if (smtp_read_response(sx, US buffer, buffsize, '2', timeout)) return OK; /* Not a success response. If errno != 0 there is some kind of transmission error. Otherwise, check the response code in the buffer. If it starts with @@ -263,10 +256,10 @@ while ((s = string_nextinlist(&text, &sep, big_buffer, big_buffer_size))) /* If there is no more data to send, we have to cancel the authentication exchange and return ERROR. */ - if (text == NULL) + if (!text) { - if (smtp_write_command(outblock, SCMD_FLUSH, "*\r\n") >= 0) - (void)smtp_read_response(inblock, US buffer, buffsize, '2', timeout); + if (smtp_write_command(sx, SCMD_FLUSH, "*\r\n") >= 0) + (void)smtp_read_response(sx, US buffer, buffsize, '2', timeout); string_format(buffer, buffsize, "Too few items in client_send in %s " "authenticator", ablock->name); return ERROR; @@ -287,8 +280,8 @@ while ((s = string_nextinlist(&text, &sep, big_buffer, big_buffer_size))) uschar *save_bad = string_copy(buffer); if (!ob->client_ignore_invalid_base64) { - if (smtp_write_command(outblock, SCMD_FLUSH, "*\r\n") >= 0) - (void)smtp_read_response(inblock, US buffer, buffsize, '2', timeout); + if (smtp_write_command(sx, SCMD_FLUSH, "*\r\n") >= 0) + (void)smtp_read_response(sx, US buffer, buffsize, '2', timeout); string_format(buffer, buffsize, "Invalid base64 string in server " "response \"%s\"", save_bad); return CANCELLED;