diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-04 00:48:32 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-04 00:51:19 +0100 |
commit | 9833a66c7eba011c3740867c80133bc6fa976aa3 (patch) | |
tree | 1cf22ee5d296d2fa8e624c76757cc5b02595b0c8 /src/journal/journald-audit.c | |
parent | audit: improve the audit messages we generate (diff) | |
download | systemd-9833a66c7eba011c3740867c80133bc6fa976aa3.tar.xz systemd-9833a66c7eba011c3740867c80133bc6fa976aa3.zip |
journal: also consider audit fields with '-' valid
Diffstat (limited to 'src/journal/journald-audit.c')
-rw-r--r-- | src/journal/journald-audit.c | 16 |
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 ++; |