removing svn keyword $Id$ from all files
[strongswan.git] / src / pluto / plutomain.c
1 /* Pluto main program
2 * Copyright (C) 1997 Angelos D. Keromytis.
3 * Copyright (C) 1998-2001 D. Hugh Redelmeier.
4 * Copyright (C) 2009 Andreas Steffen
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <unistd.h>
20 #include <ctype.h>
21 #include <errno.h>
22 #include <string.h>
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #include <sys/un.h>
26 #include <fcntl.h>
27 #include <getopt.h>
28 #include <resolv.h>
29 #include <arpa/nameser.h> /* missing from <resolv.h> on old systems */
30 #include <sys/queue.h>
31 #include <sys/prctl.h>
32 #include <pwd.h>
33 #include <grp.h>
34
35 #ifdef CAPABILITIES
36 #include <sys/capability.h>
37 #endif /* CAPABILITIES */
38
39 #include <freeswan.h>
40 #include <library.h>
41 #include <debug.h>
42 #include <utils/enumerator.h>
43
44 #include <pfkeyv2.h>
45 #include <pfkey.h>
46
47 #include "constants.h"
48 #include "defs.h"
49 #include "id.h"
50 #include "ca.h"
51 #include "certs.h"
52 #include "ac.h"
53 #include "connections.h"
54 #include "foodgroups.h"
55 #include "packet.h"
56 #include "demux.h" /* needs packet.h */
57 #include "server.h"
58 #include "kernel.h"
59 #include "log.h"
60 #include "keys.h"
61 #include "adns.h" /* needs <resolv.h> */
62 #include "dnskey.h" /* needs keys.h and adns.h */
63 #include "rnd.h"
64 #include "state.h"
65 #include "ipsec_doi.h" /* needs demux.h and state.h */
66 #include "ocsp.h"
67 #include "crl.h"
68 #include "fetch.h"
69 #include "xauth.h"
70 #include "sha1.h"
71 #include "md5.h"
72 #include "crypto.h" /* requires sha1.h and md5.h */
73 #include "nat_traversal.h"
74 #include "virtual.h"
75 #include "timer.h"
76
77 static void usage(const char *mess)
78 {
79 if (mess != NULL && *mess != '\0')
80 fprintf(stderr, "%s\n", mess);
81 fprintf(stderr
82 , "Usage: pluto"
83 " [--help]"
84 " [--version]"
85 " [--optionsfrom <filename>]"
86 " \\\n\t"
87 "[--nofork]"
88 " [--stderrlog]"
89 " [--noklips]"
90 " [--nocrsend]"
91 " \\\n\t"
92 "[--strictcrlpolicy]"
93 " [--crlcheckinterval <interval>]"
94 " [--cachecrls]"
95 " [--uniqueids]"
96 " \\\n\t"
97 "[--interface <ifname>]"
98 " [--ikeport <port-number>]"
99 " \\\n\t"
100 "[--ctlbase <path>]"
101 " \\\n\t"
102 "[--perpeerlogbase <path>] [--perpeerlog]"
103 " \\\n\t"
104 "[--secretsfile <secrets-file>]"
105 " [--policygroupsdir <policygroups-dir>]"
106 " \\\n\t"
107 "[--adns <pathname>]"
108 "[--pkcs11module <path>]"
109 "[--pkcs11keepstate]"
110 "[--pkcs11initargs <string>]"
111 #ifdef DEBUG
112 " \\\n\t"
113 "[--debug-none]"
114 " [--debug-all]"
115 " \\\n\t"
116 "[--debug-raw]"
117 " [--debug-crypt]"
118 " [--debug-parsing]"
119 " [--debug-emitting]"
120 " \\\n\t"
121 "[--debug-control]"
122 " [--debug-lifecycle]"
123 " [--debug-klips]"
124 " [--debug-dns]"
125 " \\\n\t"
126 "[--debug-oppo]"
127 " [--debug-controlmore]"
128 " [--debug-private]"
129 " [--debug-natt]"
130 #endif
131 " \\\n\t"
132 "[--nat_traversal] [--keep_alive <delay_sec>]"
133 " \\\n\t"
134 "[--force_keepalive] [--disable_port_floating]"
135 " \\\n\t"
136 "[--virtual_private <network_list>]"
137 "\n"
138 "strongSwan %s\n"
139 , ipsec_version_code());
140 exit_pluto(mess == NULL? 0 : 1);
141 }
142
143
144 /* lock file support
145 * - provides convenient way for scripts to find Pluto's pid
146 * - prevents multiple Plutos competing for the same port
147 * - same basename as unix domain control socket
148 * NOTE: will not take account of sharing LOCK_DIR with other systems.
149 */
150
151 static char pluto_lock[sizeof(ctl_addr.sun_path)] = DEFAULT_CTLBASE LOCK_SUFFIX;
152 static bool pluto_lock_created = FALSE;
153
154 /* create lockfile, or die in the attempt */
155 static int create_lock(void)
156 {
157 int fd = open(pluto_lock, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC
158 , S_IRUSR | S_IRGRP | S_IROTH);
159
160 if (fd < 0)
161 {
162 if (errno == EEXIST)
163 {
164 fprintf(stderr, "pluto: lock file \"%s\" already exists\n"
165 , pluto_lock);
166 exit_pluto(10);
167 }
168 else
169 {
170 fprintf(stderr
171 , "pluto: unable to create lock file \"%s\" (%d %s)\n"
172 , pluto_lock, errno, strerror(errno));
173 exit_pluto(1);
174 }
175 }
176 pluto_lock_created = TRUE;
177 return fd;
178 }
179
180 static bool fill_lock(int lockfd, pid_t pid)
181 {
182 char buf[30]; /* holds "<pid>\n" */
183 int len = snprintf(buf, sizeof(buf), "%u\n", (unsigned int) pid);
184 bool ok = len > 0 && write(lockfd, buf, len) == len;
185
186 close(lockfd);
187 return ok;
188 }
189
190 static void delete_lock(void)
191 {
192 if (pluto_lock_created)
193 {
194 delete_ctl_socket();
195 unlink(pluto_lock); /* is noting failure useful? */
196 }
197 }
198
199
200 /* by default pluto sends certificate requests to its peers */
201 bool no_cr_send = FALSE;
202
203 /* by default the CRL policy is lenient */
204 bool strict_crl_policy = FALSE;
205
206 /* by default CRLs are cached locally as files */
207 bool cache_crls = FALSE;
208
209 /* by default pluto does not check crls dynamically */
210 long crl_check_interval = 0;
211
212 /* path to the PKCS#11 module */
213 char *pkcs11_module_path = NULL;
214
215 /* by default pluto logs out after every smartcard use */
216 bool pkcs11_keep_state = FALSE;
217
218 /* by default pluto does not allow pkcs11 proxy access via whack */
219 bool pkcs11_proxy = FALSE;
220
221 /* argument string to pass to PKCS#11 module.
222 * Not used for compliant modules, just for NSS softoken
223 */
224 static const char *pkcs11_init_args = NULL;
225
226 /**
227 * Log loaded plugins
228 */
229 static void print_plugins()
230 {
231 char buf[BUF_LEN], *plugin;
232 int len = 0;
233 enumerator_t *enumerator;
234
235 enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
236 while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin))
237 {
238 len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin);
239 }
240 enumerator->destroy(enumerator);
241 DBG1("loaded plugins: %s", buf);
242 }
243
244 int main(int argc, char **argv)
245 {
246 bool fork_desired = TRUE;
247 bool log_to_stderr_desired = FALSE;
248 bool nat_traversal = FALSE;
249 bool nat_t_spf = TRUE; /* support port floating */
250 unsigned int keep_alive = 0;
251 bool force_keepalive = FALSE;
252 char *virtual_private = NULL;
253 int lockfd;
254 #ifdef CAPABILITIES
255 cap_t caps;
256 int keep[] = { CAP_NET_ADMIN, CAP_NET_BIND_SERVICE };
257 #endif /* CAPABILITIES */
258
259 library_init(STRONGSWAN_CONF);
260
261 /* handle arguments */
262 for (;;)
263 {
264 # define DBG_OFFSET 256
265 static const struct option long_opts[] = {
266 /* name, has_arg, flag, val */
267 { "help", no_argument, NULL, 'h' },
268 { "version", no_argument, NULL, 'v' },
269 { "optionsfrom", required_argument, NULL, '+' },
270 { "nofork", no_argument, NULL, 'd' },
271 { "stderrlog", no_argument, NULL, 'e' },
272 { "noklips", no_argument, NULL, 'n' },
273 { "nocrsend", no_argument, NULL, 'c' },
274 { "strictcrlpolicy", no_argument, NULL, 'r' },
275 { "crlcheckinterval", required_argument, NULL, 'x'},
276 { "cachecrls", no_argument, NULL, 'C' },
277 { "uniqueids", no_argument, NULL, 'u' },
278 { "interface", required_argument, NULL, 'i' },
279 { "ikeport", required_argument, NULL, 'p' },
280 { "ctlbase", required_argument, NULL, 'b' },
281 { "secretsfile", required_argument, NULL, 's' },
282 { "foodgroupsdir", required_argument, NULL, 'f' },
283 { "perpeerlogbase", required_argument, NULL, 'P' },
284 { "perpeerlog", no_argument, NULL, 'l' },
285 { "policygroupsdir", required_argument, NULL, 'f' },
286 #ifdef USE_LWRES
287 { "lwdnsq", required_argument, NULL, 'a' },
288 #else /* !USE_LWRES */
289 { "adns", required_argument, NULL, 'a' },
290 #endif /* !USE_LWRES */
291 { "pkcs11module", required_argument, NULL, 'm' },
292 { "pkcs11keepstate", no_argument, NULL, 'k' },
293 { "pkcs11initargs", required_argument, NULL, 'z' },
294 { "pkcs11proxy", no_argument, NULL, 'y' },
295 { "nat_traversal", no_argument, NULL, '1' },
296 { "keep_alive", required_argument, NULL, '2' },
297 { "force_keepalive", no_argument, NULL, '3' },
298 { "disable_port_floating", no_argument, NULL, '4' },
299 { "debug-natt", no_argument, NULL, '5' },
300 { "virtual_private", required_argument, NULL, '6' },
301 #ifdef DEBUG
302 { "debug-none", no_argument, NULL, 'N' },
303 { "debug-all", no_argument, NULL, 'A' },
304 { "debug-raw", no_argument, NULL, DBG_RAW + DBG_OFFSET },
305 { "debug-crypt", no_argument, NULL, DBG_CRYPT + DBG_OFFSET },
306 { "debug-parsing", no_argument, NULL, DBG_PARSING + DBG_OFFSET },
307 { "debug-emitting", no_argument, NULL, DBG_EMITTING + DBG_OFFSET },
308 { "debug-control", no_argument, NULL, DBG_CONTROL + DBG_OFFSET },
309 { "debug-lifecycle", no_argument, NULL, DBG_LIFECYCLE + DBG_OFFSET },
310 { "debug-klips", no_argument, NULL, DBG_KLIPS + DBG_OFFSET },
311 { "debug-dns", no_argument, NULL, DBG_DNS + DBG_OFFSET },
312 { "debug-oppo", no_argument, NULL, DBG_OPPO + DBG_OFFSET },
313 { "debug-controlmore", no_argument, NULL, DBG_CONTROLMORE + DBG_OFFSET },
314 { "debug-private", no_argument, NULL, DBG_PRIVATE + DBG_OFFSET },
315
316 { "impair-delay-adns-key-answer", no_argument, NULL, IMPAIR_DELAY_ADNS_KEY_ANSWER + DBG_OFFSET },
317 { "impair-delay-adns-txt-answer", no_argument, NULL, IMPAIR_DELAY_ADNS_TXT_ANSWER + DBG_OFFSET },
318 { "impair-bust-mi2", no_argument, NULL, IMPAIR_BUST_MI2 + DBG_OFFSET },
319 { "impair-bust-mr2", no_argument, NULL, IMPAIR_BUST_MR2 + DBG_OFFSET },
320 #endif
321 { 0,0,0,0 }
322 };
323 /* Note: we don't like the way short options get parsed
324 * by getopt_long, so we simply pass an empty string as
325 * the list. It could be "hvdenp:l:s:" "NARXPECK".
326 */
327 int c = getopt_long(argc, argv, "", long_opts, NULL);
328
329 /* Note: "breaking" from case terminates loop */
330 switch (c)
331 {
332 case EOF: /* end of flags */
333 break;
334
335 case 0: /* long option already handled */
336 continue;
337
338 case ':': /* diagnostic already printed by getopt_long */
339 case '?': /* diagnostic already printed by getopt_long */
340 usage("");
341 break; /* not actually reached */
342
343 case 'h': /* --help */
344 usage(NULL);
345 break; /* not actually reached */
346
347 case 'v': /* --version */
348 {
349 const char **sp = ipsec_copyright_notice();
350
351 printf("%s%s\n", ipsec_version_string(),
352 compile_time_interop_options);
353 for (; *sp != NULL; sp++)
354 puts(*sp);
355 }
356 exit_pluto(0);
357 break; /* not actually reached */
358
359 case '+': /* --optionsfrom <filename> */
360 optionsfrom(optarg, &argc, &argv, optind, stderr);
361 /* does not return on error */
362 continue;
363
364 case 'd': /* --nofork*/
365 fork_desired = FALSE;
366 continue;
367
368 case 'e': /* --stderrlog */
369 log_to_stderr_desired = TRUE;
370 continue;
371
372 case 'n': /* --noklips */
373 no_klips = TRUE;
374 continue;
375
376 case 'c': /* --nocrsend */
377 no_cr_send = TRUE;
378 continue;
379
380 case 'r': /* --strictcrlpolicy */
381 strict_crl_policy = TRUE;
382 continue;
383
384 case 'x': /* --crlcheckinterval <time>*/
385 if (optarg == NULL || !isdigit(optarg[0]))
386 usage("missing interval time");
387
388 {
389 char *endptr;
390 long interval = strtol(optarg, &endptr, 0);
391
392 if (*endptr != '\0' || endptr == optarg
393 || interval <= 0)
394 usage("<interval-time> must be a positive number");
395 crl_check_interval = interval;
396 }
397 continue;
398
399 case 'C': /* --cachecrls */
400 cache_crls = TRUE;
401 continue;
402
403 case 'u': /* --uniqueids */
404 uniqueIDs = TRUE;
405 continue;
406
407 case 'i': /* --interface <ifname> */
408 if (!use_interface(optarg))
409 usage("too many --interface specifications");
410 continue;
411
412 case 'p': /* --port <portnumber> */
413 if (optarg == NULL || !isdigit(optarg[0]))
414 usage("missing port number");
415
416 {
417 char *endptr;
418 long port = strtol(optarg, &endptr, 0);
419
420 if (*endptr != '\0' || endptr == optarg
421 || port <= 0 || port > 0x10000)
422 usage("<port-number> must be a number between 1 and 65535");
423 pluto_port = port;
424 }
425 continue;
426
427 case 'b': /* --ctlbase <path> */
428 if (snprintf(ctl_addr.sun_path, sizeof(ctl_addr.sun_path)
429 , "%s%s", optarg, CTL_SUFFIX) == -1)
430 usage("<path>" CTL_SUFFIX " too long for sun_path");
431 if (snprintf(info_addr.sun_path, sizeof(info_addr.sun_path)
432 , "%s%s", optarg, INFO_SUFFIX) == -1)
433 usage("<path>" INFO_SUFFIX " too long for sun_path");
434 if (snprintf(pluto_lock, sizeof(pluto_lock)
435 , "%s%s", optarg, LOCK_SUFFIX) == -1)
436 usage("<path>" LOCK_SUFFIX " must fit");
437 continue;
438
439 case 's': /* --secretsfile <secrets-file> */
440 shared_secrets_file = optarg;
441 continue;
442
443 case 'f': /* --policygroupsdir <policygroups-dir> */
444 policygroups_dir = optarg;
445 continue;
446
447 case 'a': /* --adns <pathname> */
448 pluto_adns_option = optarg;
449 continue;
450
451 case 'm': /* --pkcs11module <pathname> */
452 pkcs11_module_path = optarg;
453 continue;
454
455 case 'k': /* --pkcs11keepstate */
456 pkcs11_keep_state = TRUE;
457 continue;
458
459 case 'y': /* --pkcs11proxy */
460 pkcs11_proxy = TRUE;
461 continue;
462
463 case 'z': /* --pkcs11initargs */
464 pkcs11_init_args = optarg;
465 continue;
466
467 #ifdef DEBUG
468 case 'N': /* --debug-none */
469 base_debugging = DBG_NONE;
470 continue;
471
472 case 'A': /* --debug-all */
473 base_debugging = DBG_ALL;
474 continue;
475 #endif
476
477 case 'P': /* --perpeerlogbase */
478 base_perpeer_logdir = optarg;
479 continue;
480
481 case 'l':
482 log_to_perpeer = TRUE;
483 continue;
484
485 case '1': /* --nat_traversal */
486 nat_traversal = TRUE;
487 continue;
488 case '2': /* --keep_alive */
489 keep_alive = atoi(optarg);
490 continue;
491 case '3': /* --force_keepalive */
492 force_keepalive = TRUE;
493 continue;
494 case '4': /* --disable_port_floating */
495 nat_t_spf = FALSE;
496 continue;
497 case '5': /* --debug-nat_t */
498 base_debugging |= DBG_NATT;
499 continue;
500 case '6': /* --virtual_private */
501 virtual_private = optarg;
502 continue;
503
504 default:
505 #ifdef DEBUG
506 if (c >= DBG_OFFSET)
507 {
508 base_debugging |= c - DBG_OFFSET;
509 continue;
510 }
511 # undef DBG_OFFSET
512 #endif
513 bad_case(c);
514 }
515 break;
516 }
517 if (optind != argc)
518 usage("unexpected argument");
519 reset_debugging();
520 lockfd = create_lock();
521
522 /* select between logging methods */
523
524 if (log_to_stderr_desired)
525 {
526 log_to_syslog = FALSE;
527 }
528 else
529 {
530 log_to_stderr = FALSE;
531 }
532
533 /* set the logging function of pfkey debugging */
534 #ifdef DEBUG
535 pfkey_debug_func = DBG_log;
536 #else
537 pfkey_debug_func = NULL;
538 #endif
539
540 /* create control socket.
541 * We must create it before the parent process returns so that
542 * there will be no race condition in using it. The easiest
543 * place to do this is before the daemon fork.
544 */
545 {
546 err_t ugh = init_ctl_socket();
547
548 if (ugh != NULL)
549 {
550 fprintf(stderr, "pluto: %s", ugh);
551 exit_pluto(1);
552 }
553 }
554
555 /* If not suppressed, do daemon fork */
556
557 if (fork_desired)
558 {
559 {
560 pid_t pid = fork();
561
562 if (pid < 0)
563 {
564 int e = errno;
565
566 fprintf(stderr, "pluto: fork failed (%d %s)\n",
567 errno, strerror(e));
568 exit_pluto(1);
569 }
570
571 if (pid != 0)
572 {
573 /* parent: die, after filling PID into lock file.
574 * must not use exit_pluto: lock would be removed!
575 */
576 exit(fill_lock(lockfd, pid)? 0 : 1);
577 }
578 }
579
580 if (setsid() < 0)
581 {
582 int e = errno;
583
584 fprintf(stderr, "setsid() failed in main(). Errno %d: %s\n",
585 errno, strerror(e));
586 exit_pluto(1);
587 }
588 }
589 else
590 {
591 /* no daemon fork: we have to fill in lock file */
592 (void) fill_lock(lockfd, getpid());
593 fprintf(stdout, "Pluto initialized\n");
594 fflush(stdout);
595 }
596
597 /* Close everything but ctl_fd and (if needed) stderr.
598 * There is some danger that a library that we don't know
599 * about is using some fd that we don't know about.
600 * I guess we'll soon find out.
601 */
602 {
603 int i;
604
605 for (i = getdtablesize() - 1; i >= 0; i--) /* Bad hack */
606 {
607 if ((!log_to_stderr || i != 2) && i != ctl_fd)
608 close(i);
609 }
610
611 /* make sure that stdin, stdout, stderr are reserved */
612 if (open("/dev/null", O_RDONLY) != 0)
613 abort();
614 if (dup2(0, 1) != 1)
615 abort();
616 if (!log_to_stderr && dup2(0, 2) != 2)
617 abort();
618 }
619
620 init_constants();
621 init_log("pluto");
622
623 /* Note: some scripts may look for this exact message -- don't change
624 * ipsec barf was one, but it no longer does.
625 */
626 plog("Starting Pluto (strongSwan Version %s%s)"
627 , ipsec_version_code()
628 , compile_time_interop_options);
629
630 /* load plugins, further infrastructure may need it */
631 lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
632 lib->settings->get_str(lib->settings, "pluto.load", PLUGINS));
633 print_plugins();
634
635 init_nat_traversal(nat_traversal, keep_alive, force_keepalive, nat_t_spf);
636 init_virtual_ip(virtual_private);
637 scx_init(pkcs11_module_path, pkcs11_init_args); /* load and initialize PKCS #11 module */
638 xauth_init(); /* load and initialize XAUTH module */
639 init_rnd_pool();
640 init_secret();
641 init_states();
642 init_crypto();
643 init_demux();
644 init_kernel();
645 init_adns();
646 init_id();
647 init_fetch();
648
649 /* drop unneeded capabilities and change UID/GID */
650 prctl(PR_SET_KEEPCAPS, 1);
651
652 #ifdef IPSEC_GROUP
653 {
654 struct group group, *grp;
655 char buf[1024];
656
657 if (getgrnam_r(IPSEC_GROUP, &group, buf, sizeof(buf), &grp) != 0 ||
658 grp == NULL || setgid(grp->gr_gid) != 0)
659 {
660 plog("unable to change daemon group");
661 abort();
662 }
663 }
664 #endif
665 #ifdef IPSEC_USER
666 {
667 struct passwd passwd, *pwp;
668 char buf[1024];
669
670 if (getpwnam_r(IPSEC_USER, &passwd, buf, sizeof(buf), &pwp) != 0 ||
671 pwp == NULL || setuid(pwp->pw_uid) != 0)
672 {
673 plog("unable to change daemon user");
674 abort();
675 }
676 }
677 #endif
678
679 #ifdef CAPABILITIES
680 caps = cap_init();
681 cap_set_flag(caps, CAP_EFFECTIVE, 2, keep, CAP_SET);
682 cap_set_flag(caps, CAP_INHERITABLE, 2, keep, CAP_SET);
683 cap_set_flag(caps, CAP_PERMITTED, 2, keep, CAP_SET);
684 if (cap_set_proc(caps) != 0)
685 {
686 plog("unable to drop daemon capabilities");
687 abort();
688 }
689 cap_free(caps);
690 #endif /* CAPABILITIES */
691
692 /* loading X.509 CA certificates */
693 load_authcerts("CA cert", CA_CERT_PATH, AUTH_CA);
694 /* loading X.509 AA certificates */
695 load_authcerts("AA cert", AA_CERT_PATH, AUTH_AA);
696 /* loading X.509 OCSP certificates */
697 load_authcerts("OCSP cert", OCSP_CERT_PATH, AUTH_OCSP);
698 /* loading X.509 CRLs */
699 load_crls();
700 /* loading attribute certificates (experimental) */
701 load_acerts();
702
703 daily_log_event();
704 call_server();
705 return -1; /* Shouldn't ever reach this */
706 }
707
708 /* leave pluto, with status.
709 * Once child is launched, parent must not exit this way because
710 * the lock would be released.
711 *
712 * 0 OK
713 * 1 general discomfort
714 * 10 lock file exists
715 */
716 void exit_pluto(int status)
717 {
718 reset_globals(); /* needed because we may be called in odd state */
719 free_preshared_secrets();
720 free_remembered_public_keys();
721 delete_every_connection();
722 free_crl_fetch(); /* free chain of crl fetch requests */
723 free_ocsp_fetch(); /* free chain of ocsp fetch requests */
724 free_authcerts(); /* free chain of X.509 authority certificates */
725 free_crls(); /* free chain of X.509 CRLs */
726 free_acerts(); /* free chain of X.509 attribute certificates */
727 free_ca_infos(); /* free chain of X.509 CA information records */
728 free_ocsp(); /* free ocsp cache */
729 free_ifaces();
730 scx_finalize(); /* finalize and unload PKCS #11 module */
731 xauth_finalize(); /* finalize and unload XAUTH module */
732 stop_adns();
733 free_md_pool();
734 free_crypto();
735 free_id(); /* free myids */
736 free_events(); /* free remaining events */
737 free_vendorid(); /* free all vendor id records */
738 delete_lock();
739 library_deinit();
740 close_log();
741 exit(status);
742 }
743
744 /*
745 * Local Variables:
746 * c-basic-offset:4
747 * c-style: pluto
748 * End:
749 */