]> 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>
Wed, 20 Jul 2022 15:36:20 +0000 (17:36 +0200)
commit0d600d3cc1fcc89306aa491c723e3e716585ced3
tree746f940e276b33580a9117e53c185cb5162acd5c
parentb144dfa04eb6322b6cd717beb861c6cd8664e613
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