4 Copyright (c) 2000 The Regents of the University of Michigan.
7 Copyright (c) 2000 Dug Song <dugsong@UMICH.EDU>.
8 Copyright (c) 2002 Andy Adamson <andros@UMICH.EDU>.
9 Copyright (c) 2002 Marius Aamodt Eriksen <marius@UMICH.EDU>.
10 All rights reserved, all wrongs reversed.
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
18 2. Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in the
20 documentation and/or other materials provided with the distribution.
21 3. Neither the name of the University nor the names of its
22 contributors may be used to endorse or promote products derived
23 from this software without specific prior written permission.
25 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #include <sys/param.h>
40 #include <sys/socket.h>
52 #include "krb5_util.h"
54 char pipefsdir[PATH_MAX] = GSSD_PIPEFS_DIR;
55 char keytabfile[PATH_MAX] = GSSD_DEFAULT_KEYTAB_FILE;
60 /* destroy krb5 machine creds */
61 gssd_destroy_krb5_machine_creds();
62 printerr(1, "exiting on signal %d\n", signal);
69 /* don't exit on SIGHUP */
70 printerr(1, "Received SIGHUP... Ignoring.\n");
77 fprintf(stderr, "usage: %s [-f] [-v] [-p pipefsdir] [-k keytab]\n",
83 main(int argc, char *argv[])
91 while ((opt = getopt(argc, argv, "fvmp:k:")) != -1) {
97 /* Accept but ignore this. Now the default. */
103 strncpy(pipefsdir, optarg, sizeof(pipefsdir));
104 if (pipefsdir[sizeof(pipefsdir)-1] != '\0')
105 errx(1, "pipefs path name too long");
108 strncpy(keytabfile, optarg, sizeof(keytabfile));
109 if (keytabfile[sizeof(keytabfile)-1] != '\0')
110 errx(1, "keytab path name too long");
117 strncat(pipefsdir + strlen(pipefsdir), "/" GSSD_SERVICE_NAME,
118 sizeof(pipefsdir)-strlen(pipefsdir));
119 if (pipefsdir[sizeof(pipefsdir)-1] != '\0')
120 errx(1, "pipefs path name too long");
122 if ((progname = strrchr(argv[0], '/')))
127 initerr(progname, verbosity, fg);
129 if (!fg && daemon(0, 0) < 0)
132 signal(SIGINT, sig_die);
133 signal(SIGTERM, sig_die);
134 signal(SIGHUP, sig_hup);
136 /* Process keytab file and get machine credentials */
137 gssd_refresh_krb5_machine_creds();
140 printerr(0, "gssd_run returned!\n");