mirror of
https://github.com/samhocevar/rinetd.git
synced 2025-01-14 14:20:07 +08:00
Remove patternBad() and inline its code in its only caller.
This commit is contained in:
parent
e3c2b09c01
commit
86cba0ad56
19
rinetd.c
19
rinetd.c
@ -152,7 +152,6 @@ static void refuse(ConnectionInfo *cnx, int logCode);
|
||||
|
||||
static int readArgs (int argc, char **argv, RinetdOptions *options);
|
||||
static int getConfLine(FILE *in, char *line, int space, int *lnum);
|
||||
static int patternBad(char const *pattern);
|
||||
static void clearConfiguration(void);
|
||||
static void readConfiguration(void);
|
||||
|
||||
@ -278,7 +277,13 @@ static void readConfiguration(void) {
|
||||
"specified on file %s, line %d.\n", bindAddress, options.conf_file, lnum);
|
||||
continue;
|
||||
}
|
||||
if (patternBad(pattern)) {
|
||||
int bad = 0;
|
||||
for (char const *p = pattern; *p; ++p) {
|
||||
if (!strchr("0123456789?*.", *p)) {
|
||||
bad = 1;
|
||||
}
|
||||
}
|
||||
if (bad) {
|
||||
syslog(LOG_ERR, "illegal allow or "
|
||||
"deny pattern. Only digits, ., and\n"
|
||||
"the ? and * wild cards are allowed. "
|
||||
@ -1142,13 +1147,3 @@ static struct tm *get_gmtoff(int *tz) {
|
||||
return t;
|
||||
}
|
||||
|
||||
static int patternBad(char const *pattern)
|
||||
{
|
||||
for (char const *p = pattern; *p; ++p) {
|
||||
if (!isdigit(*p) && !strchr("?*.", *p)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user