Commit | Line | Data |
---|---|---|
c215a4bc IJ |
1 | /* |
2 | * This file is part of secnet. | |
3 | * See README for full list of copyright holders. | |
4 | * | |
5 | * secnet is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version d of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * secnet is distributed in the hope that it will be useful, but | |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * version 3 along with secnet; if not, see | |
17 | * https://www.gnu.org/licenses/gpl.html. | |
18 | */ | |
19 | ||
8689b3a9 | 20 | #include "secnet.h" |
2fe58dfd | 21 | #include <stdio.h> |
59230b9b IJ |
22 | #include <assert.h> |
23 | #include <limits.h> | |
2fe58dfd SE |
24 | #include <string.h> |
25 | #include <getopt.h> | |
2fe58dfd | 26 | #include <errno.h> |
8689b3a9 | 27 | #include <unistd.h> |
2fe58dfd | 28 | #include <sys/socket.h> |
2fe58dfd | 29 | #include <arpa/inet.h> |
2fe58dfd | 30 | #include <pwd.h> |
08daaaff | 31 | #include <grp.h> |
2fe58dfd | 32 | |
2fe58dfd SE |
33 | #include "util.h" |
34 | #include "conffile.h" | |
7138d0c5 | 35 | #include "process.h" |
2fe58dfd | 36 | |
29672515 RK |
37 | #if __APPLE__ |
38 | /* apple's poll() does not work on char devs */ | |
39 | # define USE_SELECT 1 | |
40 | #endif | |
41 | ||
b2a56f7c | 42 | /* XXX should be from autoconf */ |
fe5e9cc4 SE |
43 | static const char *configfile="/etc/secnet/secnet.conf"; |
44 | static const char *sites_key="sites"; | |
baa06aeb | 45 | bool_t just_check_config=False; |
2fe58dfd SE |
46 | static char *userid=NULL; |
47 | static uid_t uid=0; | |
08daaaff | 48 | static gid_t gid; |
b2a56f7c | 49 | bool_t background=True; |
2fe58dfd | 50 | static char *pidfile=NULL; |
9d3a4132 | 51 | bool_t require_root_privileges=False; |
fe5e9cc4 | 52 | cstring_t require_root_privileges_explanation=NULL; |
2fe58dfd | 53 | |
7138d0c5 SE |
54 | static pid_t secnet_pid; |
55 | ||
2fe58dfd SE |
56 | /* Structures dealing with poll() call */ |
57 | struct poll_interest { | |
8bebb299 | 58 | beforepoll_fn *before; /* 0 if deregistered and waiting to be deleted */ |
2fe58dfd SE |
59 | afterpoll_fn *after; |
60 | void *state; | |
1caa23ff | 61 | int32_t nfds; |
fe5e9cc4 | 62 | cstring_t desc; |
cf5f1149 | 63 | LIST_ENTRY(poll_interest) entry; |
2fe58dfd | 64 | }; |
cf5f1149 | 65 | static LIST_HEAD(, poll_interest) reg = LIST_HEAD_INITIALIZER(®); |
2fe58dfd | 66 | |
8bebb299 IJ |
67 | static bool_t interest_isregistered(const struct poll_interest *i) |
68 | { | |
69 | return !!i->before; | |
70 | } | |
71 | ||
2fe58dfd SE |
72 | static bool_t finished=False; |
73 | ||
74 | /* Parse the command line options */ | |
75 | static void parse_options(int argc, char **argv) | |
76 | { | |
77 | int c; | |
78 | ||
79 | while (True) { | |
80 | int option_index = 0; | |
81 | static struct option long_options[] = { | |
82 | {"verbose", 0, 0, 'v'}, | |
83 | {"nowarnings", 0, 0, 'w'}, | |
84 | {"help", 0, 0, 2}, | |
85 | {"version", 0, 0, 1}, | |
86 | {"nodetach", 0, 0, 'n'}, | |
7b1a9fb7 | 87 | {"managed", 0, 0, 'm'}, |
2fe58dfd SE |
88 | {"silent", 0, 0, 'f'}, |
89 | {"quiet", 0, 0, 'f'}, | |
dd568518 | 90 | {"debug", 0, 0, 'd'}, |
2fe58dfd | 91 | {"config", 1, 0, 'c'}, |
baa06aeb | 92 | {"just-check-config", 0, 0, 'j'}, |
794f2398 | 93 | {"sites-key", 1, 0, 's'}, |
2fe58dfd SE |
94 | {0,0,0,0} |
95 | }; | |
96 | ||
7b1a9fb7 | 97 | c=getopt_long(argc, argv, "vwdnjc:ft:s:m", |
2fe58dfd SE |
98 | long_options, &option_index); |
99 | if (c==-1) | |
100 | break; | |
101 | ||
102 | switch(c) { | |
103 | case 2: | |
104 | /* Help */ | |
4f5e39ec SE |
105 | printf("Usage: secnet [OPTION]...\n\n" |
106 | " -f, --silent, --quiet suppress error messages\n" | |
107 | " -w, --nowarnings suppress warnings\n" | |
108 | " -v, --verbose output extra diagnostics\n" | |
109 | " -c, --config=filename specify a configuration file\n" | |
110 | " -j, --just-check-config stop after reading " | |
111 | "configuration file\n" | |
112 | " -s, --sites-key=name configuration key that " | |
113 | "specifies active sites\n" | |
114 | " -n, --nodetach do not run in background\n" | |
7b1a9fb7 | 115 | " -m, --managed running under a supervisor\n" |
dd568518 | 116 | " -d, --debug output debug messages\n" |
4f5e39ec SE |
117 | " --help display this help and exit\n" |
118 | " --version output version information " | |
119 | "and exit\n" | |
2fe58dfd SE |
120 | ); |
121 | exit(0); | |
122 | break; | |
123 | ||
124 | case 1: | |
125 | /* Version */ | |
4f5e39ec | 126 | printf("%s\n",version); |
2fe58dfd SE |
127 | exit(0); |
128 | break; | |
129 | ||
130 | case 'v': | |
469fd1d9 | 131 | message_level|=M_INFO|M_NOTICE|M_WARNING|M_ERR|M_SECURITY| |
b2a56f7c | 132 | M_FATAL; |
2fe58dfd SE |
133 | break; |
134 | ||
b2a56f7c SE |
135 | case 'w': |
136 | message_level&=(~M_WARNING); | |
2fe58dfd SE |
137 | break; |
138 | ||
139 | case 'd': | |
b2a56f7c | 140 | message_level|=M_DEBUG_CONFIG|M_DEBUG_PHASE|M_DEBUG; |
2fe58dfd SE |
141 | break; |
142 | ||
143 | case 'f': | |
144 | message_level=M_FATAL; | |
145 | break; | |
146 | ||
b2a56f7c SE |
147 | case 'n': |
148 | background=False; | |
149 | break; | |
150 | ||
7b1a9fb7 RK |
151 | case 'm': |
152 | secnet_is_daemon=True; | |
153 | break; | |
154 | ||
2fe58dfd SE |
155 | case 'c': |
156 | if (optarg) | |
157 | configfile=safe_strdup(optarg,"config_filename"); | |
158 | else | |
159 | fatal("secnet: no config filename specified"); | |
160 | break; | |
161 | ||
baa06aeb SE |
162 | case 'j': |
163 | just_check_config=True; | |
164 | break; | |
165 | ||
794f2398 SE |
166 | case 's': |
167 | if (optarg) | |
168 | sites_key=safe_strdup(optarg,"sites-key"); | |
169 | else | |
170 | fatal("secnet: no sites key specified"); | |
171 | break; | |
172 | ||
2fe58dfd | 173 | case '?': |
20c68a90 | 174 | exit(1); |
2fe58dfd SE |
175 | break; |
176 | ||
177 | default: | |
469fd1d9 | 178 | Message(M_ERR,"secnet: Unknown getopt code %c\n",c); |
2fe58dfd SE |
179 | } |
180 | } | |
181 | ||
182 | if (argc-optind != 0) { | |
469fd1d9 | 183 | Message(M_ERR,"secnet: You gave extra command line parameters, " |
2fe58dfd SE |
184 | "which were ignored.\n"); |
185 | } | |
186 | } | |
187 | ||
188 | static void setup(dict_t *config) | |
189 | { | |
190 | list_t *l; | |
191 | item_t *site; | |
192 | dict_t *system; | |
2fe58dfd SE |
193 | struct passwd *pw; |
194 | struct cloc loc; | |
195 | int i; | |
196 | ||
197 | l=dict_lookup(config,"system"); | |
198 | ||
199 | if (!l || list_elem(l,0)->type!=t_dict) { | |
4f5e39ec | 200 | fatal("configuration does not include a \"system\" dictionary"); |
2fe58dfd SE |
201 | } |
202 | system=list_elem(l,0)->data.dict; | |
203 | loc=list_elem(l,0)->loc; | |
204 | ||
205 | /* Arrange systemwide log facility */ | |
206 | l=dict_lookup(system,"log"); | |
207 | if (!l) { | |
4f5e39ec | 208 | fatal("configuration does not include a system/log facility"); |
2fe58dfd | 209 | } |
b2a56f7c | 210 | system_log=init_log(l); |
2fe58dfd SE |
211 | |
212 | /* Who are we supposed to run as? */ | |
213 | userid=dict_read_string(system,"userid",False,"system",loc); | |
214 | if (userid) { | |
7b1a9fb7 | 215 | if (!(pw=getpwnam(userid))) |
4f5e39ec | 216 | fatal("userid \"%s\" not found",userid); |
08daaaff RK |
217 | uid=pw->pw_uid; |
218 | gid=pw->pw_gid; | |
2fe58dfd SE |
219 | } |
220 | ||
221 | /* Pidfile name */ | |
222 | pidfile=dict_read_string(system,"pidfile",False,"system",loc); | |
223 | ||
9d3a4132 SE |
224 | /* Check whether we need root privileges */ |
225 | if (require_root_privileges && uid!=0) { | |
4f5e39ec SE |
226 | fatal("the configured feature \"%s\" requires " |
227 | "that secnet retain root privileges while running.", | |
9d3a4132 SE |
228 | require_root_privileges_explanation); |
229 | } | |
230 | ||
2fe58dfd | 231 | /* Go along site list, starting sites */ |
794f2398 | 232 | l=dict_lookup(config,sites_key); |
2fe58dfd | 233 | if (!l) { |
794f2398 SE |
234 | Message(M_WARNING,"secnet: configuration key \"%s\" is missing; no " |
235 | "remote sites are defined\n",sites_key); | |
9d3a4132 SE |
236 | } else { |
237 | i=0; | |
238 | while ((site=list_elem(l, i++))) { | |
239 | struct site_if *s; | |
240 | if (site->type!=t_closure) { | |
241 | cfgfatal(site->loc,"system","non-closure in site list"); | |
242 | } | |
243 | if (site->data.closure->type!=CL_SITE) { | |
244 | cfgfatal(site->loc,"system","non-site closure in site list"); | |
245 | } | |
246 | s=site->data.closure->interface; | |
247 | s->control(s->st,True); | |
2fe58dfd | 248 | } |
2fe58dfd SE |
249 | } |
250 | } | |
251 | ||
8bebb299 | 252 | struct poll_interest *register_for_poll(void *st, beforepoll_fn *before, |
32fc582f | 253 | afterpoll_fn *after, cstring_t desc) |
2fe58dfd SE |
254 | { |
255 | struct poll_interest *i; | |
256 | ||
b7886fd4 | 257 | NEW(i); |
2fe58dfd SE |
258 | i->before=before; |
259 | i->after=after; | |
260 | i->state=st; | |
2fe58dfd SE |
261 | i->nfds=0; |
262 | i->desc=desc; | |
cf5f1149 | 263 | LIST_INSERT_HEAD(®, i, entry); |
8bebb299 IJ |
264 | return i; |
265 | } | |
266 | ||
267 | void deregister_for_poll(struct poll_interest *i) | |
268 | { | |
269 | /* We cannot simply throw this away because we're reentrantly | |
270 | * inside the main loop, which needs to remember which range of | |
271 | * fds corresponds to this now-obsolete interest */ | |
272 | i->before=0; | |
2fe58dfd SE |
273 | } |
274 | ||
275 | static void system_phase_hook(void *sst, uint32_t newphase) | |
276 | { | |
277 | if (newphase==PHASE_SHUTDOWN && pidfile) { | |
278 | /* Try to unlink the pidfile; don't care if it fails */ | |
279 | unlink(pidfile); | |
280 | } | |
281 | } | |
282 | ||
29672515 RK |
283 | #if USE_SELECT |
284 | static int fakepoll(struct pollfd *fds, int nfds, int timeout) { | |
285 | fd_set infds[1], outfds[1]; | |
286 | int maxfd = -1, i, rc; | |
287 | struct timeval tvtimeout; | |
288 | FD_ZERO(infds); | |
289 | FD_ZERO(outfds); | |
290 | for(i = 0; i < nfds; ++i) { | |
291 | if(fds[i].events & POLLIN) | |
292 | FD_SET(fds[i].fd, infds); | |
293 | if(fds[i].events & POLLOUT) | |
294 | FD_SET(fds[i].fd, outfds); | |
295 | if(fds[i].fd > maxfd) | |
296 | maxfd = fds[i].fd; | |
297 | } | |
298 | if(timeout != -1) { | |
299 | tvtimeout.tv_sec = timeout / 1000; | |
300 | tvtimeout.tv_usec = 1000 * (timeout % 1000); | |
301 | } | |
302 | rc = select(maxfd + 1, infds, outfds, NULL, | |
303 | timeout == -1 ? NULL : &tvtimeout); | |
304 | if(rc >= 0) { | |
305 | for(i = 0; i < nfds; ++i) { | |
306 | int revents = 0; | |
307 | if(FD_ISSET(fds[i].fd, infds)) | |
308 | revents |= POLLIN; | |
309 | if(FD_ISSET(fds[i].fd, outfds)) | |
310 | revents |= POLLOUT; | |
311 | fds[i].revents = revents; | |
312 | } | |
313 | } | |
314 | return rc; | |
315 | } | |
316 | #endif | |
317 | ||
698280de IJ |
318 | struct timeval tv_now_global; |
319 | uint64_t now_global; | |
320 | ||
2fe58dfd SE |
321 | static void run(void) |
322 | { | |
8bebb299 | 323 | struct poll_interest *i, *itmp; |
d613fd78 | 324 | int rv, nfds, idx; |
2fe58dfd | 325 | int timeout; |
67be07ed IJ |
326 | struct pollfd *fds=0; |
327 | int allocdfds=0, shortfall=0; | |
2fe58dfd | 328 | |
7138d0c5 | 329 | Message(M_NOTICE,"%s [%d]: starting\n",version,secnet_pid); |
b2a56f7c | 330 | |
7138d0c5 | 331 | do { |
698280de | 332 | if (gettimeofday(&tv_now_global, NULL)!=0) { |
2fe58dfd SE |
333 | fatal_perror("main loop: gettimeofday"); |
334 | } | |
698280de IJ |
335 | now_global=((uint64_t)tv_now_global.tv_sec*(uint64_t)1000)+ |
336 | ((uint64_t)tv_now_global.tv_usec/(uint64_t)1000); | |
2fe58dfd | 337 | idx=0; |
cf5f1149 | 338 | LIST_FOREACH(i, ®, entry) { |
508bb583 | 339 | int check; |
8bebb299 IJ |
340 | if (interest_isregistered(i)) { |
341 | for (check=0; check<i->nfds; check++) { | |
342 | if(fds[idx+check].revents & POLLNVAL) { | |
343 | fatal("run: poll (%s#%d) set POLLNVAL", i->desc, check); | |
344 | } | |
508bb583 | 345 | } |
8bebb299 | 346 | i->after(i->state, fds+idx, i->nfds); |
29672515 | 347 | } |
2fe58dfd SE |
348 | idx+=i->nfds; |
349 | } | |
67be07ed IJ |
350 | if (shortfall) { |
351 | allocdfds *= 2; | |
352 | allocdfds += shortfall; | |
2f9fa75f | 353 | REALLOC_ARY(fds,allocdfds); |
67be07ed | 354 | } |
67be07ed | 355 | shortfall=0; |
2fe58dfd SE |
356 | idx=0; |
357 | timeout=-1; | |
8bebb299 | 358 | LIST_FOREACH_SAFE(i, ®, entry, itmp) { |
d613fd78 | 359 | int remain=allocdfds-idx; |
2fe58dfd | 360 | nfds=remain; |
8bebb299 IJ |
361 | if (interest_isregistered(i)) { |
362 | rv=i->before(i->state, fds+idx, &nfds, &timeout); | |
363 | if (rv!=0) { | |
364 | if (rv!=ERANGE) | |
365 | fatal("run: beforepoll_fn (%s) returns %d",i->desc,rv); | |
366 | assert(nfds < INT_MAX/4 - shortfall); | |
367 | shortfall += nfds-remain; | |
368 | nfds=0; | |
369 | timeout=0; | |
370 | } | |
371 | } else { | |
67be07ed | 372 | nfds=0; |
2fe58dfd SE |
373 | } |
374 | if (timeout<-1) { | |
779837e1 IJ |
375 | fatal("run: beforepoll_fn (%s) set timeout to %d", |
376 | i->desc,timeout); | |
2fe58dfd | 377 | } |
8bebb299 IJ |
378 | if (!interest_isregistered(i)) { |
379 | /* check this here, rather than earlier, so that we | |
380 | handle the case where i->before() calls deregister */ | |
381 | LIST_REMOVE(i, entry); | |
382 | free(i); | |
383 | continue; | |
384 | } | |
2fe58dfd | 385 | idx+=nfds; |
2fe58dfd SE |
386 | i->nfds=nfds; |
387 | } | |
388 | do { | |
7138d0c5 | 389 | if (finished) break; |
29672515 RK |
390 | #if USE_SELECT |
391 | rv=fakepoll(fds, idx, timeout); | |
392 | #else | |
2fe58dfd | 393 | rv=poll(fds, idx, timeout); |
29672515 | 394 | #endif |
2fe58dfd SE |
395 | if (rv<0) { |
396 | if (errno!=EINTR) { | |
397 | fatal_perror("run: poll"); | |
398 | } | |
399 | } | |
400 | } while (rv<0); | |
7138d0c5 | 401 | } while (!finished); |
3b83c932 | 402 | free(fds); |
2fe58dfd SE |
403 | } |
404 | ||
64f5ae57 IJ |
405 | bool_t will_droppriv(void) |
406 | { | |
407 | assert(current_phase >= PHASE_SETUP); | |
408 | return !!uid; | |
409 | } | |
410 | ||
7b1a9fb7 | 411 | /* Surrender privileges, if necessary */ |
2fe58dfd SE |
412 | static void droppriv(void) |
413 | { | |
08daaaff RK |
414 | if (userid) { |
415 | if (setgid(gid)!=0) | |
416 | fatal_perror("can't set gid to %ld",(long)gid); | |
7b1a9fb7 | 417 | if (initgroups(userid, gid) < 0) |
08daaaff | 418 | fatal_perror("initgroups"); |
b2a56f7c SE |
419 | if (setuid(uid)!=0) { |
420 | fatal_perror("can't set uid to \"%s\"",userid); | |
421 | } | |
08daaaff RK |
422 | assert(getuid() == uid); |
423 | assert(geteuid() == uid); | |
424 | assert(getgid() == gid); | |
425 | assert(getegid() == gid); | |
b2a56f7c | 426 | } |
7b1a9fb7 RK |
427 | } |
428 | ||
429 | /* Become a daemon, if necessary */ | |
430 | static void become_daemon(void) | |
431 | { | |
432 | FILE *pf=NULL; | |
433 | pid_t p; | |
434 | int errfds[2]; | |
435 | ||
436 | add_hook(PHASE_SHUTDOWN,system_phase_hook,NULL); | |
437 | ||
438 | /* We only want to become a daemon if we are not one | |
439 | already */ | |
440 | if (background && !secnet_is_daemon) { | |
2fe58dfd SE |
441 | p=fork(); |
442 | if (p>0) { | |
7b1a9fb7 RK |
443 | /* Parent process - just exit */ |
444 | _exit(0); | |
2fe58dfd SE |
445 | } else if (p==0) { |
446 | /* Child process - all done, just carry on */ | |
b2a56f7c | 447 | secnet_is_daemon=True; |
7b1a9fb7 RK |
448 | if (setsid() < 0) |
449 | fatal_perror("setsid"); | |
2fe58dfd SE |
450 | } else { |
451 | /* Error */ | |
452 | fatal_perror("cannot fork"); | |
453 | exit(1); | |
454 | } | |
2fe58dfd | 455 | } |
7b1a9fb7 RK |
456 | if (secnet_is_daemon) { |
457 | /* stderr etc are redirected to the system/log facility */ | |
6a06198c | 458 | pipe_cloexec(errfds); |
7b1a9fb7 RK |
459 | if (dup2(errfds[1],0) < 0 |
460 | || dup2(errfds[1],1) < 0 | |
461 | || dup2(errfds[1],2) < 0) | |
462 | fatal_perror("can't dup2 pipe"); | |
463 | if (close(errfds[1]) < 0) | |
464 | fatal_perror("can't close redundant pipe endpoint"); | |
465 | log_from_fd(errfds[0],"stderr",system_log); | |
466 | } | |
7138d0c5 | 467 | secnet_pid=getpid(); |
7b1a9fb7 RK |
468 | |
469 | /* Now we can write the pidfile */ | |
470 | if (pidfile) { | |
471 | pf=fopen(pidfile,"w"); | |
472 | if (!pf) { | |
473 | fatal_perror("cannot open pidfile \"%s\"",pidfile); | |
474 | } | |
475 | if (fprintf(pf,"%ld\n",(long)secnet_pid) < 0 | |
476 | || fclose(pf) < 0) | |
477 | fatal_perror("cannot write to pidfile \"%s\"",pidfile); | |
478 | } | |
7138d0c5 | 479 | } |
2fe58dfd | 480 | |
7138d0c5 SE |
481 | static signal_notify_fn finish,ignore_hup; |
482 | static void finish(void *st, int signum) | |
483 | { | |
484 | finished=True; | |
485 | Message(M_NOTICE,"%s [%d]: received %s\n",version,secnet_pid,(string_t)st); | |
486 | } | |
487 | static void ignore_hup(void *st, int signum) | |
488 | { | |
489 | Message(M_INFO,"%s [%d]: received SIGHUP\n",version,secnet_pid); | |
490 | return; | |
2fe58dfd SE |
491 | } |
492 | ||
493 | int main(int argc, char **argv) | |
494 | { | |
495 | dict_t *config; | |
496 | ||
a614cf77 IJ |
497 | phase_hooks_init(); |
498 | ||
2fe58dfd SE |
499 | enter_phase(PHASE_GETOPTS); |
500 | parse_options(argc,argv); | |
501 | ||
502 | enter_phase(PHASE_READCONFIG); | |
503 | config=read_conffile(configfile); | |
504 | ||
505 | enter_phase(PHASE_SETUP); | |
506 | setup(config); | |
baa06aeb SE |
507 | |
508 | if (just_check_config) { | |
509 | Message(M_INFO,"configuration file check complete\n"); | |
510 | exit(0); | |
511 | } | |
512 | ||
7b1a9fb7 RK |
513 | enter_phase(PHASE_DAEMONIZE); |
514 | become_daemon(); | |
515 | ||
baa06aeb SE |
516 | enter_phase(PHASE_GETRESOURCES); |
517 | /* Appropriate phase hooks will have been run */ | |
2fe58dfd SE |
518 | |
519 | enter_phase(PHASE_DROPPRIV); | |
520 | droppriv(); | |
521 | ||
7138d0c5 | 522 | start_signal_handling(); |
fe5e9cc4 SE |
523 | request_signal_notification(SIGTERM,finish,safe_strdup("SIGTERM","run")); |
524 | if (!background) request_signal_notification(SIGINT,finish, | |
525 | safe_strdup("SIGINT","run")); | |
7138d0c5 | 526 | request_signal_notification(SIGHUP,ignore_hup,NULL); |
042a8da9 | 527 | enter_phase(PHASE_RUN); |
2fe58dfd SE |
528 | run(); |
529 | ||
530 | enter_phase(PHASE_SHUTDOWN); | |
7138d0c5 | 531 | Message(M_NOTICE,"%s [%d]: finished\n",version,secnet_pid); |
2fe58dfd SE |
532 | |
533 | return 0; | |
534 | } |