Also memset(.., 0, ..) the pre-TLS input buffer.
[exim.git] / src / src / lss.c
CommitLineData
0a49a7a4 1/* $Cambridge: exim/src/src/lss.c,v 1.5 2009/11/16 19:50:37 nm4 Exp $ */
059ec3d9
PH
2
3/*************************************************
4* Exim - an Internet mail transport agent *
5*************************************************/
6
0a49a7a4 7/* Copyright (c) University of Cambridge 1995 - 2009 */
059ec3d9
PH
8/* See the file NOTICE for conditions of use and distribution. */
9
10/* Support functions for calling from local_scan(). These are mostly just
11wrappers for various internal functions. */
12
13
14#include "exim.h"
15
16
17/*************************************************
18* Match a domain in a list *
19*************************************************/
20
21/*
22Arguments:
23 domain the domain we are testing
24 list the domain list
25
26Returns: OK/FAIL/DEFER
27*/
28
29int
30lss_match_domain(uschar *domain, uschar *list)
31{
32return match_isinlist(domain, &list, 0, &domainlist_anchor, NULL, MCL_DOMAIN,
33 TRUE, NULL);
34}
35
36
37
38/*************************************************
39* Match a local part in a list *
40*************************************************/
41
42/*
43Arguments:
44 local_part the local part we are testing
45 list the local part list
46 caseless TRUE for caseless matching
47
48Returns: OK/FAIL/DEFER
49*/
50
51int
52lss_match_local_part(uschar *local_part, uschar *list, BOOL caseless)
53{
54return match_isinlist(local_part, &list, 0, &localpartlist_anchor, NULL,
55 MCL_LOCALPART, caseless, NULL);
56}
57
58
59
60/*************************************************
61* Match an address in a list *
62*************************************************/
63
64/*
65Arguments:
66 address the address we are testing
67 list the address list
68 caseless TRUE for caseless matching
69
70Returns: OK/FAIL/DEFER
71*/
72
73int
74lss_match_address(uschar *address, uschar *list, BOOL caseless)
75{
76return match_address_list(address, caseless, TRUE, &list, NULL, -1, 0, NULL);
77}
78
79
80
81/*************************************************
82* Match a host in a list *
83*************************************************/
84
85/*
86Arguments:
87 host name the name of the host we are testing, or NULL if this is the
88 sender host and its name hasn't yet been looked up
89 host address the IP address of the host, or an empty string for a local
90 message
91 list the host list
92
93Returns: OK/FAIL/DEFER
94 ERROR if failed to find host name when needed
95*/
96
97int
98lss_match_host(uschar *host_name, uschar *host_address, uschar *list)
99{
100return verify_check_this_host(&list, NULL, host_name, host_address, NULL);
101}
102
103
104
105/*************************************************
106* Base 64 encode/decode *
107*************************************************/
108
109/* These functions just give less "internal" names to the functions.
110
111Arguments:
112 clear points to the clear text bytes
113 len the number of bytes to encode
114
115Returns: a pointer to the zero-terminated base 64 string, which
116 is in working store
117*/
118
119uschar *
120lss_b64encode(uschar *clear, int len)
121{
122return auth_b64encode(clear, len);
123}
124
125/*
126Arguments:
127 code points to the coded string, zero-terminated
128 ptr where to put the pointer to the result, which is in
129 dynamic store
130
131Returns: the number of bytes in the result,
132 or -1 if the input was malformed
133
134A zero is added on to the end to make it easy in cases where the result is to
135be interpreted as text. This is not included in the count. */
136
137int
138lss_b64decode(uschar *code, uschar **ptr)
139{
140return auth_b64decode(code, ptr);
141}
142
143
144/* End of lss.c */