mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Implement the random-device option, and log a message if there is no entropy.
This commit is contained in:
parent
106ee474a9
commit
6b8ab03dc8
2 changed files with 28 additions and 6 deletions
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: main.c,v 1.102 2001/01/09 21:39:56 bwelling Exp $ */
|
||||
/* $Id: main.c,v 1.103 2001/01/11 23:46:10 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -410,10 +410,6 @@ create_managers(void) {
|
|||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
|
||||
#ifdef PATH_RANDOMDEV
|
||||
(void)isc_entropy_createfilesource(ns_g_entropy, PATH_RANDOMDEV);
|
||||
#endif
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: server.c,v 1.278 2001/01/09 21:40:03 bwelling Exp $ */
|
||||
/* $Id: server.c,v 1.279 2001/01/11 23:46:12 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -1416,9 +1416,13 @@ load_configuration(const char *filename, ns_server_t *server,
|
|||
char *pidfilename;
|
||||
char *statsfilename;
|
||||
char *dumpfilename;
|
||||
char *randomdev;
|
||||
isc_uint32_t interface_interval;
|
||||
isc_uint32_t heartbeat_interval;
|
||||
in_port_t listen_port;
|
||||
#ifdef PATH_RANDOMDEV
|
||||
char path_randomdev[] = PATH_RANDOMDEV;
|
||||
#endif
|
||||
|
||||
ns_aclconfctx_init(&aclconfctx);
|
||||
|
||||
|
|
@ -1708,6 +1712,28 @@ load_configuration(const char *filename, ns_server_t *server,
|
|||
CHECKM(ns_lwresd_configure(ns_g_mctx, cctx),
|
||||
"binding lightweight resolver ports");
|
||||
|
||||
/*
|
||||
* Open the source of entropy.
|
||||
*/
|
||||
randomdev = NULL;
|
||||
(void)dns_c_ctx_getrandomdevice(cctx, &randomdev);
|
||||
#ifdef PATH_RANDOMDEV
|
||||
if (randomdev == NULL)
|
||||
randomdev = path_randomdev;
|
||||
#endif
|
||||
if (randomdev == NULL)
|
||||
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
|
||||
NS_LOGMODULE_SERVER, ISC_LOG_INFO,
|
||||
"no source of entropy found");
|
||||
else {
|
||||
result = isc_entropy_createfilesource(ns_g_entropy, randomdev);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
|
||||
NS_LOGMODULE_SERVER, ISC_LOG_INFO,
|
||||
"failed to open entropy source %s: %s",
|
||||
randomdev, isc_result_totext(result));
|
||||
}
|
||||
|
||||
/*
|
||||
* Relinquish root privileges.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue