Cause the kdc to write a pidfile in /var/run/kdc.pid and to

detach from the tty by default.  Add a [-D | --no-detach]
option to restore the old behavior (which is useful for
debugging).
This commit is contained in:
thorpej 2000-08-06 18:42:19 +00:00
parent 4ed8b47725
commit 1435d15e40
4 changed files with 18 additions and 4 deletions

View File

@ -35,7 +35,7 @@
#include <getarg.h> #include <getarg.h>
#include <parse_bytes.h> #include <parse_bytes.h>
RCSID("$Id: config.c,v 1.1.1.2 2000/08/02 19:58:53 assar Exp $"); RCSID("$Id: config.c,v 1.2 2000/08/06 18:42:19 thorpej Exp $");
static char *config_file; /* location of kdc config file */ static char *config_file; /* location of kdc config file */
@ -54,6 +54,7 @@ int num_db;
char *port_str; char *port_str;
int enable_http = -1; int enable_http = -1;
int no_detach;
krb5_boolean encode_as_rep_as_tgs_rep; /* bug compatibility */ krb5_boolean encode_as_rep_as_tgs_rep; /* bug compatibility */
krb5_boolean check_ticket_addresses; krb5_boolean check_ticket_addresses;
@ -95,6 +96,7 @@ static struct getargs args[] = {
}, },
#endif #endif
{ "enable-http", 'H', arg_flag, &enable_http, "turn on HTTP support" }, { "enable-http", 'H', arg_flag, &enable_http, "turn on HTTP support" },
{ "no-detach", 'D', arg_flag, &no_detach, "do not detach from tty" },
#ifdef KRB4 #ifdef KRB4
{ "kerberos4", 0, arg_negative_flag, &enable_v4, { "kerberos4", 0, arg_negative_flag, &enable_v4,
"don't respond to kerberos 4 requests" "don't respond to kerberos 4 requests"

View File

@ -1,4 +1,4 @@
.\" $Id: kdc.8,v 1.1.1.2 2000/08/02 19:58:55 assar Exp $ .\" $Id: kdc.8,v 1.2 2000/08/06 18:42:19 thorpej Exp $
.\" .\"
.Dd July 27, 1997 .Dd July 27, 1997
.Dt KDC 8 .Dt KDC 8
@ -15,6 +15,7 @@ Kerberos 5 server
.Op Fl p | Fl -no-require-preauth .Op Fl p | Fl -no-require-preauth
.Op Fl -max-request= Ns Ar size .Op Fl -max-request= Ns Ar size
.Op Fl H | Fl -enable-http .Op Fl H | Fl -enable-http
.Op Fl D | Fl -no-detach
.Oo Fl r Ar string \*(Ba Xo .Oo Fl r Ar string \*(Ba Xo
.Fl -v4-realm= Ns Ar string Oc .Fl -v4-realm= Ns Ar string Oc
.Xc .Xc
@ -61,6 +62,11 @@ willing to handle.
.Xc .Xc
Makes the kdc listen on port 80 and handle requests encapsulated in HTTP. Makes the kdc listen on port 80 and handle requests encapsulated in HTTP.
.It Xo .It Xo
.Fl D Ns ,
.Fl -no-detach
.Xc
Makes the kdc not detach from the tty. Useful for debugging.
.It Xo
.Fl K Ns , .Fl K Ns ,
.Fl -no-kaserver .Fl -no-kaserver
.Xc .Xc

View File

@ -32,7 +32,7 @@
*/ */
/* /*
* $Id: kdc_locl.h,v 1.1.1.2 2000/08/02 19:58:55 assar Exp $ * $Id: kdc_locl.h,v 1.2 2000/08/06 18:42:19 thorpej Exp $
*/ */
#ifndef __KDC_LOCL_H__ #ifndef __KDC_LOCL_H__
@ -58,6 +58,7 @@ extern char *port_str;
extern krb5_addresses explicit_addresses; extern krb5_addresses explicit_addresses;
extern int enable_http; extern int enable_http;
extern int no_detach;
extern krb5_boolean encode_as_rep_as_tgs_rep; extern krb5_boolean encode_as_rep_as_tgs_rep;
extern krb5_boolean check_ticket_addresses; extern krb5_boolean check_ticket_addresses;
extern krb5_boolean allow_null_ticket_addresses; extern krb5_boolean allow_null_ticket_addresses;

View File

@ -33,7 +33,9 @@
#include "kdc_locl.h" #include "kdc_locl.h"
RCSID("$Id: main.c,v 1.1.1.2 2000/08/02 19:58:55 assar Exp $"); #include <util.h>
RCSID("$Id: main.c,v 1.2 2000/08/06 18:42:19 thorpej Exp $");
sig_atomic_t exit_flag = 0; sig_atomic_t exit_flag = 0;
krb5_context context; krb5_context context;
@ -94,6 +96,9 @@ main(int argc, char **argv)
signal(SIGINT, sigterm); signal(SIGINT, sigterm);
signal(SIGTERM, sigterm); signal(SIGTERM, sigterm);
#endif #endif
if (no_detach == 0)
daemon(0, 0);
pidfile(NULL);
loop(); loop();
krb5_free_context(context); krb5_free_context(context);
return 0; return 0;