diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Makefile.in | 1 | ||||
-rw-r--r-- | common/conflex.c | 24 | ||||
-rw-r--r-- | common/tests/Makefile.in | 1 |
3 files changed, 22 insertions, 4 deletions
diff --git a/common/Makefile.in b/common/Makefile.in index ade60f17..8f1f432d 100644 --- a/common/Makefile.in +++ b/common/Makefile.in @@ -267,6 +267,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDAP_CFLAGS = @LDAP_CFLAGS@ +LDAP_LIBS = @LDAP_LIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ diff --git a/common/conflex.c b/common/conflex.c index 39110160..f23a8c78 100644 --- a/common/conflex.c +++ b/common/conflex.c @@ -147,13 +147,21 @@ save_parse_state(struct parse *cfile) { /* * Return the parser to the previous saved state. * - * You must call save_parse_state() before calling - * restore_parse_state(), but you can call restore_parse_state() any - * number of times after that. + * You must call save_parse_state() every time before calling + * restore_parse_state(). + * + * Note: When the read function callback is in use in ldap mode, + * a call to get_char() may reallocate the buffer and will append + * config data to the buffer until a state restore. + * Do not restore to the (freed) pointer and size, but use new one. */ isc_result_t restore_parse_state(struct parse *cfile) { struct parse *saved_state; +#if defined(LDAP_CONFIGURATION) + char *inbuf = cfile->inbuf; + size_t size = cfile->bufsiz; +#endif if (cfile->saved_state == NULL) { return DHCP_R_NOTYET; @@ -161,7 +169,13 @@ restore_parse_state(struct parse *cfile) { saved_state = cfile->saved_state; memcpy(cfile, saved_state, sizeof(*cfile)); - cfile->saved_state = saved_state; + dfree(saved_state, MDL); + cfile->saved_state = NULL; + +#if defined(LDAP_CONFIGURATION) + cfile->inbuf = inbuf; + cfile->bufsiz = size; +#endif return ISC_R_SUCCESS; } @@ -476,6 +490,8 @@ read_whitespace(int c, struct parse *cfile) { } cfile->tokbuf[ofs++] = c; c = get_char(cfile); + if (c == EOF) + return END_OF_FILE; } while (!((c == '\n') && cfile->eol_token) && isascii(c) && isspace(c)); diff --git a/common/tests/Makefile.in b/common/tests/Makefile.in index 8fdddf63..1d174d12 100644 --- a/common/tests/Makefile.in +++ b/common/tests/Makefile.in @@ -271,6 +271,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDAP_CFLAGS = @LDAP_CFLAGS@ +LDAP_LIBS = @LDAP_LIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ |