Hello,
When running processes with proc-exec any logging send over stderr is
not very intelligible since the process name is automatically generated
and results in <dynproc:%08x>, which make them hard to read.
To clean this up I reckon we can do three things:
1) Add an extra optional proc parameter that sets the name. Diff below
does this.
2) Change the process name to match the filter name.
3) Do both
I reckon we're still early enough in the development process for us to
change the default processor name in proc-exec.
Thoughts?
martijn@
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/parse.y,v
retrieving revision 1.257
diff -u -p -r1.257 parse.y
--- parse.y 11 Aug 2019 17:23:12 -0000 1.257
+++ parse.y 23 Aug 2019 07:00:08 -0000
@@ -1625,6 +1625,37 @@ FILTER STRING PROC_EXEC STRING {
filter_config = NULL;
}
|
+FILTER STRING PROC_EXEC PROC STRING STRING {
+ if (dict_get(conf->sc_processors_dict, $5)) {
+ yyerror("processor already exists with that name: %s", $5);
+ free($2);
+ free($5);
+ free($6);
+ YYERROR;
+ }
+
+ if (dict_get(conf->sc_filters_dict, $2)) {
+ yyerror("filter already exists with that name: %s", $2);
+ free($2);
+ free($5);
+ free($6);
+ YYERROR;
+ }
+
+ processor = xcalloc(1, sizeof *processor);
+ processor->command = $6;
+
+ filter_config = xcalloc(1, sizeof *filter_config);
+ filter_config->filter_type = FILTER_TYPE_PROC;
+ filter_config->name = $2;
+ filter_config->proc = $5;
+ dict_set(conf->sc_filters_dict, $2, filter_config);
+} proc_params {
+ dict_set(conf->sc_processors_dict, filter_config->proc, processor);
+ processor = NULL;
+ filter_config = NULL;
+}
+|
FILTER STRING PHASE {
if (dict_get(conf->sc_filters_dict, $2)) {
yyerror("filter already exists with that name: %s", $2);