2 * Copyright (c) 1997-2005 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 /* Should we enable the HTTP hack? */
39 /* Log over requests to the KDC */
40 const char *request_log
;
42 /* A string describing on what ports to listen */
45 krb5_addresses explicit_addresses
;
47 size_t max_request_udp
;
48 size_t max_request_tcp
;
51 * a tuple describing on what to listen
60 /* the current ones */
62 static struct port_desc
*ports
;
63 static size_t num_ports
;
66 * add `family, port, protocol' to the list with duplicate suppresion.
70 add_port(krb5_context context
,
71 int family
, int port
, const char *protocol
)
76 if(strcmp(protocol
, "udp") == 0)
78 else if(strcmp(protocol
, "tcp") == 0)
82 for(i
= 0; i
< num_ports
; i
++){
83 if(ports
[i
].type
== type
84 && ports
[i
].port
== port
85 && ports
[i
].family
== family
)
88 ports
= realloc(ports
, (num_ports
+ 1) * sizeof(*ports
));
90 krb5_err (context
, 1, errno
, "realloc");
91 ports
[num_ports
].family
= family
;
92 ports
[num_ports
].type
= type
;
93 ports
[num_ports
].port
= port
;
98 * add a triple but with service -> port lookup
99 * (this prints warnings for stuff that does not exist)
103 add_port_service(krb5_context context
,
104 int family
, const char *service
, int port
,
105 const char *protocol
)
107 port
= krb5_getportbyname (context
, service
, protocol
, port
);
108 add_port (context
, family
, port
, protocol
);
112 * add the port with service -> port lookup or string -> number
113 * (no warning is printed)
117 add_port_string (krb5_context context
,
118 int family
, const char *str
, const char *protocol
)
123 sp
= roken_getservbyname (str
, protocol
);
129 port
= htons(strtol(str
, &end
, 0));
133 add_port (context
, family
, port
, protocol
);
137 * add the standard collection of ports for `family'
141 add_standard_ports (krb5_context context
,
142 krb5_kdc_configuration
*config
,
145 add_port_service(context
, family
, "kerberos", 88, "udp");
146 add_port_service(context
, family
, "kerberos", 88, "tcp");
147 add_port_service(context
, family
, "kerberos-sec", 88, "udp");
148 add_port_service(context
, family
, "kerberos-sec", 88, "tcp");
150 add_port_service(context
, family
, "http", 80, "tcp");
151 if(config
->enable_kx509
) {
152 add_port_service(context
, family
, "kca_service", 9878, "udp");
153 add_port_service(context
, family
, "kca_service", 9878, "tcp");
159 * parse the set of space-delimited ports in `str' and add them.
160 * "+" => all the standard ones
161 * otherwise it's port|service[/protocol]
165 parse_ports(krb5_context context
,
166 krb5_kdc_configuration
*config
,
171 char *str_copy
= strdup (str
);
173 p
= strtok_r(str_copy
, " \t", &pos
);
175 if(strcmp(p
, "+") == 0) {
177 add_standard_ports(context
, config
, AF_INET6
);
179 add_standard_ports(context
, config
, AF_INET
);
181 char *q
= strchr(p
, '/');
185 add_port_string(context
, AF_INET6
, p
, q
);
187 add_port_string(context
, AF_INET
, p
, q
);
190 add_port_string(context
, AF_INET6
, p
, "udp");
191 add_port_string(context
, AF_INET6
, p
, "tcp");
193 add_port_string(context
, AF_INET
, p
, "udp");
194 add_port_string(context
, AF_INET
, p
, "tcp");
198 p
= strtok_r(NULL
, " \t", &pos
);
204 * every socket we listen on
215 struct sockaddr_storage __ss
;
218 char addr_string
[128];
222 init_descr(struct descr
*d
)
224 memset(d
, 0, sizeof(*d
));
225 d
->sa
= (struct sockaddr
*)&d
->__ss
;
226 d
->s
= rk_INVALID_SOCKET
;
230 * re-initialize all `n' ->sa in `d'.
234 reinit_descrs (struct descr
*d
, int n
)
238 for (i
= 0; i
< n
; ++i
)
239 d
[i
].sa
= (struct sockaddr
*)&d
[i
].__ss
;
243 * Create the socket (family, type, port) in `d'
247 init_socket(krb5_context context
,
248 krb5_kdc_configuration
*config
,
249 struct descr
*d
, krb5_address
*a
, int family
, int type
, int port
)
252 struct sockaddr_storage __ss
;
253 struct sockaddr
*sa
= (struct sockaddr
*)&__ss
;
254 krb5_socklen_t sa_size
= sizeof(__ss
);
258 ret
= krb5_addr2sockaddr (context
, a
, sa
, &sa_size
, port
);
260 krb5_warn(context
, ret
, "krb5_addr2sockaddr");
261 rk_closesocket(d
->s
);
262 d
->s
= rk_INVALID_SOCKET
;
266 if (sa
->sa_family
!= family
)
269 d
->s
= socket(family
, type
, 0);
270 if(rk_IS_BAD_SOCKET(d
->s
)){
271 krb5_warn(context
, errno
, "socket(%d, %d, 0)", family
, type
);
272 d
->s
= rk_INVALID_SOCKET
;
275 #if defined(HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_REUSEADDR)
278 setsockopt(d
->s
, SOL_SOCKET
, SO_REUSEADDR
, (void *)&one
, sizeof(one
));
284 if(rk_IS_SOCKET_ERROR(bind(d
->s
, sa
, sa_size
))){
288 krb5_print_address (a
, a_str
, sizeof(a_str
), &len
);
289 krb5_warn(context
, errno
, "bind %s/%d", a_str
, ntohs(port
));
290 rk_closesocket(d
->s
);
291 d
->s
= rk_INVALID_SOCKET
;
294 if(type
== SOCK_STREAM
&& rk_IS_SOCKET_ERROR(listen(d
->s
, SOMAXCONN
))){
298 krb5_print_address (a
, a_str
, sizeof(a_str
), &len
);
299 krb5_warn(context
, errno
, "listen %s/%d", a_str
, ntohs(port
));
300 rk_closesocket(d
->s
);
301 d
->s
= rk_INVALID_SOCKET
;
307 * Allocate descriptors for all the sockets that we should listen on
308 * and return the number of them.
312 init_sockets(krb5_context context
,
313 krb5_kdc_configuration
*config
,
320 krb5_addresses addresses
;
322 if (explicit_addresses
.len
) {
323 addresses
= explicit_addresses
;
325 ret
= krb5_get_all_server_addrs (context
, &addresses
);
327 krb5_err (context
, 1, ret
, "krb5_get_all_server_addrs");
329 parse_ports(context
, config
, port_str
);
330 d
= malloc(addresses
.len
* num_ports
* sizeof(*d
));
332 krb5_errx(context
, 1, "malloc(%lu) failed",
333 (unsigned long)num_ports
* sizeof(*d
));
335 for (i
= 0; i
< num_ports
; i
++){
336 for (j
= 0; j
< addresses
.len
; ++j
) {
337 init_socket(context
, config
, &d
[num
], &addresses
.val
[j
],
338 ports
[i
].family
, ports
[i
].type
, ports
[i
].port
);
339 if(d
[num
].s
!= rk_INVALID_SOCKET
){
343 krb5_print_address (&addresses
.val
[j
], a_str
,
344 sizeof(a_str
), &len
);
346 kdc_log(context
, config
, 5, "listening on %s port %u/%s",
348 ntohs(ports
[i
].port
),
349 (ports
[i
].type
== SOCK_STREAM
) ? "tcp" : "udp");
355 krb5_free_addresses (context
, &addresses
);
356 d
= realloc(d
, num
* sizeof(*d
));
357 if (d
== NULL
&& num
!= 0)
358 krb5_errx(context
, 1, "realloc(%lu) failed",
359 (unsigned long)num
* sizeof(*d
));
360 reinit_descrs (d
, num
);
370 descr_type(struct descr
*d
)
372 if (d
->type
== SOCK_DGRAM
)
374 else if (d
->type
== SOCK_STREAM
)
380 addr_to_string(krb5_context context
,
381 struct sockaddr
*addr
, size_t addr_len
, char *str
, size_t len
)
384 if(krb5_sockaddr2address(context
, addr
, &a
) == 0) {
385 if(krb5_print_address(&a
, str
, len
, &len
) == 0) {
386 krb5_free_address(context
, &a
);
389 krb5_free_address(context
, &a
);
391 snprintf(str
, len
, "<family=%d>", addr
->sa_family
);
399 send_reply(krb5_context context
,
400 krb5_kdc_configuration
*config
,
401 krb5_boolean prependlength
,
405 kdc_log(context
, config
, 5,
406 "sending %lu bytes to %s", (unsigned long)reply
->length
,
410 l
[0] = (reply
->length
>> 24) & 0xff;
411 l
[1] = (reply
->length
>> 16) & 0xff;
412 l
[2] = (reply
->length
>> 8) & 0xff;
413 l
[3] = reply
->length
& 0xff;
414 if(rk_IS_SOCKET_ERROR(sendto(d
->s
, l
, sizeof(l
), 0, d
->sa
, d
->sock_len
))) {
415 kdc_log (context
, config
,
416 0, "sendto(%s): %s", d
->addr_string
,
417 strerror(rk_SOCK_ERRNO
));
421 if(rk_IS_SOCKET_ERROR(sendto(d
->s
, reply
->data
, reply
->length
, 0, d
->sa
, d
->sock_len
))) {
422 kdc_log (context
, config
, 0, "sendto(%s): %s", d
->addr_string
,
423 strerror(rk_SOCK_ERRNO
));
429 * Handle the request in `buf, len' to socket `d'
433 do_request(krb5_context context
,
434 krb5_kdc_configuration
*config
,
435 void *buf
, size_t len
, krb5_boolean prependlength
,
440 int datagram_reply
= (d
->type
== SOCK_DGRAM
);
442 krb5_kdc_update_time(NULL
);
444 krb5_data_zero(&reply
);
445 ret
= krb5_kdc_process_request(context
, config
,
446 buf
, len
, &reply
, &prependlength
,
447 d
->addr_string
, d
->sa
,
450 krb5_kdc_save_request(context
, request_log
, buf
, len
, &reply
, d
->sa
);
452 send_reply(context
, config
, prependlength
, d
, &reply
);
453 krb5_data_free(&reply
);
456 kdc_log(context
, config
, 0,
457 "Failed processing %lu byte request from %s",
458 (unsigned long)len
, d
->addr_string
);
462 * Handle incoming data to the UDP socket in `d'
466 handle_udp(krb5_context context
,
467 krb5_kdc_configuration
*config
,
473 buf
= malloc(max_request_udp
);
475 kdc_log(context
, config
, 0, "Failed to allocate %lu bytes", (unsigned long)max_request_udp
);
479 d
->sock_len
= sizeof(d
->__ss
);
480 n
= recvfrom(d
->s
, buf
, max_request_udp
, 0, d
->sa
, &d
->sock_len
);
481 if(rk_IS_SOCKET_ERROR(n
))
482 krb5_warn(context
, rk_SOCK_ERRNO
, "recvfrom");
484 addr_to_string (context
, d
->sa
, d
->sock_len
,
485 d
->addr_string
, sizeof(d
->addr_string
));
486 if ((size_t)n
== max_request_udp
) {
488 krb5_warn(context
, errno
,
489 "recvfrom: truncated packet from %s, asking for TCP",
491 krb5_mk_error(context
,
492 KRB5KRB_ERR_RESPONSE_TOO_BIG
,
500 send_reply(context
, config
, FALSE
, d
, &data
);
501 krb5_data_free(&data
);
503 do_request(context
, config
, buf
, n
, FALSE
, d
);
510 clear_descr(struct descr
*d
)
513 memset(d
->buf
, 0, d
->size
);
515 if(d
->s
!= rk_INVALID_SOCKET
)
516 rk_closesocket(d
->s
);
517 d
->s
= rk_INVALID_SOCKET
;
521 /* remove HTTP %-quoting from buf */
525 unsigned char *p
, *q
;
526 for(p
= q
= (unsigned char *)buf
; *p
; p
++, q
++) {
527 if(*p
== '%' && isxdigit(p
[1]) && isxdigit(p
[2])) {
529 if(sscanf((char *)p
+ 1, "%2x", &x
) != 1)
540 #define TCP_TIMEOUT 4
543 * accept a new TCP connection on `d[parent]' and store it in `d[child]'
547 add_new_tcp (krb5_context context
,
548 krb5_kdc_configuration
*config
,
549 struct descr
*d
, int parent
, int child
)
556 d
[child
].sock_len
= sizeof(d
[child
].__ss
);
557 s
= accept(d
[parent
].s
, d
[child
].sa
, &d
[child
].sock_len
);
558 if(rk_IS_BAD_SOCKET(s
)) {
559 krb5_warn(context
, rk_SOCK_ERRNO
, "accept");
564 if (s
>= FD_SETSIZE
) {
565 krb5_warnx(context
, "socket FD too large");
572 d
[child
].timeout
= time(NULL
) + TCP_TIMEOUT
;
573 d
[child
].type
= SOCK_STREAM
;
574 addr_to_string (context
,
575 d
[child
].sa
, d
[child
].sock_len
,
576 d
[child
].addr_string
, sizeof(d
[child
].addr_string
));
580 * Grow `d' to handle at least `n'.
581 * Return != 0 if fails
585 grow_descr (krb5_context context
,
586 krb5_kdc_configuration
*config
,
587 struct descr
*d
, size_t n
)
589 if (d
->size
- d
->len
< n
) {
593 grow
= max(1024, d
->len
+ n
);
594 if (d
->size
+ grow
> max_request_tcp
) {
595 kdc_log(context
, config
, 0, "Request exceeds max request size (%lu bytes).",
596 (unsigned long)d
->size
+ grow
);
600 tmp
= realloc (d
->buf
, d
->size
+ grow
);
602 kdc_log(context
, config
, 0, "Failed to re-allocate %lu bytes.",
603 (unsigned long)d
->size
+ grow
);
614 * Try to handle the TCP data at `d->buf, d->len'.
615 * Return -1 if failed, 0 if succesful, and 1 if data is complete.
619 handle_vanilla_tcp (krb5_context context
,
620 krb5_kdc_configuration
*config
,
626 sp
= krb5_storage_from_mem(d
->buf
, d
->len
);
628 kdc_log (context
, config
, 0, "krb5_storage_from_mem failed");
631 krb5_ret_uint32(sp
, &len
);
632 krb5_storage_free(sp
);
633 if(d
->len
- 4 >= len
) {
634 memmove(d
->buf
, d
->buf
+ 4, d
->len
- 4);
642 * Try to handle the TCP/HTTP data at `d->buf, d->len'.
643 * Return -1 if failed, 0 if succesful, and 1 if data is complete.
647 handle_http_tcp (krb5_context context
,
648 krb5_kdc_configuration
*config
,
658 /* If its a multi line query, truncate off the first line */
659 p
= strstr(s
, "\r\n");
664 t
= strtok_r(s
, " \t", &p
);
666 kdc_log(context
, config
, 0,
667 "Missing HTTP operand (GET) request from %s", d
->addr_string
);
671 t
= strtok_r(NULL
, " \t", &p
);
673 kdc_log(context
, config
, 0,
674 "Missing HTTP GET data in request from %s", d
->addr_string
);
678 data
= malloc(strlen(t
));
680 kdc_log(context
, config
, 0, "Failed to allocate %lu bytes",
681 (unsigned long)strlen(t
));
686 if(de_http(t
) != 0) {
687 kdc_log(context
, config
, 0, "Malformed HTTP request from %s", d
->addr_string
);
688 kdc_log(context
, config
, 5, "HTTP request: %s", t
);
692 proto
= strtok_r(NULL
, " \t", &p
);
694 kdc_log(context
, config
, 0, "Malformed HTTP request from %s", d
->addr_string
);
698 len
= base64_decode(t
, data
);
702 "Server: Heimdal/" VERSION
"\r\n"
703 "Cache-Control: no-cache\r\n"
704 "Pragma: no-cache\r\n"
705 "Content-type: text/html\r\n"
706 "Content-transfer-encoding: 8bit\r\n\r\n"
707 "<TITLE>404 Not found</TITLE>\r\n"
708 "<H1>404 Not found</H1>\r\n"
709 "That page doesn't exist, maybe you are looking for "
710 "<A HREF=\"http://www.h5l.org/\">Heimdal</A>?\r\n";
711 kdc_log(context
, config
, 0, "HTTP request from %s is non KDC request", d
->addr_string
);
712 kdc_log(context
, config
, 5, "HTTP request: %s", t
);
714 if (rk_IS_SOCKET_ERROR(send(d
->s
, proto
, strlen(proto
), 0))) {
715 kdc_log(context
, config
, 0, "HTTP write failed: %s: %s",
716 d
->addr_string
, strerror(rk_SOCK_ERRNO
));
719 if (rk_IS_SOCKET_ERROR(send(d
->s
, msg
, strlen(msg
), 0))) {
720 kdc_log(context
, config
, 0, "HTTP write failed: %s: %s",
721 d
->addr_string
, strerror(rk_SOCK_ERRNO
));
729 "Server: Heimdal/" VERSION
"\r\n"
730 "Cache-Control: no-cache\r\n"
731 "Pragma: no-cache\r\n"
732 "Content-type: application/octet-stream\r\n"
733 "Content-transfer-encoding: binary\r\n\r\n";
734 if (rk_IS_SOCKET_ERROR(send(d
->s
, proto
, strlen(proto
), 0))) {
736 kdc_log(context
, config
, 0, "HTTP write failed: %s: %s",
737 d
->addr_string
, strerror(rk_SOCK_ERRNO
));
740 if (rk_IS_SOCKET_ERROR(send(d
->s
, msg
, strlen(msg
), 0))) {
742 kdc_log(context
, config
, 0, "HTTP write failed: %s: %s",
743 d
->addr_string
, strerror(rk_SOCK_ERRNO
));
747 if ((size_t)len
> d
->len
)
749 memcpy(d
->buf
, data
, len
);
756 * Handle incoming data to the TCP socket in `d[index]'
760 handle_tcp(krb5_context context
,
761 krb5_kdc_configuration
*config
,
762 struct descr
*d
, int idx
, int min_free
)
764 unsigned char buf
[1024];
768 if (d
[idx
].timeout
== 0) {
769 add_new_tcp (context
, config
, d
, idx
, min_free
);
773 n
= recvfrom(d
[idx
].s
, buf
, sizeof(buf
), 0, NULL
, NULL
);
774 if(rk_IS_SOCKET_ERROR(n
)){
775 krb5_warn(context
, rk_SOCK_ERRNO
, "recvfrom failed from %s to %s/%d",
776 d
[idx
].addr_string
, descr_type(d
+ idx
),
780 krb5_warnx(context
, "connection closed before end of data after %lu "
781 "bytes from %s to %s/%d", (unsigned long)d
[idx
].len
,
782 d
[idx
].addr_string
, descr_type(d
+ idx
),
784 clear_descr (d
+ idx
);
787 if (grow_descr (context
, config
, &d
[idx
], n
))
789 memcpy(d
[idx
].buf
+ d
[idx
].len
, buf
, n
);
791 if(d
[idx
].len
> 4 && d
[idx
].buf
[0] == 0) {
792 ret
= handle_vanilla_tcp (context
, config
, &d
[idx
]);
793 } else if(enable_http
&&
795 strncmp((char *)d
[idx
].buf
, "GET ", 4) == 0 &&
796 strncmp((char *)d
[idx
].buf
+ d
[idx
].len
- 4,
797 "\r\n\r\n", 4) == 0) {
799 /* remove the trailing \r\n\r\n so the string is NUL terminated */
800 d
[idx
].buf
[d
[idx
].len
- 4] = '\0';
802 ret
= handle_http_tcp (context
, config
, &d
[idx
]);
804 clear_descr (d
+ idx
);
805 } else if (d
[idx
].len
> 4) {
806 kdc_log (context
, config
,
807 0, "TCP data of strange type from %s to %s/%d",
808 d
[idx
].addr_string
, descr_type(d
+ idx
),
810 if (d
[idx
].buf
[0] & 0x80) {
813 kdc_log (context
, config
, 0, "TCP extension not supported");
815 ret
= krb5_mk_error(context
,
816 KRB5KRB_ERR_FIELD_TOOLONG
,
825 send_reply(context
, config
, TRUE
, d
+ idx
, &reply
);
826 krb5_data_free(&reply
);
829 clear_descr(d
+ idx
);
835 do_request(context
, config
,
836 d
[idx
].buf
, d
[idx
].len
, TRUE
, &d
[idx
]);
837 clear_descr(d
+ idx
);
842 loop(krb5_context context
,
843 krb5_kdc_configuration
*config
)
848 ndescr
= init_sockets(context
, config
, &d
);
850 krb5_errx(context
, 1, "No sockets!");
851 kdc_log(context
, config
, 0, "KDC started");
852 while(exit_flag
== 0){
853 struct timeval tmout
;
860 for(i
= 0; i
< ndescr
; i
++) {
861 if(!rk_IS_BAD_SOCKET(d
[i
].s
)){
862 if(d
[i
].type
== SOCK_STREAM
&&
863 d
[i
].timeout
&& d
[i
].timeout
< time(NULL
)) {
864 kdc_log(context
, config
, 1,
865 "TCP-connection from %s expired after %lu bytes",
866 d
[i
].addr_string
, (unsigned long)d
[i
].len
);
870 #ifndef NO_LIMIT_FD_SETSIZE
874 if (max_fd
>= FD_SETSIZE
)
875 krb5_errx(context
, 1, "fd too large");
878 FD_SET(d
[i
].s
, &fds
);
879 } else if(min_free
< 0 || i
< (size_t)min_free
)
884 tmp
= realloc(d
, (ndescr
+ 4) * sizeof(*d
));
886 krb5_warnx(context
, "No memory");
889 reinit_descrs (d
, ndescr
);
890 memset(d
+ ndescr
, 0, 4 * sizeof(*d
));
891 for(i
= ndescr
; i
< ndescr
+ 4; i
++)
898 tmout
.tv_sec
= TCP_TIMEOUT
;
900 switch(select(max_fd
+ 1, &fds
, 0, 0, &tmout
)){
905 krb5_warn(context
, rk_SOCK_ERRNO
, "select");
908 for(i
= 0; i
< ndescr
; i
++)
909 if(!rk_IS_BAD_SOCKET(d
[i
].s
) && FD_ISSET(d
[i
].s
, &fds
)) {
910 if(d
[i
].type
== SOCK_DGRAM
)
911 handle_udp(context
, config
, &d
[i
]);
912 else if(d
[i
].type
== SOCK_STREAM
)
913 handle_tcp(context
, config
, d
, i
, min_free
);
919 else if(exit_flag
== SIGXCPU
)
920 kdc_log(context
, config
, 0, "CPU time limit exceeded");
922 else if(exit_flag
== SIGINT
|| exit_flag
== SIGTERM
)
923 kdc_log(context
, config
, 0, "Terminated");
925 kdc_log(context
, config
, 0, "Unexpected exit reason: %d", exit_flag
);