summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-08-21 04:32:26 -0400
committerAndrew Cady <d@jerkface.net>2020-08-21 04:32:26 -0400
commitbd9ff5dca38171597651693b56c3be272040330d (patch)
treeb0dcc13e9e86f6cd65e4847e2185cbe04533fefd
parentf32dfb23412095f6bd19f96cc8e06fdf3cadc30e (diff)
avoid unneeded conditionals
-rw-r--r--main.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/main.c b/main.c
index 7b267c0..c94409d 100644
--- a/main.c
+++ b/main.c
@@ -451,8 +451,8 @@ int handle_request_tunnel_frame(protocol_frame *rcvd_frame)
451 log_printf(L_INFO, "Got a request to forward data from %s:%d\n", hostname, port); 451 log_printf(L_INFO, "Got a request to forward data from %s:%d\n", hostname, port);
452 452
453 // check rules 453 // check rules
454 if (rules_policy == VALIDATE && nrules > 0 ) { 454 if(rules_policy == VALIDATE && nrules > 0)
455 455 {
456 rule temp_rule, *found = NULL; 456 rule temp_rule, *found = NULL;
457 temp_rule.host = hostname; 457 temp_rule.host = hostname;
458 temp_rule.port = port; 458 temp_rule.port = port;
@@ -461,18 +461,14 @@ int handle_request_tunnel_frame(protocol_frame *rcvd_frame)
461 if(!found) 461 if(!found)
462 { 462 {
463 log_printf(L_WARNING, "Rejected, request not in rules\n"); 463 log_printf(L_WARNING, "Rejected, request not in rules\n");
464 if(hostname) 464 free(hostname);
465 {
466 free(hostname);
467 }
468 return -1; 465 return -1;
469 } 466 }
470 } else if (rules_policy != NONE) { 467 }
468 else if (rules_policy != NONE)
469 {
471 log_printf(L_WARNING, "Filter option active but no allowed host/port. All requests will be dropped.\n"); 470 log_printf(L_WARNING, "Filter option active but no allowed host/port. All requests will be dropped.\n");
472 if(hostname) 471 free(hostname);
473 {
474 free(hostname);
475 }
476 return -1; 472 return -1;
477 } 473 }
478 474