Browse Source

polished reg exp handling and fixed bugs

pull/349/head
Logan007 4 years ago
parent
commit
1d048c59a9
  1. 2
      src/sn.c
  2. 13
      src/sn_utils.c

2
src/sn.c

@ -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;

13
src/sn_utils.c

@ -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))) {

Loading…
Cancel
Save