Skip to content

Commit

Permalink
accept single-letter and single-digit hostnames
Browse files Browse the repository at this point in the history
git-svn-id: https://sshguard.svn.sourceforge.net/svnroot/sshguard/trunk@202 8a9c3130-423d-464b-8744-2863c99db41f
  • Loading branch information
mijio committed Jul 5, 2010
1 parent 75a3ff4 commit db14f08
Show file tree
Hide file tree
Showing 5 changed files with 6,996 additions and 6,976 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,4 +1,5 @@
* 1.5rc4
- accept single-letter and single-digit hostnames
- complete fix to hosts backend's logic for temporary files (thanks Cameos)
- fix file descriptor leak if "ps" command fails to run

Expand Down
72 changes: 40 additions & 32 deletions src/parser/attack_parser.c
@@ -1,10 +1,9 @@

/* A Bison parser, made by GNU Bison 2.4.1. */
/* A Bison parser, made by GNU Bison 2.4.2. */

/* Skeleton implementation for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 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
Expand Down Expand Up @@ -46,7 +45,7 @@
#define YYBISON 1

/* Bison version. */
#define YYBISON_VERSION "2.4.1"
#define YYBISON_VERSION "2.4.2"

/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
Expand Down Expand Up @@ -141,7 +140,7 @@ static struct {


/* Line 189 of yacc.c */
#line 145 "attack_parser.c"
#line 144 "attack_parser.c"

/* Enabling traces. */
#ifndef YYDEBUG
Expand Down Expand Up @@ -268,7 +267,7 @@ typedef union YYSTYPE


/* Line 214 of yacc.c */
#line 272 "attack_parser.c"
#line 271 "attack_parser.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
Expand All @@ -280,7 +279,7 @@ typedef union YYSTYPE


/* Line 264 of yacc.c */
#line 284 "attack_parser.c"
#line 283 "attack_parser.c"

#ifdef short
# undef short
Expand Down Expand Up @@ -330,7 +329,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)

#ifndef YY_
# if YYENABLE_NLS
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
Expand Down Expand Up @@ -759,9 +758,18 @@ static const yytype_uint8 yystos[] =

/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
Once GCC version 2 has supplanted version 1, this can go. However,
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
discussed. */

#define YYFAIL goto yyerrlab
#if defined YYFAIL
/* This is here to suppress warnings from the GCC cpp's
-Wunused-macros. Normally we don't worry about that warning, but
some users do, and we want to make it easy for users to remove
YYFAIL uses, which will produce warnings from Bison 2.5. */
#endif

#define YYRECOVERING() (!!yyerrstatus)

Expand Down Expand Up @@ -818,7 +826,7 @@ while (YYID (0))
we won't break user code: when these are the locations we know. */

#ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
Expand Down Expand Up @@ -1563,7 +1571,7 @@ yyparse (source_id)
{
case 6:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 138 "attack_parser.y"
{
/* reject to accept if the pid has been forged */
Expand All @@ -1577,98 +1585,98 @@ yyparse (source_id)

case 10:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 163 "attack_parser.y"
{ parser_metadata.sources[parser_metadata.current_source_index].last_multiplicity = 1; }
break;

case 11:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 165 "attack_parser.y"
{ parser_metadata.sources[parser_metadata.current_source_index].last_multiplicity = (yyvsp[(1) - (1)].num); }
break;

case 12:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 169 "attack_parser.y"
{ parsed_attack.service = SERVICES_SSH; }
break;

case 13:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 170 "attack_parser.y"
{ parsed_attack.service = SERVICES_DOVECOT; }
break;

case 14:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 171 "attack_parser.y"
{ parsed_attack.service = SERVICES_UWIMAP; }
break;

case 15:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 172 "attack_parser.y"
{ parsed_attack.service = SERVICES_CYRUSIMAP; }
break;

case 16:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 173 "attack_parser.y"
{ parsed_attack.service = SERVICES_CUCIPOP; }
break;

case 17:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 174 "attack_parser.y"
{ parsed_attack.service = SERVICES_EXIM; }
break;

case 18:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 175 "attack_parser.y"
{ parsed_attack.service = SERVICES_SENDMAIL; }
break;

case 19:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 176 "attack_parser.y"
{ parsed_attack.service = SERVICES_FREEBSDFTPD; }
break;

case 20:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 177 "attack_parser.y"
{ parsed_attack.service = SERVICES_PROFTPD; }
break;

case 21:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 178 "attack_parser.y"
{ parsed_attack.service = SERVICES_PUREFTPD; }
break;

case 22:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 179 "attack_parser.y"
{ parsed_attack.service = SERVICES_VSFTPD; }
break;

case 23:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 184 "attack_parser.y"
{
/* the message repeated, was it an attack? */
Expand All @@ -1689,7 +1697,7 @@ yyparse (source_id)

case 24:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 203 "attack_parser.y"
{
parsed_attack.address.kind = ADDRKIND_IPv4;
Expand All @@ -1699,7 +1707,7 @@ yyparse (source_id)

case 25:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 207 "attack_parser.y"
{
parsed_attack.address.kind = ADDRKIND_IPv6;
Expand All @@ -1709,7 +1717,7 @@ yyparse (source_id)

case 26:

/* Line 1455 of yacc.c */
/* Line 1464 of yacc.c */
#line 211 "attack_parser.y"
{
struct addrinfo addrinfo_hints;
Expand Down Expand Up @@ -1759,8 +1767,8 @@ yyparse (source_id)



/* Line 1455 of yacc.c */
#line 1764 "attack_parser.c"
/* Line 1464 of yacc.c */
#line 1772 "attack_parser.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
Expand Down Expand Up @@ -1971,7 +1979,7 @@ yyparse (source_id)



/* Line 1675 of yacc.c */
/* Line 1684 of yacc.c */
#line 342 "attack_parser.y"


Expand Down
13 changes: 6 additions & 7 deletions src/parser/attack_parser.h
@@ -1,10 +1,9 @@

/* A Bison parser, made by GNU Bison 2.4.1. */
/* A Bison parser, made by GNU Bison 2.4.2. */

/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 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
Expand Down Expand Up @@ -130,16 +129,16 @@
typedef union YYSTYPE
{

/* Line 1676 of yacc.c */
/* Line 1685 of yacc.c */
#line 78 "attack_parser.y"

char *str;
int num;



/* Line 1676 of yacc.c */
#line 143 "attack_parser.h"
/* Line 1685 of yacc.c */
#line 142 "attack_parser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
Expand Down

0 comments on commit db14f08

Please sign in to comment.