From: Samuel Cabrero Date: Fri, 10 Feb 2023 13:04:27 +0000 (+0100) Subject: userdb: Use json_dispatch_user_group_name() to parse GetMembership fields X-Git-Tag: v253-rc3~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=edd5ec23738ef9ae7b1416bacede97e70ddf9402;p=thirdparty%2Fsystemd.git 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 --- diff --git a/src/shared/userdb.c b/src/shared/userdb.c index aa55cc00ae4..a77eff4407a 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 }, {} };