+Fri Jul 24 19:38:58 1998 Geoffrey King <gjking@mit.edu>
+
+ * krb524d.c (main): Fork into the background by default, also
+ add a -nofork command line option.
+
Sat Jul 18 22:10:29 1998 Geoffrey King <gjking@mit.edu>
* krb524d.c (main): Remove the variable use_other_realm.
void usage(context)
krb5_context context;
{
- fprintf(stderr, "Usage: %s [-k[eytab]] [-m[aster] [-r realm]]\n", whoami);
+ fprintf(stderr, "Usage: %s [-k[eytab]] [-m[aster] [-r realm]] [-nofork]\n", whoami);
cleanup_and_exit(1, context);
}
struct servent *serv;
struct sockaddr_in saddr;
struct timeval timeout;
- int ret, s;
+ int ret, s, nofork;
fd_set rfds;
krb5_context context;
krb5_error_code retval;
whoami = ((whoami = strrchr(argv[0], '/')) ? whoami + 1 : argv[0]);
argv++; argc--;
- use_master = use_keytab = 0;
+ use_master = use_keytab = nofork = 0;
config_params.mask = 0;
while (argc) {
use_keytab = 1;
else if (strncmp(*argv, "-m", 2) == 0)
use_master = 1;
+ else if (strcmp(*argv, "-nofork") == 0)
+ nofork = 1;
else if (strcmp(*argv, "-r") == 0) {
argv++; argc--;
if (argc == 0 || !use_master)
com_err(whoami, errno, "binding main socket");
cleanup_and_exit(1, context);
}
+ if (!nofork && daemon(0, 0)) {
+ com_err(whoami, errno, "while detaching from tty");
+ cleanup_and_exit(1, context);
+ }
while (1) {
FD_ZERO(&rfds);