Skip to content

Commit

Permalink
Tighter code
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Dec 27, 2024
1 parent 921459a commit a0c70ba
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions sniff2ban.c
Original file line number Diff line number Diff line change
Expand Up @@ -2526,16 +2526,14 @@ setup_apache_hosts(void)
while(fgets(buf, sizeof(buf) - 1, fin) != NULL) {
char *p, *q;

p = strstr(buf, "ServerName");
if(p)
/* Locate ServerName or ServerAlias */
if((p = strstr(buf, "ServerName")) != NULL)
p = &p[10];
else {
p = strstr(buf, "ServerAlias");
if(p)
p = &p[11];
if(p == NULL)
continue;
}
else if((p = strstr(buf, "ServerAlias")) != NULL)
p = &p[11];
else
continue;

while(isspace(*p))
p++;
if(*p == '\0')
Expand Down

0 comments on commit a0c70ba

Please sign in to comment.