Import Upstream version 4.89
[hcoop/debian/exim4.git] / src / auths / get_no64_data.c
CommitLineData
420a0d19
CE
1/*************************************************
2* Exim - an Internet mail transport agent *
3*************************************************/
4
5/* Copyright (c) University of Cambridge 1995 - 2012 */
6/* See the file NOTICE for conditions of use and distribution. */
7
8#include "../exim.h"
9
10
11/*************************************************
12* Issue a non-b64 challenge and get a response *
13*************************************************/
14
15/* This function is used by authentication drivers to output a challenge
16to the SMTP client and read the response line. This version does not use base
1764 encoding for the text on the 334 line. It is used by the SPA, dovecot
18and gsasl authenticators.
19
20Arguments:
21 aptr set to point to the response (which is in big_buffer)
22 challenge the challenge text (unencoded)
23
24Returns: OK on success
25 BAD64 if response too large for buffer
26 CANCELLED if response is "*"
27*/
28
29int
30auth_get_no64_data(uschar **aptr, uschar *challenge)
31{
32int c;
33int p = 0;
34smtp_printf("334 %s\r\n", challenge);
2813c06e 35while ((c = receive_getc(GETC_BUFFER_UNLIMITED)) != '\n' && c != EOF)
420a0d19
CE
36 {
37 if (p >= big_buffer_size - 1) return BAD64;
38 big_buffer[p++] = c;
39 }
40if (p > 0 && big_buffer[p-1] == '\r') p--;
41big_buffer[p] = 0;
42if (Ustrcmp(big_buffer, "*") == 0) return CANCELLED;
43*aptr = big_buffer;
44return OK;
45}
46
47/* End of get_no64_data.c */