diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/confpars.c | 23 | ||||
-rw-r--r-- | server/dhcpd.c | 41 | ||||
-rw-r--r-- | server/omapi.c | 9 |
3 files changed, 42 insertions, 31 deletions
diff --git a/server/confpars.c b/server/confpars.c index 2121225f..1aaaaed2 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -157,10 +157,13 @@ isc_result_t read_conf_file (const char *filename, struct group *group, /* If we're recording, write out the filename and file contents. */ if (trace_record ()) trace_write_packet (ttype, ulen + tflen + 1, dbuf, MDL); - new_parse (&cfile, -1, fbuf, ulen, filename, 0); /* XXX */ + status = new_parse(&cfile, -1, fbuf, ulen, filename, 0); /* XXX */ #else - new_parse (&cfile, file, (char *)0, 0, filename, 0); + status = new_parse(&cfile, file, NULL, 0, filename, 0); #endif + if (status != ISC_R_SUCCESS || cfile == NULL) + return status; + if (leasep) status = lease_file_subparse (cfile); else @@ -181,6 +184,7 @@ void trace_conf_input (trace_type_t *ttype, unsigned len, char *data) struct parse *cfile = (struct parse *)0; static int postconf_initialized; static int leaseconf_initialized; + isc_result_t status; /* Do what's done above, except that we don't have to read in the data, because it's already been read for us. */ @@ -191,12 +195,15 @@ void trace_conf_input (trace_type_t *ttype, unsigned len, char *data) /* If we're recording, write out the filename and file contents. */ if (trace_record ()) trace_write_packet (ttype, len, data, MDL); - new_parse (&cfile, -1, fbuf, flen, data, 0); - if (ttype == trace_readleases_type) - lease_file_subparse (cfile); - else - conf_file_subparse (cfile, root_group, ROOT_GROUP); - end_parse (&cfile); + + status = new_parse(&cfile, -1, fbuf, flen, data, 0); + if (status == ISC_R_SUCCESS || cfile != NULL) { + if (ttype == trace_readleases_type) + lease_file_subparse (cfile); + else + conf_file_subparse (cfile, root_group, ROOT_GROUP); + end_parse (&cfile); + } /* Postconfiguration needs to be done after the config file has been loaded. */ diff --git a/server/dhcpd.c b/server/dhcpd.c index 0f17ce41..1d60827c 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -612,20 +612,21 @@ main(int argc, char **argv) { #if defined (NSUPDATE) /* Set up the standard name service updater routine. */ - parse = (struct parse *)0; - status = new_parse (&parse, -1, - std_nsupdate, (sizeof std_nsupdate) - 1, + parse = NULL; + status = new_parse(&parse, -1, std_nsupdate, sizeof(std_nsupdate) - 1, "standard name service update routine", 0); if (status != ISC_R_SUCCESS) log_fatal ("can't begin parsing name service updater!"); - lose = 0; - if (!(parse_executable_statements - (&root_group -> statements, parse, &lose, context_any))) { - end_parse (&parse); - log_fatal ("can't parse standard name service updater!"); + if (parse != NULL) { + lose = 0; + if (!(parse_executable_statements(&root_group->statements, + parse, &lose, context_any))) { + end_parse(&parse); + log_fatal("can't parse standard name service updater!"); + } + end_parse(&parse); } - end_parse (&parse); #endif /* Initialize icmp support... */ @@ -1129,20 +1130,22 @@ void postconf_initialization (int quiet) } /* Set up the standard name service updater routine. */ - parse = (struct parse *)0; - result = new_parse (&parse, -1, - old_nsupdate, (sizeof old_nsupdate) - 1, - "old name service update routine", 0); + parse = NULL; + result = new_parse(&parse, -1, old_nsupdate, + sizeof(old_nsupdate) - 1, + "old name service update routine", 0); if (result != ISC_R_SUCCESS) log_fatal ("can't begin parsing old ddns updater!"); - tmp = 0; - if (!(parse_executable_statements (e, parse, - &tmp, context_any))) { - end_parse (&parse); - log_fatal ("can't parse standard ddns updater!"); + if (parse != NULL) { + tmp = 0; + if (!(parse_executable_statements(e, parse, &tmp, + context_any))) { + end_parse(&parse); + log_fatal("can't parse standard ddns updater!"); + } } - end_parse (&parse); + end_parse(&parse); } #endif } diff --git a/server/omapi.c b/server/omapi.c index 96541c29..4420e81d 100644 --- a/server/omapi.c +++ b/server/omapi.c @@ -1067,12 +1067,13 @@ isc_result_t dhcp_host_set_value (omapi_object_t *h, struct parse *parse; int lose = 0; parse = (struct parse *)0; - status = new_parse (&parse, -1, - (char *)value -> u.buffer.value, - value -> u.buffer.len, + status = new_parse(&parse, -1, + (char *) value->u.buffer.value, + value->u.buffer.len, "network client", 0); - if (status != ISC_R_SUCCESS) + if (status != ISC_R_SUCCESS || parse == NULL) return status; + if (!(parse_executable_statements (&host -> group -> statements, parse, &lose, context_any))) { |