|
|
@ -32,7 +32,7 @@ create(const char *id) { |
|
|
|
|
|
|
|
|
|
|
|
if ((cfg = calloc(1, sizeof(cfg_t))) == NULL) |
|
|
|
if ((cfg = calloc(1, sizeof(cfg_t))) == NULL) |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
snprintf(cfg->id, sizeof(cfg->id), "%s", id); |
|
|
|
strlcpy(cfg->id, id, sizeof(cfg->id)); |
|
|
|
|
|
|
|
|
|
|
|
return cfg; |
|
|
|
return cfg; |
|
|
|
} |
|
|
|
} |
|
|
@ -73,8 +73,8 @@ append(cfg_t *cfg, const char *pattern) { |
|
|
|
|
|
|
|
|
|
|
|
memset(buf, 0x0, bufsize); |
|
|
|
memset(buf, 0x0, bufsize); |
|
|
|
memcpy(buf, pattern, token - pattern); |
|
|
|
memcpy(buf, pattern, token - pattern); |
|
|
|
strcat(buf, HOST_REGEX); |
|
|
|
strlcat(buf, HOST_REGEX, bufsize); |
|
|
|
strcat(buf, token + strlen(HOST_TOKEN)); |
|
|
|
strlcat(buf, token + strlen(HOST_TOKEN), bufsize); |
|
|
|
|
|
|
|
|
|
|
|
if ((regex = calloc(1, sizeof(f2b_regex_t))) == NULL) |
|
|
|
if ((regex = calloc(1, sizeof(f2b_regex_t))) == NULL) |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -82,7 +82,7 @@ append(cfg_t *cfg, const char *pattern) { |
|
|
|
if (regcomp(®ex->regex, buf, flags) == 0) { |
|
|
|
if (regcomp(®ex->regex, buf, flags) == 0) { |
|
|
|
regex->next = cfg->regexps; |
|
|
|
regex->next = cfg->regexps; |
|
|
|
cfg->regexps = regex; |
|
|
|
cfg->regexps = regex; |
|
|
|
snprintf(regex->pattern, sizeof(regex->pattern), "%s", pattern); |
|
|
|
strlcpy(regex->pattern, pattern, sizeof(regex->pattern)); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|