summaryrefslogtreecommitdiff
path: root/src/journal/journald-audit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-04 00:48:32 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-04 00:51:19 +0100
commit9833a66c7eba011c3740867c80133bc6fa976aa3 (patch)
tree1cf22ee5d296d2fa8e624c76757cc5b02595b0c8 /src/journal/journald-audit.c
parent0aa281df2c5f56623abddf25d6bcdb82b641aeb2 (diff)
journal: also consider audit fields with '-' valid
Diffstat (limited to 'src/journal/journald-audit.c')
-rw-r--r--src/journal/journald-audit.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c
index ba8a1ae8bd..76f6f3fbde 100644
--- a/src/journal/journald-audit.c
+++ b/src/journal/journald-audit.c
@@ -172,7 +172,7 @@ static int map_generic_field(const char *prefix, const char **p, struct iovec **
if (!((*e >= 'a' && *e <= 'z') ||
(*e >= 'A' && *e <= 'Z') ||
(*e >= '0' && *e <= '9') ||
- (*e == '_')))
+ *e == '_' || *e == '-'))
return 0;
}
@@ -182,8 +182,18 @@ static int map_generic_field(const char *prefix, const char **p, struct iovec **
c = alloca(strlen(prefix) + (e - *p) + 2);
t = stpcpy(c, prefix);
- for (f = *p; f < e; f++)
- *(t++) = *f >= 'a' && *f <= 'z' ? ((*f - 'a') + 'A') : *f;
+ for (f = *p; f < e; f++) {
+ char x;
+
+ if (*f >= 'a' && *f <= 'z')
+ x = (*f - 'a') + 'A'; /* uppercase */
+ else if (*f == '-')
+ x = '_'; /* dashes → underscores */
+ else
+ x = *f;
+
+ *(t++) = x;
+ }
strcpy(t, "=");
e ++;