1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2015 */
6 /* See the file NOTICE for conditions of use and distribution. */
7 /* SPDX-License-Identifier: GPL-2.0-or-later */
9 /* Support functions for calling from local_scan(). These are mostly just
10 wrappers for various internal functions. */
16 /*************************************************
17 * Match a domain in a list *
18 *************************************************/
22 domain the domain we are testing
25 Returns: OK/FAIL/DEFER
29 lss_match_domain(uschar *domain, uschar *list)
31 return match_isinlist(CUS domain, CUSS &list, 0, &domainlist_anchor, NULL, MCL_DOMAIN,
37 /*************************************************
38 * Match a local part in a list *
39 *************************************************/
43 local_part the local part we are testing
44 list the local part list
45 caseless TRUE for caseless matching
47 Returns: OK/FAIL/DEFER
51 lss_match_local_part(uschar *local_part, uschar *list, BOOL caseless)
53 return match_isinlist(CUS local_part, CUSS &list, 0, &localpartlist_anchor, NULL,
54 MCL_LOCALPART, caseless, NULL);
59 /*************************************************
60 * Match an address in a list *
61 *************************************************/
65 address the address we are testing
67 caseless TRUE for caseless matching
69 Returns: OK/FAIL/DEFER
73 lss_match_address(uschar *address, uschar *list, BOOL caseless)
75 return match_address_list(CUS address, caseless, TRUE, CUSS &list, NULL, -1, 0, NULL);
80 /*************************************************
81 * Match a host in a list *
82 *************************************************/
86 host name the name of the host we are testing, or NULL if this is the
87 sender host and its name hasn't yet been looked up
88 host address the IP address of the host, or an empty string for a local
92 Returns: OK/FAIL/DEFER
93 ERROR if failed to find host name when needed
97 lss_match_host(uschar *host_name, uschar *host_address, uschar *list)
99 return verify_check_this_host(CUSS &list, NULL, host_name, host_address, NULL);
104 /*************************************************
105 * Base 64 encode/decode *
106 *************************************************/
108 /* These functions just give less "internal" names to the functions.
111 clear points to the clear text bytes
112 len the number of bytes to encode
114 Returns: a pointer to the zero-terminated base 64 string, which
119 lss_b64encode(uschar * clear, int len)
121 return b64encode(CUS clear, len);
126 code points to the coded string, zero-terminated
127 ptr where to put the pointer to the result, which is in
130 Returns: the number of bytes in the result,
131 or -1 if the input was malformed
133 A zero is added on to the end to make it easy in cases where the result is to
134 be interpreted as text. This is not included in the count. */
137 lss_b64decode(uschar * code, uschar ** ptr)
139 return b64decode(code, ptr, code);