]> git.ipfire.org Git - thirdparty/util-linux.git/commit
logger: make sure structured data are escaped
authorKarel Zak <kzak@redhat.com>
Mon, 2 May 2022 13:30:26 +0000 (15:30 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 2 May 2022 13:30:26 +0000 (15:30 +0200)
commit6ab10df254c62e1abf962a8756c0cd4aa333a47f
treea2118cd861cb332e6658a3be634038cb5acf5f80
parent63bb04509e79e2edc4b16962c7fa947b56b2a2a0
logger: make sure structured data are escaped

For the option --sd-param all formatting chars (" \ and ]) has to be
escaped by \. This patch also allow escape [ to make it more user
friendly.

For example

$ logger --rfc5424 --sd-id zoo@123 --sd-param 'foo="b\"A\"r"' --no-act --stderr "this is message"
<13>1 2022-05-02T15:35:00.342141+02:00 ws.net.home kzak - - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="45291"][zoo@123 foo="b\"A\"r"] this is message

Reported-by: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/logger.c