Commit db93c0de authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

Fix a segfault when running nslookup (#38548)

parent bef771f2
4070. [bug] Fix a segfault in nslookup in a query such as
"nslookup isc.org AMS.SNS-PB.ISC.ORG -all".
[RT #38548]
4069. [doc] Reorganize options in the nsupdate man page.
[RT #38516]
......
......@@ -4047,10 +4047,14 @@ isc_result_t
get_address(char *host, in_port_t myport, isc_sockaddr_t *sockaddr) {
int count;
isc_result_t result;
isc_boolean_t is_running;
isc_app_block();
is_running = isc_app_isrunning();
if (is_running)
isc_app_block();
result = bind9_getaddresses(host, myport, sockaddr, 1, &count);
isc_app_unblock();
if (is_running)
isc_app_unblock();
if (result != ISC_R_SUCCESS)
return (result);
......
......@@ -585,7 +585,7 @@ version(void) {
static void
setoption(char *opt) {
if (strncasecmp(opt, "all", 4) == 0) {
if (strncasecmp(opt, "all", 3) == 0) {
show_settings(ISC_TRUE, ISC_FALSE);
} else if (strncasecmp(opt, "class=", 6) == 0) {
if (testclass(&opt[6]))
......
......@@ -29,6 +29,7 @@
static isc_mutex_t createlock;
static isc_once_t once = ISC_ONCE_INIT;
static isc_appctxcreatefunc_t appctx_createfunc = NULL;
static isc_boolean_t is_running = ISC_FALSE;
#define ISCAPI_APPMETHODS_VALID(m) ISC_MAGIC_VALID(m, ISCAPI_APPMETHODS_MAGIC)
......@@ -198,12 +199,24 @@ isc_app_onrun(isc_mem_t *mctx, isc_task_t *task,
isc_result_t
isc_app_run() {
if (isc_bind9)
return (isc__app_run());
if (isc_bind9) {
isc_result_t result;
is_running = ISC_TRUE;
result = isc__app_run();
is_running = ISC_FALSE;
return (result);
}
return (ISC_R_NOTIMPLEMENTED);
}
isc_boolean_t
isc_app_isrunning() {
return (is_running);
}
isc_result_t
isc_app_shutdown(void) {
if (isc_bind9)
......
......@@ -203,6 +203,16 @@ isc_app_run(void);
*\li ISC_R_RELOAD Reload has been requested.
*/
isc_boolean_t
isc_app_isrunning(void);
/*!<
* \brief Return if the ISC library application is running.
*
* Returns:
*\li ISC_TRUE App is running.
*\li ISC_FALSE App is not running.
*/
isc_result_t
isc_app_ctxshutdown(isc_appctx_t *ctx);
......
......@@ -120,6 +120,7 @@ isc_app_ctxshutdown
isc_app_ctxstart
isc_app_ctxsuspend
isc_app_finish
isc_app_isrunning
isc_app_onrun
isc_app_register
isc_app_reload
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment