From 44807ab13c6588ee907590b1f5df3e9624fbcc4a Mon Sep 17 00:00:00 2001 From: zhaoxiaohu Date: Thu, 29 Aug 2024 15:19:20 +0800 Subject: [PATCH] userdb: Use json_dispatch_user_group_name() to parse GetMembership fields Signed-off-by: zhaoxiaohu --- ...dispatch_user_group_name-to-parse-Ge.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 backport-userdb-Use-json_dispatch_user_group_name-to-parse-Ge.patch diff --git a/backport-userdb-Use-json_dispatch_user_group_name-to-parse-Ge.patch b/backport-userdb-Use-json_dispatch_user_group_name-to-parse-Ge.patch new file mode 100644 index 0000000..5189809 --- /dev/null +++ b/backport-userdb-Use-json_dispatch_user_group_name-to-parse-Ge.patch @@ -0,0 +1,37 @@ +From 98ca2c0b2736794408caac1bf3a9dbfedf7da4c7 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 +https://github.com/systemd/systemd-stable/pull/259/commits/98ca2c0b2736794408caac1bf3a9dbfedf7da4c7 + +Signed-off-by: Samuel Cabrero +Signed-off-by: yuwang +--- + 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 91ac7c3..738da2b 100644 +--- a/src/shared/userdb.c ++++ b/src/shared/userdb.c +@@ -296,8 +296,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_const_string, offsetof(struct membership_data, user_name), JSON_RELAX }, ++ { "groupName", JSON_VARIANT_STRING, json_dispatch_const_string, offsetof(struct membership_data, group_name), JSON_RELAX }, + {} + }; + +-- +2.33.0 +