X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fauths%2Fplaintext.c;h=7a0f788529456834efb4d6d821fceb76253cc927;hb=ffbc20ed9c9ed09a68ff0a608f623c3c83d521a8;hp=32f8fd5759106806f8b11029b95190f81c110b56;hpb=4e910c01eea401e36044816744691789ef4656fa;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/auths/plaintext.c b/src/src/auths/plaintext.c index 32f8fd575..7a0f78852 100644 --- a/src/src/auths/plaintext.c +++ b/src/src/auths/plaintext.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2015 */ +/* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ #include "../exim.h" @@ -35,6 +35,18 @@ auth_plaintext_options_block auth_plaintext_option_defaults = { }; +#ifdef MACRO_PREDEF + +/* 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, void * sx, int timeout, + uschar *buffer, int buffsize) {return 0;} + +#else /*!MACRO_PREDEF*/ + + + /************************************************* * Initialization entry point * *************************************************/ @@ -155,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 */ @@ -189,10 +200,10 @@ 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 (expand_string_forcedfail) + if (f.expand_string_forcedfail) { *buffer = 0; /* No message */ return CANCELLED; @@ -224,15 +235,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; } @@ -240,7 +249,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 @@ -251,10 +260,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; @@ -275,8 +284,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; @@ -294,4 +303,5 @@ while ((s = string_nextinlist(&text, &sep, big_buffer, big_buffer_size))) return FAIL; } +#endif /*!MACRO_PREDEF*/ /* End of plaintext.c */