polished reg exp handling and fixed bugs

This commit is contained in:
Logan007 2020-08-08 22:45:34 +05:45
parent dece8d787e
commit 1d048c59a9
2 changed files with 9 additions and 6 deletions

View File

@ -100,7 +100,7 @@ static int load_allowed_sn_community(n2n_sn_t *sss, char *path) {
fclose(fd);
if (num_regex>0 || num_communities>0 )
if ((num_regex + num_communities) == 0)
{
traceEvent(TRACE_WARNING, "File %s does not contain any valid community names or regular expressions", path);
return -1;

View File

@ -253,6 +253,9 @@ void sn_term(n2n_sn_t *sss)
HASH_ITER(hh, sss->rules, re, tmp_re) {
HASH_DEL(sss->rules, re);
if (NULL!=re->rule) {
free(re->rule);
}
free(re);
}
}
@ -833,11 +836,11 @@ static int process_udp(n2n_sn_t * sss,
break;
}
}
}
if(match != 1) {
traceEvent(TRACE_INFO, "Discarded registration: unallowed community '%s'",
(char*)cmn.community);
return -1;
if(match != 1) {
traceEvent(TRACE_INFO, "Discarded registration: unallowed community '%s'",
(char*)cmn.community);
return -1;
}
}
if(!comm && (!sss->lock_communities || (match == 1))) {