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