Add support for inline comments with #

Just trim the char # onwards from the start of value. So values cannot
have the char # in them.
pull/48/head
Soner Tari 3 years ago
parent dff3f90c62
commit 42d84629f3

@ -19,7 +19,7 @@
*)]
[log ([[!]connect] [[!]master] [[!]cert]
[[!]content] [[!]pcap] [[!]mirror] [$macro]|[!]*)]
|*)
|*) [# comment]
- Add Define config option for defining macros to be used in filtering rules.
- Add Include config option for loading configuration from an include file.

@ -309,7 +309,7 @@ The syntax of filtering rules is as follows:
*)]
[log ([[!]connect] [[!]master] [[!]cert]
[[!]content] [[!]pcap] [[!]mirror] [$macro]|[!]*)]
|*)
|*) [# comment]
The definition of which connections the rule action will be applied to is
achieved by the `from` and `to` parts of a filtering rule and by the proxyspec

@ -1740,7 +1740,7 @@ filter_rule_translate(opts_t *opts, const char *name, int argc, char **argv, int
// *)]
// [log ([[!]connect] [[!]master] [[!]cert]
// [[!]content] [[!]pcap] [[!]mirror] [$macro]|[!]*)]
// |*)
// |*) [# comment]
filter_rule_t *rule = malloc(sizeof(filter_rule_t));
if (!rule)

@ -103,7 +103,7 @@ typedef struct filter_rule {
unsigned int exact_user : 1; /* 1 for exact, 0 for substring match */
char *desc;
unsigned int exact_desc : 1; /* 1 for exact, 0 for substring match */
unsigned int exact_desc : 1; /* 1 for exact, 0 for substring match */
#endif /* !WITHOUT_USERAUTH */
char *ip;

@ -2717,6 +2717,17 @@ get_name_value(char *name, char **value, const char sep, int line_num)
size_t value_len = strlen(*value);
// Trim inline comment
n = *value;
while (*n) {
if (*n == '#') {
*n = '\0';
value_len = strlen(*value);
break;
}
n++;
}
if (!value_len) {
#ifdef DEBUG_OPTS
log_dbg_printf("Warning in option: No option value on line %d\n", line_num);

@ -322,7 +322,7 @@ The syntax of filtering rules is as follows:
*)]
[log ([[!]connect] [[!]master] [[!]cert]
[[!]content] [[!]pcap] [[!]mirror] [$macro]|[!]*)]
|*)
|*) [# comment]
.LP
The definition of which connections the rule action will be applied to is
achieved by the from and to parts of a filtering rule and by the proxyspec

@ -305,7 +305,7 @@ PassUsers admin
# *)]
# [log ([[!]connect] [[!]master] [[!]cert]
# [[!]content] [[!]pcap] [[!]mirror] [$macro]|[!]*)]
# |*)
# |*) [# comment]
#
# PassSite example.com is equivalent to the following two Pass rules:
# Pass to sni example.com

@ -345,6 +345,10 @@ effectively disabling SSL inspection and content logging of packets.
.TP
\fBBlock STRING\fR
Block filtering rule terminates the connection.
.TP
\fBMatch STRING\fR
Match filtering rule specifies log actions for the connection without changing
its filter action.
.br
The syntax of filtering rules is as follows:
@ -366,7 +370,7 @@ The syntax of filtering rules is as follows:
*)]
[log ([[!]connect] [[!]master] [[!]cert]
[[!]content] [[!]pcap] [[!]mirror] [$macro]|[!]*)]
|*)
|*) [# comment]
.br
See sslproxy(1) for the details.

Loading…
Cancel
Save