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