File: | src/usr.sbin/smtpd/smtpd/obj/parse.c |
Warning: | line 2233, column 13 Attempt to free released memory |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include <stdlib.h> | |||
2 | #include <string.h> | |||
3 | #define YYBYACC1 1 | |||
4 | #define YYMAJOR1 1 | |||
5 | #define YYMINOR9 9 | |||
6 | #define YYLEXyylex() yylex() | |||
7 | #define YYEMPTY-1 -1 | |||
8 | #define yyclearin(yychar=(-1)) (yychar=(YYEMPTY-1)) | |||
9 | #define yyerrok(yyerrflag=0) (yyerrflag=0) | |||
10 | #define YYRECOVERING()(yyerrflag!=0) (yyerrflag!=0) | |||
11 | #define YYPREFIX"yy" "yy" | |||
12 | #line 25 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
13 | #include <sys/stat.h> | |||
14 | #include <sys/ioctl.h> | |||
15 | ||||
16 | #include <net/if.h> | |||
17 | #include <netinet/in.h> | |||
18 | ||||
19 | #include <arpa/inet.h> | |||
20 | #include <ctype.h> | |||
21 | #include <errno(*__errno()).h> | |||
22 | #include <ifaddrs.h> | |||
23 | #include <inttypes.h> | |||
24 | #include <resolv.h> | |||
25 | #include <syslog.h> | |||
26 | #include <unistd.h> | |||
27 | #include <util.h> | |||
28 | ||||
29 | #include "smtpd.h" | |||
30 | #include "ssl.h" | |||
31 | #include "log.h" | |||
32 | ||||
33 | TAILQ_HEAD(files, file)struct files { struct file *tqh_first; struct file **tqh_last ; } files = TAILQ_HEAD_INITIALIZER(files){ ((void *)0), &(files).tqh_first }; | |||
34 | static struct file { | |||
35 | TAILQ_ENTRY(file)struct { struct file *tqe_next; struct file **tqe_prev; } entry; | |||
36 | FILE *stream; | |||
37 | char *name; | |||
38 | size_t ungetpos; | |||
39 | size_t ungetsize; | |||
40 | u_char *ungetbuf; | |||
41 | int eof_reached; | |||
42 | int lineno; | |||
43 | int errors; | |||
44 | } *file, *topfile; | |||
45 | struct file *pushfile(const char *, int); | |||
46 | int popfile(void); | |||
47 | int check_file_secrecy(int, const char *); | |||
48 | int yyparse(void); | |||
49 | int yylex(void); | |||
50 | int kw_cmp(const void *, const void *); | |||
51 | int lookup(char *); | |||
52 | int igetc(void); | |||
53 | int lgetc(int); | |||
54 | void lungetc(int); | |||
55 | int findeol(void); | |||
56 | int yyerror(const char *, ...) | |||
57 | __attribute__((__format__ (printf, 1, 2))) | |||
58 | __attribute__((__nonnull__ (1))); | |||
59 | ||||
60 | TAILQ_HEAD(symhead, sym)struct symhead { struct sym *tqh_first; struct sym **tqh_last ; } symhead = TAILQ_HEAD_INITIALIZER(symhead){ ((void *)0), &(symhead).tqh_first }; | |||
61 | struct sym { | |||
62 | TAILQ_ENTRY(sym)struct { struct sym *tqe_next; struct sym **tqe_prev; } entry; | |||
63 | int used; | |||
64 | int persist; | |||
65 | char *nam; | |||
66 | char *val; | |||
67 | }; | |||
68 | int symset(const char *, const char *, int); | |||
69 | char *symget(const char *); | |||
70 | ||||
71 | struct smtpd *conf = NULL((void *)0); | |||
72 | static int errors = 0; | |||
73 | ||||
74 | struct table *table = NULL((void *)0); | |||
75 | struct mta_limits *limits; | |||
76 | static struct pki *pki; | |||
77 | static struct ca *sca; | |||
78 | ||||
79 | struct dispatcher *dsp; | |||
80 | struct rule *rule; | |||
81 | struct filter_proc *processor; | |||
82 | struct filter_config *filter_config; | |||
83 | static uint32_t last_dynchain_id = 1; | |||
84 | ||||
85 | enum listen_options { | |||
86 | LO_FAMILY = 0x000001, | |||
87 | LO_PORT = 0x000002, | |||
88 | LO_SSL = 0x000004, | |||
89 | LO_FILTER = 0x000008, | |||
90 | LO_PKI = 0x000010, | |||
91 | LO_AUTH = 0x000020, | |||
92 | LO_TAG = 0x000040, | |||
93 | LO_HOSTNAME = 0x000080, | |||
94 | LO_HOSTNAMES = 0x000100, | |||
95 | LO_MASKSOURCE = 0x000200, | |||
96 | LO_NODSN = 0x000400, | |||
97 | LO_SENDERS = 0x000800, | |||
98 | LO_RECEIVEDAUTH = 0x001000, | |||
99 | LO_MASQUERADE = 0x002000, | |||
100 | LO_CA = 0x004000, | |||
101 | LO_PROXY = 0x008000, | |||
102 | }; | |||
103 | ||||
104 | #define PKI_MAX32 32 | |||
105 | static struct listen_opts { | |||
106 | char *ifx; | |||
107 | int family; | |||
108 | in_port_t port; | |||
109 | uint16_t ssl; | |||
110 | char *filtername; | |||
111 | char *pki[PKI_MAX32]; | |||
112 | int pkicount; | |||
113 | char *tls_ciphers; | |||
114 | char *tls_protocols; | |||
115 | char *ca; | |||
116 | uint16_t auth; | |||
117 | struct table *authtable; | |||
118 | char *tag; | |||
119 | char *hostname; | |||
120 | struct table *hostnametable; | |||
121 | struct table *sendertable; | |||
122 | uint16_t flags; | |||
123 | ||||
124 | uint32_t options; | |||
125 | } listen_opts; | |||
126 | ||||
127 | static void create_sock_listener(struct listen_opts *); | |||
128 | static void create_if_listener(struct listen_opts *); | |||
129 | static void config_listener(struct listener *, struct listen_opts *); | |||
130 | static int host_v4(struct listen_opts *); | |||
131 | static int host_v6(struct listen_opts *); | |||
132 | static int host_dns(struct listen_opts *); | |||
133 | static int interface(struct listen_opts *); | |||
134 | ||||
135 | int delaytonum(char *); | |||
136 | int is_if_in_group(const char *, const char *); | |||
137 | ||||
138 | static int config_lo_mask_source(struct listen_opts *); | |||
139 | ||||
140 | typedef struct { | |||
141 | union { | |||
142 | int64_t number; | |||
143 | struct table *table; | |||
144 | char *string; | |||
145 | struct host *host; | |||
146 | struct mailaddr *maddr; | |||
147 | } v; | |||
148 | int lineno; | |||
149 | } YYSTYPE; | |||
150 | ||||
151 | #line 152 "parse.c" | |||
152 | #define ACTION257 257 | |||
153 | #define ADMD258 258 | |||
154 | #define ALIAS259 259 | |||
155 | #define ANY260 260 | |||
156 | #define ARROW261 261 | |||
157 | #define AUTH262 262 | |||
158 | #define AUTH_OPTIONAL263 263 | |||
159 | #define BACKUP264 264 | |||
160 | #define BOUNCE265 265 | |||
161 | #define BYPASS266 266 | |||
162 | #define CA267 267 | |||
163 | #define CERT268 268 | |||
164 | #define CHAIN269 269 | |||
165 | #define CHROOT270 270 | |||
166 | #define CIPHERS271 271 | |||
167 | #define COMMIT272 272 | |||
168 | #define COMPRESSION273 273 | |||
169 | #define CONNECT274 274 | |||
170 | #define DATA275 275 | |||
171 | #define DATA_LINE276 276 | |||
172 | #define DHE277 277 | |||
173 | #define DISCONNECT278 278 | |||
174 | #define DOMAIN279 279 | |||
175 | #define EHLO280 280 | |||
176 | #define ENABLE281 281 | |||
177 | #define ENCRYPTION282 282 | |||
178 | #define ERROR283 283 | |||
179 | #define EXPAND_ONLY284 284 | |||
180 | #define FCRDNS285 285 | |||
181 | #define FILTER286 286 | |||
182 | #define FOR287 287 | |||
183 | #define FORWARD_ONLY288 288 | |||
184 | #define FROM289 289 | |||
185 | #define GROUP290 290 | |||
186 | #define HELO291 291 | |||
187 | #define HELO_SRC292 292 | |||
188 | #define HOST293 293 | |||
189 | #define HOSTNAME294 294 | |||
190 | #define HOSTNAMES295 295 | |||
191 | #define INCLUDE296 296 | |||
192 | #define INET4297 297 | |||
193 | #define INET6298 298 | |||
194 | #define JUNK299 299 | |||
195 | #define KEY300 300 | |||
196 | #define LIMIT301 301 | |||
197 | #define LISTEN302 302 | |||
198 | #define LMTP303 303 | |||
199 | #define LOCAL304 304 | |||
200 | #define MAIL_FROM305 305 | |||
201 | #define MAILDIR306 306 | |||
202 | #define MASK_SRC307 307 | |||
203 | #define MASQUERADE308 308 | |||
204 | #define MATCH309 309 | |||
205 | #define MAX_MESSAGE_SIZE310 310 | |||
206 | #define MAX_DEFERRED311 311 | |||
207 | #define MBOX312 312 | |||
208 | #define MDA313 313 | |||
209 | #define MTA314 314 | |||
210 | #define MX315 315 | |||
211 | #define NO_DSN316 316 | |||
212 | #define NO_VERIFY317 317 | |||
213 | #define NOOP318 318 | |||
214 | #define ON319 319 | |||
215 | #define PHASE320 320 | |||
216 | #define PKI321 321 | |||
217 | #define PORT322 322 | |||
218 | #define PROC323 323 | |||
219 | #define PROC_EXEC324 324 | |||
220 | #define PROTOCOLS325 325 | |||
221 | #define PROXY_V2326 326 | |||
222 | #define QUEUE327 327 | |||
223 | #define QUIT328 328 | |||
224 | #define RCPT_TO329 329 | |||
225 | #define RDNS330 330 | |||
226 | #define RECIPIENT331 331 | |||
227 | #define RECEIVEDAUTH332 332 | |||
228 | #define REGEX333 333 | |||
229 | #define RELAY334 334 | |||
230 | #define REJECT335 335 | |||
231 | #define REPORT336 336 | |||
232 | #define REWRITE337 337 | |||
233 | #define RSET338 338 | |||
234 | #define SCHEDULER339 339 | |||
235 | #define SENDER340 340 | |||
236 | #define SENDERS341 341 | |||
237 | #define SMTP342 342 | |||
238 | #define SMTP_IN343 343 | |||
239 | #define SMTP_OUT344 344 | |||
240 | #define SMTPS345 345 | |||
241 | #define SOCKET346 346 | |||
242 | #define SRC347 347 | |||
243 | #define SRS348 348 | |||
244 | #define SUB_ADDR_DELIM349 349 | |||
245 | #define TABLE350 350 | |||
246 | #define TAG351 351 | |||
247 | #define TAGGED352 352 | |||
248 | #define TLS353 353 | |||
249 | #define TLS_REQUIRE354 354 | |||
250 | #define TTL355 355 | |||
251 | #define USER356 356 | |||
252 | #define USERBASE357 357 | |||
253 | #define VERIFY358 358 | |||
254 | #define VIRTUAL359 359 | |||
255 | #define WARN_INTERVAL360 360 | |||
256 | #define WRAPPER361 361 | |||
257 | #define STRING362 362 | |||
258 | #define NUMBER363 363 | |||
259 | #define YYERRCODE256 256 | |||
260 | const short yylhs[] = | |||
261 | { -1, | |||
262 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
263 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
264 | 0, 7, 8, 24, 24, 24, 26, 26, 25, 3, | |||
265 | 3, 27, 27, 28, 29, 29, 30, 31, 31, 32, | |||
266 | 32, 34, 9, 10, 36, 11, 37, 35, 12, 12, | |||
267 | 13, 40, 13, 41, 13, 43, 14, 44, 44, 44, | |||
268 | 42, 42, 46, 15, 47, 47, 47, 45, 45, 16, | |||
269 | 16, 16, 16, 17, 18, 18, 18, 18, 19, 19, | |||
270 | 19, 50, 50, 50, 50, 50, 51, 51, 53, 52, | |||
271 | 54, 52, 55, 52, 56, 52, 57, 52, 58, 52, | |||
272 | 59, 52, 60, 52, 61, 52, 62, 52, 63, 63, | |||
273 | 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, | |||
274 | 63, 63, 63, 63, 64, 63, 63, 66, 66, 67, | |||
275 | 68, 68, 69, 70, 70, 71, 21, 72, 72, 72, | |||
276 | 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, | |||
277 | 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, | |||
278 | 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, | |||
279 | 74, 75, 75, 76, 22, 77, 77, 77, 78, 78, | |||
280 | 78, 78, 79, 80, 81, 82, 83, 84, 85, 86, | |||
281 | 87, 88, 89, 90, 91, 92, 93, 94, 94, 94, | |||
282 | 94, 94, 94, 95, 96, 96, 96, 97, 97, 97, | |||
283 | 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, | |||
284 | 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, | |||
285 | 99, 100, 100, 100, 100, 100, 100, 100, 100, 101, | |||
286 | 101, 101, 101, 101, 101, 101, 101, 103, 102, 105, | |||
287 | 104, 107, 106, 109, 108, 111, 110, 113, 112, 115, | |||
288 | 114, 117, 116, 118, 118, 118, 118, 118, 118, 118, | |||
289 | 118, 119, 65, 65, 23, 120, 23, 121, 23, 122, | |||
290 | 23, 2, 2, 123, 33, 33, 124, 49, 49, 125, | |||
291 | 38, 38, 126, 126, 126, 39, 39, 127, 48, 48, | |||
292 | 128, 129, 128, 128, 128, 130, 130, 130, 130, 130, | |||
293 | 130, 130, 131, 130, 130, 130, 130, 130, 130, 130, | |||
294 | 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, | |||
295 | 130, 130, 130, 130, 130, 130, 132, 132, 133, 134, | |||
296 | 135, 135, 136, 136, 137, 20, 1, 138, 1, 5, | |||
297 | 139, 5, 6, 4, 4, | |||
298 | }; | |||
299 | const short yylen[] = | |||
300 | { 2, | |||
301 | 0, 2, 3, 3, 3, 3, 3, 3, 3, 3, | |||
302 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |||
303 | 3, 2, 3, 1, 1, 0, 2, 0, 2, 1, | |||
304 | 0, 1, 1, 3, 1, 3, 1, 1, 3, 1, | |||
305 | 1, 0, 4, 2, 0, 4, 2, 1, 3, 4, | |||
306 | 3, 0, 7, 0, 4, 0, 4, 2, 2, 2, | |||
307 | 2, 0, 0, 5, 2, 2, 2, 2, 0, 2, | |||
308 | 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, | |||
309 | 3, 2, 2, 2, 2, 2, 2, 0, 0, 3, | |||
310 | 0, 3, 0, 4, 0, 4, 0, 5, 0, 4, | |||
311 | 0, 5, 0, 4, 0, 3, 0, 3, 2, 2, | |||
312 | 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, | |||
313 | 1, 2, 2, 2, 0, 5, 1, 2, 0, 2, | |||
314 | 1, 1, 2, 2, 0, 0, 5, 3, 4, 3, | |||
315 | 4, 2, 2, 3, 4, 3, 4, 3, 4, 3, | |||
316 | 3, 3, 4, 5, 3, 4, 5, 3, 4, 5, | |||
317 | 4, 5, 3, 3, 4, 5, 4, 5, 2, 0, | |||
318 | 1, 1, 2, 0, 4, 1, 1, 1, 2, 2, | |||
319 | 2, 2, 2, 2, 3, 4, 3, 4, 3, 4, | |||
320 | 2, 3, 4, 3, 4, 3, 4, 1, 1, 1, | |||
321 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
322 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
323 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
324 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
325 | 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, | |||
326 | 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, | |||
327 | 5, 0, 5, 1, 1, 1, 1, 1, 1, 1, | |||
328 | 1, 1, 1, 3, 4, 0, 6, 0, 5, 0, | |||
329 | 7, 1, 1, 1, 3, 1, 2, 2, 0, 2, | |||
330 | 2, 0, 1, 1, 2, 2, 0, 2, 2, 0, | |||
331 | 2, 0, 5, 1, 2, 1, 1, 2, 2, 2, | |||
332 | 2, 2, 0, 5, 1, 2, 1, 1, 2, 2, | |||
333 | 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, | |||
334 | 1, 1, 1, 1, 2, 3, 1, 1, 2, 2, | |||
335 | 2, 0, 2, 0, 0, 4, 3, 0, 6, 1, | |||
336 | 0, 4, 3, 1, 1, | |||
337 | }; | |||
338 | const short yydefred[] = | |||
339 | { 1, | |||
340 | 0, 0, 0, 0, 0, 0, 0, 0, 345, 174, | |||
341 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
342 | 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
343 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, | |||
344 | 136, 44, 42, 45, 0, 22, 0, 0, 0, 0, | |||
345 | 0, 0, 56, 0, 70, 0, 0, 0, 0, 0, | |||
346 | 0, 0, 0, 0, 0, 0, 17, 3, 4, 5, | |||
347 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | |||
348 | 16, 18, 19, 20, 0, 0, 0, 280, 278, 0, | |||
349 | 0, 0, 30, 0, 0, 0, 0, 49, 0, 0, | |||
350 | 0, 0, 51, 0, 63, 72, 73, 0, 74, 0, | |||
351 | 76, 0, 75, 0, 283, 282, 77, 78, 0, 79, | |||
352 | 81, 347, 0, 23, 107, 105, 0, 0, 89, 0, | |||
353 | 0, 131, 132, 0, 284, 0, 286, 0, 46, 48, | |||
354 | 0, 0, 275, 276, 0, 0, 346, 337, 338, 0, | |||
355 | 0, 0, 0, 0, 0, 0, 142, 169, 0, 172, | |||
356 | 175, 287, 291, 50, 0, 293, 294, 0, 55, 0, | |||
357 | 0, 0, 0, 57, 0, 0, 298, 299, 290, 288, | |||
358 | 80, 0, 0, 0, 0, 93, 0, 0, 0, 103, | |||
359 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
360 | 0, 0, 0, 127, 0, 0, 130, 0, 0, 137, | |||
361 | 0, 47, 0, 254, 262, 248, 260, 252, 250, 256, | |||
362 | 258, 264, 265, 266, 267, 268, 269, 270, 271, 279, | |||
363 | 0, 0, 304, 0, 0, 339, 0, 0, 0, 0, | |||
364 | 0, 0, 0, 306, 307, 331, 333, 0, 0, 0, | |||
365 | 334, 332, 0, 0, 0, 317, 0, 0, 340, 0, | |||
366 | 350, 351, 0, 144, 354, 355, 164, 0, 163, 0, | |||
367 | 152, 0, 151, 0, 0, 150, 0, 0, 140, 0, | |||
368 | 146, 0, 148, 0, 138, 171, 173, 52, 295, 296, | |||
369 | 58, 60, 59, 61, 0, 0, 0, 64, 0, 0, | |||
370 | 0, 41, 0, 40, 0, 0, 0, 0, 0, 0, | |||
371 | 0, 108, 106, 101, 0, 0, 97, 0, 92, 90, | |||
372 | 0, 123, 0, 112, 113, 120, 124, 0, 109, 110, | |||
373 | 119, 116, 111, 114, 115, 122, 128, 133, 134, 285, | |||
374 | 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
375 | 0, 277, 301, 0, 305, 341, 326, 327, 323, 320, | |||
376 | 312, 0, 329, 330, 322, 309, 310, 308, 311, 321, | |||
377 | 0, 316, 328, 319, 343, 145, 0, 0, 0, 165, | |||
378 | 0, 167, 0, 159, 0, 161, 0, 156, 0, 153, | |||
379 | 141, 147, 149, 139, 0, 67, 66, 65, 68, 33, | |||
380 | 32, 0, 0, 24, 0, 25, 0, 349, 83, 82, | |||
381 | 85, 84, 86, 87, 0, 100, 94, 0, 96, 104, | |||
382 | 117, 0, 281, 0, 0, 0, 0, 0, 0, 0, | |||
383 | 0, 0, 0, 0, 336, 0, 353, 166, 168, 160, | |||
384 | 162, 157, 154, 53, 34, 0, 29, 0, 36, 37, | |||
385 | 39, 102, 98, 0, 274, 0, 198, 199, 201, 200, | |||
386 | 203, 202, 208, 209, 210, 211, 212, 213, 0, 0, | |||
387 | 240, 241, 242, 243, 244, 245, 246, 247, 0, 0, | |||
388 | 204, 0, 232, 233, 234, 235, 236, 237, 238, 239, | |||
389 | 0, 0, 205, 206, 207, 0, 0, 214, 215, 216, | |||
390 | 217, 218, 219, 220, 221, 0, 0, 222, 223, 224, | |||
391 | 225, 226, 227, 228, 229, 230, 231, 0, 0, 0, | |||
392 | 352, 27, 126, 0, 183, 0, 0, 0, 178, 0, | |||
393 | 177, 0, 0, 0, 255, 176, 0, 263, 249, 261, | |||
394 | 253, 251, 257, 0, 259, 303, 314, 0, 192, 0, | |||
395 | 189, 0, 185, 0, 187, 180, 179, 182, 181, 0, | |||
396 | 194, 0, 196, 193, 190, 186, 188, 195, 197, | |||
397 | }; | |||
398 | const short yydgoto[] = | |||
399 | { 1, | |||
400 | 22, 117, 470, 264, 265, 266, 23, 24, 25, 26, | |||
401 | 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, | |||
402 | 37, 38, 39, 405, 406, 447, 402, 301, 302, 303, | |||
403 | 304, 305, 136, 86, 139, 87, 140, 98, 169, 395, | |||
404 | 102, 174, 104, 175, 298, 176, 299, 109, 113, 311, | |||
405 | 312, 132, 189, 188, 316, 318, 418, 315, 415, 321, | |||
406 | 184, 183, 206, 328, 342, 207, 133, 134, 209, 210, | |||
407 | 85, 95, 96, 287, 161, 48, 535, 536, 457, 458, | |||
408 | 459, 460, 461, 462, 493, 494, 465, 466, 467, 476, | |||
409 | 477, 515, 516, 495, 482, 496, 469, 506, 518, 491, | |||
410 | 479, 222, 346, 223, 349, 224, 348, 225, 344, 226, | |||
411 | 350, 227, 351, 228, 347, 229, 345, 230, 343, 231, | |||
412 | 142, 141, 137, 99, 114, 170, 110, 235, 354, 258, | |||
413 | 362, 147, 148, 149, 236, 259, 47, 123, 377, | |||
414 | }; | |||
415 | const short yysindex[] = | |||
416 | { 0, | |||
417 | -5, 33, -306, -294, -286, -283, -244, -228, 0, 0, | |||
418 | -249, -240, -223, -220, -219, -225, -206, -217, -215, 52, | |||
419 | 0, 139, 144, 150, 152, 155, 157, 160, 165, 168, | |||
420 | 170, 173, 175, 176, 179, 181, 186, 191, 195, 0, | |||
421 | 0, 0, 0, 0, -172, 0, -121, 182, -150, -148, | |||
422 | -78, -143, 0, -139, 0, -135, -131, -125, -119, -118, | |||
423 | -190, -117, -242, -112, -106, -94, 0, 0, 0, 0, | |||
424 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
425 | 0, 0, 0, 0, 347, -91, -7, 0, 0, -89, | |||
426 | -87, -284, 0, 183, 182, -230, -84, 0, -150, -76, | |||
427 | 16, -239, 0, -208, 0, 0, 0, -79, 0, -125, | |||
428 | 0, -63, 0, -118, 0, 0, 0, 0, -60, 0, | |||
429 | 0, 0, 192, 0, 0, 0, -57, -266, 0, -38, | |||
430 | 562, 0, 0, -19, 0, 273, 0, -29, 0, 0, | |||
431 | 215, -80, 0, 0, -252, 489, 0, 0, 0, -51, | |||
432 | -231, -159, -48, -43, -41, -37, 0, 0, -23, 0, | |||
433 | 0, 0, 0, 0, -20, 0, 0, 9, 0, -239, | |||
434 | -18, 1, 6, 0, -208, -246, 0, 0, 0, 0, | |||
435 | 0, 8, -224, -224, 30, 0, 91, -224, -224, 0, | |||
436 | -42, 83, 34, 49, -42, 59, 62, -42, -42, 64, | |||
437 | 66, 68, -42, 0, 88, 562, 0, 69, -19, 0, | |||
438 | -91, 0, 70, 0, 0, 0, 0, 0, 0, 0, | |||
439 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
440 | -246, 73, 0, 76, -252, 0, -42, -42, 85, 86, | |||
441 | 93, 98, -42, 0, 0, 0, 0, 103, 230, 113, | |||
442 | 0, 0, -42, 118, 115, 0, 120, 489, 0, -42, | |||
443 | 0, 0, 129, 0, 0, 0, 0, -35, 0, -34, | |||
444 | 0, -32, 0, -30, -21, 0, 7, -42, 0, -42, | |||
445 | 0, -42, 0, -42, 0, 0, 0, 0, 0, 0, | |||
446 | 0, 0, 0, 0, 135, 138, 140, 0, -246, -45, | |||
447 | 43, 0, 43, 0, 359, -42, 142, -42, -42, 146, | |||
448 | -224, 0, 0, 0, -224, -224, 0, -224, 0, 0, | |||
449 | -224, 0, 153, 0, 0, 0, 0, 387, 0, 0, | |||
450 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
451 | 0, 391, 43, 220, 224, 229, 231, 232, 238, 242, | |||
452 | 244, 0, 0, 396, 0, 0, 0, 0, 0, 0, | |||
453 | 0, 409, 0, 0, 0, 0, 0, 0, 0, 0, | |||
454 | 174, 0, 0, 0, 0, 0, 8, 492, -42, 0, | |||
455 | -42, 0, -42, 0, -42, 0, -42, 0, -42, 0, | |||
456 | 0, 0, 0, 0, -239, 0, 0, 0, 0, 0, | |||
457 | 0, 194, 550, 0, 201, 0, 203, 0, 0, 0, | |||
458 | 0, 0, 0, 0, -224, 0, 0, -224, 0, 0, | |||
459 | 0, 70, 0, 70, 182, 182, 182, 182, 182, 182, | |||
460 | 182, 182, 70, 70, 0, 441, 0, 0, 0, 0, | |||
461 | 0, 0, 0, 0, 0, 550, 0, -45, 0, 0, | |||
462 | 0, 0, 0, 444, 0, -221, 0, 0, 0, 0, | |||
463 | 0, 0, 0, 0, 0, 0, 0, 0, 11, 237, | |||
464 | 0, 0, 0, 0, 0, 0, 0, 0, 122, -236, | |||
465 | 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, | |||
466 | 11, -92, 0, 0, 0, 11, 11, 0, 0, 0, | |||
467 | 0, 0, 0, 0, 0, 11, -88, 0, 0, 0, | |||
468 | 0, 0, 0, 0, 0, 0, 0, 11, 445, 448, | |||
469 | 0, 0, 0, 17, 0, 54, 56, 81, 0, 219, | |||
470 | 0, 226, 236, 241, 0, 0, 84, 0, 0, 0, | |||
471 | 0, 0, 0, 90, 0, 0, 0, -42, 0, -42, | |||
472 | 0, -42, 0, -42, 0, 0, 0, 0, 0, -42, | |||
473 | 0, -42, 0, 0, 0, 0, 0, 0, 0,}; | |||
474 | const short yyrindex[] = | |||
475 | { 0, | |||
476 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
477 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
478 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
479 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
480 | 0, 0, 0, 0, 0, 0, 0, -81, 594, 0, | |||
481 | -4, 0, 0, 0, 0, 155, 0, 596, 0, 597, | |||
482 | 0, 0, 0, 0, 493, 0, 0, 0, 0, 0, | |||
483 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
484 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
485 | 0, 0, 0, 0, -81, 0, 0, 0, 594, 0, | |||
486 | 0, 602, 0, 611, 0, 0, 0, 0, 0, 596, | |||
487 | 0, 0, 0, 597, 0, 0, 0, 0, 0, 0, | |||
488 | 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, | |||
489 | -3, 0, 0, 612, 0, 615, 0, 0, 0, 0, | |||
490 | 0, 0, 0, 0, 616, 617, 0, 0, 0, -22, | |||
491 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
492 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 602, | |||
493 | 0, 0, 0, 0, 611, 150, 0, 0, 0, 0, | |||
494 | 0, 0, -2, -2, 21, 0, 47, -2, -2, 0, | |||
495 | 0, 148, 0, 0, 0, 506, 0, 0, 0, 0, | |||
496 | 0, 0, 0, 0, 158, -3, 0, 0, 612, 0, | |||
497 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
498 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
499 | 150, 507, 0, 0, 616, 0, 223, 264, 0, 0, | |||
500 | 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
501 | 0, 0, 0, 316, 0, 0, 357, 617, 0, 0, | |||
502 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
503 | 0, 438, 0, 0, 474, 0, 0, 0, 0, 0, | |||
504 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
505 | 0, 0, 0, 0, 0, 0, 0, 0, 150, 3, | |||
506 | -115, 0, -105, 0, 0, 0, 0, 0, 0, 0, | |||
507 | -2, 0, 0, 0, -2, -2, 0, -2, 0, 0, | |||
508 | -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
509 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
510 | 0, 0, -104, 0, 0, 0, 0, 0, 0, 0, | |||
511 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
512 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
513 | 423, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
514 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
515 | 0, 0, 0, 0, 602, 0, 0, 0, 0, 0, | |||
516 | 0, 0, 282, 0, 0, 0, 0, 0, 0, 0, | |||
517 | 0, 0, 0, 0, -2, 0, 0, -2, 0, 0, | |||
518 | 0, 0, 0, 0, -101, 252, -128, 252, 261, 261, | |||
519 | 252, 151, 0, 0, 0, 0, 0, 0, 0, 0, | |||
520 | 0, 0, 0, 0, 0, 282, 0, 0, 0, 0, | |||
521 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
522 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
523 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
524 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
525 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
526 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
527 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
528 | 0, 0, 0, 57, 0, 0, 188, 0, 0, 0, | |||
529 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
530 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
531 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
532 | 0, 0, 0, 0, 0, 0, 0, 0, 0,}; | |||
533 | const short yygindex[] = | |||
534 | { 0, | |||
535 | 0, 0, -44, -153, 0, 0, 0, 0, 0, 0, | |||
536 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
537 | 0, 0, 0, -237, 0, 199, 0, 0, 251, 0, | |||
538 | 239, 270, 0, 0, 0, 0, 0, 559, -156, 0, | |||
539 | 0, 487, 0, 0, -191, 0, 0, 539, 549, 0, | |||
540 | -152, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
541 | 0, 0, 0, 0, -146, 459, 0, 0, 0, 465, | |||
542 | 0, 0, 580, 0, 0, 0, 210, 197, 0, 0, | |||
543 | 0, 0, 0, 0, 36, 169, -77, 208, 240, -210, | |||
544 | 61, 0, 0, 367, 0, 247, 0, 0, 0, 0, | |||
545 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
546 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
547 | 0, 0, 469, 0, 0, 0, 0, 0, 0, 0, | |||
548 | 0, 0, 0, 0, 449, 429, 0, 0, 0, | |||
549 | }; | |||
550 | #define YYTABLESIZE915 915 | |||
551 | const short yytable[] = | |||
552 | { 279, | |||
553 | 281, 283, 285, 94, 21, 54, 129, 88, 263, 35, | |||
554 | 143, 263, 37, 290, 91, 401, 263, 263, 263, 38, | |||
555 | 273, 119, 263, 295, 263, 263, 159, 263, 267, 263, | |||
556 | 99, 313, 186, 232, 306, 319, 320, 322, 263, 352, | |||
557 | 524, 326, 40, 296, 330, 331, 37, 268, 525, 335, | |||
558 | 94, 49, 403, 55, 233, 41, 95, 166, 167, 171, | |||
559 | 51, 145, 56, 525, 59, 407, 263, 42, 172, 526, | |||
560 | 52, 262, 269, 43, 262, 58, 263, 146, 44, 262, | |||
561 | 262, 262, 63, 357, 358, 262, 404, 262, 262, 364, | |||
562 | 262, 173, 262, 527, 60, 187, 88, 270, 234, 371, | |||
563 | 271, 262, 272, 61, 160, 424, 376, 399, 527, 297, | |||
564 | 528, 50, 66, 263, 380, 263, 382, 45, 384, 120, | |||
565 | 386, 388, 168, 390, 391, 528, 392, 37, 393, 262, | |||
566 | 394, 307, 308, 46, 309, 57, 310, 64, 53, 262, | |||
567 | 263, 54, 62, 263, 273, 274, 65, 89, 67, 263, | |||
568 | 90, 91, 409, 68, 411, 412, 31, 118, 414, 69, | |||
569 | 31, 70, 416, 417, 71, 419, 72, 121, 420, 73, | |||
570 | 275, 115, 116, 524, 74, 170, 262, 75, 262, 76, | |||
571 | 31, 214, 77, 31, 78, 79, 276, 277, 80, 31, | |||
572 | 81, 215, 525, 216, 217, 82, 525, 92, 526, 218, | |||
573 | 83, 31, 526, 262, 84, 31, 262, 31, 101, 31, | |||
574 | 219, 97, 262, 100, 93, 400, 537, 488, 31, 103, | |||
575 | 503, 513, 105, 31, 220, 438, 106, 439, 31, 440, | |||
576 | 107, 441, 324, 442, 143, 443, 108, 527, 444, 143, | |||
577 | 544, 527, 111, 112, 118, 31, 26, 31, 221, 121, | |||
578 | 2, 3, 4, 170, 528, 122, 26, 26, 528, 5, | |||
579 | 138, 6, 452, 91, 143, 453, 143, 124, 143, 31, | |||
580 | 135, 31, 143, 325, 144, 454, 529, 455, 162, 99, | |||
581 | 7, 260, 143, 177, 278, 164, 519, 520, 530, 280, | |||
582 | 8, 282, 54, 54, 165, 284, 9, 379, 381, 179, | |||
583 | 383, 181, 385, 10, 185, 95, 143, 11, 12, 531, | |||
584 | 261, 387, 143, 261, 182, 13, 211, 14, 261, 261, | |||
585 | 261, 15, 191, 190, 261, 315, 261, 261, 143, 261, | |||
586 | 143, 261, 212, 16, 191, 208, 17, 213, 286, 389, | |||
587 | 261, 288, 18, 291, 19, 532, 533, 534, 473, 548, | |||
588 | 485, 129, 88, 500, 510, 191, 20, 54, 314, 91, | |||
589 | 91, 91, 292, 91, 37, 91, 318, 293, 261, 300, | |||
590 | 549, 289, 551, 553, 555, 99, 99, 99, 261, 99, | |||
591 | 456, 99, 480, 561, 492, 492, 550, 507, 552, 317, | |||
592 | 563, 191, 191, 191, 564, 324, 565, 323, 566, 530, | |||
593 | 567, 95, 95, 95, 336, 95, 568, 95, 569, 118, | |||
594 | 325, 118, 31, 554, 118, 261, 560, 261, 118, 121, | |||
595 | 327, 121, 562, 329, 121, 332, 118, 333, 121, 334, | |||
596 | 338, 341, 335, 118, 353, 31, 121, 355, 118, 118, | |||
597 | 118, 31, 261, 121, 150, 261, 359, 360, 121, 121, | |||
598 | 121, 261, 118, 184, 361, 31, 532, 533, 534, 363, | |||
599 | 463, 471, 121, 483, 365, 184, 498, 508, 118, 151, | |||
600 | 158, 152, 118, 153, 370, 372, 373, 374, 121, 31, | |||
601 | 31, 435, 121, 408, 324, 324, 184, 154, 489, 324, | |||
602 | 378, 504, 514, 324, 118, 118, 396, 31, 524, 397, | |||
603 | 118, 398, 118, 410, 121, 121, 155, 413, 324, 422, | |||
604 | 121, 155, 121, 31, 421, 423, 324, 324, 433, 324, | |||
605 | 324, 525, 184, 184, 184, 325, 325, 526, 425, 324, | |||
606 | 325, 434, 426, 156, 325, 157, 31, 427, 324, 428, | |||
607 | 429, 537, 31, 324, 324, 31, 430, 324, 324, 325, | |||
608 | 431, 31, 432, 437, 324, 445, 31, 325, 325, 446, | |||
609 | 325, 325, 448, 324, 450, 521, 527, 324, 523, 546, | |||
610 | 325, 366, 547, 324, 367, 324, 324, 315, 315, 325, | |||
611 | 556, 31, 315, 528, 325, 325, 315, 557, 325, 325, | |||
612 | 31, 368, 369, 464, 472, 325, 484, 558, 31, 499, | |||
613 | 509, 315, 559, 292, 325, 300, 289, 31, 325, 315, | |||
614 | 315, 297, 315, 315, 325, 348, 325, 325, 318, 318, | |||
615 | 62, 135, 315, 318, 43, 342, 344, 318, 125, 302, | |||
616 | 125, 315, 313, 474, 126, 486, 315, 315, 501, 511, | |||
617 | 315, 315, 318, 28, 522, 451, 436, 315, 178, 127, | |||
618 | 318, 318, 128, 318, 318, 449, 315, 163, 129, 130, | |||
619 | 315, 294, 180, 318, 337, 475, 315, 487, 315, 315, | |||
620 | 502, 512, 318, 339, 158, 538, 497, 318, 318, 340, | |||
621 | 131, 318, 318, 356, 335, 335, 375, 0, 318, 335, | |||
622 | 0, 539, 0, 335, 158, 0, 0, 318, 0, 158, | |||
623 | 540, 318, 0, 0, 0, 541, 542, 318, 335, 318, | |||
624 | 318, 0, 0, 0, 0, 543, 335, 335, 0, 335, | |||
625 | 335, 0, 0, 0, 158, 0, 158, 545, 158, 335, | |||
626 | 155, 0, 0, 0, 0, 155, 0, 0, 335, 0, | |||
627 | 0, 0, 158, 335, 335, 0, 0, 335, 335, 0, | |||
628 | 237, 238, 0, 0, 335, 239, 0, 0, 0, 240, | |||
629 | 155, 0, 155, 335, 155, 0, 158, 335, 0, 0, | |||
630 | 0, 0, 158, 335, 241, 335, 335, 0, 155, 0, | |||
631 | 0, 0, 242, 243, 0, 244, 245, 0, 158, 0, | |||
632 | 158, 468, 478, 481, 490, 246, 0, 505, 517, 0, | |||
633 | 0, 0, 155, 0, 247, 0, 0, 0, 155, 248, | |||
634 | 249, 0, 0, 250, 251, 0, 0, 0, 0, 0, | |||
635 | 252, 0, 0, 191, 155, 192, 155, 0, 193, 253, | |||
636 | 0, 0, 194, 254, 0, 0, 0, 0, 0, 255, | |||
637 | 195, 256, 257, 0, 0, 0, 0, 196, 0, 0, | |||
638 | 0, 0, 197, 198, 199, 0, 0, 0, 0, 0, | |||
639 | 0, 0, 0, 0, 0, 0, 200, 0, 0, 0, | |||
640 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
641 | 0, 0, 201, 0, 0, 0, 202, 0, 0, 0, | |||
642 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
643 | 0, 0, 0, 0, 0, 0, 0, 0, 203, 204, | |||
644 | 0, 0, 0, 0, 205, | |||
645 | }; | |||
646 | const short yycheck[] = | |||
647 | { 153, | |||
648 | 154, 155, 156, 48, 10, 10, 10, 10, 60, 125, | |||
649 | 33, 60, 10, 170, 10, 61, 60, 60, 60, 125, | |||
650 | 125, 264, 60, 270, 60, 60, 257, 60, 260, 60, | |||
651 | 10, 184, 299, 286, 259, 188, 189, 191, 60, 231, | |||
652 | 262, 195, 10, 290, 198, 199, 44, 279, 285, 203, | |||
653 | 95, 301, 10, 273, 307, 362, 10, 297, 298, 268, | |||
654 | 301, 346, 282, 285, 271, 303, 60, 362, 277, 291, | |||
655 | 311, 123, 304, 360, 123, 301, 60, 362, 362, 123, | |||
656 | 123, 123, 300, 237, 238, 123, 44, 123, 123, 243, | |||
657 | 123, 300, 123, 330, 301, 362, 269, 329, 351, 253, | |||
658 | 260, 123, 262, 310, 335, 343, 260, 299, 330, 356, | |||
659 | 347, 361, 61, 60, 268, 60, 270, 362, 272, 362, | |||
660 | 274, 275, 362, 277, 278, 347, 280, 125, 282, 123, | |||
661 | 284, 356, 357, 362, 359, 355, 361, 355, 362, 123, | |||
662 | 60, 362, 349, 60, 304, 305, 362, 320, 10, 60, | |||
663 | 323, 324, 306, 10, 308, 309, 285, 10, 311, 10, | |||
664 | 262, 10, 315, 316, 10, 318, 10, 10, 321, 10, | |||
665 | 330, 362, 363, 262, 10, 257, 123, 10, 123, 10, | |||
666 | 262, 262, 10, 285, 10, 10, 346, 347, 10, 291, | |||
667 | 10, 272, 285, 274, 275, 10, 285, 319, 291, 280, | |||
668 | 10, 330, 291, 123, 10, 287, 123, 289, 287, 291, | |||
669 | 291, 362, 123, 362, 33, 261, 305, 428, 347, 363, | |||
670 | 431, 432, 362, 305, 305, 379, 362, 381, 330, 383, | |||
671 | 362, 385, 10, 387, 257, 389, 362, 330, 395, 262, | |||
672 | 329, 330, 362, 362, 362, 347, 362, 329, 329, 362, | |||
673 | 256, 257, 258, 335, 347, 362, 362, 362, 347, 265, | |||
674 | 268, 267, 415, 259, 287, 418, 289, 362, 291, 351, | |||
675 | 362, 353, 362, 10, 362, 422, 266, 424, 363, 259, | |||
676 | 286, 333, 305, 363, 333, 362, 433, 434, 278, 333, | |||
677 | 296, 333, 297, 298, 279, 333, 302, 333, 333, 363, | |||
678 | 333, 362, 333, 309, 362, 259, 329, 313, 314, 299, | |||
679 | 362, 333, 335, 362, 123, 321, 44, 323, 362, 362, | |||
680 | 362, 327, 266, 362, 362, 10, 362, 362, 351, 362, | |||
681 | 353, 362, 362, 339, 278, 355, 342, 123, 362, 333, | |||
682 | 362, 362, 348, 362, 350, 335, 336, 337, 426, 333, | |||
683 | 428, 355, 355, 431, 432, 299, 362, 362, 329, 355, | |||
684 | 356, 357, 362, 359, 362, 361, 10, 362, 362, 362, | |||
685 | 524, 363, 526, 527, 528, 355, 356, 357, 362, 359, | |||
686 | 425, 361, 427, 537, 429, 430, 333, 432, 333, 299, | |||
687 | 544, 335, 336, 337, 548, 362, 550, 315, 552, 278, | |||
688 | 554, 355, 356, 357, 317, 359, 560, 361, 562, 262, | |||
689 | 362, 264, 262, 333, 267, 362, 333, 362, 271, 262, | |||
690 | 362, 264, 333, 362, 267, 362, 279, 362, 271, 362, | |||
691 | 362, 362, 10, 286, 362, 285, 279, 362, 291, 292, | |||
692 | 293, 291, 362, 286, 262, 362, 362, 362, 291, 292, | |||
693 | 293, 362, 305, 266, 362, 305, 335, 336, 337, 362, | |||
694 | 425, 426, 305, 428, 362, 278, 431, 432, 321, 287, | |||
695 | 33, 289, 325, 291, 362, 358, 362, 358, 321, 329, | |||
696 | 330, 308, 325, 125, 262, 263, 299, 305, 428, 267, | |||
697 | 362, 431, 432, 271, 347, 348, 362, 347, 262, 362, | |||
698 | 353, 362, 355, 362, 347, 348, 33, 362, 286, 123, | |||
699 | 353, 329, 355, 262, 362, 125, 294, 295, 123, 297, | |||
700 | 298, 285, 335, 336, 337, 262, 263, 291, 309, 307, | |||
701 | 267, 123, 309, 351, 271, 353, 285, 309, 316, 309, | |||
702 | 309, 305, 291, 321, 322, 285, 309, 325, 326, 286, | |||
703 | 309, 291, 309, 62, 332, 362, 305, 294, 295, 10, | |||
704 | 297, 298, 362, 341, 362, 125, 330, 345, 125, 125, | |||
705 | 307, 342, 125, 351, 345, 353, 354, 262, 263, 316, | |||
706 | 362, 330, 267, 347, 321, 322, 271, 362, 325, 326, | |||
707 | 330, 362, 363, 425, 426, 332, 428, 362, 347, 431, | |||
708 | 432, 286, 362, 10, 341, 10, 10, 347, 345, 294, | |||
709 | 295, 10, 297, 298, 351, 123, 353, 354, 262, 263, | |||
710 | 10, 10, 307, 267, 10, 10, 10, 271, 123, 123, | |||
711 | 284, 316, 123, 426, 288, 428, 321, 322, 431, 432, | |||
712 | 325, 326, 286, 362, 446, 407, 377, 332, 110, 303, | |||
713 | 294, 295, 306, 297, 298, 405, 341, 99, 312, 313, | |||
714 | 345, 175, 114, 307, 206, 426, 351, 428, 353, 354, | |||
715 | 431, 432, 316, 209, 95, 479, 430, 321, 322, 211, | |||
716 | 334, 325, 326, 235, 262, 263, 258, -1, 332, 267, | |||
717 | -1, 482, -1, 271, 257, -1, -1, 341, -1, 262, | |||
718 | 491, 345, -1, -1, -1, 496, 497, 351, 286, 353, | |||
719 | 354, -1, -1, -1, -1, 506, 294, 295, -1, 297, | |||
720 | 298, -1, -1, -1, 287, -1, 289, 518, 291, 307, | |||
721 | 257, -1, -1, -1, -1, 262, -1, -1, 316, -1, | |||
722 | -1, -1, 305, 321, 322, -1, -1, 325, 326, -1, | |||
723 | 262, 263, -1, -1, 332, 267, -1, -1, -1, 271, | |||
724 | 287, -1, 289, 341, 291, -1, 329, 345, -1, -1, | |||
725 | -1, -1, 335, 351, 286, 353, 354, -1, 305, -1, | |||
726 | -1, -1, 294, 295, -1, 297, 298, -1, 351, -1, | |||
727 | 353, 425, 426, 427, 428, 307, -1, 431, 432, -1, | |||
728 | -1, -1, 329, -1, 316, -1, -1, -1, 335, 321, | |||
729 | 322, -1, -1, 325, 326, -1, -1, -1, -1, -1, | |||
730 | 332, -1, -1, 262, 351, 264, 353, -1, 267, 341, | |||
731 | -1, -1, 271, 345, -1, -1, -1, -1, -1, 351, | |||
732 | 279, 353, 354, -1, -1, -1, -1, 286, -1, -1, | |||
733 | -1, -1, 291, 292, 293, -1, -1, -1, -1, -1, | |||
734 | -1, -1, -1, -1, -1, -1, 305, -1, -1, -1, | |||
735 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
736 | -1, -1, 321, -1, -1, -1, 325, -1, -1, -1, | |||
737 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
738 | -1, -1, -1, -1, -1, -1, -1, -1, 347, 348, | |||
739 | -1, -1, -1, -1, 353, | |||
740 | }; | |||
741 | #define YYFINAL1 1 | |||
742 | #ifndef YYDEBUG0 | |||
743 | #define YYDEBUG0 0 | |||
744 | #endif | |||
745 | #define YYMAXTOKEN363 363 | |||
746 | #if YYDEBUG0 | |||
747 | const char * const yyname[] = | |||
748 | { | |||
749 | "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
750 | 0,0,"'!'",0,0,0,0,0,0,0,0,0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'<'","'='", | |||
751 | "'>'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
752 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,0, | |||
753 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
754 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
755 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
756 | 0,"ACTION","ADMD","ALIAS","ANY","ARROW","AUTH","AUTH_OPTIONAL","BACKUP", | |||
757 | "BOUNCE","BYPASS","CA","CERT","CHAIN","CHROOT","CIPHERS","COMMIT","COMPRESSION", | |||
758 | "CONNECT","DATA","DATA_LINE","DHE","DISCONNECT","DOMAIN","EHLO","ENABLE", | |||
759 | "ENCRYPTION","ERROR","EXPAND_ONLY","FCRDNS","FILTER","FOR","FORWARD_ONLY", | |||
760 | "FROM","GROUP","HELO","HELO_SRC","HOST","HOSTNAME","HOSTNAMES","INCLUDE", | |||
761 | "INET4","INET6","JUNK","KEY","LIMIT","LISTEN","LMTP","LOCAL","MAIL_FROM", | |||
762 | "MAILDIR","MASK_SRC","MASQUERADE","MATCH","MAX_MESSAGE_SIZE","MAX_DEFERRED", | |||
763 | "MBOX","MDA","MTA","MX","NO_DSN","NO_VERIFY","NOOP","ON","PHASE","PKI","PORT", | |||
764 | "PROC","PROC_EXEC","PROTOCOLS","PROXY_V2","QUEUE","QUIT","RCPT_TO","RDNS", | |||
765 | "RECIPIENT","RECEIVEDAUTH","REGEX","RELAY","REJECT","REPORT","REWRITE","RSET", | |||
766 | "SCHEDULER","SENDER","SENDERS","SMTP","SMTP_IN","SMTP_OUT","SMTPS","SOCKET", | |||
767 | "SRC","SRS","SUB_ADDR_DELIM","TABLE","TAG","TAGGED","TLS","TLS_REQUIRE","TTL", | |||
768 | "USER","USERBASE","VERIFY","VIRTUAL","WARN_INTERVAL","WRAPPER","STRING", | |||
769 | "NUMBER", | |||
770 | }; | |||
771 | const char * const yyrule[] = | |||
772 | {"$accept : grammar", | |||
773 | "grammar :", | |||
774 | "grammar : grammar '\\n'", | |||
775 | "grammar : grammar include '\\n'", | |||
776 | "grammar : grammar varset '\\n'", | |||
777 | "grammar : grammar bounce '\\n'", | |||
778 | "grammar : grammar admd '\\n'", | |||
779 | "grammar : grammar ca '\\n'", | |||
780 | "grammar : grammar mda '\\n'", | |||
781 | "grammar : grammar mta '\\n'", | |||
782 | "grammar : grammar pki '\\n'", | |||
783 | "grammar : grammar proc '\\n'", | |||
784 | "grammar : grammar queue '\\n'", | |||
785 | "grammar : grammar scheduler '\\n'", | |||
786 | "grammar : grammar smtp '\\n'", | |||
787 | "grammar : grammar srs '\\n'", | |||
788 | "grammar : grammar listen '\\n'", | |||
789 | "grammar : grammar table '\\n'", | |||
790 | "grammar : grammar dispatcher '\\n'", | |||
791 | "grammar : grammar match '\\n'", | |||
792 | "grammar : grammar filter '\\n'", | |||
793 | "grammar : grammar error '\\n'", | |||
794 | "include : INCLUDE STRING", | |||
795 | "varset : STRING '=' STRING", | |||
796 | "comma : ','", | |||
797 | "comma : nl", | |||
798 | "comma :", | |||
799 | "optnl : '\\n' optnl", | |||
800 | "optnl :", | |||
801 | "nl : '\\n' optnl", | |||
802 | "negation : '!'", | |||
803 | "negation :", | |||
804 | "assign : '='", | |||
805 | "assign : ARROW", | |||
806 | "keyval : STRING assign STRING", | |||
807 | "keyval_list : keyval", | |||
808 | "keyval_list : keyval comma keyval_list", | |||
809 | "stringel : STRING", | |||
810 | "string_list : stringel", | |||
811 | "string_list : stringel comma string_list", | |||
812 | "tableval_list : string_list", | |||
813 | "tableval_list : keyval_list", | |||
814 | "$$1 :", | |||
815 | "bounce : BOUNCE WARN_INTERVAL $$1 bouncedelays", | |||
816 | "admd : ADMD STRING", | |||
817 | "$$2 :", | |||
818 | "ca : CA STRING $$2 ca_params", | |||
819 | "ca_params_opt : CERT STRING", | |||
820 | "ca_params : ca_params_opt", | |||
821 | "mda : MDA LIMIT limits_mda", | |||
822 | "mda : MDA WRAPPER STRING STRING", | |||
823 | "mta : MTA MAX_DEFERRED NUMBER", | |||
824 | "$$3 :", | |||
825 | "mta : MTA LIMIT FOR DOMAIN STRING $$3 limits_mta", | |||
826 | "$$4 :", | |||
827 | "mta : MTA LIMIT $$4 limits_mta", | |||
828 | "$$5 :", | |||
829 | "pki : PKI STRING $$5 pki_params", | |||
830 | "pki_params_opt : CERT STRING", | |||
831 | "pki_params_opt : KEY STRING", | |||
832 | "pki_params_opt : DHE STRING", | |||
833 | "pki_params : pki_params_opt pki_params", | |||
834 | "pki_params :", | |||
835 | "$$6 :", | |||
836 | "proc : PROC STRING STRING $$6 proc_params", | |||
837 | "proc_params_opt : USER STRING", | |||
838 | "proc_params_opt : GROUP STRING", | |||
839 | "proc_params_opt : CHROOT STRING", | |||
840 | "proc_params : proc_params_opt proc_params", | |||
841 | "proc_params :", | |||
842 | "queue : QUEUE COMPRESSION", | |||
843 | "queue : QUEUE ENCRYPTION", | |||
844 | "queue : QUEUE ENCRYPTION STRING", | |||
845 | "queue : QUEUE TTL STRING", | |||
846 | "scheduler : SCHEDULER LIMIT limits_scheduler", | |||
847 | "smtp : SMTP LIMIT limits_smtp", | |||
848 | "smtp : SMTP CIPHERS STRING", | |||
849 | "smtp : SMTP MAX_MESSAGE_SIZE size", | |||
850 | "smtp : SMTP SUB_ADDR_DELIM STRING", | |||
851 | "srs : SRS KEY STRING", | |||
852 | "srs : SRS KEY BACKUP STRING", | |||
853 | "srs : SRS TTL STRING", | |||
854 | "dispatcher_local_option : USER STRING", | |||
855 | "dispatcher_local_option : ALIAS tables", | |||
856 | "dispatcher_local_option : VIRTUAL tables", | |||
857 | "dispatcher_local_option : USERBASE tables", | |||
858 | "dispatcher_local_option : WRAPPER STRING", | |||
859 | "dispatcher_local_options : dispatcher_local_option dispatcher_local_options", | |||
860 | "dispatcher_local_options :", | |||
861 | "$$7 :", | |||
862 | "dispatcher_local : MBOX $$7 dispatcher_local_options", | |||
863 | "$$8 :", | |||
864 | "dispatcher_local : MAILDIR $$8 dispatcher_local_options", | |||
865 | "$$9 :", | |||
866 | "dispatcher_local : MAILDIR JUNK $$9 dispatcher_local_options", | |||
867 | "$$10 :", | |||
868 | "dispatcher_local : MAILDIR STRING $$10 dispatcher_local_options", | |||
869 | "$$11 :", | |||
870 | "dispatcher_local : MAILDIR STRING JUNK $$11 dispatcher_local_options", | |||
871 | "$$12 :", | |||
872 | "dispatcher_local : LMTP STRING $$12 dispatcher_local_options", | |||
873 | "$$13 :", | |||
874 | "dispatcher_local : LMTP STRING RCPT_TO $$13 dispatcher_local_options", | |||
875 | "$$14 :", | |||
876 | "dispatcher_local : MDA STRING $$14 dispatcher_local_options", | |||
877 | "$$15 :", | |||
878 | "dispatcher_local : FORWARD_ONLY $$15 dispatcher_local_options", | |||
879 | "$$16 :", | |||
880 | "dispatcher_local : EXPAND_ONLY $$16 dispatcher_local_options", | |||
881 | "dispatcher_remote_option : HELO STRING", | |||
882 | "dispatcher_remote_option : HELO_SRC tables", | |||
883 | "dispatcher_remote_option : PKI STRING", | |||
884 | "dispatcher_remote_option : CA STRING", | |||
885 | "dispatcher_remote_option : CIPHERS STRING", | |||
886 | "dispatcher_remote_option : PROTOCOLS STRING", | |||
887 | "dispatcher_remote_option : SRC tables", | |||
888 | "dispatcher_remote_option : MAIL_FROM STRING", | |||
889 | "dispatcher_remote_option : BACKUP MX STRING", | |||
890 | "dispatcher_remote_option : BACKUP", | |||
891 | "dispatcher_remote_option : HOST tables", | |||
892 | "dispatcher_remote_option : DOMAIN tables", | |||
893 | "dispatcher_remote_option : TLS", | |||
894 | "dispatcher_remote_option : TLS NO_VERIFY", | |||
895 | "dispatcher_remote_option : AUTH tables", | |||
896 | "dispatcher_remote_option : FILTER STRING", | |||
897 | "$$17 :", | |||
898 | "dispatcher_remote_option : FILTER $$17 '{' filter_list '}'", | |||
899 | "dispatcher_remote_option : SRS", | |||
900 | "dispatcher_remote_options : dispatcher_remote_option dispatcher_remote_options", | |||
901 | "dispatcher_remote_options :", | |||
902 | "dispatcher_remote : RELAY dispatcher_remote_options", | |||
903 | "dispatcher_type : dispatcher_local", | |||
904 | "dispatcher_type : dispatcher_remote", | |||
905 | "dispatcher_option : TTL STRING", | |||
906 | "dispatcher_options : dispatcher_option dispatcher_options", | |||
907 | "dispatcher_options :", | |||
908 | "$$18 :", | |||
909 | "dispatcher : ACTION STRING $$18 dispatcher_type dispatcher_options", | |||
910 | "match_option : negation TAG tables", | |||
911 | "match_option : negation TAG REGEX tables", | |||
912 | "match_option : negation HELO tables", | |||
913 | "match_option : negation HELO REGEX tables", | |||
914 | "match_option : negation TLS", | |||
915 | "match_option : negation AUTH", | |||
916 | "match_option : negation AUTH tables", | |||
917 | "match_option : negation AUTH REGEX tables", | |||
918 | "match_option : negation MAIL_FROM tables", | |||
919 | "match_option : negation MAIL_FROM REGEX tables", | |||
920 | "match_option : negation RCPT_TO tables", | |||
921 | "match_option : negation RCPT_TO REGEX tables", | |||
922 | "match_option : negation FROM SOCKET", | |||
923 | "match_option : negation FROM LOCAL", | |||
924 | "match_option : negation FROM ANY", | |||
925 | "match_option : negation FROM SRC tables", | |||
926 | "match_option : negation FROM SRC REGEX tables", | |||
927 | "match_option : negation FROM RDNS", | |||
928 | "match_option : negation FROM RDNS tables", | |||
929 | "match_option : negation FROM RDNS REGEX tables", | |||
930 | "match_option : negation FROM AUTH", | |||
931 | "match_option : negation FROM AUTH tables", | |||
932 | "match_option : negation FROM AUTH REGEX tables", | |||
933 | "match_option : negation FROM MAIL_FROM tables", | |||
934 | "match_option : negation FROM MAIL_FROM REGEX tables", | |||
935 | "match_option : negation FOR LOCAL", | |||
936 | "match_option : negation FOR ANY", | |||
937 | "match_option : negation FOR DOMAIN tables", | |||
938 | "match_option : negation FOR DOMAIN REGEX tables", | |||
939 | "match_option : negation FOR RCPT_TO tables", | |||
940 | "match_option : negation FOR RCPT_TO REGEX tables", | |||
941 | "match_options : match_option match_options", | |||
942 | "match_options :", | |||
943 | "match_dispatcher : STRING", | |||
944 | "action : REJECT", | |||
945 | "action : ACTION match_dispatcher", | |||
946 | "$$19 :", | |||
947 | "match : MATCH $$19 match_options action", | |||
948 | "filter_action_builtin : filter_action_builtin_nojunk", | |||
949 | "filter_action_builtin : JUNK", | |||
950 | "filter_action_builtin : BYPASS", | |||
951 | "filter_action_builtin_nojunk : REJECT STRING", | |||
952 | "filter_action_builtin_nojunk : DISCONNECT STRING", | |||
953 | "filter_action_builtin_nojunk : REWRITE STRING", | |||
954 | "filter_action_builtin_nojunk : REPORT STRING", | |||
955 | "filter_phase_check_fcrdns : negation FCRDNS", | |||
956 | "filter_phase_check_rdns : negation RDNS", | |||
957 | "filter_phase_check_rdns_table : negation RDNS tables", | |||
958 | "filter_phase_check_rdns_regex : negation RDNS REGEX tables", | |||
959 | "filter_phase_check_src_table : negation SRC tables", | |||
960 | "filter_phase_check_src_regex : negation SRC REGEX tables", | |||
961 | "filter_phase_check_helo_table : negation HELO tables", | |||
962 | "filter_phase_check_helo_regex : negation HELO REGEX tables", | |||
963 | "filter_phase_check_auth : negation AUTH", | |||
964 | "filter_phase_check_auth_table : negation AUTH tables", | |||
965 | "filter_phase_check_auth_regex : negation AUTH REGEX tables", | |||
966 | "filter_phase_check_mail_from_table : negation MAIL_FROM tables", | |||
967 | "filter_phase_check_mail_from_regex : negation MAIL_FROM REGEX tables", | |||
968 | "filter_phase_check_rcpt_to_table : negation RCPT_TO tables", | |||
969 | "filter_phase_check_rcpt_to_regex : negation RCPT_TO REGEX tables", | |||
970 | "filter_phase_global_options : filter_phase_check_fcrdns", | |||
971 | "filter_phase_global_options : filter_phase_check_rdns", | |||
972 | "filter_phase_global_options : filter_phase_check_rdns_regex", | |||
973 | "filter_phase_global_options : filter_phase_check_rdns_table", | |||
974 | "filter_phase_global_options : filter_phase_check_src_regex", | |||
975 | "filter_phase_global_options : filter_phase_check_src_table", | |||
976 | "filter_phase_connect_options : filter_phase_global_options", | |||
977 | "filter_phase_helo_options : filter_phase_check_helo_table", | |||
978 | "filter_phase_helo_options : filter_phase_check_helo_regex", | |||
979 | "filter_phase_helo_options : filter_phase_global_options", | |||
980 | "filter_phase_auth_options : filter_phase_check_helo_table", | |||
981 | "filter_phase_auth_options : filter_phase_check_helo_regex", | |||
982 | "filter_phase_auth_options : filter_phase_check_auth", | |||
983 | "filter_phase_auth_options : filter_phase_check_auth_table", | |||
984 | "filter_phase_auth_options : filter_phase_check_auth_regex", | |||
985 | "filter_phase_auth_options : filter_phase_global_options", | |||
986 | "filter_phase_mail_from_options : filter_phase_check_helo_table", | |||
987 | "filter_phase_mail_from_options : filter_phase_check_helo_regex", | |||
988 | "filter_phase_mail_from_options : filter_phase_check_auth", | |||
989 | "filter_phase_mail_from_options : filter_phase_check_auth_table", | |||
990 | "filter_phase_mail_from_options : filter_phase_check_auth_regex", | |||
991 | "filter_phase_mail_from_options : filter_phase_check_mail_from_table", | |||
992 | "filter_phase_mail_from_options : filter_phase_check_mail_from_regex", | |||
993 | "filter_phase_mail_from_options : filter_phase_global_options", | |||
994 | "filter_phase_rcpt_to_options : filter_phase_check_helo_table", | |||
995 | "filter_phase_rcpt_to_options : filter_phase_check_helo_regex", | |||
996 | "filter_phase_rcpt_to_options : filter_phase_check_auth", | |||
997 | "filter_phase_rcpt_to_options : filter_phase_check_auth_table", | |||
998 | "filter_phase_rcpt_to_options : filter_phase_check_auth_regex", | |||
999 | "filter_phase_rcpt_to_options : filter_phase_check_mail_from_table", | |||
1000 | "filter_phase_rcpt_to_options : filter_phase_check_mail_from_regex", | |||
1001 | "filter_phase_rcpt_to_options : filter_phase_check_rcpt_to_table", | |||
1002 | "filter_phase_rcpt_to_options : filter_phase_check_rcpt_to_regex", | |||
1003 | "filter_phase_rcpt_to_options : filter_phase_global_options", | |||
1004 | "filter_phase_data_options : filter_phase_check_helo_table", | |||
1005 | "filter_phase_data_options : filter_phase_check_helo_regex", | |||
1006 | "filter_phase_data_options : filter_phase_check_auth", | |||
1007 | "filter_phase_data_options : filter_phase_check_auth_table", | |||
1008 | "filter_phase_data_options : filter_phase_check_auth_regex", | |||
1009 | "filter_phase_data_options : filter_phase_check_mail_from_table", | |||
1010 | "filter_phase_data_options : filter_phase_check_mail_from_regex", | |||
1011 | "filter_phase_data_options : filter_phase_global_options", | |||
1012 | "filter_phase_commit_options : filter_phase_check_helo_table", | |||
1013 | "filter_phase_commit_options : filter_phase_check_helo_regex", | |||
1014 | "filter_phase_commit_options : filter_phase_check_auth", | |||
1015 | "filter_phase_commit_options : filter_phase_check_auth_table", | |||
1016 | "filter_phase_commit_options : filter_phase_check_auth_regex", | |||
1017 | "filter_phase_commit_options : filter_phase_check_mail_from_table", | |||
1018 | "filter_phase_commit_options : filter_phase_check_mail_from_regex", | |||
1019 | "filter_phase_commit_options : filter_phase_global_options", | |||
1020 | "$$20 :", | |||
1021 | "filter_phase_connect : CONNECT $$20 MATCH filter_phase_connect_options filter_action_builtin", | |||
1022 | "$$21 :", | |||
1023 | "filter_phase_helo : HELO $$21 MATCH filter_phase_helo_options filter_action_builtin", | |||
1024 | "$$22 :", | |||
1025 | "filter_phase_ehlo : EHLO $$22 MATCH filter_phase_helo_options filter_action_builtin", | |||
1026 | "$$23 :", | |||
1027 | "filter_phase_auth : AUTH $$23 MATCH filter_phase_auth_options filter_action_builtin", | |||
1028 | "$$24 :", | |||
1029 | "filter_phase_mail_from : MAIL_FROM $$24 MATCH filter_phase_mail_from_options filter_action_builtin", | |||
1030 | "$$25 :", | |||
1031 | "filter_phase_rcpt_to : RCPT_TO $$25 MATCH filter_phase_rcpt_to_options filter_action_builtin", | |||
1032 | "$$26 :", | |||
1033 | "filter_phase_data : DATA $$26 MATCH filter_phase_data_options filter_action_builtin", | |||
1034 | "$$27 :", | |||
1035 | "filter_phase_commit : COMMIT $$27 MATCH filter_phase_commit_options filter_action_builtin_nojunk", | |||
1036 | "filter_phase : filter_phase_connect", | |||
1037 | "filter_phase : filter_phase_helo", | |||
1038 | "filter_phase : filter_phase_ehlo", | |||
1039 | "filter_phase : filter_phase_auth", | |||
1040 | "filter_phase : filter_phase_mail_from", | |||
1041 | "filter_phase : filter_phase_rcpt_to", | |||
1042 | "filter_phase : filter_phase_data", | |||
1043 | "filter_phase : filter_phase_commit", | |||
1044 | "filterel : STRING", | |||
1045 | "filter_list : filterel", | |||
1046 | "filter_list : filterel comma filter_list", | |||
1047 | "filter : FILTER STRING PROC STRING", | |||
1048 | "$$28 :", | |||
1049 | "filter : FILTER STRING PROC_EXEC STRING $$28 proc_params", | |||
1050 | "$$29 :", | |||
1051 | "filter : FILTER STRING PHASE $$29 filter_phase", | |||
1052 | "$$30 :", | |||
1053 | "filter : FILTER STRING CHAIN $$30 '{' filter_list '}'", | |||
1054 | "size : NUMBER", | |||
1055 | "size : STRING", | |||
1056 | "bouncedelay : STRING", | |||
1057 | "bouncedelays : bouncedelays ',' bouncedelay", | |||
1058 | "bouncedelays : bouncedelay", | |||
1059 | "opt_limit_mda : STRING NUMBER", | |||
1060 | "limits_smtp : opt_limit_smtp limits_smtp", | |||
1061 | "limits_smtp :", | |||
1062 | "opt_limit_smtp : STRING NUMBER", | |||
1063 | "limits_mda : opt_limit_mda limits_mda", | |||
1064 | "limits_mda :", | |||
1065 | "opt_limit_mta : INET4", | |||
1066 | "opt_limit_mta : INET6", | |||
1067 | "opt_limit_mta : STRING NUMBER", | |||
1068 | "limits_mta : opt_limit_mta limits_mta", | |||
1069 | "limits_mta :", | |||
1070 | "opt_limit_scheduler : STRING NUMBER", | |||
1071 | "limits_scheduler : opt_limit_scheduler limits_scheduler", | |||
1072 | "limits_scheduler :", | |||
1073 | "opt_sock_listen : FILTER STRING", | |||
1074 | "$$31 :", | |||
1075 | "opt_sock_listen : FILTER $$31 '{' filter_list '}'", | |||
1076 | "opt_sock_listen : MASK_SRC", | |||
1077 | "opt_sock_listen : TAG STRING", | |||
1078 | "opt_if_listen : INET4", | |||
1079 | "opt_if_listen : INET6", | |||
1080 | "opt_if_listen : PORT STRING", | |||
1081 | "opt_if_listen : PORT SMTP", | |||
1082 | "opt_if_listen : PORT SMTPS", | |||
1083 | "opt_if_listen : PORT NUMBER", | |||
1084 | "opt_if_listen : FILTER STRING", | |||
1085 | "$$32 :", | |||
1086 | "opt_if_listen : FILTER $$32 '{' filter_list '}'", | |||
1087 | "opt_if_listen : SMTPS", | |||
1088 | "opt_if_listen : SMTPS VERIFY", | |||
1089 | "opt_if_listen : TLS", | |||
1090 | "opt_if_listen : TLS_REQUIRE", | |||
1091 | "opt_if_listen : TLS_REQUIRE VERIFY", | |||
1092 | "opt_if_listen : CIPHERS STRING", | |||
1093 | "opt_if_listen : PROTOCOLS STRING", | |||
1094 | "opt_if_listen : PKI STRING", | |||
1095 | "opt_if_listen : CA STRING", | |||
1096 | "opt_if_listen : AUTH", | |||
1097 | "opt_if_listen : AUTH_OPTIONAL", | |||
1098 | "opt_if_listen : AUTH tables", | |||
1099 | "opt_if_listen : AUTH_OPTIONAL tables", | |||
1100 | "opt_if_listen : TAG STRING", | |||
1101 | "opt_if_listen : HOSTNAME STRING", | |||
1102 | "opt_if_listen : HOSTNAMES tables", | |||
1103 | "opt_if_listen : MASK_SRC", | |||
1104 | "opt_if_listen : RECEIVEDAUTH", | |||
1105 | "opt_if_listen : NO_DSN", | |||
1106 | "opt_if_listen : PROXY_V2", | |||
1107 | "opt_if_listen : SENDERS tables", | |||
1108 | "opt_if_listen : SENDERS tables MASQUERADE", | |||
1109 | "listener_type : socket_listener", | |||
1110 | "listener_type : if_listener", | |||
1111 | "socket_listener : SOCKET sock_listen", | |||
1112 | "if_listener : STRING if_listen", | |||
1113 | "sock_listen : opt_sock_listen sock_listen", | |||
1114 | "sock_listen :", | |||
1115 | "if_listen : opt_if_listen if_listen", | |||
1116 | "if_listen :", | |||
1117 | "$$33 :", | |||
1118 | "listen : LISTEN $$33 ON listener_type", | |||
1119 | "table : TABLE STRING STRING", | |||
1120 | "$$34 :", | |||
1121 | "table : TABLE STRING $$34 '{' tableval_list '}'", | |||
1122 | "tablenew : STRING", | |||
1123 | "$$35 :", | |||
1124 | "tablenew : '{' $$35 tableval_list '}'", | |||
1125 | "tableref : '<' STRING '>'", | |||
1126 | "tables : tablenew", | |||
1127 | "tables : tableref", | |||
1128 | }; | |||
1129 | #endif | |||
1130 | #ifdef YYSTACKSIZE10000 | |||
1131 | #undef YYMAXDEPTH10000 | |||
1132 | #define YYMAXDEPTH10000 YYSTACKSIZE10000 | |||
1133 | #else | |||
1134 | #ifdef YYMAXDEPTH10000 | |||
1135 | #define YYSTACKSIZE10000 YYMAXDEPTH10000 | |||
1136 | #else | |||
1137 | #define YYSTACKSIZE10000 10000 | |||
1138 | #define YYMAXDEPTH10000 10000 | |||
1139 | #endif | |||
1140 | #endif | |||
1141 | #define YYINITSTACKSIZE200 200 | |||
1142 | /* LINTUSED */ | |||
1143 | int yydebug; | |||
1144 | int yynerrs; | |||
1145 | int yyerrflag; | |||
1146 | int yychar; | |||
1147 | short *yyssp; | |||
1148 | YYSTYPE *yyvsp; | |||
1149 | YYSTYPE yyval; | |||
1150 | YYSTYPE yylval; | |||
1151 | short *yyss; | |||
1152 | short *yysslim; | |||
1153 | YYSTYPE *yyvs; | |||
1154 | unsigned int yystacksize; | |||
1155 | int yyparse(void); | |||
1156 | #line 2608 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
1157 | ||||
1158 | struct keywords { | |||
1159 | const char *k_name; | |||
1160 | int k_val; | |||
1161 | }; | |||
1162 | ||||
1163 | int | |||
1164 | yyerror(const char *fmt, ...) | |||
1165 | { | |||
1166 | va_list ap; | |||
1167 | char *msg; | |||
1168 | ||||
1169 | file->errors++; | |||
1170 | va_start(ap, fmt)__builtin_va_start(ap, fmt); | |||
1171 | if (vasprintf(&msg, fmt, ap) == -1) | |||
1172 | fatalx("yyerror vasprintf"); | |||
1173 | va_end(ap)__builtin_va_end(ap); | |||
1174 | logit(LOG_CRIT2, "%s:%d: %s", file->name, yylval.lineno, msg); | |||
1175 | free(msg); | |||
1176 | return (0); | |||
1177 | } | |||
1178 | ||||
1179 | int | |||
1180 | kw_cmp(const void *k, const void *e) | |||
1181 | { | |||
1182 | return (strcmp(k, ((const struct keywords *)e)->k_name)); | |||
1183 | } | |||
1184 | ||||
1185 | int | |||
1186 | lookup(char *s) | |||
1187 | { | |||
1188 | /* this has to be sorted always */ | |||
1189 | static const struct keywords keywords[] = { | |||
1190 | { "action", ACTION257 }, | |||
1191 | { "admd", ADMD258 }, | |||
1192 | { "alias", ALIAS259 }, | |||
1193 | { "any", ANY260 }, | |||
1194 | { "auth", AUTH262 }, | |||
1195 | { "auth-optional", AUTH_OPTIONAL263 }, | |||
1196 | { "backup", BACKUP264 }, | |||
1197 | { "bounce", BOUNCE265 }, | |||
1198 | { "bypass", BYPASS266 }, | |||
1199 | { "ca", CA267 }, | |||
1200 | { "cert", CERT268 }, | |||
1201 | { "chain", CHAIN269 }, | |||
1202 | { "chroot", CHROOT270 }, | |||
1203 | { "ciphers", CIPHERS271 }, | |||
1204 | { "commit", COMMIT272 }, | |||
1205 | { "compression", COMPRESSION273 }, | |||
1206 | { "connect", CONNECT274 }, | |||
1207 | { "data", DATA275 }, | |||
1208 | { "data-line", DATA_LINE276 }, | |||
1209 | { "dhe", DHE277 }, | |||
1210 | { "disconnect", DISCONNECT278 }, | |||
1211 | { "domain", DOMAIN279 }, | |||
1212 | { "ehlo", EHLO280 }, | |||
1213 | { "encryption", ENCRYPTION282 }, | |||
1214 | { "expand-only", EXPAND_ONLY284 }, | |||
1215 | { "fcrdns", FCRDNS285 }, | |||
1216 | { "filter", FILTER286 }, | |||
1217 | { "for", FOR287 }, | |||
1218 | { "forward-only", FORWARD_ONLY288 }, | |||
1219 | { "from", FROM289 }, | |||
1220 | { "group", GROUP290 }, | |||
1221 | { "helo", HELO291 }, | |||
1222 | { "helo-src", HELO_SRC292 }, | |||
1223 | { "host", HOST293 }, | |||
1224 | { "hostname", HOSTNAME294 }, | |||
1225 | { "hostnames", HOSTNAMES295 }, | |||
1226 | { "include", INCLUDE296 }, | |||
1227 | { "inet4", INET4297 }, | |||
1228 | { "inet6", INET6298 }, | |||
1229 | { "junk", JUNK299 }, | |||
1230 | { "key", KEY300 }, | |||
1231 | { "limit", LIMIT301 }, | |||
1232 | { "listen", LISTEN302 }, | |||
1233 | { "lmtp", LMTP303 }, | |||
1234 | { "local", LOCAL304 }, | |||
1235 | { "mail-from", MAIL_FROM305 }, | |||
1236 | { "maildir", MAILDIR306 }, | |||
1237 | { "mask-src", MASK_SRC307 }, | |||
1238 | { "masquerade", MASQUERADE308 }, | |||
1239 | { "match", MATCH309 }, | |||
1240 | { "max-deferred", MAX_DEFERRED311 }, | |||
1241 | { "max-message-size", MAX_MESSAGE_SIZE310 }, | |||
1242 | { "mbox", MBOX312 }, | |||
1243 | { "mda", MDA313 }, | |||
1244 | { "mta", MTA314 }, | |||
1245 | { "mx", MX315 }, | |||
1246 | { "no-dsn", NO_DSN316 }, | |||
1247 | { "no-verify", NO_VERIFY317 }, | |||
1248 | { "noop", NOOP318 }, | |||
1249 | { "on", ON319 }, | |||
1250 | { "phase", PHASE320 }, | |||
1251 | { "pki", PKI321 }, | |||
1252 | { "port", PORT322 }, | |||
1253 | { "proc", PROC323 }, | |||
1254 | { "proc-exec", PROC_EXEC324 }, | |||
1255 | { "protocols", PROTOCOLS325 }, | |||
1256 | { "proxy-v2", PROXY_V2326 }, | |||
1257 | { "queue", QUEUE327 }, | |||
1258 | { "quit", QUIT328 }, | |||
1259 | { "rcpt-to", RCPT_TO329 }, | |||
1260 | { "rdns", RDNS330 }, | |||
1261 | { "received-auth", RECEIVEDAUTH332 }, | |||
1262 | { "recipient", RECIPIENT331 }, | |||
1263 | { "regex", REGEX333 }, | |||
1264 | { "reject", REJECT335 }, | |||
1265 | { "relay", RELAY334 }, | |||
1266 | { "report", REPORT336 }, | |||
1267 | { "rewrite", REWRITE337 }, | |||
1268 | { "rset", RSET338 }, | |||
1269 | { "scheduler", SCHEDULER339 }, | |||
1270 | { "senders", SENDERS341 }, | |||
1271 | { "smtp", SMTP342 }, | |||
1272 | { "smtp-in", SMTP_IN343 }, | |||
1273 | { "smtp-out", SMTP_OUT344 }, | |||
1274 | { "smtps", SMTPS345 }, | |||
1275 | { "socket", SOCKET346 }, | |||
1276 | { "src", SRC347 }, | |||
1277 | { "srs", SRS348 }, | |||
1278 | { "sub-addr-delim", SUB_ADDR_DELIM349 }, | |||
1279 | { "table", TABLE350 }, | |||
1280 | { "tag", TAG351 }, | |||
1281 | { "tagged", TAGGED352 }, | |||
1282 | { "tls", TLS353 }, | |||
1283 | { "tls-require", TLS_REQUIRE354 }, | |||
1284 | { "ttl", TTL355 }, | |||
1285 | { "user", USER356 }, | |||
1286 | { "userbase", USERBASE357 }, | |||
1287 | { "verify", VERIFY358 }, | |||
1288 | { "virtual", VIRTUAL359 }, | |||
1289 | { "warn-interval", WARN_INTERVAL360 }, | |||
1290 | { "wrapper", WRAPPER361 }, | |||
1291 | }; | |||
1292 | const struct keywords *p; | |||
1293 | ||||
1294 | p = bsearch(s, keywords, sizeof(keywords)/sizeof(keywords[0]), | |||
1295 | sizeof(keywords[0]), kw_cmp); | |||
1296 | ||||
1297 | if (p) | |||
1298 | return (p->k_val); | |||
1299 | else | |||
1300 | return (STRING362); | |||
1301 | } | |||
1302 | ||||
1303 | #define START_EXPAND1 1 | |||
1304 | #define DONE_EXPAND2 2 | |||
1305 | ||||
1306 | static int expanding; | |||
1307 | ||||
1308 | int | |||
1309 | igetc(void) | |||
1310 | { | |||
1311 | int c; | |||
1312 | ||||
1313 | while (1) { | |||
1314 | if (file->ungetpos > 0) | |||
1315 | c = file->ungetbuf[--file->ungetpos]; | |||
1316 | else | |||
1317 | c = getc(file->stream)(!__isthreaded ? (--(file->stream)->_r < 0 ? __srget (file->stream) : (int)(*(file->stream)->_p++)) : (getc )(file->stream)); | |||
1318 | ||||
1319 | if (c == START_EXPAND1) | |||
1320 | expanding = 1; | |||
1321 | else if (c == DONE_EXPAND2) | |||
1322 | expanding = 0; | |||
1323 | else | |||
1324 | break; | |||
1325 | } | |||
1326 | return (c); | |||
1327 | } | |||
1328 | ||||
1329 | int | |||
1330 | lgetc(int quotec) | |||
1331 | { | |||
1332 | int c, next; | |||
1333 | ||||
1334 | if (quotec) { | |||
1335 | if ((c = igetc()) == EOF(-1)) { | |||
1336 | yyerror("reached end of file while parsing " | |||
1337 | "quoted string"); | |||
1338 | if (file == topfile || popfile() == EOF(-1)) | |||
1339 | return (EOF(-1)); | |||
1340 | return (quotec); | |||
1341 | } | |||
1342 | return (c); | |||
1343 | } | |||
1344 | ||||
1345 | while ((c = igetc()) == '\\') { | |||
1346 | next = igetc(); | |||
1347 | if (next != '\n') { | |||
1348 | c = next; | |||
1349 | break; | |||
1350 | } | |||
1351 | yylval.lineno = file->lineno; | |||
1352 | file->lineno++; | |||
1353 | } | |||
1354 | ||||
1355 | if (c == EOF(-1)) { | |||
1356 | /* | |||
1357 | * Fake EOL when hit EOF for the first time. This gets line | |||
1358 | * count right if last line in included file is syntactically | |||
1359 | * invalid and has no newline. | |||
1360 | */ | |||
1361 | if (file->eof_reached == 0) { | |||
1362 | file->eof_reached = 1; | |||
1363 | return ('\n'); | |||
1364 | } | |||
1365 | while (c == EOF(-1)) { | |||
1366 | if (file == topfile || popfile() == EOF(-1)) | |||
1367 | return (EOF(-1)); | |||
1368 | c = igetc(); | |||
1369 | } | |||
1370 | } | |||
1371 | return (c); | |||
1372 | } | |||
1373 | ||||
1374 | void | |||
1375 | lungetc(int c) | |||
1376 | { | |||
1377 | if (c == EOF(-1)) | |||
1378 | return; | |||
1379 | ||||
1380 | if (file->ungetpos >= file->ungetsize) { | |||
1381 | void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); | |||
1382 | if (p == NULL((void *)0)) | |||
1383 | fatal("%s", __func__); | |||
1384 | file->ungetbuf = p; | |||
1385 | file->ungetsize *= 2; | |||
1386 | } | |||
1387 | file->ungetbuf[file->ungetpos++] = c; | |||
1388 | } | |||
1389 | ||||
1390 | int | |||
1391 | findeol(void) | |||
1392 | { | |||
1393 | int c; | |||
1394 | ||||
1395 | /* skip to either EOF or the first real EOL */ | |||
1396 | while (1) { | |||
1397 | c = lgetc(0); | |||
1398 | if (c == '\n') { | |||
1399 | file->lineno++; | |||
1400 | break; | |||
1401 | } | |||
1402 | if (c == EOF(-1)) | |||
1403 | break; | |||
1404 | } | |||
1405 | return (ERROR283); | |||
1406 | } | |||
1407 | ||||
1408 | int | |||
1409 | yylex(void) | |||
1410 | { | |||
1411 | char buf[8096]; | |||
1412 | char *p, *val; | |||
1413 | int quotec, next, c; | |||
1414 | int token; | |||
1415 | ||||
1416 | top: | |||
1417 | p = buf; | |||
1418 | while ((c = lgetc(0)) == ' ' || c == '\t') | |||
1419 | ; /* nothing */ | |||
1420 | ||||
1421 | yylval.lineno = file->lineno; | |||
1422 | if (c == '#') | |||
1423 | while ((c = lgetc(0)) != '\n' && c != EOF(-1)) | |||
1424 | ; /* nothing */ | |||
1425 | if (c == '$' && !expanding) { | |||
1426 | while (1) { | |||
1427 | if ((c = lgetc(0)) == EOF(-1)) | |||
1428 | return (0); | |||
1429 | ||||
1430 | if (p + 1 >= buf + sizeof(buf) - 1) { | |||
1431 | yyerror("string too long"); | |||
1432 | return (findeol()); | |||
1433 | } | |||
1434 | if (isalnum(c) || c == '_') { | |||
1435 | *p++ = c; | |||
1436 | continue; | |||
1437 | } | |||
1438 | *p = '\0'; | |||
1439 | lungetc(c); | |||
1440 | break; | |||
1441 | } | |||
1442 | val = symget(buf); | |||
1443 | if (val == NULL((void *)0)) { | |||
1444 | yyerror("macro '%s' not defined", buf); | |||
1445 | return (findeol()); | |||
1446 | } | |||
1447 | p = val + strlen(val) - 1; | |||
1448 | lungetc(DONE_EXPAND2); | |||
1449 | while (p >= val) { | |||
1450 | lungetc((unsigned char)*p); | |||
1451 | p--; | |||
1452 | } | |||
1453 | lungetc(START_EXPAND1); | |||
1454 | goto top; | |||
1455 | } | |||
1456 | ||||
1457 | switch (c) { | |||
1458 | case '\'': | |||
1459 | case '"': | |||
1460 | quotec = c; | |||
1461 | while (1) { | |||
1462 | if ((c = lgetc(quotec)) == EOF(-1)) | |||
1463 | return (0); | |||
1464 | if (c == '\n') { | |||
1465 | file->lineno++; | |||
1466 | continue; | |||
1467 | } else if (c == '\\') { | |||
1468 | if ((next = lgetc(quotec)) == EOF(-1)) | |||
1469 | return (0); | |||
1470 | if (next == quotec || next == ' ' || | |||
1471 | next == '\t') | |||
1472 | c = next; | |||
1473 | else if (next == '\n') { | |||
1474 | file->lineno++; | |||
1475 | continue; | |||
1476 | } else | |||
1477 | lungetc(next); | |||
1478 | } else if (c == quotec) { | |||
1479 | *p = '\0'; | |||
1480 | break; | |||
1481 | } else if (c == '\0') { | |||
1482 | yyerror("syntax error"); | |||
1483 | return (findeol()); | |||
1484 | } | |||
1485 | if (p + 1 >= buf + sizeof(buf) - 1) { | |||
1486 | yyerror("string too long"); | |||
1487 | return (findeol()); | |||
1488 | } | |||
1489 | *p++ = c; | |||
1490 | } | |||
1491 | yylval.v.string = strdup(buf); | |||
1492 | if (yylval.v.string == NULL((void *)0)) | |||
1493 | fatal("%s", __func__); | |||
1494 | return (STRING362); | |||
1495 | } | |||
1496 | ||||
1497 | #define allowed_to_end_number(x)(isspace(x) || x == ')' || x ==',' || x == '/' || x == '}' || x == '=') \ | |||
1498 | (isspace(x) || x == ')' || x ==',' || x == '/' || x == '}' || x == '=') | |||
1499 | ||||
1500 | if (c == '-' || isdigit(c)) { | |||
1501 | do { | |||
1502 | *p++ = c; | |||
1503 | if ((size_t)(p-buf) >= sizeof(buf)) { | |||
1504 | yyerror("string too long"); | |||
1505 | return (findeol()); | |||
1506 | } | |||
1507 | } while ((c = lgetc(0)) != EOF(-1) && isdigit(c)); | |||
1508 | lungetc(c); | |||
1509 | if (p == buf + 1 && buf[0] == '-') | |||
1510 | goto nodigits; | |||
1511 | if (c == EOF(-1) || allowed_to_end_number(c)(isspace(c) || c == ')' || c ==',' || c == '/' || c == '}' || c == '=')) { | |||
1512 | const char *errstr = NULL((void *)0); | |||
1513 | ||||
1514 | *p = '\0'; | |||
1515 | yylval.v.number = strtonum(buf, LLONG_MIN(-9223372036854775807LL -1LL), | |||
1516 | LLONG_MAX9223372036854775807LL, &errstr); | |||
1517 | if (errstr) { | |||
1518 | yyerror("\"%s\" invalid number: %s", | |||
1519 | buf, errstr); | |||
1520 | return (findeol()); | |||
1521 | } | |||
1522 | return (NUMBER363); | |||
1523 | } else { | |||
1524 | nodigits: | |||
1525 | while (p > buf + 1) | |||
1526 | lungetc((unsigned char)*--p); | |||
1527 | c = (unsigned char)*--p; | |||
1528 | if (c == '-') | |||
1529 | return (c); | |||
1530 | } | |||
1531 | } | |||
1532 | ||||
1533 | if (c == '=') { | |||
1534 | if ((c = lgetc(0)) != EOF(-1) && c == '>') | |||
1535 | return (ARROW261); | |||
1536 | lungetc(c); | |||
1537 | c = '='; | |||
1538 | } | |||
1539 | ||||
1540 | #define allowed_in_string(x)(isalnum(x) || (ispunct(x) && x != '(' && x != ')' && x != '{' && x != '}' && x != '<' && x != '>' && x != '!' && x != '=' && x != '#' && x != ',')) \ | |||
1541 | (isalnum(x) || (ispunct(x) && x != '(' && x != ')' && \ | |||
1542 | x != '{' && x != '}' && x != '<' && x != '>' && \ | |||
1543 | x != '!' && x != '=' && x != '#' && \ | |||
1544 | x != ',')) | |||
1545 | ||||
1546 | if (isalnum(c) || c == ':' || c == '_') { | |||
1547 | do { | |||
1548 | *p++ = c; | |||
1549 | if ((size_t)(p-buf) >= sizeof(buf)) { | |||
1550 | yyerror("string too long"); | |||
1551 | return (findeol()); | |||
1552 | } | |||
1553 | } while ((c = lgetc(0)) != EOF(-1) && (allowed_in_string(c)(isalnum(c) || (ispunct(c) && c != '(' && c != ')' && c != '{' && c != '}' && c != '<' && c != '>' && c != '!' && c != '=' && c != '#' && c != ',')))); | |||
1554 | lungetc(c); | |||
1555 | *p = '\0'; | |||
1556 | if ((token = lookup(buf)) == STRING362) | |||
1557 | if ((yylval.v.string = strdup(buf)) == NULL((void *)0)) | |||
1558 | fatal("%s", __func__); | |||
1559 | return (token); | |||
1560 | } | |||
1561 | if (c == '\n') { | |||
1562 | yylval.lineno = file->lineno; | |||
1563 | file->lineno++; | |||
1564 | } | |||
1565 | if (c == EOF(-1)) | |||
1566 | return (0); | |||
1567 | return (c); | |||
1568 | } | |||
1569 | ||||
1570 | int | |||
1571 | check_file_secrecy(int fd, const char *fname) | |||
1572 | { | |||
1573 | struct stat st; | |||
1574 | ||||
1575 | if (fstat(fd, &st)) { | |||
1576 | log_warn("warn: cannot stat %s", fname); | |||
1577 | return (-1); | |||
1578 | } | |||
1579 | if (st.st_uid != 0 && st.st_uid != getuid()) { | |||
1580 | log_warnx("warn: %s: owner not root or current user", fname); | |||
1581 | return (-1); | |||
1582 | } | |||
1583 | if (st.st_mode & (S_IWGRP0000020 | S_IXGRP0000010 | S_IRWXO0000007)) { | |||
1584 | log_warnx("warn: %s: group/world readable/writeable", fname); | |||
1585 | return (-1); | |||
1586 | } | |||
1587 | return (0); | |||
1588 | } | |||
1589 | ||||
1590 | struct file * | |||
1591 | pushfile(const char *name, int secret) | |||
1592 | { | |||
1593 | struct file *nfile; | |||
1594 | ||||
1595 | if ((nfile = calloc(1, sizeof(struct file))) == NULL((void *)0)) { | |||
1596 | log_warn("%s", __func__); | |||
1597 | return (NULL((void *)0)); | |||
1598 | } | |||
1599 | if ((nfile->name = strdup(name)) == NULL((void *)0)) { | |||
1600 | log_warn("%s", __func__); | |||
1601 | free(nfile); | |||
1602 | return (NULL((void *)0)); | |||
1603 | } | |||
1604 | if ((nfile->stream = fopen(nfile->name, "r")) == NULL((void *)0)) { | |||
1605 | log_warn("%s: %s", __func__, nfile->name); | |||
1606 | free(nfile->name); | |||
1607 | free(nfile); | |||
1608 | return (NULL((void *)0)); | |||
1609 | } else if (secret && | |||
1610 | check_file_secrecy(fileno(nfile->stream)(!__isthreaded ? ((nfile->stream)->_file) : (fileno)(nfile ->stream)), nfile->name)) { | |||
1611 | fclose(nfile->stream); | |||
1612 | free(nfile->name); | |||
1613 | free(nfile); | |||
1614 | return (NULL((void *)0)); | |||
1615 | } | |||
1616 | nfile->lineno = TAILQ_EMPTY(&files)(((&files)->tqh_first) == ((void *)0)) ? 1 : 0; | |||
1617 | nfile->ungetsize = 16; | |||
1618 | nfile->ungetbuf = malloc(nfile->ungetsize); | |||
1619 | if (nfile->ungetbuf == NULL((void *)0)) { | |||
1620 | log_warn("%s", __func__); | |||
1621 | fclose(nfile->stream); | |||
1622 | free(nfile->name); | |||
1623 | free(nfile); | |||
1624 | return (NULL((void *)0)); | |||
1625 | } | |||
1626 | TAILQ_INSERT_TAIL(&files, nfile, entry)do { (nfile)->entry.tqe_next = ((void *)0); (nfile)->entry .tqe_prev = (&files)->tqh_last; *(&files)->tqh_last = (nfile); (&files)->tqh_last = &(nfile)->entry .tqe_next; } while (0); | |||
1627 | return (nfile); | |||
1628 | } | |||
1629 | ||||
1630 | int | |||
1631 | popfile(void) | |||
1632 | { | |||
1633 | struct file *prev; | |||
1634 | ||||
1635 | if ((prev = TAILQ_PREV(file, files, entry)(*(((struct files *)((file)->entry.tqe_prev))->tqh_last ))) != NULL((void *)0)) | |||
1636 | prev->errors += file->errors; | |||
1637 | ||||
1638 | TAILQ_REMOVE(&files, file, entry)do { if (((file)->entry.tqe_next) != ((void *)0)) (file)-> entry.tqe_next->entry.tqe_prev = (file)->entry.tqe_prev ; else (&files)->tqh_last = (file)->entry.tqe_prev; *(file)->entry.tqe_prev = (file)->entry.tqe_next; ; ; } while (0); | |||
1639 | fclose(file->stream); | |||
1640 | free(file->name); | |||
1641 | free(file->ungetbuf); | |||
1642 | free(file); | |||
1643 | file = prev; | |||
1644 | return (file ? 0 : EOF(-1)); | |||
1645 | } | |||
1646 | ||||
1647 | int | |||
1648 | parse_config(struct smtpd *x_conf, const char *filename, int opts) | |||
1649 | { | |||
1650 | struct sym *sym, *next; | |||
1651 | ||||
1652 | conf = x_conf; | |||
1653 | errors = 0; | |||
1654 | ||||
1655 | if ((file = pushfile(filename, 0)) == NULL((void *)0)) { | |||
1656 | purge_config(PURGE_EVERYTHING0xff); | |||
1657 | return (-1); | |||
1658 | } | |||
1659 | topfile = file; | |||
1660 | ||||
1661 | /* | |||
1662 | * parse configuration | |||
1663 | */ | |||
1664 | setservent(1); | |||
1665 | yyparse(); | |||
1666 | errors = file->errors; | |||
1667 | popfile(); | |||
1668 | endservent(); | |||
1669 | ||||
1670 | /* If the socket listener was not configured, create a default one. */ | |||
1671 | if (!conf->sc_sock_listener) { | |||
1672 | memset(&listen_opts, 0, sizeof listen_opts); | |||
1673 | create_sock_listener(&listen_opts); | |||
1674 | } | |||
1675 | ||||
1676 | /* Free macros and check which have not been used. */ | |||
1677 | TAILQ_FOREACH_SAFE(sym, &symhead, entry, next)for ((sym) = ((&symhead)->tqh_first); (sym) != ((void * )0) && ((next) = ((sym)->entry.tqe_next), 1); (sym ) = (next)) { | |||
1678 | if ((conf->sc_opts & SMTPD_OPT_VERBOSE0x00000001) && !sym->used) | |||
1679 | fprintf(stderr(&__sF[2]), "warning: macro '%s' not " | |||
1680 | "used\n", sym->nam); | |||
1681 | if (!sym->persist) { | |||
1682 | free(sym->nam); | |||
1683 | free(sym->val); | |||
1684 | TAILQ_REMOVE(&symhead, sym, entry)do { if (((sym)->entry.tqe_next) != ((void *)0)) (sym)-> entry.tqe_next->entry.tqe_prev = (sym)->entry.tqe_prev; else (&symhead)->tqh_last = (sym)->entry.tqe_prev; *(sym)->entry.tqe_prev = (sym)->entry.tqe_next; ; ; } while (0); | |||
1685 | free(sym); | |||
1686 | } | |||
1687 | } | |||
1688 | ||||
1689 | if (TAILQ_EMPTY(conf->sc_rules)(((conf->sc_rules)->tqh_first) == ((void *)0))) { | |||
1690 | log_warnx("warn: no rules, nothing to do"); | |||
1691 | errors++; | |||
1692 | } | |||
1693 | ||||
1694 | if (errors) { | |||
1695 | purge_config(PURGE_EVERYTHING0xff); | |||
1696 | return (-1); | |||
1697 | } | |||
1698 | ||||
1699 | return (0); | |||
1700 | } | |||
1701 | ||||
1702 | int | |||
1703 | symset(const char *nam, const char *val, int persist) | |||
1704 | { | |||
1705 | struct sym *sym; | |||
1706 | ||||
1707 | TAILQ_FOREACH(sym, &symhead, entry)for((sym) = ((&symhead)->tqh_first); (sym) != ((void * )0); (sym) = ((sym)->entry.tqe_next)) { | |||
1708 | if (strcmp(nam, sym->nam) == 0) | |||
1709 | break; | |||
1710 | } | |||
1711 | ||||
1712 | if (sym != NULL((void *)0)) { | |||
1713 | if (sym->persist == 1) | |||
1714 | return (0); | |||
1715 | else { | |||
1716 | free(sym->nam); | |||
1717 | free(sym->val); | |||
1718 | TAILQ_REMOVE(&symhead, sym, entry)do { if (((sym)->entry.tqe_next) != ((void *)0)) (sym)-> entry.tqe_next->entry.tqe_prev = (sym)->entry.tqe_prev; else (&symhead)->tqh_last = (sym)->entry.tqe_prev; *(sym)->entry.tqe_prev = (sym)->entry.tqe_next; ; ; } while (0); | |||
1719 | free(sym); | |||
1720 | } | |||
1721 | } | |||
1722 | if ((sym = calloc(1, sizeof(*sym))) == NULL((void *)0)) | |||
1723 | return (-1); | |||
1724 | ||||
1725 | sym->nam = strdup(nam); | |||
1726 | if (sym->nam == NULL((void *)0)) { | |||
1727 | free(sym); | |||
1728 | return (-1); | |||
1729 | } | |||
1730 | sym->val = strdup(val); | |||
1731 | if (sym->val == NULL((void *)0)) { | |||
1732 | free(sym->nam); | |||
1733 | free(sym); | |||
1734 | return (-1); | |||
1735 | } | |||
1736 | sym->used = 0; | |||
1737 | sym->persist = persist; | |||
1738 | TAILQ_INSERT_TAIL(&symhead, sym, entry)do { (sym)->entry.tqe_next = ((void *)0); (sym)->entry. tqe_prev = (&symhead)->tqh_last; *(&symhead)->tqh_last = (sym); (&symhead)->tqh_last = &(sym)->entry. tqe_next; } while (0); | |||
1739 | return (0); | |||
1740 | } | |||
1741 | ||||
1742 | int | |||
1743 | cmdline_symset(char *s) | |||
1744 | { | |||
1745 | char *sym, *val; | |||
1746 | int ret; | |||
1747 | ||||
1748 | if ((val = strrchr(s, '=')) == NULL((void *)0)) | |||
1749 | return (-1); | |||
1750 | sym = strndup(s, val - s); | |||
1751 | if (sym == NULL((void *)0)) | |||
1752 | fatalx("%s: strndup", __func__); | |||
1753 | ret = symset(sym, val + 1, 1); | |||
1754 | free(sym); | |||
1755 | ||||
1756 | return (ret); | |||
1757 | } | |||
1758 | ||||
1759 | char * | |||
1760 | symget(const char *nam) | |||
1761 | { | |||
1762 | struct sym *sym; | |||
1763 | ||||
1764 | TAILQ_FOREACH(sym, &symhead, entry)for((sym) = ((&symhead)->tqh_first); (sym) != ((void * )0); (sym) = ((sym)->entry.tqe_next)) { | |||
1765 | if (strcmp(nam, sym->nam) == 0) { | |||
1766 | sym->used = 1; | |||
1767 | return (sym->val); | |||
1768 | } | |||
1769 | } | |||
1770 | return (NULL((void *)0)); | |||
1771 | } | |||
1772 | ||||
1773 | static void | |||
1774 | create_sock_listener(struct listen_opts *lo) | |||
1775 | { | |||
1776 | struct listener *l = xcalloc(1, sizeof(*l)); | |||
1777 | lo->hostname = conf->sc_hostname; | |||
1778 | l->ss.ss_family = AF_LOCAL1; | |||
1779 | l->ss.ss_len = sizeof(struct sockaddr *); | |||
1780 | l->local = 1; | |||
1781 | conf->sc_sock_listener = l; | |||
1782 | config_listener(l, lo); | |||
1783 | } | |||
1784 | ||||
1785 | static void | |||
1786 | create_if_listener(struct listen_opts *lo) | |||
1787 | { | |||
1788 | uint16_t flags; | |||
1789 | ||||
1790 | if (lo->port != 0 && lo->ssl == F_SSL(0x01 | 0x02)) | |||
1791 | fatalx("invalid listen option: tls/smtps on same port"); | |||
1792 | ||||
1793 | if (lo->auth != 0 && !lo->ssl) | |||
1794 | fatalx("invalid listen option: auth requires tls/smtps"); | |||
1795 | ||||
1796 | if (lo->pkicount && !lo->ssl) | |||
1797 | fatalx("invalid listen option: pki requires tls/smtps"); | |||
1798 | if (lo->pkicount == 0 && lo->ssl) | |||
1799 | fatalx("invalid listen option: pki required for tls/smtps"); | |||
1800 | ||||
1801 | flags = lo->flags; | |||
1802 | ||||
1803 | if (lo->port) { | |||
1804 | lo->flags = lo->ssl|lo->auth|flags; | |||
1805 | lo->port = htons(lo->port)(__uint16_t)(__builtin_constant_p(lo->port) ? (__uint16_t) (((__uint16_t)(lo->port) & 0xffU) << 8 | ((__uint16_t )(lo->port) & 0xff00U) >> 8) : __swap16md(lo-> port)); | |||
1806 | } | |||
1807 | else { | |||
1808 | if (lo->ssl & F_SMTPS0x02) { | |||
1809 | lo->port = htons(465)(__uint16_t)(__builtin_constant_p(465) ? (__uint16_t)(((__uint16_t )(465) & 0xffU) << 8 | ((__uint16_t)(465) & 0xff00U ) >> 8) : __swap16md(465)); | |||
1810 | lo->flags = F_SMTPS0x02|lo->auth|flags; | |||
1811 | } | |||
1812 | ||||
1813 | if (!lo->ssl || (lo->ssl & F_STARTTLS0x01)) { | |||
1814 | lo->port = htons(25)(__uint16_t)(__builtin_constant_p(25) ? (__uint16_t)(((__uint16_t )(25) & 0xffU) << 8 | ((__uint16_t)(25) & 0xff00U ) >> 8) : __swap16md(25)); | |||
1815 | lo->flags = lo->auth|flags; | |||
1816 | if (lo->ssl & F_STARTTLS0x01) | |||
1817 | lo->flags |= F_STARTTLS0x01; | |||
1818 | } | |||
1819 | } | |||
1820 | ||||
1821 | if (interface(lo)) | |||
1822 | return; | |||
1823 | if (host_v4(lo)) | |||
1824 | return; | |||
1825 | if (host_v6(lo)) | |||
1826 | return; | |||
1827 | if (host_dns(lo)) | |||
1828 | return; | |||
1829 | ||||
1830 | fatalx("invalid virtual ip or interface: %s", lo->ifx); | |||
1831 | } | |||
1832 | ||||
1833 | static void | |||
1834 | config_listener(struct listener *h, struct listen_opts *lo) | |||
1835 | { | |||
1836 | int i; | |||
1837 | ||||
1838 | h->fd = -1; | |||
1839 | h->port = lo->port; | |||
1840 | h->flags = lo->flags; | |||
1841 | ||||
1842 | if (lo->hostname == NULL((void *)0)) | |||
1843 | lo->hostname = conf->sc_hostname; | |||
1844 | ||||
1845 | if (lo->options & LO_FILTER) { | |||
1846 | h->flags |= F_FILTERED0x2000; | |||
1847 | (void)strlcpy(h->filter_name, | |||
1848 | lo->filtername, | |||
1849 | sizeof(h->filter_name)); | |||
1850 | } | |||
1851 | ||||
1852 | if (lo->authtable != NULL((void *)0)) | |||
1853 | (void)strlcpy(h->authtable, lo->authtable->t_name, sizeof(h->authtable)); | |||
1854 | ||||
1855 | h->pkicount = lo->pkicount; | |||
1856 | if (h->pkicount) { | |||
1857 | h->pki = calloc(h->pkicount, sizeof(*h->pki)); | |||
1858 | if (h->pki == NULL((void *)0)) | |||
1859 | fatal("calloc"); | |||
1860 | } | |||
1861 | for (i = 0; i < lo->pkicount; i++) { | |||
1862 | h->pki[i] = dict_get(conf->sc_pki_dict, lo->pki[i]); | |||
1863 | if (h->pki[i] == NULL((void *)0)) { | |||
1864 | log_warnx("pki name not found: %s", lo->pki[i]); | |||
1865 | fatalx(NULL((void *)0)); | |||
1866 | } | |||
1867 | } | |||
1868 | ||||
1869 | if (lo->tls_ciphers != NULL((void *)0) && | |||
1870 | (h->tls_ciphers = strdup(lo->tls_ciphers)) == NULL((void *)0)) { | |||
1871 | fatal("strdup"); | |||
1872 | } | |||
1873 | ||||
1874 | if (lo->tls_protocols != NULL((void *)0) && | |||
1875 | (h->tls_protocols = strdup(lo->tls_protocols)) == NULL((void *)0)) { | |||
1876 | fatal("strdup"); | |||
1877 | } | |||
1878 | ||||
1879 | if (lo->ca != NULL((void *)0)) { | |||
1880 | if (!lowercase(h->ca_name, lo->ca, sizeof(h->ca_name))) { | |||
1881 | log_warnx("ca name too long: %s", lo->ca); | |||
1882 | fatalx(NULL((void *)0)); | |||
1883 | } | |||
1884 | if (dict_get(conf->sc_ca_dict, h->ca_name) == NULL((void *)0)) { | |||
1885 | log_warnx("ca name not found: %s", lo->ca); | |||
1886 | fatalx(NULL((void *)0)); | |||
1887 | } | |||
1888 | } | |||
1889 | if (lo->tag != NULL((void *)0)) | |||
1890 | (void)strlcpy(h->tag, lo->tag, sizeof(h->tag)); | |||
1891 | ||||
1892 | (void)strlcpy(h->hostname, lo->hostname, sizeof(h->hostname)); | |||
1893 | if (lo->hostnametable) | |||
1894 | (void)strlcpy(h->hostnametable, lo->hostnametable->t_name, sizeof(h->hostnametable)); | |||
1895 | if (lo->sendertable) { | |||
1896 | (void)strlcpy(h->sendertable, lo->sendertable->t_name, sizeof(h->sendertable)); | |||
1897 | if (lo->options & LO_MASQUERADE) | |||
1898 | h->flags |= F_MASQUERADE0x1000; | |||
1899 | } | |||
1900 | ||||
1901 | if (lo->ssl & F_TLS_VERIFY0x200) | |||
1902 | h->flags |= F_TLS_VERIFY0x200; | |||
1903 | ||||
1904 | if (lo->ssl & F_STARTTLS_REQUIRE0x20) | |||
1905 | h->flags |= F_STARTTLS_REQUIRE0x20; | |||
1906 | ||||
1907 | if (h != conf->sc_sock_listener) | |||
1908 | TAILQ_INSERT_TAIL(conf->sc_listeners, h, entry)do { (h)->entry.tqe_next = ((void *)0); (h)->entry.tqe_prev = (conf->sc_listeners)->tqh_last; *(conf->sc_listeners )->tqh_last = (h); (conf->sc_listeners)->tqh_last = & (h)->entry.tqe_next; } while (0); | |||
1909 | } | |||
1910 | ||||
1911 | static int | |||
1912 | host_v4(struct listen_opts *lo) | |||
1913 | { | |||
1914 | struct in_addr ina; | |||
1915 | struct sockaddr_in *sain; | |||
1916 | struct listener *h; | |||
1917 | ||||
1918 | if (lo->family != AF_UNSPEC0 && lo->family != AF_INET2) | |||
1919 | return (0); | |||
1920 | ||||
1921 | memset(&ina, 0, sizeof(ina)); | |||
1922 | if (inet_pton(AF_INET2, lo->ifx, &ina) != 1) | |||
1923 | return (0); | |||
1924 | ||||
1925 | h = xcalloc(1, sizeof(*h)); | |||
1926 | sain = (struct sockaddr_in *)&h->ss; | |||
1927 | sain->sin_len = sizeof(struct sockaddr_in); | |||
1928 | sain->sin_family = AF_INET2; | |||
1929 | sain->sin_addr.s_addr = ina.s_addr; | |||
1930 | sain->sin_port = lo->port; | |||
1931 | ||||
1932 | if (sain->sin_addr.s_addr == htonl(INADDR_LOOPBACK)(__uint32_t)(__builtin_constant_p(((u_int32_t)(0x7f000001))) ? (__uint32_t)(((__uint32_t)(((u_int32_t)(0x7f000001))) & 0xff ) << 24 | ((__uint32_t)(((u_int32_t)(0x7f000001))) & 0xff00) << 8 | ((__uint32_t)(((u_int32_t)(0x7f000001)) ) & 0xff0000) >> 8 | ((__uint32_t)(((u_int32_t)(0x7f000001 ))) & 0xff000000) >> 24) : __swap32md(((u_int32_t)( 0x7f000001))))) | |||
1933 | h->local = 1; | |||
1934 | config_listener(h, lo); | |||
1935 | ||||
1936 | return (1); | |||
1937 | } | |||
1938 | ||||
1939 | static int | |||
1940 | host_v6(struct listen_opts *lo) | |||
1941 | { | |||
1942 | struct in6_addr ina6; | |||
1943 | struct sockaddr_in6 *sin6; | |||
1944 | struct listener *h; | |||
1945 | ||||
1946 | if (lo->family != AF_UNSPEC0 && lo->family != AF_INET624) | |||
1947 | return (0); | |||
1948 | ||||
1949 | memset(&ina6, 0, sizeof(ina6)); | |||
1950 | if (inet_pton(AF_INET624, lo->ifx, &ina6) != 1) | |||
1951 | return (0); | |||
1952 | ||||
1953 | h = xcalloc(1, sizeof(*h)); | |||
1954 | sin6 = (struct sockaddr_in6 *)&h->ss; | |||
1955 | sin6->sin6_len = sizeof(struct sockaddr_in6); | |||
1956 | sin6->sin6_family = AF_INET624; | |||
1957 | sin6->sin6_port = lo->port; | |||
1958 | memcpy(&sin6->sin6_addr, &ina6, sizeof(ina6)); | |||
1959 | ||||
1960 | if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)((*(const u_int32_t *)(const void *)(&(&sin6->sin6_addr )->__u6_addr.__u6_addr8[0]) == 0) && (*(const u_int32_t *)(const void *)(&(&sin6->sin6_addr)->__u6_addr .__u6_addr8[4]) == 0) && (*(const u_int32_t *)(const void *)(&(&sin6->sin6_addr)->__u6_addr.__u6_addr8[8 ]) == 0) && (*(const u_int32_t *)(const void *)(& (&sin6->sin6_addr)->__u6_addr.__u6_addr8[12]) == (__uint32_t )(__builtin_constant_p(1) ? (__uint32_t)(((__uint32_t)(1) & 0xff) << 24 | ((__uint32_t)(1) & 0xff00) << 8 | ((__uint32_t)(1) & 0xff0000) >> 8 | ((__uint32_t )(1) & 0xff000000) >> 24) : __swap32md(1))))) | |||
1961 | h->local = 1; | |||
1962 | config_listener(h, lo); | |||
1963 | ||||
1964 | return (1); | |||
1965 | } | |||
1966 | ||||
1967 | static int | |||
1968 | host_dns(struct listen_opts *lo) | |||
1969 | { | |||
1970 | struct addrinfo hints, *res0, *res; | |||
1971 | int error, cnt = 0; | |||
1972 | struct sockaddr_in *sain; | |||
1973 | struct sockaddr_in6 *sin6; | |||
1974 | struct listener *h; | |||
1975 | ||||
1976 | memset(&hints, 0, sizeof(hints)); | |||
1977 | hints.ai_family = lo->family; | |||
1978 | hints.ai_socktype = SOCK_STREAM1; | |||
1979 | hints.ai_flags = AI_ADDRCONFIG64; | |||
1980 | error = getaddrinfo(lo->ifx, NULL((void *)0), &hints, &res0); | |||
1981 | if (error == EAI_AGAIN-3 || error == EAI_NODATA-5 || error == EAI_NONAME-2) | |||
1982 | return (0); | |||
1983 | if (error) { | |||
1984 | log_warnx("warn: host_dns: could not parse \"%s\": %s", lo->ifx, | |||
1985 | gai_strerror(error)); | |||
1986 | return (-1); | |||
1987 | } | |||
1988 | ||||
1989 | for (res = res0; res; res = res->ai_next) { | |||
1990 | if (res->ai_family != AF_INET2 && | |||
1991 | res->ai_family != AF_INET624) | |||
1992 | continue; | |||
1993 | h = xcalloc(1, sizeof(*h)); | |||
1994 | ||||
1995 | h->ss.ss_family = res->ai_family; | |||
1996 | if (res->ai_family == AF_INET2) { | |||
1997 | sain = (struct sockaddr_in *)&h->ss; | |||
1998 | sain->sin_len = sizeof(struct sockaddr_in); | |||
1999 | sain->sin_addr.s_addr = ((struct sockaddr_in *) | |||
2000 | res->ai_addr)->sin_addr.s_addr; | |||
2001 | sain->sin_port = lo->port; | |||
2002 | if (sain->sin_addr.s_addr == htonl(INADDR_LOOPBACK)(__uint32_t)(__builtin_constant_p(((u_int32_t)(0x7f000001))) ? (__uint32_t)(((__uint32_t)(((u_int32_t)(0x7f000001))) & 0xff ) << 24 | ((__uint32_t)(((u_int32_t)(0x7f000001))) & 0xff00) << 8 | ((__uint32_t)(((u_int32_t)(0x7f000001)) ) & 0xff0000) >> 8 | ((__uint32_t)(((u_int32_t)(0x7f000001 ))) & 0xff000000) >> 24) : __swap32md(((u_int32_t)( 0x7f000001))))) | |||
2003 | h->local = 1; | |||
2004 | } else { | |||
2005 | sin6 = (struct sockaddr_in6 *)&h->ss; | |||
2006 | sin6->sin6_len = sizeof(struct sockaddr_in6); | |||
2007 | memcpy(&sin6->sin6_addr, &((struct sockaddr_in6 *) | |||
2008 | res->ai_addr)->sin6_addr, sizeof(struct in6_addr)); | |||
2009 | sin6->sin6_port = lo->port; | |||
2010 | if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)((*(const u_int32_t *)(const void *)(&(&sin6->sin6_addr )->__u6_addr.__u6_addr8[0]) == 0) && (*(const u_int32_t *)(const void *)(&(&sin6->sin6_addr)->__u6_addr .__u6_addr8[4]) == 0) && (*(const u_int32_t *)(const void *)(&(&sin6->sin6_addr)->__u6_addr.__u6_addr8[8 ]) == 0) && (*(const u_int32_t *)(const void *)(& (&sin6->sin6_addr)->__u6_addr.__u6_addr8[12]) == (__uint32_t )(__builtin_constant_p(1) ? (__uint32_t)(((__uint32_t)(1) & 0xff) << 24 | ((__uint32_t)(1) & 0xff00) << 8 | ((__uint32_t)(1) & 0xff0000) >> 8 | ((__uint32_t )(1) & 0xff000000) >> 24) : __swap32md(1))))) | |||
2011 | h->local = 1; | |||
2012 | } | |||
2013 | ||||
2014 | config_listener(h, lo); | |||
2015 | ||||
2016 | cnt++; | |||
2017 | } | |||
2018 | ||||
2019 | freeaddrinfo(res0); | |||
2020 | return (cnt); | |||
2021 | } | |||
2022 | ||||
2023 | static int | |||
2024 | interface(struct listen_opts *lo) | |||
2025 | { | |||
2026 | struct ifaddrs *ifap, *p; | |||
2027 | struct sockaddr_in *sain; | |||
2028 | struct sockaddr_in6 *sin6; | |||
2029 | struct listener *h; | |||
2030 | int ret = 0; | |||
2031 | ||||
2032 | if (getifaddrs(&ifap) == -1) | |||
2033 | fatal("getifaddrs"); | |||
2034 | ||||
2035 | for (p = ifap; p != NULL((void *)0); p = p->ifa_next) { | |||
2036 | if (p->ifa_addr == NULL((void *)0)) | |||
2037 | continue; | |||
2038 | if (strcmp(p->ifa_name, lo->ifx) != 0 && | |||
2039 | !is_if_in_group(p->ifa_name, lo->ifx)) | |||
2040 | continue; | |||
2041 | if (lo->family != AF_UNSPEC0 && lo->family != p->ifa_addr->sa_family) | |||
2042 | continue; | |||
2043 | ||||
2044 | h = xcalloc(1, sizeof(*h)); | |||
2045 | ||||
2046 | switch (p->ifa_addr->sa_family) { | |||
2047 | case AF_INET2: | |||
2048 | sain = (struct sockaddr_in *)&h->ss; | |||
2049 | *sain = *(struct sockaddr_in *)p->ifa_addr; | |||
2050 | sain->sin_len = sizeof(struct sockaddr_in); | |||
2051 | sain->sin_port = lo->port; | |||
2052 | if (sain->sin_addr.s_addr == htonl(INADDR_LOOPBACK)(__uint32_t)(__builtin_constant_p(((u_int32_t)(0x7f000001))) ? (__uint32_t)(((__uint32_t)(((u_int32_t)(0x7f000001))) & 0xff ) << 24 | ((__uint32_t)(((u_int32_t)(0x7f000001))) & 0xff00) << 8 | ((__uint32_t)(((u_int32_t)(0x7f000001)) ) & 0xff0000) >> 8 | ((__uint32_t)(((u_int32_t)(0x7f000001 ))) & 0xff000000) >> 24) : __swap32md(((u_int32_t)( 0x7f000001))))) | |||
2053 | h->local = 1; | |||
2054 | break; | |||
2055 | ||||
2056 | case AF_INET624: | |||
2057 | sin6 = (struct sockaddr_in6 *)&h->ss; | |||
2058 | *sin6 = *(struct sockaddr_in6 *)p->ifa_addr; | |||
2059 | sin6->sin6_len = sizeof(struct sockaddr_in6); | |||
2060 | sin6->sin6_port = lo->port; | |||
2061 | #ifdef __KAME__ | |||
2062 | if ((IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)(((&sin6->sin6_addr)->__u6_addr.__u6_addr8[0] == 0xfe ) && (((&sin6->sin6_addr)->__u6_addr.__u6_addr8 [1] & 0xc0) == 0x80)) || | |||
2063 | IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr)(((&sin6->sin6_addr)->__u6_addr.__u6_addr8[0] == 0xff ) && (((&sin6->sin6_addr)->__u6_addr.__u6_addr8 [1] & 0x0f) == 0x02)) || | |||
2064 | IN6_IS_ADDR_MC_INTFACELOCAL(&sin6->sin6_addr)(((&sin6->sin6_addr)->__u6_addr.__u6_addr8[0] == 0xff ) && (((&sin6->sin6_addr)->__u6_addr.__u6_addr8 [1] & 0x0f) == 0x01))) && | |||
2065 | sin6->sin6_scope_id == 0) { | |||
2066 | sin6->sin6_scope_id = ntohs((__uint16_t)(__builtin_constant_p(*(u_int16_t *)&sin6-> sin6_addr.__u6_addr.__u6_addr8[2]) ? (__uint16_t)(((__uint16_t )(*(u_int16_t *)&sin6->sin6_addr.__u6_addr.__u6_addr8[ 2]) & 0xffU) << 8 | ((__uint16_t)(*(u_int16_t *)& sin6->sin6_addr.__u6_addr.__u6_addr8[2]) & 0xff00U) >> 8) : __swap16md(*(u_int16_t *)&sin6->sin6_addr.__u6_addr .__u6_addr8[2])) | |||
2067 | *(u_int16_t *)&sin6->sin6_addr.s6_addr[2])(__uint16_t)(__builtin_constant_p(*(u_int16_t *)&sin6-> sin6_addr.__u6_addr.__u6_addr8[2]) ? (__uint16_t)(((__uint16_t )(*(u_int16_t *)&sin6->sin6_addr.__u6_addr.__u6_addr8[ 2]) & 0xffU) << 8 | ((__uint16_t)(*(u_int16_t *)& sin6->sin6_addr.__u6_addr.__u6_addr8[2]) & 0xff00U) >> 8) : __swap16md(*(u_int16_t *)&sin6->sin6_addr.__u6_addr .__u6_addr8[2])); | |||
2068 | sin6->sin6_addr.s6_addr__u6_addr.__u6_addr8[2] = 0; | |||
2069 | sin6->sin6_addr.s6_addr__u6_addr.__u6_addr8[3] = 0; | |||
2070 | } | |||
2071 | #endif | |||
2072 | if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)((*(const u_int32_t *)(const void *)(&(&sin6->sin6_addr )->__u6_addr.__u6_addr8[0]) == 0) && (*(const u_int32_t *)(const void *)(&(&sin6->sin6_addr)->__u6_addr .__u6_addr8[4]) == 0) && (*(const u_int32_t *)(const void *)(&(&sin6->sin6_addr)->__u6_addr.__u6_addr8[8 ]) == 0) && (*(const u_int32_t *)(const void *)(& (&sin6->sin6_addr)->__u6_addr.__u6_addr8[12]) == (__uint32_t )(__builtin_constant_p(1) ? (__uint32_t)(((__uint32_t)(1) & 0xff) << 24 | ((__uint32_t)(1) & 0xff00) << 8 | ((__uint32_t)(1) & 0xff0000) >> 8 | ((__uint32_t )(1) & 0xff000000) >> 24) : __swap32md(1))))) | |||
2073 | h->local = 1; | |||
2074 | break; | |||
2075 | ||||
2076 | default: | |||
2077 | free(h); | |||
2078 | continue; | |||
2079 | } | |||
2080 | ||||
2081 | config_listener(h, lo); | |||
2082 | ret = 1; | |||
2083 | } | |||
2084 | ||||
2085 | freeifaddrs(ifap); | |||
2086 | ||||
2087 | return ret; | |||
2088 | } | |||
2089 | ||||
2090 | int | |||
2091 | delaytonum(char *str) | |||
2092 | { | |||
2093 | unsigned int factor; | |||
2094 | size_t len; | |||
2095 | const char *errstr = NULL((void *)0); | |||
2096 | int delay; | |||
2097 | ||||
2098 | /* we need at least 1 digit and 1 unit */ | |||
2099 | len = strlen(str); | |||
2100 | if (len < 2) | |||
2101 | goto bad; | |||
2102 | ||||
2103 | switch(str[len - 1]) { | |||
2104 | ||||
2105 | case 's': | |||
2106 | factor = 1; | |||
2107 | break; | |||
2108 | ||||
2109 | case 'm': | |||
2110 | factor = 60; | |||
2111 | break; | |||
2112 | ||||
2113 | case 'h': | |||
2114 | factor = 60 * 60; | |||
2115 | break; | |||
2116 | ||||
2117 | case 'd': | |||
2118 | factor = 24 * 60 * 60; | |||
2119 | break; | |||
2120 | ||||
2121 | default: | |||
2122 | goto bad; | |||
2123 | } | |||
2124 | ||||
2125 | str[len - 1] = '\0'; | |||
2126 | delay = strtonum(str, 1, INT_MAX2147483647 / factor, &errstr); | |||
2127 | if (errstr) | |||
2128 | goto bad; | |||
2129 | ||||
2130 | return (delay * factor); | |||
2131 | ||||
2132 | bad: | |||
2133 | return (-1); | |||
2134 | } | |||
2135 | ||||
2136 | int | |||
2137 | is_if_in_group(const char *ifname, const char *groupname) | |||
2138 | { | |||
2139 | unsigned int len; | |||
2140 | struct ifgroupreq ifgr; | |||
2141 | struct ifg_req *ifg; | |||
2142 | int s; | |||
2143 | int ret = 0; | |||
2144 | ||||
2145 | if ((s = socket(AF_INET2, SOCK_DGRAM2, 0)) == -1) | |||
2146 | fatal("socket"); | |||
2147 | ||||
2148 | memset(&ifgr, 0, sizeof(ifgr)); | |||
2149 | if (strlcpy(ifgr.ifgr_name, ifname, IFNAMSIZ16) >= IFNAMSIZ16) | |||
2150 | fatalx("interface name too large"); | |||
2151 | ||||
2152 | if (ioctl(s, SIOCGIFGROUP(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct ifgroupreq) & 0x1fff) << 16) | ((('i')) << 8) | ((136))), (caddr_t)&ifgr) == -1) { | |||
2153 | if (errno(*__errno()) == EINVAL22 || errno(*__errno()) == ENOTTY25) | |||
2154 | goto end; | |||
2155 | fatal("SIOCGIFGROUP"); | |||
2156 | } | |||
2157 | ||||
2158 | len = ifgr.ifgr_len; | |||
2159 | ifgr.ifgr_groupsifgr_ifgru.ifgru_groups = xcalloc(len/sizeof(struct ifg_req), | |||
2160 | sizeof(struct ifg_req)); | |||
2161 | if (ioctl(s, SIOCGIFGROUP(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof (struct ifgroupreq) & 0x1fff) << 16) | ((('i')) << 8) | ((136))), (caddr_t)&ifgr) == -1) | |||
2162 | fatal("SIOCGIFGROUP"); | |||
2163 | ||||
2164 | ifg = ifgr.ifgr_groupsifgr_ifgru.ifgru_groups; | |||
2165 | for (; ifg && len >= sizeof(struct ifg_req); ifg++) { | |||
2166 | len -= sizeof(struct ifg_req); | |||
2167 | if (strcmp(ifg->ifgrq_groupifgrq_ifgrqu.ifgrqu_group, groupname) == 0) { | |||
2168 | ret = 1; | |||
2169 | break; | |||
2170 | } | |||
2171 | } | |||
2172 | free(ifgr.ifgr_groupsifgr_ifgru.ifgru_groups); | |||
2173 | ||||
2174 | end: | |||
2175 | close(s); | |||
2176 | return ret; | |||
2177 | } | |||
2178 | ||||
2179 | static int | |||
2180 | config_lo_mask_source(struct listen_opts *lo) { | |||
2181 | if (lo->options & LO_MASKSOURCE) { | |||
2182 | yyerror("mask-source already specified"); | |||
2183 | return -1; | |||
2184 | } | |||
2185 | lo->options |= LO_MASKSOURCE; | |||
2186 | lo->flags |= F_MASK_SOURCE0x100; | |||
2187 | ||||
2188 | return 0; | |||
2189 | } | |||
2190 | ||||
2191 | #line 2184 "parse.c" | |||
2192 | /* allocate initial stack or double stack size, up to YYMAXDEPTH */ | |||
2193 | static int yygrowstack(void) | |||
2194 | { | |||
2195 | unsigned int newsize; | |||
2196 | long sslen; | |||
2197 | short *newss; | |||
2198 | YYSTYPE *newvs; | |||
2199 | ||||
2200 | if ((newsize = yystacksize) == 0) | |||
2201 | newsize = YYINITSTACKSIZE200; | |||
2202 | else if (newsize >= YYMAXDEPTH10000) | |||
2203 | return -1; | |||
2204 | else if ((newsize *= 2) > YYMAXDEPTH10000) | |||
2205 | newsize = YYMAXDEPTH10000; | |||
2206 | sslen = yyssp - yyss; | |||
2207 | #ifdef SIZE_MAX0xffffffffffffffffUL | |||
2208 | #define YY_SIZE_MAX0xffffffffffffffffUL SIZE_MAX0xffffffffffffffffUL | |||
2209 | #else | |||
2210 | #define YY_SIZE_MAX0xffffffffffffffffUL 0xffffffffU | |||
2211 | #endif | |||
2212 | if (newsize && YY_SIZE_MAX0xffffffffffffffffUL / newsize < sizeof *newss) | |||
2213 | goto bail; | |||
2214 | newss = (short *)realloc(yyss, newsize * sizeof *newss); | |||
2215 | if (newss == NULL((void *)0)) | |||
2216 | goto bail; | |||
2217 | yyss = newss; | |||
2218 | yyssp = newss + sslen; | |||
2219 | if (newsize
| |||
2220 | goto bail; | |||
2221 | newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs); | |||
2222 | if (newvs == NULL((void *)0)) | |||
2223 | goto bail; | |||
2224 | yyvs = newvs; | |||
2225 | yyvsp = newvs + sslen; | |||
2226 | yystacksize = newsize; | |||
2227 | yysslim = yyss + newsize - 1; | |||
2228 | return 0; | |||
2229 | bail: | |||
2230 | if (yyss
| |||
2231 | free(yyss); | |||
2232 | if (yyvs) | |||
2233 | free(yyvs); | |||
| ||||
2234 | yyss = yyssp = NULL((void *)0); | |||
2235 | yyvs = yyvsp = NULL((void *)0); | |||
2236 | yystacksize = 0; | |||
2237 | return -1; | |||
2238 | } | |||
2239 | ||||
2240 | #define YYABORTgoto yyabort goto yyabort | |||
2241 | #define YYREJECTgoto yyabort goto yyabort | |||
2242 | #define YYACCEPTgoto yyaccept goto yyaccept | |||
2243 | #define YYERRORgoto yyerrlab goto yyerrlab | |||
2244 | int | |||
2245 | yyparse(void) | |||
2246 | { | |||
2247 | int yym, yyn, yystate; | |||
2248 | #if YYDEBUG0 | |||
2249 | const char *yys; | |||
2250 | ||||
2251 | if ((yys = getenv("YYDEBUG"))) | |||
2252 | { | |||
2253 | yyn = *yys; | |||
2254 | if (yyn >= '0' && yyn <= '9') | |||
2255 | yydebug = yyn - '0'; | |||
2256 | } | |||
2257 | #endif /* YYDEBUG */ | |||
2258 | ||||
2259 | yynerrs = 0; | |||
2260 | yyerrflag = 0; | |||
2261 | yychar = (-1); | |||
2262 | ||||
2263 | if (yyss == NULL((void *)0) && yygrowstack()) goto yyoverflow; | |||
| ||||
2264 | yyssp = yyss; | |||
2265 | yyvsp = yyvs; | |||
2266 | *yyssp = yystate = 0; | |||
2267 | ||||
2268 | yyloop: | |||
2269 | if ((yyn = yydefred[yystate]) != 0) goto yyreduce; | |||
2270 | if (yychar < 0) | |||
2271 | { | |||
2272 | if ((yychar = yylex()) < 0) yychar = 0; | |||
2273 | #if YYDEBUG0 | |||
2274 | if (yydebug) | |||
2275 | { | |||
2276 | yys = 0; | |||
2277 | if (yychar <= YYMAXTOKEN363) yys = yyname[yychar]; | |||
2278 | if (!yys) yys = "illegal-symbol"; | |||
2279 | printf("%sdebug: state %d, reading %d (%s)\n", | |||
2280 | YYPREFIX"yy", yystate, yychar, yys); | |||
2281 | } | |||
2282 | #endif | |||
2283 | } | |||
2284 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && | |||
2285 | yyn <= YYTABLESIZE915 && yycheck[yyn] == yychar) | |||
2286 | { | |||
2287 | #if YYDEBUG0 | |||
2288 | if (yydebug) | |||
2289 | printf("%sdebug: state %d, shifting to state %d\n", | |||
2290 | YYPREFIX"yy", yystate, yytable[yyn]); | |||
2291 | #endif | |||
2292 | if (yyssp >= yysslim && yygrowstack()) | |||
2293 | { | |||
2294 | goto yyoverflow; | |||
2295 | } | |||
2296 | *++yyssp = yystate = yytable[yyn]; | |||
2297 | *++yyvsp = yylval; | |||
2298 | yychar = (-1); | |||
2299 | if (yyerrflag > 0) --yyerrflag; | |||
2300 | goto yyloop; | |||
2301 | } | |||
2302 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && | |||
2303 | yyn <= YYTABLESIZE915 && yycheck[yyn] == yychar) | |||
2304 | { | |||
2305 | yyn = yytable[yyn]; | |||
2306 | goto yyreduce; | |||
2307 | } | |||
2308 | if (yyerrflag) goto yyinrecovery; | |||
2309 | #if defined(__GNUC__4) | |||
2310 | goto yynewerror; | |||
2311 | #endif | |||
2312 | yynewerror: | |||
2313 | yyerror("syntax error"); | |||
2314 | #if defined(__GNUC__4) | |||
2315 | goto yyerrlab; | |||
2316 | #endif | |||
2317 | yyerrlab: | |||
2318 | ++yynerrs; | |||
2319 | yyinrecovery: | |||
2320 | if (yyerrflag < 3) | |||
2321 | { | |||
2322 | yyerrflag = 3; | |||
2323 | for (;;) | |||
2324 | { | |||
2325 | if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE256) >= 0 && | |||
2326 | yyn <= YYTABLESIZE915 && yycheck[yyn] == YYERRCODE256) | |||
2327 | { | |||
2328 | #if YYDEBUG0 | |||
2329 | if (yydebug) | |||
2330 | printf("%sdebug: state %d, error recovery shifting\ | |||
2331 | to state %d\n", YYPREFIX"yy", *yyssp, yytable[yyn]); | |||
2332 | #endif | |||
2333 | if (yyssp >= yysslim && yygrowstack()) | |||
2334 | { | |||
2335 | goto yyoverflow; | |||
2336 | } | |||
2337 | *++yyssp = yystate = yytable[yyn]; | |||
2338 | *++yyvsp = yylval; | |||
2339 | goto yyloop; | |||
2340 | } | |||
2341 | else | |||
2342 | { | |||
2343 | #if YYDEBUG0 | |||
2344 | if (yydebug) | |||
2345 | printf("%sdebug: error recovery discarding state %d\n", | |||
2346 | YYPREFIX"yy", *yyssp); | |||
2347 | #endif | |||
2348 | if (yyssp <= yyss) goto yyabort; | |||
2349 | --yyssp; | |||
2350 | --yyvsp; | |||
2351 | } | |||
2352 | } | |||
2353 | } | |||
2354 | else | |||
2355 | { | |||
2356 | if (yychar == 0) goto yyabort; | |||
2357 | #if YYDEBUG0 | |||
2358 | if (yydebug) | |||
2359 | { | |||
2360 | yys = 0; | |||
2361 | if (yychar <= YYMAXTOKEN363) yys = yyname[yychar]; | |||
2362 | if (!yys) yys = "illegal-symbol"; | |||
2363 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", | |||
2364 | YYPREFIX"yy", yystate, yychar, yys); | |||
2365 | } | |||
2366 | #endif | |||
2367 | yychar = (-1); | |||
2368 | goto yyloop; | |||
2369 | } | |||
2370 | yyreduce: | |||
2371 | #if YYDEBUG0 | |||
2372 | if (yydebug) | |||
2373 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", | |||
2374 | YYPREFIX"yy", yystate, yyn, yyrule[yyn]); | |||
2375 | #endif | |||
2376 | yym = yylen[yyn]; | |||
2377 | if (yym) | |||
2378 | yyval = yyvsp[1-yym]; | |||
2379 | else | |||
2380 | memset(&yyval, 0, sizeof yyval); | |||
2381 | switch (yyn) | |||
2382 | { | |||
2383 | case 21: | |||
2384 | #line 216 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2385 | { file->errors++; } | |||
2386 | break; | |||
2387 | case 22: | |||
2388 | #line 219 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2389 | { | |||
2390 | struct file *nfile; | |||
2391 | ||||
2392 | if ((nfile = pushfile(yyvsp[0].v.string, 0)) == NULL((void *)0)) { | |||
2393 | yyerror("failed to include file %s", yyvsp[0].v.string); | |||
2394 | free(yyvsp[0].v.string); | |||
2395 | YYERRORgoto yyerrlab; | |||
2396 | } | |||
2397 | free(yyvsp[0].v.string); | |||
2398 | ||||
2399 | file = nfile; | |||
2400 | lungetc('\n'); | |||
2401 | } | |||
2402 | break; | |||
2403 | case 23: | |||
2404 | #line 234 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2405 | { | |||
2406 | char *s = yyvsp[-2].v.string; | |||
2407 | while (*s++) { | |||
2408 | if (isspace((unsigned char)*s)) { | |||
2409 | yyerror("macro name cannot contain " | |||
2410 | "whitespace"); | |||
2411 | free(yyvsp[-2].v.string); | |||
2412 | free(yyvsp[0].v.string); | |||
2413 | YYERRORgoto yyerrlab; | |||
2414 | } | |||
2415 | } | |||
2416 | if (symset(yyvsp[-2].v.string, yyvsp[0].v.string, 0) == -1) | |||
2417 | fatal("cannot store variable"); | |||
2418 | free(yyvsp[-2].v.string); | |||
2419 | free(yyvsp[0].v.string); | |||
2420 | } | |||
2421 | break; | |||
2422 | case 30: | |||
2423 | #line 264 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2424 | { yyval.v.number = 1; } | |||
2425 | break; | |||
2426 | case 31: | |||
2427 | #line 265 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2428 | { yyval.v.number = 0; } | |||
2429 | break; | |||
2430 | case 34: | |||
2431 | #line 271 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2432 | { | |||
2433 | table_add(table, yyvsp[-2].v.string, yyvsp[0].v.string); | |||
2434 | free(yyvsp[-2].v.string); | |||
2435 | free(yyvsp[0].v.string); | |||
2436 | } | |||
2437 | break; | |||
2438 | case 37: | |||
2439 | #line 282 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2440 | { | |||
2441 | table_add(table, yyvsp[0].v.string, NULL((void *)0)); | |||
2442 | free(yyvsp[0].v.string); | |||
2443 | } | |||
2444 | break; | |||
2445 | case 40: | |||
2446 | #line 292 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2447 | { } | |||
2448 | break; | |||
2449 | case 41: | |||
2450 | #line 293 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2451 | { } | |||
2452 | break; | |||
2453 | case 42: | |||
2454 | #line 297 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2455 | { | |||
2456 | memset(conf->sc_bounce_warn, 0, sizeof conf->sc_bounce_warn); | |||
2457 | } | |||
2458 | break; | |||
2459 | case 44: | |||
2460 | #line 304 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2461 | { | |||
2462 | size_t i; | |||
2463 | ||||
2464 | for (i = 0; yyvsp[0].v.string[i] != '\0'; i++) { | |||
2465 | if (!isprint(yyvsp[0].v.string[i])) { | |||
2466 | yyerror("not a valid admd"); | |||
2467 | free(yyvsp[0].v.string); | |||
2468 | YYERRORgoto yyerrlab; | |||
2469 | } | |||
2470 | } | |||
2471 | conf->sc_admd = yyvsp[0].v.string; | |||
2472 | } | |||
2473 | break; | |||
2474 | case 45: | |||
2475 | #line 319 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2476 | { | |||
2477 | char buf[HOST_NAME_MAX255+1]; | |||
2478 | ||||
2479 | /* if not catchall, check that it is a valid domain */ | |||
2480 | if (strcmp(yyvsp[0].v.string, "*") != 0) { | |||
2481 | if (!res_hnok__res_hnok(yyvsp[0].v.string)) { | |||
2482 | yyerror("not a valid domain name: %s", yyvsp[0].v.string); | |||
2483 | free(yyvsp[0].v.string); | |||
2484 | YYERRORgoto yyerrlab; | |||
2485 | } | |||
2486 | } | |||
2487 | xlowercase(buf, yyvsp[0].v.string, sizeof(buf)); | |||
2488 | free(yyvsp[0].v.string); | |||
2489 | sca = dict_get(conf->sc_ca_dict, buf); | |||
2490 | if (sca == NULL((void *)0)) { | |||
2491 | sca = xcalloc(1, sizeof *sca); | |||
2492 | (void)strlcpy(sca->ca_name, buf, sizeof(sca->ca_name)); | |||
2493 | dict_set(conf->sc_ca_dict, sca->ca_name, sca); | |||
2494 | } | |||
2495 | } | |||
2496 | break; | |||
2497 | case 47: | |||
2498 | #line 343 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2499 | { | |||
2500 | sca->ca_cert_file = yyvsp[0].v.string; | |||
2501 | } | |||
2502 | break; | |||
2503 | case 50: | |||
2504 | #line 355 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2505 | { | |||
2506 | if (dict_get(conf->sc_mda_wrappers, yyvsp[-1].v.string)) { | |||
2507 | yyerror("mda wrapper already declared with that name: %s", yyvsp[-1].v.string); | |||
2508 | YYERRORgoto yyerrlab; | |||
2509 | } | |||
2510 | dict_set(conf->sc_mda_wrappers, yyvsp[-1].v.string, yyvsp[0].v.string); | |||
2511 | } | |||
2512 | break; | |||
2513 | case 51: | |||
2514 | #line 366 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2515 | { | |||
2516 | conf->sc_mta_max_deferred = yyvsp[0].v.number; | |||
2517 | } | |||
2518 | break; | |||
2519 | case 52: | |||
2520 | #line 369 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2521 | { | |||
2522 | struct mta_limits *d; | |||
2523 | ||||
2524 | limits = dict_get(conf->sc_limits_dict, yyvsp[0].v.string); | |||
2525 | if (limits == NULL((void *)0)) { | |||
2526 | limits = xcalloc(1, sizeof(*limits)); | |||
2527 | dict_xset(conf->sc_limits_dict, yyvsp[0].v.string, limits); | |||
2528 | d = dict_xget(conf->sc_limits_dict, "default"); | |||
2529 | memmove(limits, d, sizeof(*limits)); | |||
2530 | } | |||
2531 | free(yyvsp[0].v.string); | |||
2532 | } | |||
2533 | break; | |||
2534 | case 54: | |||
2535 | #line 381 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2536 | { | |||
2537 | limits = dict_get(conf->sc_limits_dict, "default"); | |||
2538 | } | |||
2539 | break; | |||
2540 | case 56: | |||
2541 | #line 388 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2542 | { | |||
2543 | char buf[HOST_NAME_MAX255+1]; | |||
2544 | ||||
2545 | /* if not catchall, check that it is a valid domain */ | |||
2546 | if (strcmp(yyvsp[0].v.string, "*") != 0) { | |||
2547 | if (!res_hnok__res_hnok(yyvsp[0].v.string)) { | |||
2548 | yyerror("not a valid domain name: %s", yyvsp[0].v.string); | |||
2549 | free(yyvsp[0].v.string); | |||
2550 | YYERRORgoto yyerrlab; | |||
2551 | } | |||
2552 | } | |||
2553 | xlowercase(buf, yyvsp[0].v.string, sizeof(buf)); | |||
2554 | free(yyvsp[0].v.string); | |||
2555 | pki = dict_get(conf->sc_pki_dict, buf); | |||
2556 | if (pki == NULL((void *)0)) { | |||
2557 | pki = xcalloc(1, sizeof *pki); | |||
2558 | (void)strlcpy(pki->pki_name, buf, sizeof(pki->pki_name)); | |||
2559 | dict_set(conf->sc_pki_dict, pki->pki_name, pki); | |||
2560 | } | |||
2561 | } | |||
2562 | break; | |||
2563 | case 58: | |||
2564 | #line 411 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2565 | { | |||
2566 | pki->pki_cert_file = yyvsp[0].v.string; | |||
2567 | } | |||
2568 | break; | |||
2569 | case 59: | |||
2570 | #line 414 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2571 | { | |||
2572 | pki->pki_key_file = yyvsp[0].v.string; | |||
2573 | } | |||
2574 | break; | |||
2575 | case 60: | |||
2576 | #line 417 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2577 | { | |||
2578 | if (strcasecmp(yyvsp[0].v.string, "none") == 0) | |||
2579 | pki->pki_dhe = 0; | |||
2580 | else if (strcasecmp(yyvsp[0].v.string, "auto") == 0) | |||
2581 | pki->pki_dhe = 1; | |||
2582 | else if (strcasecmp(yyvsp[0].v.string, "legacy") == 0) | |||
2583 | pki->pki_dhe = 2; | |||
2584 | else { | |||
2585 | yyerror("invalid DHE keyword: %s", yyvsp[0].v.string); | |||
2586 | free(yyvsp[0].v.string); | |||
2587 | YYERRORgoto yyerrlab; | |||
2588 | } | |||
2589 | free(yyvsp[0].v.string); | |||
2590 | } | |||
2591 | break; | |||
2592 | case 63: | |||
2593 | #line 441 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2594 | { | |||
2595 | if (dict_get(conf->sc_filter_processes_dict, yyvsp[-1].v.string)) { | |||
2596 | yyerror("processor already exists with that name: %s", yyvsp[-1].v.string); | |||
2597 | free(yyvsp[-1].v.string); | |||
2598 | free(yyvsp[0].v.string); | |||
2599 | YYERRORgoto yyerrlab; | |||
2600 | } | |||
2601 | processor = xcalloc(1, sizeof *processor); | |||
2602 | processor->command = yyvsp[0].v.string; | |||
2603 | } | |||
2604 | break; | |||
2605 | case 64: | |||
2606 | #line 450 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2607 | { | |||
2608 | dict_set(conf->sc_filter_processes_dict, yyvsp[-3].v.string, processor); | |||
2609 | processor = NULL((void *)0); | |||
2610 | } | |||
2611 | break; | |||
2612 | case 65: | |||
2613 | #line 458 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2614 | { | |||
2615 | if (processor->user) { | |||
2616 | yyerror("user already specified for this processor"); | |||
2617 | free(yyvsp[0].v.string); | |||
2618 | YYERRORgoto yyerrlab; | |||
2619 | } | |||
2620 | processor->user = yyvsp[0].v.string; | |||
2621 | } | |||
2622 | break; | |||
2623 | case 66: | |||
2624 | #line 466 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2625 | { | |||
2626 | if (processor->group) { | |||
2627 | yyerror("group already specified for this processor"); | |||
2628 | free(yyvsp[0].v.string); | |||
2629 | YYERRORgoto yyerrlab; | |||
2630 | } | |||
2631 | processor->group = yyvsp[0].v.string; | |||
2632 | } | |||
2633 | break; | |||
2634 | case 67: | |||
2635 | #line 474 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2636 | { | |||
2637 | if (processor->chroot) { | |||
2638 | yyerror("chroot already specified for this processor"); | |||
2639 | free(yyvsp[0].v.string); | |||
2640 | YYERRORgoto yyerrlab; | |||
2641 | } | |||
2642 | processor->chroot = yyvsp[0].v.string; | |||
2643 | } | |||
2644 | break; | |||
2645 | case 70: | |||
2646 | #line 491 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2647 | { | |||
2648 | conf->sc_queue_flags |= QUEUE_COMPRESSION0x00000001; | |||
2649 | } | |||
2650 | break; | |||
2651 | case 71: | |||
2652 | #line 494 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2653 | { | |||
2654 | conf->sc_queue_flags |= QUEUE_ENCRYPTION0x00000002; | |||
2655 | } | |||
2656 | break; | |||
2657 | case 72: | |||
2658 | #line 497 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2659 | { | |||
2660 | if (strcasecmp(yyvsp[0].v.string, "stdin") == 0 || strcasecmp(yyvsp[0].v.string, "-") == 0) { | |||
2661 | conf->sc_queue_key = "stdin"; | |||
2662 | free(yyvsp[0].v.string); | |||
2663 | } | |||
2664 | else | |||
2665 | conf->sc_queue_key = yyvsp[0].v.string; | |||
2666 | conf->sc_queue_flags |= QUEUE_ENCRYPTION0x00000002; | |||
2667 | } | |||
2668 | break; | |||
2669 | case 73: | |||
2670 | #line 506 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2671 | { | |||
2672 | conf->sc_ttl = delaytonum(yyvsp[0].v.string); | |||
2673 | if (conf->sc_ttl == -1) { | |||
2674 | yyerror("invalid ttl delay: %s", yyvsp[0].v.string); | |||
2675 | free(yyvsp[0].v.string); | |||
2676 | YYERRORgoto yyerrlab; | |||
2677 | } | |||
2678 | free(yyvsp[0].v.string); | |||
2679 | } | |||
2680 | break; | |||
2681 | case 76: | |||
2682 | #line 525 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2683 | { | |||
2684 | conf->sc_tls_ciphers = yyvsp[0].v.string; | |||
2685 | } | |||
2686 | break; | |||
2687 | case 77: | |||
2688 | #line 528 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2689 | { | |||
2690 | conf->sc_maxsize = yyvsp[0].v.number; | |||
2691 | } | |||
2692 | break; | |||
2693 | case 78: | |||
2694 | #line 531 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2695 | { | |||
2696 | if (strlen(yyvsp[0].v.string) != 1) { | |||
2697 | yyerror("subaddressing-delimiter must be one character"); | |||
2698 | free(yyvsp[0].v.string); | |||
2699 | YYERRORgoto yyerrlab; | |||
2700 | } | |||
2701 | if (isspace((unsigned char)*yyvsp[0].v.string) || !isprint((unsigned char)*yyvsp[0].v.string) || *yyvsp[0].v.string == '@') { | |||
2702 | yyerror("sub-addr-delim uses invalid character"); | |||
2703 | free(yyvsp[0].v.string); | |||
2704 | YYERRORgoto yyerrlab; | |||
2705 | } | |||
2706 | conf->sc_subaddressing_delim = yyvsp[0].v.string; | |||
2707 | } | |||
2708 | break; | |||
2709 | case 79: | |||
2710 | #line 547 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2711 | { | |||
2712 | conf->sc_srs_key = yyvsp[0].v.string; | |||
2713 | } | |||
2714 | break; | |||
2715 | case 80: | |||
2716 | #line 550 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2717 | { | |||
2718 | conf->sc_srs_key_backup = yyvsp[0].v.string; | |||
2719 | } | |||
2720 | break; | |||
2721 | case 81: | |||
2722 | #line 553 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2723 | { | |||
2724 | conf->sc_srs_ttl = delaytonum(yyvsp[0].v.string); | |||
2725 | if (conf->sc_srs_ttl == -1) { | |||
2726 | yyerror("ttl delay \"%s\" is invalid", yyvsp[0].v.string); | |||
2727 | free(yyvsp[0].v.string); | |||
2728 | YYERRORgoto yyerrlab; | |||
2729 | } | |||
2730 | ||||
2731 | conf->sc_srs_ttl /= 86400; | |||
2732 | if (conf->sc_srs_ttl == 0) { | |||
2733 | yyerror("ttl delay \"%s\" is too short", yyvsp[0].v.string); | |||
2734 | free(yyvsp[0].v.string); | |||
2735 | YYERRORgoto yyerrlab; | |||
2736 | } | |||
2737 | free(yyvsp[0].v.string); | |||
2738 | } | |||
2739 | break; | |||
2740 | case 82: | |||
2741 | #line 573 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2742 | { | |||
2743 | if (dsp->u.local.is_mbox) { | |||
2744 | yyerror("user may not be specified for this dispatcher"); | |||
2745 | YYERRORgoto yyerrlab; | |||
2746 | } | |||
2747 | ||||
2748 | if (dsp->u.local.forward_only) { | |||
2749 | yyerror("user may not be specified for forward-only"); | |||
2750 | YYERRORgoto yyerrlab; | |||
2751 | } | |||
2752 | ||||
2753 | if (dsp->u.local.expand_only) { | |||
2754 | yyerror("user may not be specified for expand-only"); | |||
2755 | YYERRORgoto yyerrlab; | |||
2756 | } | |||
2757 | ||||
2758 | if (dsp->u.local.user) { | |||
2759 | yyerror("user already specified for this dispatcher"); | |||
2760 | YYERRORgoto yyerrlab; | |||
2761 | } | |||
2762 | ||||
2763 | dsp->u.local.user = yyvsp[0].v.string; | |||
2764 | } | |||
2765 | break; | |||
2766 | case 83: | |||
2767 | #line 596 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2768 | { | |||
2769 | struct table *t = yyvsp[0].v.table; | |||
2770 | ||||
2771 | if (dsp->u.local.table_alias) { | |||
2772 | yyerror("alias mapping already specified for this dispatcher"); | |||
2773 | YYERRORgoto yyerrlab; | |||
2774 | } | |||
2775 | ||||
2776 | if (dsp->u.local.table_virtual) { | |||
2777 | yyerror("virtual mapping already specified for this dispatcher"); | |||
2778 | YYERRORgoto yyerrlab; | |||
2779 | } | |||
2780 | ||||
2781 | if (!table_check_use(t, T_DYNAMIC|T_HASH, K_ALIAS)) { | |||
2782 | yyerror("table \"%s\" may not be used for alias lookups", | |||
2783 | t->t_name); | |||
2784 | YYERRORgoto yyerrlab; | |||
2785 | } | |||
2786 | ||||
2787 | dsp->u.local.table_alias = strdup(t->t_name); | |||
2788 | } | |||
2789 | break; | |||
2790 | case 84: | |||
2791 | #line 617 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2792 | { | |||
2793 | struct table *t = yyvsp[0].v.table; | |||
2794 | ||||
2795 | if (dsp->u.local.table_virtual) { | |||
2796 | yyerror("virtual mapping already specified for this dispatcher"); | |||
2797 | YYERRORgoto yyerrlab; | |||
2798 | } | |||
2799 | ||||
2800 | if (dsp->u.local.table_alias) { | |||
2801 | yyerror("alias mapping already specified for this dispatcher"); | |||
2802 | YYERRORgoto yyerrlab; | |||
2803 | } | |||
2804 | ||||
2805 | if (!table_check_use(t, T_DYNAMIC|T_HASH, K_ALIAS)) { | |||
2806 | yyerror("table \"%s\" may not be used for virtual lookups", | |||
2807 | t->t_name); | |||
2808 | YYERRORgoto yyerrlab; | |||
2809 | } | |||
2810 | ||||
2811 | dsp->u.local.table_virtual = strdup(t->t_name); | |||
2812 | } | |||
2813 | break; | |||
2814 | case 85: | |||
2815 | #line 638 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2816 | { | |||
2817 | struct table *t = yyvsp[0].v.table; | |||
2818 | ||||
2819 | if (dsp->u.local.table_userbase) { | |||
2820 | yyerror("userbase mapping already specified for this dispatcher"); | |||
2821 | YYERRORgoto yyerrlab; | |||
2822 | } | |||
2823 | ||||
2824 | if (!table_check_use(t, T_DYNAMIC|T_HASH, K_USERINFO)) { | |||
2825 | yyerror("table \"%s\" may not be used for userbase lookups", | |||
2826 | t->t_name); | |||
2827 | YYERRORgoto yyerrlab; | |||
2828 | } | |||
2829 | ||||
2830 | dsp->u.local.table_userbase = strdup(t->t_name); | |||
2831 | } | |||
2832 | break; | |||
2833 | case 86: | |||
2834 | #line 654 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2835 | { | |||
2836 | if (! dict_get(conf->sc_mda_wrappers, yyvsp[0].v.string)) { | |||
2837 | yyerror("no mda wrapper with that name: %s", yyvsp[0].v.string); | |||
2838 | YYERRORgoto yyerrlab; | |||
2839 | } | |||
2840 | dsp->u.local.mda_wrapper = yyvsp[0].v.string; | |||
2841 | } | |||
2842 | break; | |||
2843 | case 89: | |||
2844 | #line 669 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2845 | { | |||
2846 | dsp->u.local.is_mbox = 1; | |||
2847 | asprintf(&dsp->u.local.command, "/usr/libexec/mail.local -f %%{mbox.from} -- %%{user.username}"); | |||
2848 | } | |||
2849 | break; | |||
2850 | case 91: | |||
2851 | #line 673 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2852 | { | |||
2853 | asprintf(&dsp->u.local.command, "/usr/libexec/mail.maildir"); | |||
2854 | } | |||
2855 | break; | |||
2856 | case 93: | |||
2857 | #line 676 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2858 | { | |||
2859 | asprintf(&dsp->u.local.command, "/usr/libexec/mail.maildir -j"); | |||
2860 | } | |||
2861 | break; | |||
2862 | case 95: | |||
2863 | #line 679 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2864 | { | |||
2865 | if (strncmp(yyvsp[0].v.string, "~/", 2) == 0) | |||
2866 | asprintf(&dsp->u.local.command, | |||
2867 | "/usr/libexec/mail.maildir \"%%{user.directory}/%s\"", yyvsp[0].v.string+2); | |||
2868 | else | |||
2869 | asprintf(&dsp->u.local.command, | |||
2870 | "/usr/libexec/mail.maildir \"%s\"", yyvsp[0].v.string); | |||
2871 | } | |||
2872 | break; | |||
2873 | case 97: | |||
2874 | #line 687 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2875 | { | |||
2876 | if (strncmp(yyvsp[-1].v.string, "~/", 2) == 0) | |||
2877 | asprintf(&dsp->u.local.command, | |||
2878 | "/usr/libexec/mail.maildir -j \"%%{user.directory}/%s\"", yyvsp[-1].v.string+2); | |||
2879 | else | |||
2880 | asprintf(&dsp->u.local.command, | |||
2881 | "/usr/libexec/mail.maildir -j \"%s\"", yyvsp[-1].v.string); | |||
2882 | } | |||
2883 | break; | |||
2884 | case 99: | |||
2885 | #line 695 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2886 | { | |||
2887 | asprintf(&dsp->u.local.command, | |||
2888 | "/usr/libexec/mail.lmtp -d %s -u", yyvsp[0].v.string); | |||
2889 | dsp->u.local.user = SMTPD_USER"_smtpd"; | |||
2890 | } | |||
2891 | break; | |||
2892 | case 101: | |||
2893 | #line 700 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2894 | { | |||
2895 | asprintf(&dsp->u.local.command, | |||
2896 | "/usr/libexec/mail.lmtp -d %s -r", yyvsp[-1].v.string); | |||
2897 | dsp->u.local.user = SMTPD_USER"_smtpd"; | |||
2898 | } | |||
2899 | break; | |||
2900 | case 103: | |||
2901 | #line 705 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2902 | { | |||
2903 | asprintf(&dsp->u.local.command, | |||
2904 | "/usr/libexec/mail.mda \"%s\"", yyvsp[0].v.string); | |||
2905 | } | |||
2906 | break; | |||
2907 | case 105: | |||
2908 | #line 709 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2909 | { | |||
2910 | dsp->u.local.forward_only = 1; | |||
2911 | } | |||
2912 | break; | |||
2913 | case 107: | |||
2914 | #line 712 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2915 | { | |||
2916 | dsp->u.local.expand_only = 1; | |||
2917 | } | |||
2918 | break; | |||
2919 | case 109: | |||
2920 | #line 719 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2921 | { | |||
2922 | if (dsp->u.remote.helo) { | |||
2923 | yyerror("helo already specified for this dispatcher"); | |||
2924 | YYERRORgoto yyerrlab; | |||
2925 | } | |||
2926 | ||||
2927 | dsp->u.remote.helo = yyvsp[0].v.string; | |||
2928 | } | |||
2929 | break; | |||
2930 | case 110: | |||
2931 | #line 727 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2932 | { | |||
2933 | struct table *t = yyvsp[0].v.table; | |||
2934 | ||||
2935 | if (dsp->u.remote.helo_source) { | |||
2936 | yyerror("helo-source mapping already specified for this dispatcher"); | |||
2937 | YYERRORgoto yyerrlab; | |||
2938 | } | |||
2939 | if (!table_check_use(t, T_DYNAMIC|T_HASH, K_ADDRNAME)) { | |||
2940 | yyerror("table \"%s\" may not be used for helo-source lookups", | |||
2941 | t->t_name); | |||
2942 | YYERRORgoto yyerrlab; | |||
2943 | } | |||
2944 | ||||
2945 | dsp->u.remote.helo_source = strdup(t->t_name); | |||
2946 | } | |||
2947 | break; | |||
2948 | case 111: | |||
2949 | #line 742 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2950 | { | |||
2951 | if (dsp->u.remote.pki) { | |||
2952 | yyerror("pki already specified for this dispatcher"); | |||
2953 | YYERRORgoto yyerrlab; | |||
2954 | } | |||
2955 | ||||
2956 | dsp->u.remote.pki = yyvsp[0].v.string; | |||
2957 | } | |||
2958 | break; | |||
2959 | case 112: | |||
2960 | #line 750 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2961 | { | |||
2962 | if (dsp->u.remote.ca) { | |||
2963 | yyerror("ca already specified for this dispatcher"); | |||
2964 | YYERRORgoto yyerrlab; | |||
2965 | } | |||
2966 | ||||
2967 | dsp->u.remote.ca = yyvsp[0].v.string; | |||
2968 | } | |||
2969 | break; | |||
2970 | case 113: | |||
2971 | #line 758 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2972 | { | |||
2973 | if (dsp->u.remote.tls_ciphers) { | |||
2974 | yyerror("ciphers already specified for this dispatcher"); | |||
2975 | YYERRORgoto yyerrlab; | |||
2976 | } | |||
2977 | ||||
2978 | dsp->u.remote.tls_ciphers = yyvsp[0].v.string; | |||
2979 | } | |||
2980 | break; | |||
2981 | case 114: | |||
2982 | #line 766 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2983 | { | |||
2984 | if (dsp->u.remote.tls_protocols) { | |||
2985 | yyerror("protocols already specified for this dispatcher"); | |||
2986 | YYERRORgoto yyerrlab; | |||
2987 | } | |||
2988 | ||||
2989 | dsp->u.remote.tls_protocols = yyvsp[0].v.string; | |||
2990 | } | |||
2991 | break; | |||
2992 | case 115: | |||
2993 | #line 774 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
2994 | { | |||
2995 | struct table *t = yyvsp[0].v.table; | |||
2996 | ||||
2997 | if (dsp->u.remote.source) { | |||
2998 | yyerror("source mapping already specified for this dispatcher"); | |||
2999 | YYERRORgoto yyerrlab; | |||
3000 | } | |||
3001 | ||||
3002 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_SOURCE)) { | |||
3003 | yyerror("table \"%s\" may not be used for source lookups", | |||
3004 | t->t_name); | |||
3005 | YYERRORgoto yyerrlab; | |||
3006 | } | |||
3007 | ||||
3008 | dsp->u.remote.source = strdup(t->t_name); | |||
3009 | } | |||
3010 | break; | |||
3011 | case 116: | |||
3012 | #line 790 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3013 | { | |||
3014 | if (dsp->u.remote.mail_from) { | |||
3015 | yyerror("mail-from already specified for this dispatcher"); | |||
3016 | YYERRORgoto yyerrlab; | |||
3017 | } | |||
3018 | ||||
3019 | dsp->u.remote.mail_from = yyvsp[0].v.string; | |||
3020 | } | |||
3021 | break; | |||
3022 | case 117: | |||
3023 | #line 798 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3024 | { | |||
3025 | if (dsp->u.remote.backup) { | |||
3026 | yyerror("backup already specified for this dispatcher"); | |||
3027 | YYERRORgoto yyerrlab; | |||
3028 | } | |||
3029 | if (dsp->u.remote.smarthost) { | |||
3030 | yyerror("backup and host are mutually exclusive"); | |||
3031 | YYERRORgoto yyerrlab; | |||
3032 | } | |||
3033 | ||||
3034 | dsp->u.remote.backup = 1; | |||
3035 | dsp->u.remote.backupmx = yyvsp[0].v.string; | |||
3036 | } | |||
3037 | break; | |||
3038 | case 118: | |||
3039 | #line 811 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3040 | { | |||
3041 | if (dsp->u.remote.backup) { | |||
3042 | yyerror("backup already specified for this dispatcher"); | |||
3043 | YYERRORgoto yyerrlab; | |||
3044 | } | |||
3045 | if (dsp->u.remote.smarthost) { | |||
3046 | yyerror("backup and host are mutually exclusive"); | |||
3047 | YYERRORgoto yyerrlab; | |||
3048 | } | |||
3049 | ||||
3050 | dsp->u.remote.backup = 1; | |||
3051 | } | |||
3052 | break; | |||
3053 | case 119: | |||
3054 | #line 823 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3055 | { | |||
3056 | struct table *t = yyvsp[0].v.table; | |||
3057 | ||||
3058 | if (dsp->u.remote.smarthost) { | |||
3059 | yyerror("host mapping already specified for this dispatcher"); | |||
3060 | YYERRORgoto yyerrlab; | |||
3061 | } | |||
3062 | if (dsp->u.remote.backup) { | |||
3063 | yyerror("backup and host are mutually exclusive"); | |||
3064 | YYERRORgoto yyerrlab; | |||
3065 | } | |||
3066 | ||||
3067 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_RELAYHOST)) { | |||
3068 | yyerror("table \"%s\" may not be used for host lookups", | |||
3069 | t->t_name); | |||
3070 | YYERRORgoto yyerrlab; | |||
3071 | } | |||
3072 | ||||
3073 | dsp->u.remote.smarthost = strdup(t->t_name); | |||
3074 | } | |||
3075 | break; | |||
3076 | case 120: | |||
3077 | #line 843 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3078 | { | |||
3079 | struct table *t = yyvsp[0].v.table; | |||
3080 | ||||
3081 | if (dsp->u.remote.smarthost) { | |||
3082 | yyerror("host mapping already specified for this dispatcher"); | |||
3083 | YYERRORgoto yyerrlab; | |||
3084 | } | |||
3085 | if (dsp->u.remote.backup) { | |||
3086 | yyerror("backup and domain are mutually exclusive"); | |||
3087 | YYERRORgoto yyerrlab; | |||
3088 | } | |||
3089 | ||||
3090 | if (!table_check_use(t, T_DYNAMIC|T_HASH, K_RELAYHOST)) { | |||
3091 | yyerror("table \"%s\" may not be used for host lookups", | |||
3092 | t->t_name); | |||
3093 | YYERRORgoto yyerrlab; | |||
3094 | } | |||
3095 | ||||
3096 | dsp->u.remote.smarthost = strdup(t->t_name); | |||
3097 | dsp->u.remote.smarthost_domain = 1; | |||
3098 | } | |||
3099 | break; | |||
3100 | case 121: | |||
3101 | #line 864 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3102 | { | |||
3103 | if (dsp->u.remote.tls_required == 1) { | |||
3104 | yyerror("tls already specified for this dispatcher"); | |||
3105 | YYERRORgoto yyerrlab; | |||
3106 | } | |||
3107 | ||||
3108 | dsp->u.remote.tls_required = 1; | |||
3109 | } | |||
3110 | break; | |||
3111 | case 122: | |||
3112 | #line 872 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3113 | { | |||
3114 | if (dsp->u.remote.tls_required == 1) { | |||
3115 | yyerror("tls already specified for this dispatcher"); | |||
3116 | YYERRORgoto yyerrlab; | |||
3117 | } | |||
3118 | ||||
3119 | dsp->u.remote.tls_required = 1; | |||
3120 | dsp->u.remote.tls_noverify = 1; | |||
3121 | } | |||
3122 | break; | |||
3123 | case 123: | |||
3124 | #line 881 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3125 | { | |||
3126 | struct table *t = yyvsp[0].v.table; | |||
3127 | ||||
3128 | if (dsp->u.remote.smarthost == NULL((void *)0)) { | |||
3129 | yyerror("auth may not be specified without host on a dispatcher"); | |||
3130 | YYERRORgoto yyerrlab; | |||
3131 | } | |||
3132 | ||||
3133 | if (dsp->u.remote.auth) { | |||
3134 | yyerror("auth mapping already specified for this dispatcher"); | |||
3135 | YYERRORgoto yyerrlab; | |||
3136 | } | |||
3137 | ||||
3138 | if (!table_check_use(t, T_DYNAMIC|T_HASH, K_CREDENTIALS)) { | |||
3139 | yyerror("table \"%s\" may not be used for auth lookups", | |||
3140 | t->t_name); | |||
3141 | YYERRORgoto yyerrlab; | |||
3142 | } | |||
3143 | ||||
3144 | dsp->u.remote.auth = strdup(t->t_name); | |||
3145 | } | |||
3146 | break; | |||
3147 | case 124: | |||
3148 | #line 902 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3149 | { | |||
3150 | struct filter_config *fc; | |||
3151 | ||||
3152 | if (dsp->u.remote.filtername) { | |||
3153 | yyerror("filter already specified for this dispatcher"); | |||
3154 | YYERRORgoto yyerrlab; | |||
3155 | } | |||
3156 | ||||
3157 | if ((fc = dict_get(conf->sc_filters_dict, yyvsp[0].v.string)) == NULL((void *)0)) { | |||
3158 | yyerror("no filter exist with that name: %s", yyvsp[0].v.string); | |||
3159 | free(yyvsp[0].v.string); | |||
3160 | YYERRORgoto yyerrlab; | |||
3161 | } | |||
3162 | fc->filter_subsystem |= FILTER_SUBSYSTEM_SMTP_OUT; | |||
3163 | dsp->u.remote.filtername = yyvsp[0].v.string; | |||
3164 | } | |||
3165 | break; | |||
3166 | case 125: | |||
3167 | #line 918 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3168 | { | |||
3169 | char buffer[128]; | |||
3170 | char *filtername; | |||
3171 | ||||
3172 | if (dsp->u.remote.filtername) { | |||
3173 | yyerror("filter already specified for this dispatcher"); | |||
3174 | YYERRORgoto yyerrlab; | |||
3175 | } | |||
3176 | ||||
3177 | do { | |||
3178 | (void)snprintf(buffer, sizeof buffer, "<dynchain:%08x>", last_dynchain_id++); | |||
3179 | } while (dict_check(conf->sc_filters_dict, buffer)); | |||
3180 | ||||
3181 | filtername = xstrdup(buffer); | |||
3182 | filter_config = xcalloc(1, sizeof *filter_config); | |||
3183 | filter_config->filter_type = FILTER_TYPE_CHAIN; | |||
3184 | filter_config->filter_subsystem |= FILTER_SUBSYSTEM_SMTP_OUT; | |||
3185 | dict_init(&filter_config->chain_procs)do { do { (&((&filter_config->chain_procs)->dict ))->sph_root = ((void *)0); } while (0); (&filter_config ->chain_procs)->count = 0; } while(0); | |||
3186 | dsp->u.remote.filtername = filtername; | |||
3187 | } | |||
3188 | break; | |||
3189 | case 126: | |||
3190 | #line 937 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3191 | { | |||
3192 | dict_set(conf->sc_filters_dict, dsp->u.remote.filtername, filter_config); | |||
3193 | filter_config = NULL((void *)0); | |||
3194 | } | |||
3195 | break; | |||
3196 | case 127: | |||
3197 | #line 941 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3198 | { | |||
3199 | if (conf->sc_srs_key == NULL((void *)0)) { | |||
3200 | yyerror("an srs key is required for srs to be specified in an action"); | |||
3201 | YYERRORgoto yyerrlab; | |||
3202 | } | |||
3203 | if (dsp->u.remote.srs == 1) { | |||
3204 | yyerror("srs already specified for this dispatcher"); | |||
3205 | YYERRORgoto yyerrlab; | |||
3206 | } | |||
3207 | ||||
3208 | dsp->u.remote.srs = 1; | |||
3209 | } | |||
3210 | break; | |||
3211 | case 131: | |||
3212 | #line 965 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3213 | { | |||
3214 | dsp->type = DISPATCHER_LOCAL; | |||
3215 | } | |||
3216 | break; | |||
3217 | case 132: | |||
3218 | #line 968 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3219 | { | |||
3220 | dsp->type = DISPATCHER_REMOTE; | |||
3221 | } | |||
3222 | break; | |||
3223 | case 133: | |||
3224 | #line 974 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3225 | { | |||
3226 | if (dsp->ttl) { | |||
3227 | yyerror("ttl already specified for this dispatcher"); | |||
3228 | YYERRORgoto yyerrlab; | |||
3229 | } | |||
3230 | ||||
3231 | dsp->ttl = delaytonum(yyvsp[0].v.string); | |||
3232 | if (dsp->ttl == -1) { | |||
3233 | yyerror("ttl delay \"%s\" is invalid", yyvsp[0].v.string); | |||
3234 | free(yyvsp[0].v.string); | |||
3235 | YYERRORgoto yyerrlab; | |||
3236 | } | |||
3237 | free(yyvsp[0].v.string); | |||
3238 | } | |||
3239 | break; | |||
3240 | case 136: | |||
3241 | #line 996 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3242 | { | |||
3243 | if (dict_get(conf->sc_dispatchers, yyvsp[0].v.string)) { | |||
3244 | yyerror("dispatcher already declared with that name: %s", yyvsp[0].v.string); | |||
3245 | YYERRORgoto yyerrlab; | |||
3246 | } | |||
3247 | dsp = xcalloc(1, sizeof *dsp); | |||
3248 | } | |||
3249 | break; | |||
3250 | case 137: | |||
3251 | #line 1002 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3252 | { | |||
3253 | if (dsp->type == DISPATCHER_LOCAL) | |||
3254 | if (dsp->u.local.table_userbase == NULL((void *)0)) | |||
3255 | dsp->u.local.table_userbase = "<getpwnam>"; | |||
3256 | dict_set(conf->sc_dispatchers, yyvsp[-3].v.string, dsp); | |||
3257 | dsp = NULL((void *)0); | |||
3258 | } | |||
3259 | break; | |||
3260 | case 138: | |||
3261 | #line 1012 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3262 | { | |||
3263 | struct table *t = yyvsp[0].v.table; | |||
3264 | ||||
3265 | if (rule->flag_tag) { | |||
3266 | yyerror("tag already specified for this rule"); | |||
3267 | YYERRORgoto yyerrlab; | |||
3268 | } | |||
3269 | ||||
3270 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_STRING)) { | |||
3271 | yyerror("table \"%s\" may not be used for tag lookups", | |||
3272 | t->t_name); | |||
3273 | YYERRORgoto yyerrlab; | |||
3274 | } | |||
3275 | ||||
3276 | rule->flag_tag = yyvsp[-2].v.number ? -1 : 1; | |||
3277 | rule->table_tag = strdup(t->t_name); | |||
3278 | } | |||
3279 | break; | |||
3280 | case 139: | |||
3281 | #line 1030 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3282 | { | |||
3283 | struct table *t = yyvsp[0].v.table; | |||
3284 | ||||
3285 | if (rule->flag_tag) { | |||
3286 | yyerror("tag already specified for this rule"); | |||
3287 | YYERRORgoto yyerrlab; | |||
3288 | } | |||
3289 | ||||
3290 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3291 | yyerror("table \"%s\" may not be used for tag lookups", | |||
3292 | t->t_name); | |||
3293 | YYERRORgoto yyerrlab; | |||
3294 | } | |||
3295 | ||||
3296 | rule->flag_tag = yyvsp[-3].v.number ? -1 : 1; | |||
3297 | rule->flag_tag_regex = 1; | |||
3298 | rule->table_tag = strdup(t->t_name); | |||
3299 | } | |||
3300 | break; | |||
3301 | case 140: | |||
3302 | #line 1049 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3303 | { | |||
3304 | struct table *t = yyvsp[0].v.table; | |||
3305 | ||||
3306 | if (rule->flag_smtp_helo) { | |||
3307 | yyerror("helo already specified for this rule"); | |||
3308 | YYERRORgoto yyerrlab; | |||
3309 | } | |||
3310 | ||||
3311 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_DOMAIN)) { | |||
3312 | yyerror("table \"%s\" may not be used for helo lookups", | |||
3313 | t->t_name); | |||
3314 | YYERRORgoto yyerrlab; | |||
3315 | } | |||
3316 | ||||
3317 | rule->flag_smtp_helo = yyvsp[-2].v.number ? -1 : 1; | |||
3318 | rule->table_smtp_helo = strdup(t->t_name); | |||
3319 | } | |||
3320 | break; | |||
3321 | case 141: | |||
3322 | #line 1066 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3323 | { | |||
3324 | struct table *t = yyvsp[0].v.table; | |||
3325 | ||||
3326 | if (rule->flag_smtp_helo) { | |||
3327 | yyerror("helo already specified for this rule"); | |||
3328 | YYERRORgoto yyerrlab; | |||
3329 | } | |||
3330 | ||||
3331 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3332 | yyerror("table \"%s\" may not be used for helo lookups", | |||
3333 | t->t_name); | |||
3334 | YYERRORgoto yyerrlab; | |||
3335 | } | |||
3336 | ||||
3337 | rule->flag_smtp_helo = yyvsp[-3].v.number ? -1 : 1; | |||
3338 | rule->flag_smtp_helo_regex = 1; | |||
3339 | rule->table_smtp_helo = strdup(t->t_name); | |||
3340 | } | |||
3341 | break; | |||
3342 | case 142: | |||
3343 | #line 1084 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3344 | { | |||
3345 | if (rule->flag_smtp_starttls) { | |||
3346 | yyerror("tls already specified for this rule"); | |||
3347 | YYERRORgoto yyerrlab; | |||
3348 | } | |||
3349 | rule->flag_smtp_starttls = yyvsp[-1].v.number ? -1 : 1; | |||
3350 | } | |||
3351 | break; | |||
3352 | case 143: | |||
3353 | #line 1091 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3354 | { | |||
3355 | if (rule->flag_smtp_auth) { | |||
3356 | yyerror("auth already specified for this rule"); | |||
3357 | YYERRORgoto yyerrlab; | |||
3358 | } | |||
3359 | rule->flag_smtp_auth = yyvsp[-1].v.number ? -1 : 1; | |||
3360 | } | |||
3361 | break; | |||
3362 | case 144: | |||
3363 | #line 1098 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3364 | { | |||
3365 | struct table *t = yyvsp[0].v.table; | |||
3366 | ||||
3367 | if (rule->flag_smtp_auth) { | |||
3368 | yyerror("auth already specified for this rule"); | |||
3369 | YYERRORgoto yyerrlab; | |||
3370 | } | |||
3371 | ||||
3372 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_STRING|K_CREDENTIALS)) { | |||
3373 | yyerror("table \"%s\" may not be used for auth lookups", | |||
3374 | t->t_name); | |||
3375 | YYERRORgoto yyerrlab; | |||
3376 | } | |||
3377 | ||||
3378 | rule->flag_smtp_auth = yyvsp[-2].v.number ? -1 : 1; | |||
3379 | rule->table_smtp_auth = strdup(t->t_name); | |||
3380 | } | |||
3381 | break; | |||
3382 | case 145: | |||
3383 | #line 1115 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3384 | { | |||
3385 | struct table *t = yyvsp[0].v.table; | |||
3386 | ||||
3387 | if (rule->flag_smtp_auth) { | |||
3388 | yyerror("auth already specified for this rule"); | |||
3389 | YYERRORgoto yyerrlab; | |||
3390 | } | |||
3391 | ||||
3392 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3393 | yyerror("table \"%s\" may not be used for auth lookups", | |||
3394 | t->t_name); | |||
3395 | YYERRORgoto yyerrlab; | |||
3396 | } | |||
3397 | ||||
3398 | rule->flag_smtp_auth = yyvsp[-3].v.number ? -1 : 1; | |||
3399 | rule->flag_smtp_auth_regex = 1; | |||
3400 | rule->table_smtp_auth = strdup(t->t_name); | |||
3401 | } | |||
3402 | break; | |||
3403 | case 146: | |||
3404 | #line 1133 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3405 | { | |||
3406 | struct table *t = yyvsp[0].v.table; | |||
3407 | ||||
3408 | if (rule->flag_smtp_mail_from) { | |||
3409 | yyerror("mail-from already specified for this rule"); | |||
3410 | YYERRORgoto yyerrlab; | |||
3411 | } | |||
3412 | ||||
3413 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_MAILADDR)) { | |||
3414 | yyerror("table \"%s\" may not be used for mail-from lookups", | |||
3415 | t->t_name); | |||
3416 | YYERRORgoto yyerrlab; | |||
3417 | } | |||
3418 | ||||
3419 | rule->flag_smtp_mail_from = yyvsp[-2].v.number ? -1 : 1; | |||
3420 | rule->table_smtp_mail_from = strdup(t->t_name); | |||
3421 | } | |||
3422 | break; | |||
3423 | case 147: | |||
3424 | #line 1150 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3425 | { | |||
3426 | struct table *t = yyvsp[0].v.table; | |||
3427 | ||||
3428 | if (rule->flag_smtp_mail_from) { | |||
3429 | yyerror("mail-from already specified for this rule"); | |||
3430 | YYERRORgoto yyerrlab; | |||
3431 | } | |||
3432 | ||||
3433 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3434 | yyerror("table \"%s\" may not be used for mail-from lookups", | |||
3435 | t->t_name); | |||
3436 | YYERRORgoto yyerrlab; | |||
3437 | } | |||
3438 | ||||
3439 | rule->flag_smtp_mail_from = yyvsp[-3].v.number ? -1 : 1; | |||
3440 | rule->flag_smtp_mail_from_regex = 1; | |||
3441 | rule->table_smtp_mail_from = strdup(t->t_name); | |||
3442 | } | |||
3443 | break; | |||
3444 | case 148: | |||
3445 | #line 1168 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3446 | { | |||
3447 | struct table *t = yyvsp[0].v.table; | |||
3448 | ||||
3449 | if (rule->flag_smtp_rcpt_to) { | |||
3450 | yyerror("rcpt-to already specified for this rule"); | |||
3451 | YYERRORgoto yyerrlab; | |||
3452 | } | |||
3453 | ||||
3454 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_MAILADDR)) { | |||
3455 | yyerror("table \"%s\" may not be used for rcpt-to lookups", | |||
3456 | t->t_name); | |||
3457 | YYERRORgoto yyerrlab; | |||
3458 | } | |||
3459 | ||||
3460 | rule->flag_smtp_rcpt_to = yyvsp[-2].v.number ? -1 : 1; | |||
3461 | rule->table_smtp_rcpt_to = strdup(t->t_name); | |||
3462 | } | |||
3463 | break; | |||
3464 | case 149: | |||
3465 | #line 1185 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3466 | { | |||
3467 | struct table *t = yyvsp[0].v.table; | |||
3468 | ||||
3469 | if (rule->flag_smtp_rcpt_to) { | |||
3470 | yyerror("rcpt-to already specified for this rule"); | |||
3471 | YYERRORgoto yyerrlab; | |||
3472 | } | |||
3473 | ||||
3474 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3475 | yyerror("table \"%s\" may not be used for rcpt-to lookups", | |||
3476 | t->t_name); | |||
3477 | YYERRORgoto yyerrlab; | |||
3478 | } | |||
3479 | ||||
3480 | rule->flag_smtp_rcpt_to = yyvsp[-3].v.number ? -1 : 1; | |||
3481 | rule->flag_smtp_rcpt_to_regex = 1; | |||
3482 | rule->table_smtp_rcpt_to = strdup(t->t_name); | |||
3483 | } | |||
3484 | break; | |||
3485 | case 150: | |||
3486 | #line 1204 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3487 | { | |||
3488 | if (rule->flag_from) { | |||
3489 | yyerror("from already specified for this rule"); | |||
3490 | YYERRORgoto yyerrlab; | |||
3491 | } | |||
3492 | rule->flag_from = yyvsp[-2].v.number ? -1 : 1; | |||
3493 | rule->flag_from_socket = 1; | |||
3494 | } | |||
3495 | break; | |||
3496 | case 151: | |||
3497 | #line 1212 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3498 | { | |||
3499 | struct table *t = table_find(conf, "<localhost>"); | |||
3500 | ||||
3501 | if (rule->flag_from) { | |||
3502 | yyerror("from already specified for this rule"); | |||
3503 | YYERRORgoto yyerrlab; | |||
3504 | } | |||
3505 | rule->flag_from = yyvsp[-2].v.number ? -1 : 1; | |||
3506 | rule->table_from = strdup(t->t_name); | |||
3507 | } | |||
3508 | break; | |||
3509 | case 152: | |||
3510 | #line 1222 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3511 | { | |||
3512 | struct table *t = table_find(conf, "<anyhost>"); | |||
3513 | ||||
3514 | if (rule->flag_from) { | |||
3515 | yyerror("from already specified for this rule"); | |||
3516 | YYERRORgoto yyerrlab; | |||
3517 | } | |||
3518 | rule->flag_from = yyvsp[-2].v.number ? -1 : 1; | |||
3519 | rule->table_from = strdup(t->t_name); | |||
3520 | } | |||
3521 | break; | |||
3522 | case 153: | |||
3523 | #line 1232 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3524 | { | |||
3525 | struct table *t = yyvsp[0].v.table; | |||
3526 | ||||
3527 | if (rule->flag_from) { | |||
3528 | yyerror("from already specified for this rule"); | |||
3529 | YYERRORgoto yyerrlab; | |||
3530 | } | |||
3531 | ||||
3532 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_NETADDR)) { | |||
3533 | yyerror("table \"%s\" may not be used for from lookups", | |||
3534 | t->t_name); | |||
3535 | YYERRORgoto yyerrlab; | |||
3536 | } | |||
3537 | ||||
3538 | rule->flag_from = yyvsp[-3].v.number ? -1 : 1; | |||
3539 | rule->table_from = strdup(t->t_name); | |||
3540 | } | |||
3541 | break; | |||
3542 | case 154: | |||
3543 | #line 1249 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3544 | { | |||
3545 | struct table *t = yyvsp[0].v.table; | |||
3546 | ||||
3547 | if (rule->flag_from) { | |||
3548 | yyerror("from already specified for this rule"); | |||
3549 | YYERRORgoto yyerrlab; | |||
3550 | } | |||
3551 | ||||
3552 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3553 | yyerror("table \"%s\" may not be used for from lookups", | |||
3554 | t->t_name); | |||
3555 | YYERRORgoto yyerrlab; | |||
3556 | } | |||
3557 | ||||
3558 | rule->flag_from = yyvsp[-4].v.number ? -1 : 1; | |||
3559 | rule->flag_from_regex = 1; | |||
3560 | rule->table_from = strdup(t->t_name); | |||
3561 | } | |||
3562 | break; | |||
3563 | case 155: | |||
3564 | #line 1267 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3565 | { | |||
3566 | if (rule->flag_from) { | |||
3567 | yyerror("from already specified for this rule"); | |||
3568 | YYERRORgoto yyerrlab; | |||
3569 | } | |||
3570 | rule->flag_from = yyvsp[-2].v.number ? -1 : 1; | |||
3571 | rule->flag_from_rdns = 1; | |||
3572 | } | |||
3573 | break; | |||
3574 | case 156: | |||
3575 | #line 1275 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3576 | { | |||
3577 | struct table *t = yyvsp[0].v.table; | |||
3578 | ||||
3579 | if (rule->flag_from) { | |||
3580 | yyerror("from already specified for this rule"); | |||
3581 | YYERRORgoto yyerrlab; | |||
3582 | } | |||
3583 | ||||
3584 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_DOMAIN)) { | |||
3585 | yyerror("table \"%s\" may not be used for rdns lookups", | |||
3586 | t->t_name); | |||
3587 | YYERRORgoto yyerrlab; | |||
3588 | } | |||
3589 | ||||
3590 | rule->flag_from = yyvsp[-3].v.number ? -1 : 1; | |||
3591 | rule->flag_from_rdns = 1; | |||
3592 | rule->table_from = strdup(t->t_name); | |||
3593 | } | |||
3594 | break; | |||
3595 | case 157: | |||
3596 | #line 1293 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3597 | { | |||
3598 | struct table *t = yyvsp[0].v.table; | |||
3599 | ||||
3600 | if (rule->flag_from) { | |||
3601 | yyerror("from already specified for this rule"); | |||
3602 | YYERRORgoto yyerrlab; | |||
3603 | } | |||
3604 | ||||
3605 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_DOMAIN)) { | |||
3606 | yyerror("table \"%s\" may not be used for rdns lookups", | |||
3607 | t->t_name); | |||
3608 | YYERRORgoto yyerrlab; | |||
3609 | } | |||
3610 | ||||
3611 | rule->flag_from = yyvsp[-4].v.number ? -1 : 1; | |||
3612 | rule->flag_from_regex = 1; | |||
3613 | rule->flag_from_rdns = 1; | |||
3614 | rule->table_from = strdup(t->t_name); | |||
3615 | } | |||
3616 | break; | |||
3617 | case 158: | |||
3618 | #line 1313 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3619 | { | |||
3620 | struct table *anyhost = table_find(conf, "<anyhost>"); | |||
3621 | ||||
3622 | if (rule->flag_from) { | |||
3623 | yyerror("from already specified for this rule"); | |||
3624 | YYERRORgoto yyerrlab; | |||
3625 | } | |||
3626 | ||||
3627 | rule->flag_from = 1; | |||
3628 | rule->table_from = strdup(anyhost->t_name); | |||
3629 | rule->flag_smtp_auth = yyvsp[-2].v.number ? -1 : 1; | |||
3630 | } | |||
3631 | break; | |||
3632 | case 159: | |||
3633 | #line 1325 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3634 | { | |||
3635 | struct table *anyhost = table_find(conf, "<anyhost>"); | |||
3636 | struct table *t = yyvsp[0].v.table; | |||
3637 | ||||
3638 | if (rule->flag_from) { | |||
3639 | yyerror("from already specified for this rule"); | |||
3640 | YYERRORgoto yyerrlab; | |||
3641 | } | |||
3642 | ||||
3643 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_STRING|K_CREDENTIALS)) { | |||
3644 | yyerror("table \"%s\" may not be used for from lookups", | |||
3645 | t->t_name); | |||
3646 | YYERRORgoto yyerrlab; | |||
3647 | } | |||
3648 | ||||
3649 | rule->flag_from = 1; | |||
3650 | rule->table_from = strdup(anyhost->t_name); | |||
3651 | rule->flag_smtp_auth = yyvsp[-3].v.number ? -1 : 1; | |||
3652 | rule->table_smtp_auth = strdup(t->t_name); | |||
3653 | } | |||
3654 | break; | |||
3655 | case 160: | |||
3656 | #line 1345 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3657 | { | |||
3658 | struct table *anyhost = table_find(conf, "<anyhost>"); | |||
3659 | struct table *t = yyvsp[0].v.table; | |||
3660 | ||||
3661 | if (rule->flag_from) { | |||
3662 | yyerror("from already specified for this rule"); | |||
3663 | YYERRORgoto yyerrlab; | |||
3664 | } | |||
3665 | ||||
3666 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3667 | yyerror("table \"%s\" may not be used for from lookups", | |||
3668 | t->t_name); | |||
3669 | YYERRORgoto yyerrlab; | |||
3670 | } | |||
3671 | ||||
3672 | rule->flag_from = 1; | |||
3673 | rule->table_from = strdup(anyhost->t_name); | |||
3674 | rule->flag_smtp_auth = yyvsp[-4].v.number ? -1 : 1; | |||
3675 | rule->flag_smtp_auth_regex = 1; | |||
3676 | rule->table_smtp_auth = strdup(t->t_name); | |||
3677 | } | |||
3678 | break; | |||
3679 | case 161: | |||
3680 | #line 1367 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3681 | { | |||
3682 | struct table *anyhost = table_find(conf, "<anyhost>"); | |||
3683 | struct table *t = yyvsp[0].v.table; | |||
3684 | ||||
3685 | if (rule->flag_from) { | |||
3686 | yyerror("from already specified for this rule"); | |||
3687 | YYERRORgoto yyerrlab; | |||
3688 | } | |||
3689 | ||||
3690 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_MAILADDR)) { | |||
3691 | yyerror("table \"%s\" may not be used for from lookups", | |||
3692 | t->t_name); | |||
3693 | YYERRORgoto yyerrlab; | |||
3694 | } | |||
3695 | ||||
3696 | rule->flag_from = 1; | |||
3697 | rule->table_from = strdup(anyhost->t_name); | |||
3698 | rule->flag_smtp_mail_from = yyvsp[-3].v.number ? -1 : 1; | |||
3699 | rule->table_smtp_mail_from = strdup(t->t_name); | |||
3700 | } | |||
3701 | break; | |||
3702 | case 162: | |||
3703 | #line 1387 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3704 | { | |||
3705 | struct table *anyhost = table_find(conf, "<anyhost>"); | |||
3706 | struct table *t = yyvsp[0].v.table; | |||
3707 | ||||
3708 | if (rule->flag_from) { | |||
3709 | yyerror("from already specified for this rule"); | |||
3710 | YYERRORgoto yyerrlab; | |||
3711 | } | |||
3712 | ||||
3713 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3714 | yyerror("table \"%s\" may not be used for from lookups", | |||
3715 | t->t_name); | |||
3716 | YYERRORgoto yyerrlab; | |||
3717 | } | |||
3718 | ||||
3719 | rule->flag_from = 1; | |||
3720 | rule->table_from = strdup(anyhost->t_name); | |||
3721 | rule->flag_smtp_mail_from = yyvsp[-4].v.number ? -1 : 1; | |||
3722 | rule->flag_smtp_mail_from_regex = 1; | |||
3723 | rule->table_smtp_mail_from = strdup(t->t_name); | |||
3724 | } | |||
3725 | break; | |||
3726 | case 163: | |||
3727 | #line 1409 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3728 | { | |||
3729 | struct table *t = table_find(conf, "<localnames>"); | |||
3730 | ||||
3731 | if (rule->flag_for) { | |||
3732 | yyerror("for already specified for this rule"); | |||
3733 | YYERRORgoto yyerrlab; | |||
3734 | } | |||
3735 | rule->flag_for = yyvsp[-2].v.number ? -1 : 1; | |||
3736 | rule->table_for = strdup(t->t_name); | |||
3737 | } | |||
3738 | break; | |||
3739 | case 164: | |||
3740 | #line 1419 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3741 | { | |||
3742 | struct table *t = table_find(conf, "<anydestination>"); | |||
3743 | ||||
3744 | if (rule->flag_for) { | |||
3745 | yyerror("for already specified for this rule"); | |||
3746 | YYERRORgoto yyerrlab; | |||
3747 | } | |||
3748 | rule->flag_for = yyvsp[-2].v.number ? -1 : 1; | |||
3749 | rule->table_for = strdup(t->t_name); | |||
3750 | } | |||
3751 | break; | |||
3752 | case 165: | |||
3753 | #line 1429 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3754 | { | |||
3755 | struct table *t = yyvsp[0].v.table; | |||
3756 | ||||
3757 | if (rule->flag_for) { | |||
3758 | yyerror("for already specified for this rule"); | |||
3759 | YYERRORgoto yyerrlab; | |||
3760 | } | |||
3761 | ||||
3762 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_DOMAIN)) { | |||
3763 | yyerror("table \"%s\" may not be used for 'for' lookups", | |||
3764 | t->t_name); | |||
3765 | YYERRORgoto yyerrlab; | |||
3766 | } | |||
3767 | ||||
3768 | rule->flag_for = yyvsp[-3].v.number ? -1 : 1; | |||
3769 | rule->table_for = strdup(t->t_name); | |||
3770 | } | |||
3771 | break; | |||
3772 | case 166: | |||
3773 | #line 1446 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3774 | { | |||
3775 | struct table *t = yyvsp[0].v.table; | |||
3776 | ||||
3777 | if (rule->flag_for) { | |||
3778 | yyerror("for already specified for this rule"); | |||
3779 | YYERRORgoto yyerrlab; | |||
3780 | } | |||
3781 | ||||
3782 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3783 | yyerror("table \"%s\" may not be used for 'for' lookups", | |||
3784 | t->t_name); | |||
3785 | YYERRORgoto yyerrlab; | |||
3786 | } | |||
3787 | ||||
3788 | rule->flag_for = yyvsp[-4].v.number ? -1 : 1; | |||
3789 | rule->flag_for_regex = 1; | |||
3790 | rule->table_for = strdup(t->t_name); | |||
3791 | } | |||
3792 | break; | |||
3793 | case 167: | |||
3794 | #line 1464 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3795 | { | |||
3796 | struct table *anyhost = table_find(conf, "<anydestination>"); | |||
3797 | struct table *t = yyvsp[0].v.table; | |||
3798 | ||||
3799 | if (rule->flag_for) { | |||
3800 | yyerror("for already specified for this rule"); | |||
3801 | YYERRORgoto yyerrlab; | |||
3802 | } | |||
3803 | ||||
3804 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_MAILADDR)) { | |||
3805 | yyerror("table \"%s\" may not be used for for lookups", | |||
3806 | t->t_name); | |||
3807 | YYERRORgoto yyerrlab; | |||
3808 | } | |||
3809 | ||||
3810 | rule->flag_for = 1; | |||
3811 | rule->table_for = strdup(anyhost->t_name); | |||
3812 | rule->flag_smtp_rcpt_to = yyvsp[-3].v.number ? -1 : 1; | |||
3813 | rule->table_smtp_rcpt_to = strdup(t->t_name); | |||
3814 | } | |||
3815 | break; | |||
3816 | case 168: | |||
3817 | #line 1484 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3818 | { | |||
3819 | struct table *anyhost = table_find(conf, "<anydestination>"); | |||
3820 | struct table *t = yyvsp[0].v.table; | |||
3821 | ||||
3822 | if (rule->flag_for) { | |||
3823 | yyerror("for already specified for this rule"); | |||
3824 | YYERRORgoto yyerrlab; | |||
3825 | } | |||
3826 | ||||
3827 | if (!table_check_use(t, T_DYNAMIC|T_LIST, K_REGEX)) { | |||
3828 | yyerror("table \"%s\" may not be used for for lookups", | |||
3829 | t->t_name); | |||
3830 | YYERRORgoto yyerrlab; | |||
3831 | } | |||
3832 | ||||
3833 | rule->flag_for = 1; | |||
3834 | rule->table_for = strdup(anyhost->t_name); | |||
3835 | rule->flag_smtp_rcpt_to = yyvsp[-4].v.number ? -1 : 1; | |||
3836 | rule->flag_smtp_rcpt_to_regex = 1; | |||
3837 | rule->table_smtp_rcpt_to = strdup(t->t_name); | |||
3838 | } | |||
3839 | break; | |||
3840 | case 171: | |||
3841 | #line 1513 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3842 | { | |||
3843 | if (dict_get(conf->sc_dispatchers, yyvsp[0].v.string) == NULL((void *)0)) { | |||
3844 | yyerror("no such dispatcher: %s", yyvsp[0].v.string); | |||
3845 | YYERRORgoto yyerrlab; | |||
3846 | } | |||
3847 | rule->dispatcher = yyvsp[0].v.string; | |||
3848 | } | |||
3849 | break; | |||
3850 | case 172: | |||
3851 | #line 1523 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3852 | { | |||
3853 | rule->reject = 1; | |||
3854 | } | |||
3855 | break; | |||
3856 | case 174: | |||
3857 | #line 1530 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3858 | { | |||
3859 | rule = xcalloc(1, sizeof *rule); | |||
3860 | } | |||
3861 | break; | |||
3862 | case 175: | |||
3863 | #line 1532 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3864 | { | |||
3865 | if (!rule->flag_from) { | |||
3866 | rule->table_from = strdup("<localhost>"); | |||
3867 | rule->flag_from = 1; | |||
3868 | } | |||
3869 | if (!rule->flag_for) { | |||
3870 | rule->table_for = strdup("<localnames>"); | |||
3871 | rule->flag_for = 1; | |||
3872 | } | |||
3873 | TAILQ_INSERT_TAIL(conf->sc_rules, rule, r_entry)do { (rule)->r_entry.tqe_next = ((void *)0); (rule)->r_entry .tqe_prev = (conf->sc_rules)->tqh_last; *(conf->sc_rules )->tqh_last = (rule); (conf->sc_rules)->tqh_last = & (rule)->r_entry.tqe_next; } while (0); | |||
3874 | rule = NULL((void *)0); | |||
3875 | } | |||
3876 | break; | |||
3877 | case 177: | |||
3878 | #line 1548 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3879 | { | |||
3880 | filter_config->junk = 1; | |||
3881 | } | |||
3882 | break; | |||
3883 | case 178: | |||
3884 | #line 1551 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3885 | { | |||
3886 | filter_config->bypass = 1; | |||
3887 | } | |||
3888 | break; | |||
3889 | case 179: | |||
3890 | #line 1557 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3891 | { | |||
3892 | filter_config->reject = yyvsp[0].v.string; | |||
3893 | } | |||
3894 | break; | |||
3895 | case 180: | |||
3896 | #line 1560 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3897 | { | |||
3898 | filter_config->disconnect = yyvsp[0].v.string; | |||
3899 | } | |||
3900 | break; | |||
3901 | case 181: | |||
3902 | #line 1563 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3903 | { | |||
3904 | filter_config->rewrite = yyvsp[0].v.string; | |||
3905 | } | |||
3906 | break; | |||
3907 | case 182: | |||
3908 | #line 1566 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3909 | { | |||
3910 | filter_config->report = yyvsp[0].v.string; | |||
3911 | } | |||
3912 | break; | |||
3913 | case 183: | |||
3914 | #line 1572 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3915 | { | |||
3916 | filter_config->not_fcrdns = yyvsp[-1].v.number ? -1 : 1; | |||
3917 | filter_config->fcrdns = 1; | |||
3918 | } | |||
3919 | break; | |||
3920 | case 184: | |||
3921 | #line 1579 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3922 | { | |||
3923 | filter_config->not_rdns = yyvsp[-1].v.number ? -1 : 1; | |||
3924 | filter_config->rdns = 1; | |||
3925 | } | |||
3926 | break; | |||
3927 | case 185: | |||
3928 | #line 1586 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3929 | { | |||
3930 | filter_config->not_rdns_table = yyvsp[-2].v.number ? -1 : 1; | |||
3931 | filter_config->rdns_table = yyvsp[0].v.table; | |||
3932 | } | |||
3933 | break; | |||
3934 | case 186: | |||
3935 | #line 1592 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3936 | { | |||
3937 | filter_config->not_rdns_regex = yyvsp[-3].v.number ? -1 : 1; | |||
3938 | filter_config->rdns_regex = yyvsp[0].v.table; | |||
3939 | } | |||
3940 | break; | |||
3941 | case 187: | |||
3942 | #line 1599 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3943 | { | |||
3944 | filter_config->not_src_table = yyvsp[-2].v.number ? -1 : 1; | |||
3945 | filter_config->src_table = yyvsp[0].v.table; | |||
3946 | } | |||
3947 | break; | |||
3948 | case 188: | |||
3949 | #line 1605 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3950 | { | |||
3951 | filter_config->not_src_regex = yyvsp[-3].v.number ? -1 : 1; | |||
3952 | filter_config->src_regex = yyvsp[0].v.table; | |||
3953 | } | |||
3954 | break; | |||
3955 | case 189: | |||
3956 | #line 1612 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3957 | { | |||
3958 | filter_config->not_helo_table = yyvsp[-2].v.number ? -1 : 1; | |||
3959 | filter_config->helo_table = yyvsp[0].v.table; | |||
3960 | } | |||
3961 | break; | |||
3962 | case 190: | |||
3963 | #line 1618 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3964 | { | |||
3965 | filter_config->not_helo_regex = yyvsp[-3].v.number ? -1 : 1; | |||
3966 | filter_config->helo_regex = yyvsp[0].v.table; | |||
3967 | } | |||
3968 | break; | |||
3969 | case 191: | |||
3970 | #line 1625 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3971 | { | |||
3972 | filter_config->not_auth = yyvsp[-1].v.number ? -1 : 1; | |||
3973 | filter_config->auth = 1; | |||
3974 | } | |||
3975 | break; | |||
3976 | case 192: | |||
3977 | #line 1631 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3978 | { | |||
3979 | filter_config->not_auth_table = yyvsp[-2].v.number ? -1 : 1; | |||
3980 | filter_config->auth_table = yyvsp[0].v.table; | |||
3981 | } | |||
3982 | break; | |||
3983 | case 193: | |||
3984 | #line 1637 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3985 | { | |||
3986 | filter_config->not_auth_regex = yyvsp[-3].v.number ? -1 : 1; | |||
3987 | filter_config->auth_regex = yyvsp[0].v.table; | |||
3988 | } | |||
3989 | break; | |||
3990 | case 194: | |||
3991 | #line 1644 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3992 | { | |||
3993 | filter_config->not_mail_from_table = yyvsp[-2].v.number ? -1 : 1; | |||
3994 | filter_config->mail_from_table = yyvsp[0].v.table; | |||
3995 | } | |||
3996 | break; | |||
3997 | case 195: | |||
3998 | #line 1650 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
3999 | { | |||
4000 | filter_config->not_mail_from_regex = yyvsp[-3].v.number ? -1 : 1; | |||
4001 | filter_config->mail_from_regex = yyvsp[0].v.table; | |||
4002 | } | |||
4003 | break; | |||
4004 | case 196: | |||
4005 | #line 1657 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4006 | { | |||
4007 | filter_config->not_rcpt_to_table = yyvsp[-2].v.number ? -1 : 1; | |||
4008 | filter_config->rcpt_to_table = yyvsp[0].v.table; | |||
4009 | } | |||
4010 | break; | |||
4011 | case 197: | |||
4012 | #line 1663 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4013 | { | |||
4014 | filter_config->not_rcpt_to_regex = yyvsp[-3].v.number ? -1 : 1; | |||
4015 | filter_config->rcpt_to_regex = yyvsp[0].v.table; | |||
4016 | } | |||
4017 | break; | |||
4018 | case 248: | |||
4019 | #line 1754 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4020 | { | |||
4021 | filter_config->phase = FILTER_CONNECT; | |||
4022 | } | |||
4023 | break; | |||
4024 | case 250: | |||
4025 | #line 1761 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4026 | { | |||
4027 | filter_config->phase = FILTER_HELO; | |||
4028 | } | |||
4029 | break; | |||
4030 | case 252: | |||
4031 | #line 1767 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4032 | { | |||
4033 | filter_config->phase = FILTER_EHLO; | |||
4034 | } | |||
4035 | break; | |||
4036 | case 254: | |||
4037 | #line 1773 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4038 | { | |||
4039 | } | |||
4040 | break; | |||
4041 | case 256: | |||
4042 | #line 1778 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4043 | { | |||
4044 | filter_config->phase = FILTER_MAIL_FROM; | |||
4045 | } | |||
4046 | break; | |||
4047 | case 258: | |||
4048 | #line 1784 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4049 | { | |||
4050 | filter_config->phase = FILTER_RCPT_TO; | |||
4051 | } | |||
4052 | break; | |||
4053 | case 260: | |||
4054 | #line 1790 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4055 | { | |||
4056 | filter_config->phase = FILTER_DATA; | |||
4057 | } | |||
4058 | break; | |||
4059 | case 262: | |||
4060 | #line 1822 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4061 | { | |||
4062 | filter_config->phase = FILTER_COMMIT; | |||
4063 | } | |||
4064 | break; | |||
4065 | case 272: | |||
4066 | #line 1846 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4067 | { | |||
4068 | struct filter_config *fr; | |||
4069 | size_t i; | |||
4070 | ||||
4071 | if ((fr = dict_get(conf->sc_filters_dict, yyvsp[0].v.string)) == NULL((void *)0)) { | |||
4072 | yyerror("no filter exist with that name: %s", yyvsp[0].v.string); | |||
4073 | free(yyvsp[0].v.string); | |||
4074 | YYERRORgoto yyerrlab; | |||
4075 | } | |||
4076 | if (fr->filter_type == FILTER_TYPE_CHAIN) { | |||
4077 | yyerror("no filter chain allowed within a filter chain: %s", yyvsp[0].v.string); | |||
4078 | free(yyvsp[0].v.string); | |||
4079 | YYERRORgoto yyerrlab; | |||
4080 | } | |||
4081 | ||||
4082 | for (i = 0; i < filter_config->chain_size; i++) { | |||
4083 | if (strcmp(filter_config->chain[i], yyvsp[0].v.string) == 0) { | |||
4084 | yyerror("no filter allowed twice within a filter chain: %s", yyvsp[0].v.string); | |||
4085 | free(yyvsp[0].v.string); | |||
4086 | YYERRORgoto yyerrlab; | |||
4087 | } | |||
4088 | } | |||
4089 | ||||
4090 | if (fr->proc) { | |||
4091 | if (dict_get(&filter_config->chain_procs, fr->proc)) { | |||
4092 | yyerror("no proc allowed twice within a filter chain: %s", fr->proc); | |||
4093 | free(yyvsp[0].v.string); | |||
4094 | YYERRORgoto yyerrlab; | |||
4095 | } | |||
4096 | dict_set(&filter_config->chain_procs, fr->proc, NULL((void *)0)); | |||
4097 | } | |||
4098 | ||||
4099 | fr->filter_subsystem |= filter_config->filter_subsystem; | |||
4100 | filter_config->chain_size += 1; | |||
4101 | filter_config->chain = reallocarray(filter_config->chain, filter_config->chain_size, sizeof(char *)); | |||
4102 | if (filter_config->chain == NULL((void *)0)) | |||
4103 | fatal("reallocarray"); | |||
4104 | filter_config->chain[filter_config->chain_size - 1] = yyvsp[0].v.string; | |||
4105 | } | |||
4106 | break; | |||
4107 | case 275: | |||
4108 | #line 1893 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4109 | { | |||
4110 | ||||
4111 | if (dict_get(conf->sc_filters_dict, yyvsp[-2].v.string)) { | |||
4112 | yyerror("filter already exists with that name: %s", yyvsp[-2].v.string); | |||
4113 | free(yyvsp[-2].v.string); | |||
4114 | free(yyvsp[0].v.string); | |||
4115 | YYERRORgoto yyerrlab; | |||
4116 | } | |||
4117 | if (dict_get(conf->sc_filter_processes_dict, yyvsp[0].v.string) == NULL((void *)0)) { | |||
4118 | yyerror("no processor exist with that name: %s", yyvsp[0].v.string); | |||
4119 | free(yyvsp[0].v.string); | |||
4120 | YYERRORgoto yyerrlab; | |||
4121 | } | |||
4122 | ||||
4123 | filter_config = xcalloc(1, sizeof *filter_config); | |||
4124 | filter_config->filter_type = FILTER_TYPE_PROC; | |||
4125 | filter_config->name = yyvsp[-2].v.string; | |||
4126 | filter_config->proc = yyvsp[0].v.string; | |||
4127 | dict_set(conf->sc_filters_dict, yyvsp[-2].v.string, filter_config); | |||
4128 | filter_config = NULL((void *)0); | |||
4129 | } | |||
4130 | break; | |||
4131 | case 276: | |||
4132 | #line 1915 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4133 | { | |||
4134 | if (dict_get(conf->sc_filters_dict, yyvsp[-2].v.string)) { | |||
4135 | yyerror("filter already exists with that name: %s", yyvsp[-2].v.string); | |||
4136 | free(yyvsp[-2].v.string); | |||
4137 | free(yyvsp[0].v.string); | |||
4138 | YYERRORgoto yyerrlab; | |||
4139 | } | |||
4140 | ||||
4141 | processor = xcalloc(1, sizeof *processor); | |||
4142 | processor->command = yyvsp[0].v.string; | |||
4143 | ||||
4144 | filter_config = xcalloc(1, sizeof *filter_config); | |||
4145 | filter_config->filter_type = FILTER_TYPE_PROC; | |||
4146 | filter_config->name = yyvsp[-2].v.string; | |||
4147 | filter_config->proc = xstrdup(yyvsp[-2].v.string); | |||
4148 | dict_set(conf->sc_filters_dict, yyvsp[-2].v.string, filter_config); | |||
4149 | } | |||
4150 | break; | |||
4151 | case 277: | |||
4152 | #line 1931 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4153 | { | |||
4154 | dict_set(conf->sc_filter_processes_dict, filter_config->proc, processor); | |||
4155 | processor = NULL((void *)0); | |||
4156 | filter_config = NULL((void *)0); | |||
4157 | } | |||
4158 | break; | |||
4159 | case 278: | |||
4160 | #line 1937 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4161 | { | |||
4162 | if (dict_get(conf->sc_filters_dict, yyvsp[-1].v.string)) { | |||
4163 | yyerror("filter already exists with that name: %s", yyvsp[-1].v.string); | |||
4164 | free(yyvsp[-1].v.string); | |||
4165 | YYERRORgoto yyerrlab; | |||
4166 | } | |||
4167 | filter_config = xcalloc(1, sizeof *filter_config); | |||
4168 | filter_config->name = yyvsp[-1].v.string; | |||
4169 | filter_config->filter_type = FILTER_TYPE_BUILTIN; | |||
4170 | dict_set(conf->sc_filters_dict, yyvsp[-1].v.string, filter_config); | |||
4171 | } | |||
4172 | break; | |||
4173 | case 279: | |||
4174 | #line 1947 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4175 | { | |||
4176 | filter_config = NULL((void *)0); | |||
4177 | } | |||
4178 | break; | |||
4179 | case 280: | |||
4180 | #line 1951 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4181 | { | |||
4182 | if (dict_get(conf->sc_filters_dict, yyvsp[-1].v.string)) { | |||
4183 | yyerror("filter already exists with that name: %s", yyvsp[-1].v.string); | |||
4184 | free(yyvsp[-1].v.string); | |||
4185 | YYERRORgoto yyerrlab; | |||
4186 | } | |||
4187 | filter_config = xcalloc(1, sizeof *filter_config); | |||
4188 | filter_config->filter_type = FILTER_TYPE_CHAIN; | |||
4189 | dict_init(&filter_config->chain_procs)do { do { (&((&filter_config->chain_procs)->dict ))->sph_root = ((void *)0); } while (0); (&filter_config ->chain_procs)->count = 0; } while(0); | |||
4190 | } | |||
4191 | break; | |||
4192 | case 281: | |||
4193 | #line 1960 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4194 | { | |||
4195 | dict_set(conf->sc_filters_dict, yyvsp[-5].v.string, filter_config); | |||
4196 | filter_config = NULL((void *)0); | |||
4197 | } | |||
4198 | break; | |||
4199 | case 282: | |||
4200 | #line 1966 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4201 | { | |||
4202 | if (yyvsp[0].v.number < 0) { | |||
4203 | yyerror("invalid size: %" PRId64"lld", yyvsp[0].v.number); | |||
4204 | YYERRORgoto yyerrlab; | |||
4205 | } | |||
4206 | yyval.v.number = yyvsp[0].v.number; | |||
4207 | } | |||
4208 | break; | |||
4209 | case 283: | |||
4210 | #line 1973 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4211 | { | |||
4212 | long long result; | |||
4213 | ||||
4214 | if (scan_scaled(yyvsp[0].v.string, &result) == -1 || result < 0) { | |||
4215 | yyerror("invalid size: %s", yyvsp[0].v.string); | |||
4216 | free(yyvsp[0].v.string); | |||
4217 | YYERRORgoto yyerrlab; | |||
4218 | } | |||
4219 | free(yyvsp[0].v.string); | |||
4220 | yyval.v.number = result; | |||
4221 | } | |||
4222 | break; | |||
4223 | case 284: | |||
4224 | #line 1986 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4225 | { | |||
4226 | time_t d; | |||
4227 | int i; | |||
4228 | ||||
4229 | d = delaytonum(yyvsp[0].v.string); | |||
4230 | if (d < 0) { | |||
4231 | yyerror("invalid bounce delay: %s", yyvsp[0].v.string); | |||
4232 | free(yyvsp[0].v.string); | |||
4233 | YYERRORgoto yyerrlab; | |||
4234 | } | |||
4235 | free(yyvsp[0].v.string); | |||
4236 | for (i = 0; i < MAX_BOUNCE_WARN4; i++) { | |||
4237 | if (conf->sc_bounce_warn[i] != 0) | |||
4238 | continue; | |||
4239 | conf->sc_bounce_warn[i] = d; | |||
4240 | break; | |||
4241 | } | |||
4242 | } | |||
4243 | break; | |||
4244 | case 287: | |||
4245 | #line 2010 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4246 | { | |||
4247 | if (!strcmp(yyvsp[-1].v.string, "max-session")) { | |||
4248 | conf->sc_mda_max_session = yyvsp[0].v.number; | |||
4249 | } | |||
4250 | else if (!strcmp(yyvsp[-1].v.string, "max-session-per-user")) { | |||
4251 | conf->sc_mda_max_user_session = yyvsp[0].v.number; | |||
4252 | } | |||
4253 | else if (!strcmp(yyvsp[-1].v.string, "task-lowat")) { | |||
4254 | conf->sc_mda_task_lowat = yyvsp[0].v.number; | |||
4255 | } | |||
4256 | else if (!strcmp(yyvsp[-1].v.string, "task-hiwat")) { | |||
4257 | conf->sc_mda_task_hiwat = yyvsp[0].v.number; | |||
4258 | } | |||
4259 | else if (!strcmp(yyvsp[-1].v.string, "task-release")) { | |||
4260 | conf->sc_mda_task_release = yyvsp[0].v.number; | |||
4261 | } | |||
4262 | else { | |||
4263 | yyerror("invalid scheduler limit keyword: %s", yyvsp[-1].v.string); | |||
4264 | free(yyvsp[-1].v.string); | |||
4265 | YYERRORgoto yyerrlab; | |||
4266 | } | |||
4267 | free(yyvsp[-1].v.string); | |||
4268 | } | |||
4269 | break; | |||
4270 | case 290: | |||
4271 | #line 2039 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4272 | { | |||
4273 | if (!strcmp(yyvsp[-1].v.string, "max-rcpt")) { | |||
4274 | conf->sc_session_max_rcpt = yyvsp[0].v.number; | |||
4275 | } | |||
4276 | else if (!strcmp(yyvsp[-1].v.string, "max-mails")) { | |||
4277 | conf->sc_session_max_mails = yyvsp[0].v.number; | |||
4278 | } | |||
4279 | else { | |||
4280 | yyerror("invalid session limit keyword: %s", yyvsp[-1].v.string); | |||
4281 | free(yyvsp[-1].v.string); | |||
4282 | YYERRORgoto yyerrlab; | |||
4283 | } | |||
4284 | free(yyvsp[-1].v.string); | |||
4285 | } | |||
4286 | break; | |||
4287 | case 293: | |||
4288 | #line 2059 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4289 | { | |||
4290 | limits->family = AF_INET2; | |||
4291 | } | |||
4292 | break; | |||
4293 | case 294: | |||
4294 | #line 2062 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4295 | { | |||
4296 | limits->family = AF_INET624; | |||
4297 | } | |||
4298 | break; | |||
4299 | case 295: | |||
4300 | #line 2065 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4301 | { | |||
4302 | if (!limit_mta_set(limits, yyvsp[-1].v.string, yyvsp[0].v.number)) { | |||
4303 | yyerror("invalid mta limit keyword: %s", yyvsp[-1].v.string); | |||
4304 | free(yyvsp[-1].v.string); | |||
4305 | YYERRORgoto yyerrlab; | |||
4306 | } | |||
4307 | free(yyvsp[-1].v.string); | |||
4308 | } | |||
4309 | break; | |||
4310 | case 298: | |||
4311 | #line 2079 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4312 | { | |||
4313 | if (!strcmp(yyvsp[-1].v.string, "max-inflight")) { | |||
4314 | conf->sc_scheduler_max_inflight = yyvsp[0].v.number; | |||
4315 | } | |||
4316 | else if (!strcmp(yyvsp[-1].v.string, "max-evp-batch-size")) { | |||
4317 | conf->sc_scheduler_max_evp_batch_size = yyvsp[0].v.number; | |||
4318 | } | |||
4319 | else if (!strcmp(yyvsp[-1].v.string, "max-msg-batch-size")) { | |||
4320 | conf->sc_scheduler_max_msg_batch_size = yyvsp[0].v.number; | |||
4321 | } | |||
4322 | else if (!strcmp(yyvsp[-1].v.string, "max-schedule")) { | |||
4323 | conf->sc_scheduler_max_schedule = yyvsp[0].v.number; | |||
4324 | } | |||
4325 | else { | |||
4326 | yyerror("invalid scheduler limit keyword: %s", yyvsp[-1].v.string); | |||
4327 | free(yyvsp[-1].v.string); | |||
4328 | YYERRORgoto yyerrlab; | |||
4329 | } | |||
4330 | free(yyvsp[-1].v.string); | |||
4331 | } | |||
4332 | break; | |||
4333 | case 301: | |||
4334 | #line 2106 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4335 | { | |||
4336 | struct filter_config *fc; | |||
4337 | ||||
4338 | if (listen_opts.options & LO_FILTER) { | |||
4339 | yyerror("filter already specified"); | |||
4340 | free(yyvsp[0].v.string); | |||
4341 | YYERRORgoto yyerrlab; | |||
4342 | } | |||
4343 | if ((fc = dict_get(conf->sc_filters_dict, yyvsp[0].v.string)) == NULL((void *)0)) { | |||
4344 | yyerror("no filter exist with that name: %s", yyvsp[0].v.string); | |||
4345 | free(yyvsp[0].v.string); | |||
4346 | YYERRORgoto yyerrlab; | |||
4347 | } | |||
4348 | fc->filter_subsystem |= FILTER_SUBSYSTEM_SMTP_IN; | |||
4349 | listen_opts.options |= LO_FILTER; | |||
4350 | listen_opts.filtername = yyvsp[0].v.string; | |||
4351 | } | |||
4352 | break; | |||
4353 | case 302: | |||
4354 | #line 2123 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4355 | { | |||
4356 | char buffer[128]; | |||
4357 | ||||
4358 | if (listen_opts.options & LO_FILTER) { | |||
4359 | yyerror("filter already specified"); | |||
4360 | YYERRORgoto yyerrlab; | |||
4361 | } | |||
4362 | ||||
4363 | do { | |||
4364 | (void)snprintf(buffer, sizeof buffer, "<dynchain:%08x>", last_dynchain_id++); | |||
4365 | } while (dict_check(conf->sc_filters_dict, buffer)); | |||
4366 | ||||
4367 | listen_opts.options |= LO_FILTER; | |||
4368 | listen_opts.filtername = xstrdup(buffer); | |||
4369 | filter_config = xcalloc(1, sizeof *filter_config); | |||
4370 | filter_config->filter_type = FILTER_TYPE_CHAIN; | |||
4371 | filter_config->filter_subsystem |= FILTER_SUBSYSTEM_SMTP_IN; | |||
4372 | dict_init(&filter_config->chain_procs)do { do { (&((&filter_config->chain_procs)->dict ))->sph_root = ((void *)0); } while (0); (&filter_config ->chain_procs)->count = 0; } while(0); | |||
4373 | } | |||
4374 | break; | |||
4375 | case 303: | |||
4376 | #line 2141 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4377 | { | |||
4378 | dict_set(conf->sc_filters_dict, listen_opts.filtername, filter_config); | |||
4379 | filter_config = NULL((void *)0); | |||
4380 | } | |||
4381 | break; | |||
4382 | case 304: | |||
4383 | #line 2145 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4384 | { | |||
4385 | if (config_lo_mask_source(&listen_opts)) { | |||
4386 | YYERRORgoto yyerrlab; | |||
4387 | } | |||
4388 | } | |||
4389 | break; | |||
4390 | case 305: | |||
4391 | #line 2150 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4392 | { | |||
4393 | if (listen_opts.options & LO_TAG) { | |||
4394 | yyerror("tag already specified"); | |||
4395 | YYERRORgoto yyerrlab; | |||
4396 | } | |||
4397 | listen_opts.options |= LO_TAG; | |||
4398 | ||||
4399 | if (strlen(yyvsp[0].v.string) >= SMTPD_TAG_SIZE(32 + 1)) { | |||
4400 | yyerror("tag name too long"); | |||
4401 | free(yyvsp[0].v.string); | |||
4402 | YYERRORgoto yyerrlab; | |||
4403 | } | |||
4404 | listen_opts.tag = yyvsp[0].v.string; | |||
4405 | } | |||
4406 | break; | |||
4407 | case 306: | |||
4408 | #line 2166 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4409 | { | |||
4410 | if (listen_opts.options & LO_FAMILY) { | |||
4411 | yyerror("address family already specified"); | |||
4412 | YYERRORgoto yyerrlab; | |||
4413 | } | |||
4414 | listen_opts.options |= LO_FAMILY; | |||
4415 | listen_opts.family = AF_INET2; | |||
4416 | } | |||
4417 | break; | |||
4418 | case 307: | |||
4419 | #line 2174 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4420 | { | |||
4421 | if (listen_opts.options & LO_FAMILY) { | |||
4422 | yyerror("address family already specified"); | |||
4423 | YYERRORgoto yyerrlab; | |||
4424 | } | |||
4425 | listen_opts.options |= LO_FAMILY; | |||
4426 | listen_opts.family = AF_INET624; | |||
4427 | } | |||
4428 | break; | |||
4429 | case 308: | |||
4430 | #line 2182 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4431 | { | |||
4432 | struct servent *servent; | |||
4433 | ||||
4434 | if (listen_opts.options & LO_PORT) { | |||
4435 | yyerror("port already specified"); | |||
4436 | YYERRORgoto yyerrlab; | |||
4437 | } | |||
4438 | listen_opts.options |= LO_PORT; | |||
4439 | ||||
4440 | servent = getservbyname(yyvsp[0].v.string, "tcp"); | |||
4441 | if (servent == NULL((void *)0)) { | |||
4442 | yyerror("invalid port: %s", yyvsp[0].v.string); | |||
4443 | free(yyvsp[0].v.string); | |||
4444 | YYERRORgoto yyerrlab; | |||
4445 | } | |||
4446 | free(yyvsp[0].v.string); | |||
4447 | listen_opts.port = ntohs(servent->s_port)(__uint16_t)(__builtin_constant_p(servent->s_port) ? (__uint16_t )(((__uint16_t)(servent->s_port) & 0xffU) << 8 | ((__uint16_t)(servent->s_port) & 0xff00U) >> 8) : __swap16md(servent->s_port)); | |||
4448 | } | |||
4449 | break; | |||
4450 | case 309: | |||
4451 | #line 2200 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4452 | { | |||
4453 | struct servent *servent; | |||
4454 | ||||
4455 | if (listen_opts.options & LO_PORT) { | |||
4456 | yyerror("port already specified"); | |||
4457 | YYERRORgoto yyerrlab; | |||
4458 | } | |||
4459 | listen_opts.options |= LO_PORT; | |||
4460 | ||||
4461 | servent = getservbyname("smtp", "tcp"); | |||
4462 | if (servent == NULL((void *)0)) { | |||
4463 | yyerror("invalid port: smtp"); | |||
4464 | YYERRORgoto yyerrlab; | |||
4465 | } | |||
4466 | listen_opts.port = ntohs(servent->s_port)(__uint16_t)(__builtin_constant_p(servent->s_port) ? (__uint16_t )(((__uint16_t)(servent->s_port) & 0xffU) << 8 | ((__uint16_t)(servent->s_port) & 0xff00U) >> 8) : __swap16md(servent->s_port)); | |||
4467 | } | |||
4468 | break; | |||
4469 | case 310: | |||
4470 | #line 2216 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4471 | { | |||
4472 | struct servent *servent; | |||
4473 | ||||
4474 | if (listen_opts.options & LO_PORT) { | |||
4475 | yyerror("port already specified"); | |||
4476 | YYERRORgoto yyerrlab; | |||
4477 | } | |||
4478 | listen_opts.options |= LO_PORT; | |||
4479 | ||||
4480 | servent = getservbyname("smtps", "tcp"); | |||
4481 | if (servent == NULL((void *)0)) { | |||
4482 | yyerror("invalid port: smtps"); | |||
4483 | YYERRORgoto yyerrlab; | |||
4484 | } | |||
4485 | listen_opts.port = ntohs(servent->s_port)(__uint16_t)(__builtin_constant_p(servent->s_port) ? (__uint16_t )(((__uint16_t)(servent->s_port) & 0xffU) << 8 | ((__uint16_t)(servent->s_port) & 0xff00U) >> 8) : __swap16md(servent->s_port)); | |||
4486 | } | |||
4487 | break; | |||
4488 | case 311: | |||
4489 | #line 2232 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4490 | { | |||
4491 | if (listen_opts.options & LO_PORT) { | |||
4492 | yyerror("port already specified"); | |||
4493 | YYERRORgoto yyerrlab; | |||
4494 | } | |||
4495 | listen_opts.options |= LO_PORT; | |||
4496 | ||||
4497 | if (yyvsp[0].v.number <= 0 || yyvsp[0].v.number > (int)USHRT_MAX(32767 *2 +1)) { | |||
4498 | yyerror("invalid port: %" PRId64"lld", yyvsp[0].v.number); | |||
4499 | YYERRORgoto yyerrlab; | |||
4500 | } | |||
4501 | listen_opts.port = yyvsp[0].v.number; | |||
4502 | } | |||
4503 | break; | |||
4504 | case 312: | |||
4505 | #line 2245 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4506 | { | |||
4507 | struct filter_config *fc; | |||
4508 | ||||
4509 | if (listen_opts.options & LO_FILTER) { | |||
4510 | yyerror("filter already specified"); | |||
4511 | YYERRORgoto yyerrlab; | |||
4512 | } | |||
4513 | if ((fc = dict_get(conf->sc_filters_dict, yyvsp[0].v.string)) == NULL((void *)0)) { | |||
4514 | yyerror("no filter exist with that name: %s", yyvsp[0].v.string); | |||
4515 | free(yyvsp[0].v.string); | |||
4516 | YYERRORgoto yyerrlab; | |||
4517 | } | |||
4518 | fc->filter_subsystem |= FILTER_SUBSYSTEM_SMTP_IN; | |||
4519 | listen_opts.options |= LO_FILTER; | |||
4520 | listen_opts.filtername = yyvsp[0].v.string; | |||
4521 | } | |||
4522 | break; | |||
4523 | case 313: | |||
4524 | #line 2261 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4525 | { | |||
4526 | char buffer[128]; | |||
4527 | ||||
4528 | if (listen_opts.options & LO_FILTER) { | |||
4529 | yyerror("filter already specified"); | |||
4530 | YYERRORgoto yyerrlab; | |||
4531 | } | |||
4532 | ||||
4533 | do { | |||
4534 | (void)snprintf(buffer, sizeof buffer, "<dynchain:%08x>", last_dynchain_id++); | |||
4535 | } while (dict_check(conf->sc_filters_dict, buffer)); | |||
4536 | ||||
4537 | listen_opts.options |= LO_FILTER; | |||
4538 | listen_opts.filtername = xstrdup(buffer); | |||
4539 | filter_config = xcalloc(1, sizeof *filter_config); | |||
4540 | filter_config->filter_type = FILTER_TYPE_CHAIN; | |||
4541 | filter_config->filter_subsystem |= FILTER_SUBSYSTEM_SMTP_IN; | |||
4542 | dict_init(&filter_config->chain_procs)do { do { (&((&filter_config->chain_procs)->dict ))->sph_root = ((void *)0); } while (0); (&filter_config ->chain_procs)->count = 0; } while(0); | |||
4543 | } | |||
4544 | break; | |||
4545 | case 314: | |||
4546 | #line 2279 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4547 | { | |||
4548 | dict_set(conf->sc_filters_dict, listen_opts.filtername, filter_config); | |||
4549 | filter_config = NULL((void *)0); | |||
4550 | } | |||
4551 | break; | |||
4552 | case 315: | |||
4553 | #line 2283 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4554 | { | |||
4555 | if (listen_opts.options & LO_SSL) { | |||
4556 | yyerror("TLS mode already specified"); | |||
4557 | YYERRORgoto yyerrlab; | |||
4558 | } | |||
4559 | listen_opts.options |= LO_SSL; | |||
4560 | listen_opts.ssl = F_SMTPS0x02; | |||
4561 | } | |||
4562 | break; | |||
4563 | case 316: | |||
4564 | #line 2291 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4565 | { | |||
4566 | if (listen_opts.options & LO_SSL) { | |||
4567 | yyerror("TLS mode already specified"); | |||
4568 | YYERRORgoto yyerrlab; | |||
4569 | } | |||
4570 | listen_opts.options |= LO_SSL; | |||
4571 | listen_opts.ssl = F_SMTPS0x02|F_TLS_VERIFY0x200; | |||
4572 | } | |||
4573 | break; | |||
4574 | case 317: | |||
4575 | #line 2299 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4576 | { | |||
4577 | if (listen_opts.options & LO_SSL) { | |||
4578 | yyerror("TLS mode already specified"); | |||
4579 | YYERRORgoto yyerrlab; | |||
4580 | } | |||
4581 | listen_opts.options |= LO_SSL; | |||
4582 | listen_opts.ssl = F_STARTTLS0x01; | |||
4583 | } | |||
4584 | break; | |||
4585 | case 318: | |||
4586 | #line 2307 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4587 | { | |||
4588 | if (listen_opts.options & LO_SSL) { | |||
4589 | yyerror("TLS mode already specified"); | |||
4590 | YYERRORgoto yyerrlab; | |||
4591 | } | |||
4592 | listen_opts.options |= LO_SSL; | |||
4593 | listen_opts.ssl = F_STARTTLS0x01|F_STARTTLS_REQUIRE0x20; | |||
4594 | } | |||
4595 | break; | |||
4596 | case 319: | |||
4597 | #line 2315 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4598 | { | |||
4599 | if (listen_opts.options & LO_SSL) { | |||
4600 | yyerror("TLS mode already specified"); | |||
4601 | YYERRORgoto yyerrlab; | |||
4602 | } | |||
4603 | listen_opts.options |= LO_SSL; | |||
4604 | listen_opts.ssl = F_STARTTLS0x01|F_STARTTLS_REQUIRE0x20|F_TLS_VERIFY0x200; | |||
4605 | } | |||
4606 | break; | |||
4607 | case 320: | |||
4608 | #line 2323 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4609 | { | |||
4610 | if (listen_opts.tls_ciphers) { | |||
4611 | yyerror("ciphers already specified"); | |||
4612 | YYERRORgoto yyerrlab; | |||
4613 | } | |||
4614 | listen_opts.tls_ciphers = yyvsp[0].v.string; | |||
4615 | } | |||
4616 | break; | |||
4617 | case 321: | |||
4618 | #line 2330 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4619 | { | |||
4620 | if (listen_opts.tls_protocols) { | |||
4621 | yyerror("protocols already specified"); | |||
4622 | YYERRORgoto yyerrlab; | |||
4623 | } | |||
4624 | listen_opts.tls_protocols = yyvsp[0].v.string; | |||
4625 | } | |||
4626 | break; | |||
4627 | case 322: | |||
4628 | #line 2337 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4629 | { | |||
4630 | if (listen_opts.pkicount == PKI_MAX32) { | |||
4631 | yyerror("too many pki specified"); | |||
4632 | YYERRORgoto yyerrlab; | |||
4633 | } | |||
4634 | listen_opts.pki[listen_opts.pkicount++] = yyvsp[0].v.string; | |||
4635 | } | |||
4636 | break; | |||
4637 | case 323: | |||
4638 | #line 2344 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4639 | { | |||
4640 | if (listen_opts.options & LO_CA) { | |||
4641 | yyerror("ca already specified"); | |||
4642 | YYERRORgoto yyerrlab; | |||
4643 | } | |||
4644 | listen_opts.options |= LO_CA; | |||
4645 | listen_opts.ca = yyvsp[0].v.string; | |||
4646 | } | |||
4647 | break; | |||
4648 | case 324: | |||
4649 | #line 2352 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4650 | { | |||
4651 | if (listen_opts.options & LO_AUTH) { | |||
4652 | yyerror("auth already specified"); | |||
4653 | YYERRORgoto yyerrlab; | |||
4654 | } | |||
4655 | listen_opts.options |= LO_AUTH; | |||
4656 | listen_opts.auth = F_AUTH0x08|F_AUTH_REQUIRE0x40; | |||
4657 | } | |||
4658 | break; | |||
4659 | case 325: | |||
4660 | #line 2360 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4661 | { | |||
4662 | if (listen_opts.options & LO_AUTH) { | |||
4663 | yyerror("auth already specified"); | |||
4664 | YYERRORgoto yyerrlab; | |||
4665 | } | |||
4666 | listen_opts.options |= LO_AUTH; | |||
4667 | listen_opts.auth = F_AUTH0x08; | |||
4668 | } | |||
4669 | break; | |||
4670 | case 326: | |||
4671 | #line 2368 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4672 | { | |||
4673 | if (listen_opts.options & LO_AUTH) { | |||
4674 | yyerror("auth already specified"); | |||
4675 | YYERRORgoto yyerrlab; | |||
4676 | } | |||
4677 | listen_opts.options |= LO_AUTH; | |||
4678 | listen_opts.authtable = yyvsp[0].v.table; | |||
4679 | listen_opts.auth = F_AUTH0x08|F_AUTH_REQUIRE0x40; | |||
4680 | } | |||
4681 | break; | |||
4682 | case 327: | |||
4683 | #line 2377 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4684 | { | |||
4685 | if (listen_opts.options & LO_AUTH) { | |||
4686 | yyerror("auth already specified"); | |||
4687 | YYERRORgoto yyerrlab; | |||
4688 | } | |||
4689 | listen_opts.options |= LO_AUTH; | |||
4690 | listen_opts.authtable = yyvsp[0].v.table; | |||
4691 | listen_opts.auth = F_AUTH0x08; | |||
4692 | } | |||
4693 | break; | |||
4694 | case 328: | |||
4695 | #line 2386 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4696 | { | |||
4697 | if (listen_opts.options & LO_TAG) { | |||
4698 | yyerror("tag already specified"); | |||
4699 | YYERRORgoto yyerrlab; | |||
4700 | } | |||
4701 | listen_opts.options |= LO_TAG; | |||
4702 | ||||
4703 | if (strlen(yyvsp[0].v.string) >= SMTPD_TAG_SIZE(32 + 1)) { | |||
4704 | yyerror("tag name too long"); | |||
4705 | free(yyvsp[0].v.string); | |||
4706 | YYERRORgoto yyerrlab; | |||
4707 | } | |||
4708 | listen_opts.tag = yyvsp[0].v.string; | |||
4709 | } | |||
4710 | break; | |||
4711 | case 329: | |||
4712 | #line 2400 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4713 | { | |||
4714 | if (listen_opts.options & LO_HOSTNAME) { | |||
4715 | yyerror("hostname already specified"); | |||
4716 | YYERRORgoto yyerrlab; | |||
4717 | } | |||
4718 | listen_opts.options |= LO_HOSTNAME; | |||
4719 | ||||
4720 | listen_opts.hostname = yyvsp[0].v.string; | |||
4721 | } | |||
4722 | break; | |||
4723 | case 330: | |||
4724 | #line 2409 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4725 | { | |||
4726 | struct table *t = yyvsp[0].v.table; | |||
4727 | ||||
4728 | if (listen_opts.options & LO_HOSTNAMES) { | |||
4729 | yyerror("hostnames already specified"); | |||
4730 | YYERRORgoto yyerrlab; | |||
4731 | } | |||
4732 | listen_opts.options |= LO_HOSTNAMES; | |||
4733 | ||||
4734 | if (!table_check_use(t, T_DYNAMIC|T_HASH, K_ADDRNAME)) { | |||
4735 | yyerror("invalid use of table \"%s\" as " | |||
4736 | "HOSTNAMES parameter", t->t_name); | |||
4737 | YYERRORgoto yyerrlab; | |||
4738 | } | |||
4739 | listen_opts.hostnametable = t; | |||
4740 | } | |||
4741 | break; | |||
4742 | case 331: | |||
4743 | #line 2425 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4744 | { | |||
4745 | if (config_lo_mask_source(&listen_opts)) { | |||
4746 | YYERRORgoto yyerrlab; | |||
4747 | } | |||
4748 | } | |||
4749 | break; | |||
4750 | case 332: | |||
4751 | #line 2430 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4752 | { | |||
4753 | if (listen_opts.options & LO_RECEIVEDAUTH) { | |||
4754 | yyerror("received-auth already specified"); | |||
4755 | YYERRORgoto yyerrlab; | |||
4756 | } | |||
4757 | listen_opts.options |= LO_RECEIVEDAUTH; | |||
4758 | listen_opts.flags |= F_RECEIVEDAUTH0x800; | |||
4759 | } | |||
4760 | break; | |||
4761 | case 333: | |||
4762 | #line 2438 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4763 | { | |||
4764 | if (listen_opts.options & LO_NODSN) { | |||
4765 | yyerror("no-dsn already specified"); | |||
4766 | YYERRORgoto yyerrlab; | |||
4767 | } | |||
4768 | listen_opts.options |= LO_NODSN; | |||
4769 | listen_opts.flags &= ~F_EXT_DSN0x400; | |||
4770 | } | |||
4771 | break; | |||
4772 | case 334: | |||
4773 | #line 2446 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4774 | { | |||
4775 | if (listen_opts.options & LO_PROXY) { | |||
4776 | yyerror("proxy-v2 already specified"); | |||
4777 | YYERRORgoto yyerrlab; | |||
4778 | } | |||
4779 | listen_opts.options |= LO_PROXY; | |||
4780 | listen_opts.flags |= F_PROXY0x4000; | |||
4781 | } | |||
4782 | break; | |||
4783 | case 335: | |||
4784 | #line 2454 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4785 | { | |||
4786 | struct table *t = yyvsp[0].v.table; | |||
4787 | ||||
4788 | if (listen_opts.options & LO_SENDERS) { | |||
4789 | yyerror("senders already specified"); | |||
4790 | YYERRORgoto yyerrlab; | |||
4791 | } | |||
4792 | listen_opts.options |= LO_SENDERS; | |||
4793 | ||||
4794 | if (!table_check_use(t, T_DYNAMIC|T_HASH, K_MAILADDRMAP)) { | |||
4795 | yyerror("invalid use of table \"%s\" as " | |||
4796 | "SENDERS parameter", t->t_name); | |||
4797 | YYERRORgoto yyerrlab; | |||
4798 | } | |||
4799 | listen_opts.sendertable = t; | |||
4800 | } | |||
4801 | break; | |||
4802 | case 336: | |||
4803 | #line 2470 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4804 | { | |||
4805 | struct table *t = yyvsp[-1].v.table; | |||
4806 | ||||
4807 | if (listen_opts.options & LO_SENDERS) { | |||
4808 | yyerror("senders already specified"); | |||
4809 | YYERRORgoto yyerrlab; | |||
4810 | } | |||
4811 | listen_opts.options |= LO_SENDERS|LO_MASQUERADE; | |||
4812 | ||||
4813 | if (!table_check_use(t, T_DYNAMIC|T_HASH, K_MAILADDRMAP)) { | |||
4814 | yyerror("invalid use of table \"%s\" as " | |||
4815 | "SENDERS parameter", t->t_name); | |||
4816 | YYERRORgoto yyerrlab; | |||
4817 | } | |||
4818 | listen_opts.sendertable = t; | |||
4819 | } | |||
4820 | break; | |||
4821 | case 339: | |||
4822 | #line 2492 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4823 | { | |||
4824 | if (conf->sc_sock_listener) { | |||
4825 | yyerror("socket listener already configured"); | |||
4826 | YYERRORgoto yyerrlab; | |||
4827 | } | |||
4828 | create_sock_listener(&listen_opts); | |||
4829 | } | |||
4830 | break; | |||
4831 | case 340: | |||
4832 | #line 2501 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4833 | { | |||
4834 | listen_opts.ifx = yyvsp[-1].v.string; | |||
4835 | create_if_listener(&listen_opts); | |||
4836 | } | |||
4837 | break; | |||
4838 | case 345: | |||
4839 | #line 2516 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4840 | { | |||
4841 | memset(&listen_opts, 0, sizeof listen_opts); | |||
4842 | listen_opts.family = AF_UNSPEC0; | |||
4843 | listen_opts.flags |= F_EXT_DSN0x400; | |||
4844 | } | |||
4845 | break; | |||
4846 | case 346: | |||
4847 | #line 2520 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4848 | { | |||
4849 | free(listen_opts.tls_protocols); | |||
4850 | free(listen_opts.tls_ciphers); | |||
4851 | memset(&listen_opts, 0, sizeof listen_opts); | |||
4852 | } | |||
4853 | break; | |||
4854 | case 347: | |||
4855 | #line 2527 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4856 | { | |||
4857 | char *p, *backend, *config; | |||
4858 | ||||
4859 | p = yyvsp[0].v.string; | |||
4860 | if (*p == '/') { | |||
4861 | backend = "static"; | |||
4862 | config = yyvsp[0].v.string; | |||
4863 | } | |||
4864 | else { | |||
4865 | backend = yyvsp[0].v.string; | |||
4866 | config = NULL((void *)0); | |||
4867 | for (p = yyvsp[0].v.string; *p && *p != ':'; p++) | |||
4868 | ; | |||
4869 | if (*p == ':') { | |||
4870 | *p = '\0'; | |||
4871 | backend = yyvsp[0].v.string; | |||
4872 | config = p+1; | |||
4873 | } | |||
4874 | } | |||
4875 | if (config != NULL((void *)0) && *config != '/') { | |||
4876 | yyerror("invalid backend parameter for table: %s", | |||
4877 | yyvsp[-1].v.string); | |||
4878 | free(yyvsp[-1].v.string); | |||
4879 | free(yyvsp[0].v.string); | |||
4880 | YYERRORgoto yyerrlab; | |||
4881 | } | |||
4882 | table = table_create(conf, backend, yyvsp[-1].v.string, config); | |||
4883 | if (!table_config(table)) { | |||
4884 | yyerror("invalid configuration file %s for table %s", | |||
4885 | config, table->t_name); | |||
4886 | free(yyvsp[-1].v.string); | |||
4887 | free(yyvsp[0].v.string); | |||
4888 | YYERRORgoto yyerrlab; | |||
4889 | } | |||
4890 | table = NULL((void *)0); | |||
4891 | free(yyvsp[-1].v.string); | |||
4892 | free(yyvsp[0].v.string); | |||
4893 | } | |||
4894 | break; | |||
4895 | case 348: | |||
4896 | #line 2565 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4897 | { | |||
4898 | table = table_create(conf, "static", yyvsp[0].v.string, NULL((void *)0)); | |||
4899 | free(yyvsp[0].v.string); | |||
4900 | } | |||
4901 | break; | |||
4902 | case 349: | |||
4903 | #line 2568 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4904 | { | |||
4905 | table = NULL((void *)0); | |||
4906 | } | |||
4907 | break; | |||
4908 | case 350: | |||
4909 | #line 2573 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4910 | { | |||
4911 | struct table *t; | |||
4912 | ||||
4913 | t = table_create(conf, "static", NULL((void *)0), NULL((void *)0)); | |||
4914 | table_add(t, yyvsp[0].v.string, NULL((void *)0)); | |||
4915 | free(yyvsp[0].v.string); | |||
4916 | yyval.v.table = t; | |||
4917 | } | |||
4918 | break; | |||
4919 | case 351: | |||
4920 | #line 2581 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4921 | { | |||
4922 | table = table_create(conf, "static", NULL((void *)0), NULL((void *)0)); | |||
4923 | } | |||
4924 | break; | |||
4925 | case 352: | |||
4926 | #line 2583 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4927 | { | |||
4928 | yyval.v.table = table; | |||
4929 | table = NULL((void *)0); | |||
4930 | } | |||
4931 | break; | |||
4932 | case 353: | |||
4933 | #line 2589 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4934 | { | |||
4935 | struct table *t; | |||
4936 | ||||
4937 | if ((t = table_find(conf, yyvsp[-1].v.string)) == NULL((void *)0)) { | |||
4938 | yyerror("no such table: %s", yyvsp[-1].v.string); | |||
4939 | free(yyvsp[-1].v.string); | |||
4940 | YYERRORgoto yyerrlab; | |||
4941 | } | |||
4942 | free(yyvsp[-1].v.string); | |||
4943 | yyval.v.table = t; | |||
4944 | } | |||
4945 | break; | |||
4946 | case 354: | |||
4947 | #line 2602 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4948 | { yyval.v.table = yyvsp[0].v.table; } | |||
4949 | break; | |||
4950 | case 355: | |||
4951 | #line 2603 "/usr/src/usr.sbin/smtpd/smtpd/../parse.y" | |||
4952 | { yyval.v.table = yyvsp[0].v.table; } | |||
4953 | break; | |||
4954 | #line 4947 "parse.c" | |||
4955 | } | |||
4956 | yyssp -= yym; | |||
4957 | yystate = *yyssp; | |||
4958 | yyvsp -= yym; | |||
4959 | yym = yylhs[yyn]; | |||
4960 | if (yystate == 0 && yym == 0) | |||
4961 | { | |||
4962 | #if YYDEBUG0 | |||
4963 | if (yydebug) | |||
4964 | printf("%sdebug: after reduction, shifting from state 0 to\ | |||
4965 | state %d\n", YYPREFIX"yy", YYFINAL1); | |||
4966 | #endif | |||
4967 | yystate = YYFINAL1; | |||
4968 | *++yyssp = YYFINAL1; | |||
4969 | *++yyvsp = yyval; | |||
4970 | if (yychar < 0) | |||
4971 | { | |||
4972 | if ((yychar = yylex()) < 0) yychar = 0; | |||
4973 | #if YYDEBUG0 | |||
4974 | if (yydebug) | |||
4975 | { | |||
4976 | yys = 0; | |||
4977 | if (yychar <= YYMAXTOKEN363) yys = yyname[yychar]; | |||
4978 | if (!yys) yys = "illegal-symbol"; | |||
4979 | printf("%sdebug: state %d, reading %d (%s)\n", | |||
4980 | YYPREFIX"yy", YYFINAL1, yychar, yys); | |||
4981 | } | |||
4982 | #endif | |||
4983 | } | |||
4984 | if (yychar == 0) goto yyaccept; | |||
4985 | goto yyloop; | |||
4986 | } | |||
4987 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && | |||
4988 | yyn <= YYTABLESIZE915 && yycheck[yyn] == yystate) | |||
4989 | yystate = yytable[yyn]; | |||
4990 | else | |||
4991 | yystate = yydgoto[yym]; | |||
4992 | #if YYDEBUG0 | |||
4993 | if (yydebug) | |||
4994 | printf("%sdebug: after reduction, shifting from state %d \ | |||
4995 | to state %d\n", YYPREFIX"yy", *yyssp, yystate); | |||
4996 | #endif | |||
4997 | if (yyssp >= yysslim && yygrowstack()) | |||
4998 | { | |||
4999 | goto yyoverflow; | |||
5000 | } | |||
5001 | *++yyssp = yystate; | |||
5002 | *++yyvsp = yyval; | |||
5003 | goto yyloop; | |||
5004 | yyoverflow: | |||
5005 | yyerror("yacc stack overflow"); | |||
5006 | yyabort: | |||
5007 | if (yyss) | |||
5008 | free(yyss); | |||
5009 | if (yyvs) | |||
5010 | free(yyvs); | |||
5011 | yyss = yyssp = NULL((void *)0); | |||
5012 | yyvs = yyvsp = NULL((void *)0); | |||
5013 | yystacksize = 0; | |||
5014 | return (1); | |||
5015 | yyaccept: | |||
5016 | if (yyss) | |||
5017 | free(yyss); | |||
5018 | if (yyvs) | |||
5019 | free(yyvs); | |||
5020 | yyss = yyssp = NULL((void *)0); | |||
5021 | yyvs = yyvsp = NULL((void *)0); | |||
5022 | yystacksize = 0; | |||
5023 | return (0); | |||
5024 | } |