From edd5ec23738ef9ae7b1416bacede97e70ddf9402 Mon Sep 17 00:00:00 2001 From: Samuel Cabrero Date: Fri, 10 Feb 2023 14:04:27 +0100 Subject: [PATCH] userdb: Use json_dispatch_user_group_name() to parse GetMembership fields It allows to relax the checks and allow characters like '\', used by windows to split the domain name and user name. For reference, discussion in the systemd-devel mailing list: https://lists.freedesktop.org/archives/systemd-devel/2023-February/048804.html Signed-off-by: Samuel Cabrero --- src/shared/userdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/userdb.c b/src/shared/userdb.c index aa55cc00ae..a77eff4407 100644 --- a/src/shared/userdb.c +++ b/src/shared/userdb.c @@ -294,8 +294,8 @@ static int userdb_on_query_reply( } membership_data = {}; static const JsonDispatch dispatch_table[] = { - { "userName", JSON_VARIANT_STRING, json_dispatch_const_string, offsetof(struct membership_data, user_name), JSON_SAFE }, - { "groupName", JSON_VARIANT_STRING, json_dispatch_const_string, offsetof(struct membership_data, group_name), JSON_SAFE }, + { "userName", JSON_VARIANT_STRING, json_dispatch_user_group_name, offsetof(struct membership_data, user_name), JSON_RELAX }, + { "groupName", JSON_VARIANT_STRING, json_dispatch_user_group_name, offsetof(struct membership_data, group_name), JSON_RELAX }, {} };