add support for sandbox
This commit is contained in:
18
kdc/main.c
18
kdc/main.c
@@ -3,6 +3,8 @@
|
|||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
* Portions Copyright (c) 2009 Apple Inc. All rights reserved.
|
||||||
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -36,6 +38,10 @@
|
|||||||
#include <util.h>
|
#include <util.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <sandbox.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
sig_atomic_t exit_flag = 0;
|
sig_atomic_t exit_flag = 0;
|
||||||
|
|
||||||
#ifdef SUPPORT_DETACH
|
#ifdef SUPPORT_DETACH
|
||||||
@@ -92,6 +98,15 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
setprogname(argv[0]);
|
setprogname(argv[0]);
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
{
|
||||||
|
char *errorstring;
|
||||||
|
ret = sandbox_init("kdc", SANDBOX_NAMED, &errorstring);
|
||||||
|
if (ret)
|
||||||
|
errx(1, "sandbox_init failed: %d: %s", ret, errorstring);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = krb5_init_context(&context);
|
ret = krb5_init_context(&context);
|
||||||
if (ret == KRB5_CONFIG_BADFORMAT)
|
if (ret == KRB5_CONFIG_BADFORMAT)
|
||||||
errx (1, "krb5_init_context failed to parse configuration file");
|
errx (1, "krb5_init_context failed to parse configuration file");
|
||||||
@@ -128,6 +143,9 @@ main(int argc, char **argv)
|
|||||||
#ifdef SUPPORT_DETACH
|
#ifdef SUPPORT_DETACH
|
||||||
if (detach_from_console)
|
if (detach_from_console)
|
||||||
daemon(0, 0);
|
daemon(0, 0);
|
||||||
|
#endif
|
||||||
|
#ifdef __APPLE__
|
||||||
|
bonjour_announce(context, config);
|
||||||
#endif
|
#endif
|
||||||
pidfile(NULL);
|
pidfile(NULL);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user