mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix to simplify empty string checking from Michael McConville.
git-svn-id: file:///svn/unbound/trunk@3600 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
9bb637e7a4
commit
c53222e101
8 changed files with 1596 additions and 1849 deletions
|
|
@ -1,3 +1,6 @@
|
|||
14 January 2016: Wouter
|
||||
- Fix to simplify empty string checking from Michael McConville.
|
||||
|
||||
12 January 2016: Wouter
|
||||
- Fix #734: Do not log an error when the PID file cannot be chown'ed.
|
||||
Patch from Simon Deziel.
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ rrinternal_get_owner(sldns_buffer* strbuf, uint8_t* rr, size_t* len,
|
|||
return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
|
||||
sldns_buffer_position(strbuf));
|
||||
memmove(rr, tocopy, *dname_len);
|
||||
} else if(strlen(token) == 0) {
|
||||
} else if(*token == '\0') {
|
||||
/* no ownername was given, try prev, if that fails
|
||||
* origin, else default to root */
|
||||
uint8_t* tocopy;
|
||||
|
|
@ -1091,7 +1091,7 @@ int sldns_str2wire_apl_buf(const char* str, uint8_t* rd, size_t* len)
|
|||
uint8_t prefix;
|
||||
size_t i;
|
||||
|
||||
if(strlen(my_str) == 0) {
|
||||
if(*my_str == '\0') {
|
||||
/* empty APL element, no data, no string */
|
||||
*len = 0;
|
||||
return LDNS_WIREPARSE_ERR_OK;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ spool_auto_file(FILE* in, int* lineno, FILE* cfg, char* id)
|
|||
/* find filename for new file */
|
||||
while(isspace((unsigned char)*id))
|
||||
id++;
|
||||
if(strlen(id)==0)
|
||||
if(*id == '\0')
|
||||
fatal_exit("AUTROTRUST_FILE must have id, line %d", *lineno);
|
||||
id[strlen(id)-1]=0; /* remove newline */
|
||||
fake_temp_file("_auto_", id, line, sizeof(line));
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
#define YY_FLEX_SUBMINOR_VERSION 37
|
||||
#define YY_FLEX_SUBMINOR_VERSION 39
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
|
@ -169,6 +169,7 @@ extern FILE *yyin, *yyout;
|
|||
#define EOB_ACT_LAST_MATCH 2
|
||||
|
||||
#define YY_LESS_LINENO(n)
|
||||
#define YY_LINENO_REWIND_TO(ptr)
|
||||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
|
|
@ -1890,7 +1891,7 @@ static void config_start_include(const char* filename)
|
|||
ub_c_error_msg("too many include files");
|
||||
return;
|
||||
}
|
||||
if(strlen(filename) == 0) {
|
||||
if(*filename == '\0') {
|
||||
ub_c_error_msg("empty include file name");
|
||||
return;
|
||||
}
|
||||
|
|
@ -2010,7 +2011,7 @@ static void config_end_include(void)
|
|||
#define YY_NO_INPUT 1
|
||||
#endif
|
||||
|
||||
#line 2012 "<stdout>"
|
||||
#line 2013 "<stdout>"
|
||||
|
||||
#define INITIAL 0
|
||||
#define quotedstring 1
|
||||
|
|
@ -2195,10 +2196,6 @@ YY_DECL
|
|||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 201 "./util/configlexer.lex"
|
||||
|
||||
#line 2199 "<stdout>"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
(yy_init) = 1;
|
||||
|
|
@ -2225,6 +2222,11 @@ YY_DECL
|
|||
yy_load_buffer_state( );
|
||||
}
|
||||
|
||||
{
|
||||
#line 201 "./util/configlexer.lex"
|
||||
|
||||
#line 2227 "<stdout>"
|
||||
|
||||
while ( 1 ) /* loops until end-of-file is reached */
|
||||
{
|
||||
(yy_more_len) = 0;
|
||||
|
|
@ -2247,7 +2249,7 @@ YY_DECL
|
|||
yy_match:
|
||||
do
|
||||
{
|
||||
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
|
||||
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
(yy_last_accepting_state) = yy_current_state;
|
||||
|
|
@ -3275,7 +3277,7 @@ YY_RULE_SETUP
|
|||
#line 464 "./util/configlexer.lex"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 3277 "<stdout>"
|
||||
#line 3279 "<stdout>"
|
||||
|
||||
case YY_END_OF_BUFFER:
|
||||
{
|
||||
|
|
@ -3404,6 +3406,7 @@ ECHO;
|
|||
"fatal flex scanner internal error--no action found" );
|
||||
} /* end of action switch */
|
||||
} /* end of scanning one token */
|
||||
} /* end of user's declarations */
|
||||
} /* end of yylex */
|
||||
|
||||
/* yy_get_next_buffer - try to read in a new buffer
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ static void config_start_include(const char* filename)
|
|||
ub_c_error_msg("too many include files");
|
||||
return;
|
||||
}
|
||||
if(strlen(filename) == 0) {
|
||||
if(*filename == '\0') {
|
||||
ub_c_error_msg("empty include file name");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
2451
util/configparser.c
2451
util/configparser.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +1,8 @@
|
|||
/* A Bison parser, made by GNU Bison 2.7. */
|
||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#ifndef YY_YY_UTIL_CONFIGPARSER_H_INCLUDED
|
||||
# define YY_YY_UTIL_CONFIGPARSER_H_INCLUDED
|
||||
/* Enabling traces. */
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
|
|
@ -40,12 +40,11 @@
|
|||
extern int yydebug;
|
||||
#endif
|
||||
|
||||
/* Tokens. */
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
enum yytokentype
|
||||
{
|
||||
SPACE = 258,
|
||||
LETTER = 259,
|
||||
NEWLINE = 260,
|
||||
|
|
@ -374,39 +373,26 @@ extern int yydebug;
|
|||
#define VAR_PERMIT_SMALL_HOLDDOWN 418
|
||||
#define VAR_QNAME_MINIMISATION 419
|
||||
|
||||
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
|
||||
union YYSTYPE
|
||||
{
|
||||
/* Line 2058 of yacc.c */
|
||||
#line 64 "./util/configparser.y"
|
||||
#line 64 "./util/configparser.y" /* yacc.c:1909 */
|
||||
|
||||
char* str;
|
||||
|
||||
#line 386 "util/configparser.h" /* yacc.c:1909 */
|
||||
};
|
||||
|
||||
/* Line 2058 of yacc.c */
|
||||
#line 390 "util/configparser.h"
|
||||
} YYSTYPE;
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
#ifdef YYPARSE_PARAM
|
||||
#if defined __STDC__ || defined __cplusplus
|
||||
int yyparse (void *YYPARSE_PARAM);
|
||||
#else
|
||||
int yyparse ();
|
||||
#endif
|
||||
#else /* ! YYPARSE_PARAM */
|
||||
#if defined __STDC__ || defined __cplusplus
|
||||
int yyparse (void);
|
||||
#else
|
||||
int yyparse ();
|
||||
#endif
|
||||
#endif /* ! YYPARSE_PARAM */
|
||||
|
||||
#endif /* !YY_YY_UTIL_CONFIGPARSER_H_INCLUDED */
|
||||
|
|
|
|||
|
|
@ -998,7 +998,7 @@ server_module_conf: VAR_MODULE_CONF STRING_ARG
|
|||
server_val_override_date: VAR_VAL_OVERRIDE_DATE STRING_ARG
|
||||
{
|
||||
OUTYY(("P(server_val_override_date:%s)\n", $2));
|
||||
if(strlen($2) == 0 || strcmp($2, "0") == 0) {
|
||||
if(*$2 == '\0' || strcmp($2, "0") == 0) {
|
||||
cfg_parser->cfg->val_date_override = 0;
|
||||
} else if(strlen($2) == 14) {
|
||||
cfg_parser->cfg->val_date_override =
|
||||
|
|
@ -1016,7 +1016,7 @@ server_val_override_date: VAR_VAL_OVERRIDE_DATE STRING_ARG
|
|||
server_val_sig_skew_min: VAR_VAL_SIG_SKEW_MIN STRING_ARG
|
||||
{
|
||||
OUTYY(("P(server_val_sig_skew_min:%s)\n", $2));
|
||||
if(strlen($2) == 0 || strcmp($2, "0") == 0) {
|
||||
if(*$2 == '\0' || strcmp($2, "0") == 0) {
|
||||
cfg_parser->cfg->val_sig_skew_min = 0;
|
||||
} else {
|
||||
cfg_parser->cfg->val_sig_skew_min = atoi($2);
|
||||
|
|
@ -1029,7 +1029,7 @@ server_val_sig_skew_min: VAR_VAL_SIG_SKEW_MIN STRING_ARG
|
|||
server_val_sig_skew_max: VAR_VAL_SIG_SKEW_MAX STRING_ARG
|
||||
{
|
||||
OUTYY(("P(server_val_sig_skew_max:%s)\n", $2));
|
||||
if(strlen($2) == 0 || strcmp($2, "0") == 0) {
|
||||
if(*$2 == '\0' || strcmp($2, "0") == 0) {
|
||||
cfg_parser->cfg->val_sig_skew_max = 0;
|
||||
} else {
|
||||
cfg_parser->cfg->val_sig_skew_max = atoi($2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue