Skip to content

Commit

Permalink
Function renamed for the consistency. Incomplete coding completed.
Browse files Browse the repository at this point in the history
Tested for the empty and invalid values.  Parameter is ignored in those cases.
  • Loading branch information
KORAY VATANSEVER authored and KORAY VATANSEVER committed Aug 9, 2022
1 parent 22af3ea commit 2b91f0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/apps/common/ns_turn_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static int int_fac[]={LOG_AUTH , LOG_CRON , LOG_DAEMON ,

static int syslog_facility = 0;

static int str2facility(char *s)
static int str_to_syslog_facility(char *s)
{
int i;
for (i=0; str_fac[i]; i++) {
Expand All @@ -182,8 +182,9 @@ void set_syslog_facility(char *val)
if(val == NULL){
return;
}
int tmp = str2facility(val);
int tmp = str_to_syslog_facility(val);
if(tmp == -1){
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "WARNING: invalid syslog-facility value (%s); ignored.\n", val);
return;
}
syslog_facility = tmp;
Expand Down
7 changes: 7 additions & 0 deletions src/apps/relay/mainrelay.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@ static const struct myoption long_options[] = {
{ "no-rfc5780", optional_argument, NULL, NO_RFC5780 },
{ "no-stun-backward-compatibility", optional_argument, NULL, NO_STUN_BACKWARD_COMPATIBILITY_OPT },
{ "response-origin-only-with-rfc5780", optional_argument, NULL, RESPONSE_ORIGIN_ONLY_WITH_RFC5780_OPT },
{ "syslog-facility", required_argument, NULL, SYSLOG_FACILITY_OPT },
{ NULL, no_argument, NULL, 0 }
};

Expand Down Expand Up @@ -1681,6 +1682,7 @@ static void set_option(int c, char *value)
case SIMPLE_LOG_OPT:
case NEW_LOG_TIMESTAMP_OPT:
case NEW_LOG_TIMESTAMP_FORMAT_OPT:
case SYSLOG_FACILITY_OPT:
case 'c':
case 'n':
case 'h':
Expand Down Expand Up @@ -1811,6 +1813,8 @@ static void read_config_file(int argc, char **argv, int pass)
use_new_log_timestamp_format=1;
} else if ((pass==0) && (c==NEW_LOG_TIMESTAMP_FORMAT_OPT)) {
set_turn_log_timestamp_format(value);
} else if((pass==0) && (c==SYSLOG_FACILITY_OPT)) {
set_syslog_facility(value);
} else if((pass == 1) && (c != 'u')) {
set_option(c, value);
} else if((pass == 2) && (c == 'u')) {
Expand Down Expand Up @@ -2297,6 +2301,9 @@ int main(int argc, char **argv)
case NEW_LOG_TIMESTAMP_FORMAT_OPT:
set_turn_log_timestamp_format(optarg);
break;
case SYSLOG_FACILITY_OPT:
set_syslog_facility(optarg);
break;
default:
;
}
Expand Down

0 comments on commit 2b91f0a

Please sign in to comment.