1 /* $Cambridge: exim/src/src/lss.c,v 1.3 2006/02/07 11:19:00 ph10 Exp $ */
3 /*************************************************
4 * Exim - an Internet mail transport agent *
5 *************************************************/
7 /* Copyright (c) University of Cambridge 1995 - 2006 */
8 /* See the file NOTICE for conditions of use and distribution. */
10 /* Support functions for calling from local_scan(). These are mostly just
11 wrappers for various internal functions. */
17 /*************************************************
18 * Match a domain in a list *
19 *************************************************/
23 domain the domain we are testing
26 Returns: OK/FAIL/DEFER
30 lss_match_domain(uschar *domain, uschar *list)
32 return match_isinlist(domain, &list, 0, &domainlist_anchor, NULL, MCL_DOMAIN,
38 /*************************************************
39 * Match a local part in a list *
40 *************************************************/
44 local_part the local part we are testing
45 list the local part list
46 caseless TRUE for caseless matching
48 Returns: OK/FAIL/DEFER
52 lss_match_local_part(uschar *local_part, uschar *list, BOOL caseless)
54 return match_isinlist(local_part, &list, 0, &localpartlist_anchor, NULL,
55 MCL_LOCALPART, caseless, NULL);
60 /*************************************************
61 * Match an address in a list *
62 *************************************************/
66 address the address we are testing
68 caseless TRUE for caseless matching
70 Returns: OK/FAIL/DEFER
74 lss_match_address(uschar *address, uschar *list, BOOL caseless)
76 return match_address_list(address, caseless, TRUE, &list, NULL, -1, 0, NULL);
81 /*************************************************
82 * Match a host in a list *
83 *************************************************/
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
93 Returns: OK/FAIL/DEFER
94 ERROR if failed to find host name when needed
98 lss_match_host(uschar *host_name, uschar *host_address, uschar *list)
100 return verify_check_this_host(&list, NULL, host_name, host_address, NULL);
105 /*************************************************
106 * Base 64 encode/decode *
107 *************************************************/
109 /* These functions just give less "internal" names to the functions.
112 clear points to the clear text bytes
113 len the number of bytes to encode
115 Returns: a pointer to the zero-terminated base 64 string, which
120 lss_b64encode(uschar *clear, int len)
122 return auth_b64encode(clear, len);
127 code points to the coded string, zero-terminated
128 ptr where to put the pointer to the result, which is in
131 Returns: the number of bytes in the result,
132 or -1 if the input was malformed
134 A zero is added on to the end to make it easy in cases where the result is to
135 be interpreted as text. This is not included in the count. */
138 lss_b64decode(uschar *code, uschar **ptr)
140 return auth_b64decode(code, ptr);