Commit 63807dd2 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make the utils ignore binary and unsafe VSL records.

This includes the Debug record, if that becomes a problem we will
deal with it.
parent 49d52ebd
......@@ -258,6 +258,9 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
/* get the value we want and register if it's a hit */
tag = VSL_TAG(tr->c->rec.ptr);
if (VSL_tagflags[tag])
continue;
switch (tag) {
case SLT_Hit:
hit = 1;
......@@ -549,6 +552,11 @@ main(int argc, char **argv)
VUT_Error(vut, 1,
"-P: '%s' is not a valid tag name",
optarg);
if (VSL_tagflags[match_tag])
VUT_Error(vut, 1,
"-P: '%s' is an unsafe or binary record",
optarg);
cli_p.name = "custom";
cli_p.tag = match_tag;
profile = NULL;
......
......@@ -570,6 +570,9 @@ addf_vsl(enum VSL_tag_e tag, long i, const char *prefix)
ALLOC_OBJ(w, VSL_WATCH_MAGIC);
AN(w);
if (VSL_tagflags[tag])
VUT_Error(vut, 1, "Tag %s can contain control characters",
VSL_tags[tag]);
w->tag = tag;
assert(i <= INT_MAX);
w->idx = i;
......@@ -961,6 +964,9 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[],
skip = 0;
while (skip == 0 && 1 == VSL_Next(t->c)) {
tag = VSL_TAG(t->c->rec.ptr);
if (VSL_tagflags[tag])
continue;
b = VSL_CDATA(t->c->rec.ptr);
e = b + VSL_LEN(t->c->rec.ptr);
while (e > b && e[-1] == '\0')
......
......@@ -131,9 +131,11 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
for (tr = pt[0]; tr != NULL; tr = *++pt) {
while ((1 == VSL_Next(tr->c))) {
tag = VSL_TAG(tr->c->rec.ptr);
if (VSL_tagflags[tag])
continue;
if (!VSL_Match(vsl, tr->c))
continue;
tag = VSL_TAG(tr->c->rec.ptr);
b = VSL_CDATA(tr->c->rec.ptr);
e = b + VSL_LEN(tr->c->rec.ptr);
u = 0;
......
......@@ -163,6 +163,9 @@ extern const unsigned VSL_tagflags[SLT__MAX];
* Tag flags array.
* Use these macros with VSL_tagflags (included from vsl_int.h):
*
* VSL_tagflags[tag] & SLT_F_BINARY
* Non-zero if the payload is binary data
*
* VSL_tagflags[tag] & SLT_F_UNSAFE
* Non-zero if the payload with this tag may include
* non-printable characters
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment