kevent: fix directory check
[exim.git] / src / src / tls.c
1 /*************************************************
2 *     Exim - an Internet mail transport agent    *
3 *************************************************/
4
5 /* Copyright (c) University of Cambridge 1995 - 2018 */
6 /* Copyright (c) The Exim Maintainers 2020 */
7 /* See the file NOTICE for conditions of use and distribution. */
8
9 /* This module provides TLS (aka SSL) support for Exim. The code for OpenSSL is
10 based on a patch that was originally contributed by Steve Haslam. It was
11 adapted from stunnel, a GPL program by Michal Trojnara. The code for GNU TLS is
12 based on a patch contributed by Nikos Mavrogiannopoulos. Because these packages
13 are so very different, the functions for each are kept in separate files. The
14 relevant file is #included as required, after any any common functions.
15
16 No cryptographic code is included in Exim. All this module does is to call
17 functions from the OpenSSL or GNU TLS libraries. */
18
19
20 #include "exim.h"
21 #include "transports/smtp.h"
22
23 #if !defined(DISABLE_TLS) && !defined(USE_OPENSSL) && !defined(USE_GNUTLS)
24 # error One of USE_OPENSSL or USE_GNUTLS must be defined for a TLS build
25 #endif
26
27
28 #if defined(MACRO_PREDEF) && !defined(DISABLE_TLS)
29 # include "macro_predef.h"
30 # ifdef USE_GNUTLS
31 #  include "tls-gnu.c"
32 # else
33 #  include "tls-openssl.c"
34 # endif
35 #endif
36
37 #ifndef MACRO_PREDEF
38
39 static void tls_per_lib_daemon_init(void);
40 static void tls_per_lib_daemon_tick(void);
41 static void tls_server_creds_init(void);
42 static void tls_server_creds_invalidate(void);
43 static void tls_client_creds_init(transport_instance *, BOOL);
44 static void tls_client_creds_invalidate(transport_instance *);
45 static void tls_daemon_creds_reload(void);
46 static BOOL opt_set_and_noexpand(const uschar *);
47 static BOOL opt_unset_or_noexpand(const uschar *);
48
49
50
51 /* This module is compiled only when it is specifically requested in the
52 build-time configuration. However, some compilers don't like compiling empty
53 modules, so keep them happy with a dummy when skipping the rest. Make it
54 reference itself to stop picky compilers complaining that it is unused, and put
55 in a dummy argument to stop even pickier compilers complaining about infinite
56 loops. */
57
58 #ifdef DISABLE_TLS
59 static void dummy(int x) { dummy(x-1); }
60 #else   /* most of the rest of the file */
61
62 const exim_tlslib_state null_tls_preload = {0};
63
64 /* Static variables that are used for buffering data by both sets of
65 functions and the common functions below.
66
67 We're moving away from this; GnuTLS is already using a state, which
68 can switch, so we can do TLS callouts during ACLs. */
69
70 static const int ssl_xfer_buffer_size = 4096;
71 #ifdef USE_OPENSSL
72 static uschar *ssl_xfer_buffer = NULL;
73 static int ssl_xfer_buffer_lwm = 0;
74 static int ssl_xfer_buffer_hwm = 0;
75 static int ssl_xfer_eof = FALSE;
76 static BOOL ssl_xfer_error = FALSE;
77 #endif
78
79 #ifdef EXIM_HAVE_KEVENT
80 # define KEV_SIZE 16    /* Eight file,dir pairs */
81 static struct kevent kev[KEV_SIZE];
82 static int kev_used = 0;
83 #endif
84
85 /*************************************************
86 *       Expand string; give error on failure     *
87 *************************************************/
88
89 /* If expansion is forced to fail, set the result NULL and return TRUE.
90 Other failures return FALSE. For a server, an SMTP response is given.
91
92 Arguments:
93   s         the string to expand; if NULL just return TRUE
94   name      name of string being expanded (for error)
95   result    where to put the result
96
97 Returns:    TRUE if OK; result may still be NULL after forced failure
98 */
99
100 static BOOL
101 expand_check(const uschar *s, const uschar *name, uschar **result, uschar ** errstr)
102 {
103 if (!s)
104   *result = NULL;
105 else if (  !(*result = expand_string(US s)) /* need to clean up const more */
106         && !f.expand_string_forcedfail
107         )
108   {
109   *errstr = US"Internal error";
110   log_write(0, LOG_MAIN|LOG_PANIC, "expansion of %s failed: %s", name,
111     expand_string_message);
112   return FALSE;
113   }
114 return TRUE;
115 }
116
117
118 #if defined(EXIM_HAVE_INOTIFY) || defined(EXIM_HAVE_KEVENT)
119 /* Add the directory for a filename to the inotify handle, creating that if
120 needed.  This is enough to see changes to files in that dir.
121 Return boolean success.
122
123 The word "system" fails, which is on the safe side as we don't know what
124 directory it implies nor if the TLS library handles a watch for us.
125
126 The string "system,cache" is recognised and explicitly accepted without
127 setting a watch.  This permits the system CA bundle to be cached even though
128 we have no way to tell when it gets modified by an update.
129 The call chain for OpenSSL uses a (undocumented) call into the library
130 to discover the actual file.  We don't know what GnuTLS uses.
131
132 A full set of caching including the CAs takes 35ms output off of the
133 server tls_init() (GnuTLS, Fedora 32, 2018-class x86_64 laptop hardware).
134 */
135 static BOOL
136 tls_set_one_watch(const uschar * filename)
137 # ifdef EXIM_HAVE_INOTIFY
138 {
139 uschar * s;
140
141 if (Ustrcmp(filename, "system,cache") == 0) return TRUE;
142
143 if (!(s = Ustrrchr(filename, '/'))) return FALSE;
144 s = string_copyn(filename, s - filename);       /* mem released by tls_set_watch */
145 DEBUG(D_tls) debug_printf("watch dir '%s'\n", s);
146
147 /*XXX unclear what effect symlinked files will have for inotify */
148
149 if (inotify_add_watch(tls_watch_fd, CCS s,
150       IN_ONESHOT | IN_CLOSE_WRITE | IN_DELETE | IN_DELETE_SELF
151       | IN_MOVED_FROM | IN_MOVED_TO | IN_MOVE_SELF) >= 0)
152   return TRUE;
153 DEBUG(D_tls) debug_printf("notify_add_watch: %s\n", strerror(errno));
154 return FALSE;
155 }
156 # endif
157 # ifdef EXIM_HAVE_KEVENT
158 {
159 uschar * s;
160 int fd1, fd2, i, cnt = 0;
161 struct stat sb;
162
163 errno = 0;
164 if (Ustrcmp(filename, "system,cache") == 0) return TRUE;
165
166 for (;;)
167   {
168   if (kev_used > KEV_SIZE-2) { s = US"out of kev space"; goto bad; }
169   if (!(s = Ustrrchr(filename, '/'))) return FALSE;
170   s = string_copyn(filename, s - filename);     /* mem released by tls_set_watch */
171
172   /* The dir open will fail if there is a symlink on the path. Fine; it's too
173   much effort to handle all possible cases; just refuse the preload. */
174
175   if ((fd2 = open(CCS s, O_RDONLY | O_NOFOLLOW)) < 0) { s = US"open dir"; goto bad; }
176
177   if ((lstat(CCS filename, &sb)) < 0) { s = US"lstat"; goto bad; }
178   if (!S_ISLNK(sb.st_mode))
179     {
180     if ((fd1 = open(CCS filename, O_RDONLY | O_NOFOLLOW)) < 0)
181       { s = US"open file"; goto bad; }
182     DEBUG(D_tls) debug_printf("watch file '%s'\n", filename);
183     EV_SET(&kev[++kev_used],
184         (uintptr_t)fd1,
185         EVFILT_VNODE,
186         EV_ADD | EV_ENABLE | EV_ONESHOT,
187         NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND
188         | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
189         0,
190         NULL);
191     cnt++;
192     }
193   DEBUG(D_tls) debug_printf("watch dir  '%s'\n", s);
194   EV_SET(&kev[++kev_used],
195         (uintptr_t)fd2,
196         EVFILT_VNODE,
197         EV_ADD | EV_ENABLE | EV_ONESHOT,
198         NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND
199         | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
200         0,
201         NULL);
202   cnt++;
203
204   if (!(S_ISLNK(sb.st_mode))) break;
205
206   s = store_get(1024, FALSE);
207   if ((i = readlink(CCS filename, s, 1024)) < 0) { s = US"readlink"; goto bad; }
208   filename = s;
209   *(s += i) = '\0';
210   store_release_above(s+1);
211   }
212
213 if (kevent(tls_watch_fd, &kev[kev_used-cnt], cnt, NULL, 0, NULL) >= 0)
214   return TRUE;
215 s = US"kevent";
216
217 bad:
218 DEBUG(D_tls)
219   if (errno)
220     debug_printf("%s: %s: %s\n", __FUNCTION__, s, strerror(errno));
221   else
222     debug_printf("%s: %s\n", __FUNCTION__, s);
223 return FALSE;
224 }
225 # endif /*EXIM_HAVE_KEVENT*/
226
227
228 /* Create an inotify facility if needed.
229 Then set watches on the dir containing the given file or (optionally)
230 list of files.  Return boolean success. */
231
232 static BOOL
233 tls_set_watch(const uschar * filename, BOOL list)
234 {
235 rmark r;
236 BOOL rc = FALSE;
237
238 if (!filename || !*filename) return TRUE;
239 if (Ustrncmp(filename, "system", 6) == 0) return TRUE;
240
241 DEBUG(D_tls) debug_printf("tls_set_watch: '%s'\n", filename);
242
243 if (  tls_watch_fd < 0
244 # ifdef EXIM_HAVE_INOTIFY
245    && (tls_watch_fd = inotify_init1(O_CLOEXEC)) < 0
246 # endif
247 # ifdef EXIM_HAVE_KEVENT
248    && (tls_watch_fd = kqueue()) < 0
249 # endif
250    )
251     {
252     DEBUG(D_tls) debug_printf("inotify_init: %s\n", strerror(errno));
253     return FALSE;
254     }
255
256 r = store_mark();
257
258 if (list)
259   {
260   int sep = 0;
261   for (uschar * s; s = string_nextinlist(&filename, &sep, NULL, 0); )
262     if (!(rc = tls_set_one_watch(s))) break;
263   }
264 else
265   rc = tls_set_one_watch(filename);
266
267 store_reset(r);
268 if (!rc) DEBUG(D_tls) debug_printf("tls_set_watch() fail on '%s': %s\n", filename, strerror(errno));
269 return rc;
270 }
271
272
273 void
274 tls_watch_discard_event(int fd)
275 {
276 #ifdef EXIM_HAVE_INOTIFY
277 (void) read(fd, big_buffer, big_buffer_size);
278 #endif
279 #ifdef EXIM_HAVE_KEVENT
280 struct kevent kev;
281 struct timespec t = {0};
282 (void) kevent(fd, NULL, 0, &kev, 1, &t);
283 #endif
284 }
285
286 /* Called, after a delay for multiple file ops to get done, from
287 the daemon when any of the watches added (above) fire.
288
289 Dump the set of watches and arrange to reload cached creds (which
290 will set up new watches). */
291
292 static void
293 tls_watch_triggered(void)
294 {
295 DEBUG(D_tls) debug_printf("watch triggered\n");
296
297 tls_daemon_creds_reload();
298 }
299 #endif  /*EXIM_HAVE_INOTIFY*/
300
301
302 void
303 tls_client_creds_reload(BOOL watch)
304 {
305 for(transport_instance * t = transports; t; t = t->next)
306   if (Ustrcmp(t->driver_name, "smtp") == 0)
307     {
308     tls_client_creds_invalidate(t);
309     tls_client_creds_init(t, watch);
310     }
311 }
312
313
314 void
315 tls_watch_invalidate(void)
316 {
317 if (tls_watch_fd < 0) return;
318
319 #ifdef EXIM_HAVE_KEVENT
320 /* Close the files we had open for kevent */
321 for (int fd, i = 0; i < kev_used; i++)
322   {
323   (void) close((int) kev[i].ident);
324   kev[i].ident = (uintptr_t)-1;
325   }
326 kev_used = 0;
327 #endif
328
329 close(tls_watch_fd);
330 tls_watch_fd = -1;
331 }
332
333
334 static void
335 tls_daemon_creds_reload(void)
336 {
337 #ifdef EXIM_HAVE_KEVENT
338 tls_watch_invalidate();
339 #endif
340
341 tls_server_creds_invalidate();
342 tls_server_creds_init();
343
344 tls_client_creds_reload(TRUE);
345 }
346
347
348 /* Utility predicates for use by the per-library code */
349 static BOOL
350 opt_set_and_noexpand(const uschar * opt)
351 { return opt && *opt && Ustrchr(opt, '$') == NULL; }
352
353 static BOOL
354 opt_unset_or_noexpand(const uschar * opt)
355 { return !opt || Ustrchr(opt, '$') == NULL; }
356
357
358
359 /* Called every time round the daemon loop */
360
361 void
362 tls_daemon_tick(void)
363 {
364 tls_per_lib_daemon_tick();
365 #if defined(EXIM_HAVE_INOTIFY) || defined(EXIM_HAVE_KEVENT)
366 if (tls_watch_trigger_time && time(NULL) >= tls_watch_trigger_time + 5)
367   {
368   tls_watch_trigger_time = 0;
369   tls_watch_triggered();
370   }
371 #endif
372 }
373
374 /* Called once at daemon startup */
375
376 void
377 tls_daemon_init(void)
378 {
379 tls_per_lib_daemon_init();
380 }
381
382
383 /*************************************************
384 *        Timezone environment flipping           *
385 *************************************************/
386
387 static uschar *
388 to_tz(uschar * tz)
389 {
390 uschar * old = US getenv("TZ");
391 (void) setenv("TZ", CCS tz, 1);
392 tzset();
393 return old;
394 }
395
396 static void
397 restore_tz(uschar * tz)
398 {
399 if (tz)
400   (void) setenv("TZ", CCS tz, 1);
401 else
402   (void) os_unsetenv(US"TZ");
403 tzset();
404 }
405
406 /*************************************************
407 *        Many functions are package-specific     *
408 *************************************************/
409
410 #ifdef USE_GNUTLS
411 # include "tls-gnu.c"
412 # include "tlscert-gnu.c"
413 # define ssl_xfer_buffer (state_server.xfer_buffer)
414 # define ssl_xfer_buffer_lwm (state_server.xfer_buffer_lwm)
415 # define ssl_xfer_buffer_hwm (state_server.xfer_buffer_hwm)
416 # define ssl_xfer_eof (state_server.xfer_eof)
417 # define ssl_xfer_error (state_server.xfer_error)
418 #endif
419
420 #ifdef USE_OPENSSL
421 # include "tls-openssl.c"
422 # include "tlscert-openssl.c"
423 #endif
424
425
426
427 /*************************************************
428 *           TLS version of ungetc                *
429 *************************************************/
430
431 /* Puts a character back in the input buffer. Only ever
432 called once.
433 Only used by the server-side TLS.
434
435 Arguments:
436   ch           the character
437
438 Returns:       the character
439 */
440
441 int
442 tls_ungetc(int ch)
443 {
444 ssl_xfer_buffer[--ssl_xfer_buffer_lwm] = ch;
445 return ch;
446 }
447
448
449
450 /*************************************************
451 *           TLS version of feof                  *
452 *************************************************/
453
454 /* Tests for a previous EOF
455 Only used by the server-side TLS.
456
457 Arguments:     none
458 Returns:       non-zero if the eof flag is set
459 */
460
461 int
462 tls_feof(void)
463 {
464 return (int)ssl_xfer_eof;
465 }
466
467
468
469 /*************************************************
470 *              TLS version of ferror             *
471 *************************************************/
472
473 /* Tests for a previous read error, and returns with errno
474 restored to what it was when the error was detected.
475 Only used by the server-side TLS.
476
477 >>>>> Hmm. Errno not handled yet. Where do we get it from?  >>>>>
478
479 Arguments:     none
480 Returns:       non-zero if the error flag is set
481 */
482
483 int
484 tls_ferror(void)
485 {
486 return (int)ssl_xfer_error;
487 }
488
489
490 /*************************************************
491 *           TLS version of smtp_buffered         *
492 *************************************************/
493
494 /* Tests for unused chars in the TLS input buffer.
495 Only used by the server-side TLS.
496
497 Arguments:     none
498 Returns:       TRUE/FALSE
499 */
500
501 BOOL
502 tls_smtp_buffered(void)
503 {
504 return ssl_xfer_buffer_lwm < ssl_xfer_buffer_hwm;
505 }
506
507
508 #endif  /*DISABLE_TLS*/
509
510 void
511 tls_modify_variables(tls_support * dest_tsp)
512 {
513 modify_variable(US"tls_bits",                 &dest_tsp->bits);
514 modify_variable(US"tls_certificate_verified", &dest_tsp->certificate_verified);
515 modify_variable(US"tls_cipher",               &dest_tsp->cipher);
516 modify_variable(US"tls_peerdn",               &dest_tsp->peerdn);
517 #ifdef USE_OPENSSL
518 modify_variable(US"tls_sni",                  &dest_tsp->sni);
519 #endif
520 }
521
522
523 #ifndef DISABLE_TLS
524 /************************************************
525 *       TLS certificate name operations         *
526 ************************************************/
527
528 /* Convert an rfc4514 DN to an exim comma-sep list.
529 Backslashed commas need to be replaced by doublecomma
530 for Exim's list quoting.  We modify the given string
531 inplace.
532 */
533
534 static void
535 dn_to_list(uschar * dn)
536 {
537 for (uschar * cp = dn; *cp; cp++)
538   if (cp[0] == '\\' && cp[1] == ',')
539     *cp++ = ',';
540 }
541
542
543 /* Extract fields of a given type from an RFC4514-
544 format Distinguished Name.  Return an Exim list.
545 NOTE: We modify the supplied dn string during operation.
546
547 Arguments:
548         dn      Distinguished Name string
549         mod     list containing optional output list-sep and
550                 field selector match, comma-separated
551 Return:
552         allocated string with list of matching fields,
553         field type stripped
554 */
555
556 uschar *
557 tls_field_from_dn(uschar * dn, const uschar * mod)
558 {
559 int insep = ',';
560 uschar outsep = '\n';
561 uschar * ele;
562 uschar * match = NULL;
563 int len;
564 gstring * list = NULL;
565
566 while ((ele = string_nextinlist(&mod, &insep, NULL, 0)))
567   if (ele[0] != '>')
568     match = ele;        /* field tag to match */
569   else if (ele[1])
570     outsep = ele[1];    /* nondefault output separator */
571
572 dn_to_list(dn);
573 insep = ',';
574 len = match ? Ustrlen(match) : -1;
575 while ((ele = string_nextinlist(CUSS &dn, &insep, NULL, 0)))
576   if (  !match
577      || Ustrncmp(ele, match, len) == 0 && ele[len] == '='
578      )
579     list = string_append_listele(list, outsep, ele+len+1);
580 return string_from_gstring(list);
581 }
582
583
584 /* Compare a domain name with a possibly-wildcarded name. Wildcards
585 are restricted to a single one, as the first element of patterns
586 having at least three dot-separated elements.  Case-independent.
587 Return TRUE for a match
588 */
589 static BOOL
590 is_name_match(const uschar * name, const uschar * pat)
591 {
592 uschar * cp;
593 return *pat == '*'              /* possible wildcard match */
594   ?    *++pat == '.'            /* starts star, dot              */
595     && !Ustrchr(++pat, '*')     /* has no more stars             */
596     && Ustrchr(pat, '.')        /* and has another dot.          */
597     && (cp = Ustrchr(name, '.'))/* The name has at least one dot */
598     && strcmpic(++cp, pat) == 0 /* and we only compare after it. */
599   :    !Ustrchr(pat+1, '*')
600     && strcmpic(name, pat) == 0;
601 }
602
603 /* Compare a list of names with the dnsname elements
604 of the Subject Alternate Name, if any, and the
605 Subject otherwise.
606
607 Arguments:
608         namelist names to compare
609         cert     certificate
610
611 Returns:
612         TRUE/FALSE
613 */
614
615 BOOL
616 tls_is_name_for_cert(const uschar * namelist, void * cert)
617 {
618 uschar * altnames = tls_cert_subject_altname(cert, US"dns");
619 uschar * subjdn;
620 uschar * certname;
621 int cmp_sep = 0;
622 uschar * cmpname;
623
624 if ((altnames = tls_cert_subject_altname(cert, US"dns")))
625   {
626   int alt_sep = '\n';
627   while ((cmpname = string_nextinlist(&namelist, &cmp_sep, NULL, 0)))
628     {
629     const uschar * an = altnames;
630     while ((certname = string_nextinlist(&an, &alt_sep, NULL, 0)))
631       if (is_name_match(cmpname, certname))
632         return TRUE;
633     }
634   }
635
636 else if ((subjdn = tls_cert_subject(cert, NULL)))
637   {
638   int sn_sep = ',';
639
640   dn_to_list(subjdn);
641   while ((cmpname = string_nextinlist(&namelist, &cmp_sep, NULL, 0)))
642     {
643     const uschar * sn = subjdn;
644     while ((certname = string_nextinlist(&sn, &sn_sep, NULL, 0)))
645       if (  *certname++ == 'C'
646          && *certname++ == 'N'
647          && *certname++ == '='
648          && is_name_match(cmpname, certname)
649          )
650         return TRUE;
651     }
652   }
653 return FALSE;
654 }
655
656
657 /* Environment cleanup: The GnuTLS library uses SSLKEYLOGFILE in the environment
658 and writes a file by that name.  Our OpenSSL code does the same, using keying
659 info from the library API.
660 The GnuTLS support only works if exim is run by root, not taking advantage of
661 the setuid bit.
662 You can use either the external environment (modulo the keep_environment config)
663 or the add_environment config option for SSLKEYLOGFILE; the latter takes
664 precedence.
665
666 If the path is absolute, require it starts with the spooldir; otherwise delete
667 the env variable.  If relative, prefix the spooldir.
668 */
669 void
670 tls_clean_env(void)
671 {
672 uschar * path = US getenv("SSLKEYLOGFILE");
673 if (path)
674   if (!*path)
675     unsetenv("SSLKEYLOGFILE");
676   else if (*path != '/')
677     {
678     DEBUG(D_tls)
679       debug_printf("prepending spooldir to  env SSLKEYLOGFILE\n");
680     setenv("SSLKEYLOGFILE", CCS string_sprintf("%s/%s", spool_directory, path), 1);
681     }
682   else if (Ustrncmp(path, spool_directory, Ustrlen(spool_directory)) != 0)
683     {
684     DEBUG(D_tls)
685       debug_printf("removing env SSLKEYLOGFILE=%s: not under spooldir\n", path);
686     unsetenv("SSLKEYLOGFILE");
687     }
688 }
689
690 /*************************************************
691 *       Drop privs for checking TLS config      *
692 *************************************************/
693
694 /* We want to validate TLS options during readconf, but do not want to be
695 root when we call into the TLS library, in case of library linkage errors
696 which cause segfaults; before this check, those were always done as the Exim
697 runtime user and it makes sense to continue with that.
698
699 Assumes:  tls_require_ciphers has been set, if it will be
700           exim_user has been set, if it will be
701           exim_group has been set, if it will be
702
703 Returns:  bool for "okay"; false will cause caller to immediately exit.
704 */
705
706 BOOL
707 tls_dropprivs_validate_require_cipher(BOOL nowarn)
708 {
709 const uschar *errmsg;
710 pid_t pid;
711 int rc, status;
712 void (*oldsignal)(int);
713
714 /* If TLS will never be used, no point checking ciphers */
715
716 if (  !tls_advertise_hosts
717    || !*tls_advertise_hosts
718    || Ustrcmp(tls_advertise_hosts, ":") == 0
719    )
720   return TRUE;
721 else if (!nowarn && !tls_certificate)
722   log_write(0, LOG_MAIN,
723     "Warning: No server certificate defined; will use a selfsigned one.\n"
724     " Suggested action: either install a certificate or change tls_advertise_hosts option");
725
726 oldsignal = signal(SIGCHLD, SIG_DFL);
727
728 fflush(NULL);
729 if ((pid = exim_fork(US"cipher-validate")) < 0)
730   log_write(0, LOG_MAIN|LOG_PANIC_DIE, "fork failed for TLS check");
731
732 if (pid == 0)
733   {
734   /* in some modes, will have dropped privilege already */
735   if (!geteuid())
736     exim_setugid(exim_uid, exim_gid, FALSE,
737         US"calling tls_validate_require_cipher");
738
739   if ((errmsg = tls_validate_require_cipher()))
740     log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
741         "tls_require_ciphers invalid: %s", errmsg);
742   fflush(NULL);
743   exim_underbar_exit(EXIT_SUCCESS);
744   }
745
746 do {
747   rc = waitpid(pid, &status, 0);
748 } while (rc < 0 && errno == EINTR);
749
750 DEBUG(D_tls)
751   debug_printf("tls_validate_require_cipher child %d ended: status=0x%x\n",
752       (int)pid, status);
753
754 signal(SIGCHLD, oldsignal);
755
756 return status == 0;
757 }
758
759
760
761
762 #endif  /*!DISABLE_TLS*/
763 #endif  /*!MACRO_PREDEF*/
764
765 /* vi: aw ai sw=2
766 */
767 /* End of tls.c */