1 /* $NetBSD: main.c,v 1.1.1.2 2014/04/24 12:45:27 pettai Exp $ */
4 * Copyright (c) 1997-2002 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the Institute nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 sig_atomic_t exit_flag
= 0;
42 krb5_context kcm_context
= NULL
;
44 const char *service_name
= "org.h5l.kcm";
55 kcm_debug_ccache(kcm_context
);
61 kcm_debug_events(kcm_context
);
65 main(int argc
, char **argv
)
70 ret
= krb5_init_context(&kcm_context
);
72 errx (1, "krb5_init_context failed: %d", ret
);
76 kcm_configure(argc
, argv
);
83 sa
.sa_handler
= sigterm
;
84 sigemptyset(&sa
.sa_mask
);
86 sigaction(SIGINT
, &sa
, NULL
);
87 sigaction(SIGTERM
, &sa
, NULL
);
89 sa
.sa_handler
= sigusr1
;
90 sigaction(SIGUSR1
, &sa
, NULL
);
92 sa
.sa_handler
= sigusr2
;
93 sigaction(SIGUSR2
, &sa
, NULL
);
95 sa
.sa_handler
= SIG_IGN
;
96 sigaction(SIGPIPE
, &sa
, NULL
);
99 signal(SIGINT
, sigterm
);
100 signal(SIGTERM
, sigterm
);
101 signal(SIGUSR1
, sigusr1
);
102 signal(SIGUSR2
, sigusr2
);
103 signal(SIGPIPE
, SIG_IGN
);
105 #ifdef SUPPORT_DETACH
106 if (detach_from_console
)
113 heim_sipc_launchd_mach_init(service_name
, kcm_service
, NULL
, &mach
);
116 heim_sipc_service_unix(service_name
, kcm_service
, NULL
, &un
);
121 krb5_free_context(kcm_context
);