[Dhcp-agent-commits] dhcp-agent dhcp-client.c,1.37,1.38 dhcp-files.c,1.13,1.14 dhcp-parser.c,1.2,1.3
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2002-06-30 20:43:14
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv20983 Modified Files: dhcp-client.c dhcp-files.c dhcp-parser.c dhcp-sysconf.c dhcp-sysconf.h Log Message: parser now accepts \\ for newline; disabled cleanup except on do_sysconf (will fix up later); Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** dhcp-client.c 30 Jun 2002 18:27:12 -0000 1.37 --- dhcp-client.c 30 Jun 2002 20:43:10 -0000 1.38 *************** *** 134,138 **** if(dc) { /* only do clean up if we can. */ ! do_sysconf_cleanup(dc); client_release(dc); delete_pid_file(dc->interface); --- 134,138 ---- if(dc) { /* only do clean up if we can. */ ! // do_sysconf_cleanup(dc); client_release(dc); delete_pid_file(dc->interface); Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-files.c 30 Jun 2002 08:23:45 -0000 1.13 --- dhcp-files.c 30 Jun 2002 20:43:10 -0000 1.14 *************** *** 141,150 **** char *fname = get_pid_file_name(name); ! if(delete_file(fname) < 0) { ! push_exception("files", "delete_pid_file", ! "could not delete pid file: %s : %s", fname, strerror(errno)); ! xfree(fname); ! return 1; ! } xfree(fname); --- 141,145 ---- char *fname = get_pid_file_name(name); ! delete_file(fname); /* ignore any errors. */ xfree(fname); Index: dhcp-parser.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-parser.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-parser.c 17 Jun 2002 13:23:08 -0000 1.2 --- dhcp-parser.c 30 Jun 2002 20:43:10 -0000 1.3 *************** *** 42,45 **** --- 42,48 ---- static int is_valid_string_char(int c) { + if(c == '\\') + return 0; + if(ispunct(c) || isalnum(c)) return 1; *************** *** 81,85 **** static token_t parse_get_quoted_string(parser_t *input) { ! int c; while(1) { --- 84,88 ---- static token_t parse_get_quoted_string(parser_t *input) { ! int c, c2; while(1) { *************** *** 98,103 **** return PARSER_TOKEN_ERROR; /* error to have newline in string constant. */ ! case ' ': ! case '\t': default: if(is_valid_string_char(c) || c == ' ' || c == '\t') --- 101,120 ---- return PARSER_TOKEN_ERROR; /* error to have newline in string constant. */ ! case '\\': ! c2 = getc(input->fp); ! if(c2 != '\\') { ! ! ungetc(c2, input->fp); ! ! if(parse_gobble_line(input) != PARSER_TOKEN_NEWLINE) ! return PARSER_TOKEN_ERROR; ! else ! break; ! } else ! ungetc(c2, input->fp); ! ! /* otherwise put it back and fall through. */ ! ungetc(c, input->fp); ! /* fall through */ default: if(is_valid_string_char(c) || c == ' ' || c == '\t') *************** *** 150,154 **** atom_t get_next_atom(parser_t *input) { ! int c; token_t token; --- 167,171 ---- atom_t get_next_atom(parser_t *input) { ! int c, c2; token_t token; *************** *** 193,196 **** --- 210,228 ---- return PARSER_ATOM_STRING; + + case '\\': + c2 = getc(input->fp); + if(c2 != '\\') { + + ungetc(c2, input->fp); + + if(parse_gobble_line(input) != PARSER_TOKEN_NEWLINE) + return PARSER_ATOM_ERROR; + else + break; + } else + ungetc(c2, input->fp); + + /* fall through */ default: Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dhcp-sysconf.c 30 Jun 2002 08:23:45 -0000 1.24 --- dhcp-sysconf.c 30 Jun 2002 20:43:10 -0000 1.25 *************** *** 436,468 **** } ! void do_sysconf_cleanup(dhcp_client_control_t *dc) { int i; void *data; /* Walk through the sysconf_handlers array. */ - for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { ! /* Perform cleanup only if we're supposed to, and if there's a ! * cleanup function for the option. */ ! if(sysconf_handlers[i].flag & SYSCONF_DO_CLEANUP && ! sysconf_handlers[i].cleanup != NULL) { ! data = option_convert_handlers[i].serialize_to_internal(dhcp_options_strings[i]); - info_message("cleanup option: %s", dhcp_options_strings[i]); ! if(sysconf_handlers[i].cleanup(data, dc)) ! warn_message("cleanup option: %s: %s", dhcp_options_strings[i]); ! else ! sysconf_handlers[i].flag &= ~SYSCONF_DO_CLEANUP; ! option_convert_handlers[i].free_internal(data); ! } } } --- 436,481 ---- } ! void do_sysconf_cleanup(list_t *options, dhcp_client_control_t *dc) { int i; void *data; + cache_entry_t *ce; + list_t *list_ptr; /* Walk through the sysconf_handlers array. */ ! for(list_ptr = options;list_ptr;list_ptr = list_ptr->next) { ! ce = list_ptr->data; ! ! for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { ! if(string_matches(dhcp_options_strings[i], ce->name)) { ! /* Perform cleanup only if we're supposed to, and if there's a ! * cleanup function for the option. */ ! if(sysconf_handlers[i].flag & SYSCONF_DO_CLEANUP && ! sysconf_handlers[i].cleanup != NULL) { ! ! ! data = option_convert_handlers[i].serialize_to_internal(ce->value); ! ! info_message("cleanup option: %s", ! dhcp_options_strings[i]); + if(sysconf_handlers[i].cleanup(data, dc)) + warn_message("sysconf: error cleaning up option: %s", dhcp_options_strings[i]); + + option_convert_handlers[i].free_internal(data); + } + } + } } + return; } + Index: dhcp-sysconf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-sysconf.h 24 Jun 2002 02:04:56 -0000 1.3 --- dhcp-sysconf.h 30 Jun 2002 20:43:10 -0000 1.4 *************** *** 45,49 **** extern int sysconf_setup_domain_name(void *value, dhcp_client_control_t *dc); extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); ! extern void do_sysconf_cleanup(dhcp_client_control_t *dc); #endif /* SYSCONF_H */ --- 45,49 ---- extern int sysconf_setup_domain_name(void *value, dhcp_client_control_t *dc); extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); ! extern void do_sysconf_cleanup(list_t *options, dhcp_client_control_t *dc); #endif /* SYSCONF_H */ |