Copyright updates:
[exim.git] / src / src / auths / tls.c
CommitLineData
b3ef41c9
JH
1/*************************************************
2* Exim - an Internet mail transport agent *
3*************************************************/
4
1e1ddfac 5/* Copyright (c) Jeremy Harris 1995 - 2020 */
b3ef41c9
JH
6/* See the file NOTICE for conditions of use and distribution. */
7
8/* This file provides an Exim authenticator driver for
9a server to verify a client SSL certificate
10*/
11
12
13#include "../exim.h"
14#include "tls.h"
15
16/* Options specific to the tls authentication mechanism. */
17
18optionlist auth_tls_options[] = {
19 { "server_param", opt_stringptr,
13a4b4c1 20 OPT_OFF(auth_tls_options_block, server_param1) },
b3ef41c9 21 { "server_param1", opt_stringptr,
13a4b4c1 22 OPT_OFF(auth_tls_options_block, server_param1) },
b3ef41c9 23 { "server_param2", opt_stringptr,
13a4b4c1 24 OPT_OFF(auth_tls_options_block, server_param2) },
b3ef41c9 25 { "server_param3", opt_stringptr,
13a4b4c1 26 OPT_OFF(auth_tls_options_block, server_param3) },
b3ef41c9
JH
27};
28
29/* Size of the options list. An extern variable has to be used so that its
30address can appear in the tables drtables.c. */
31
32int auth_tls_options_count = nelem(auth_tls_options);
33
34/* Default private options block for the authentication method. */
35
36auth_tls_options_block auth_tls_option_defaults = {
37 NULL, /* server_param1 */
38 NULL, /* server_param2 */
39 NULL, /* server_param3 */
40};
41
42
d185889f
JH
43#ifdef MACRO_PREDEF
44
45/* Dummy values */
46void auth_tls_init(auth_instance *ablock) {}
47int auth_tls_server(auth_instance *ablock, uschar *data) {return 0;}
251b9eb4
JH
48int auth_tls_client(auth_instance *ablock, void * sx,
49 int timeout, uschar *buffer, int buffsize) {return 0;}
d185889f
JH
50
51#else /*!MACRO_PREDEF*/
52
53
54
55
b3ef41c9
JH
56/*************************************************
57* Initialization entry point *
58*************************************************/
59
60/* Called for each instance, after its options have been read, to
61enable consistency checks to be done, or anything else that needs
62to be set up. */
63
64void
65auth_tls_init(auth_instance *ablock)
66{
67ablock->public_name = ablock->name; /* needed for core code */
68}
69
70
71
72/*************************************************
73* Server entry point *
74*************************************************/
75
76/* For interface, see auths/README */
77
78int
79auth_tls_server(auth_instance *ablock, uschar *data)
80{
81auth_tls_options_block * ob = (auth_tls_options_block *)ablock->options_block;
82
83if (ob->server_param1)
84 auth_vars[expand_nmax++] = expand_string(ob->server_param1);
85if (ob->server_param2)
86 auth_vars[expand_nmax++] = expand_string(ob->server_param2);
d4ff61d1 87if (ob->server_param3)
b3ef41c9
JH
88 auth_vars[expand_nmax++] = expand_string(ob->server_param3);
89return auth_check_serv_cond(ablock);
90}
91
92
d185889f 93#endif /*!MACRO_PREDEF*/
b3ef41c9 94/* End of tls.c */