systemd/backport-userdb-Use-json_dispatch_user_group_name-to-parse-Ge.patch
zhaoxiaohu 44807ab13c userdb: Use json_dispatch_user_group_name() to parse GetMembership fields
Signed-off-by: zhaoxiaohu <zhaoxiaohu@kuaishou.com>
2024-12-04 11:39:44 +08:00

38 lines
1.7 KiB
Diff

From 98ca2c0b2736794408caac1bf3a9dbfedf7da4c7 Mon Sep 17 00:00:00 2001
From: Samuel Cabrero <scabrero@suse.de>
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 <scabrero@suse.de>
Signed-off-by: yuwang <yuwang@kuaishou.com>
---
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