summaryrefslogtreecommitdiffstats
path: root/src/home/user-record-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-08-06 17:41:05 +0200
committerLennart Poettering <lennart@poettering.net>2020-08-07 08:39:52 +0200
commit0a388dfcc5c02219a2b6780c1ab6521fb4a49bf1 (patch)
treeffa2bf286145bd9e1ef5118a01da53351e58c5e6 /src/home/user-record-util.c
parentuserdb: add "description" field to group records (diff)
downloadsystemd-0a388dfcc5c02219a2b6780c1ab6521fb4a49bf1.tar.xz
systemd-0a388dfcc5c02219a2b6780c1ab6521fb4a49bf1.zip
core,home,machined: generate description fields for all groups we synthesize
Diffstat (limited to 'src/home/user-record-util.c')
-rw-r--r--src/home/user-record-util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/home/user-record-util.c b/src/home/user-record-util.c
index a9f6f05e13..516ffaa8a6 100644
--- a/src/home/user-record-util.c
+++ b/src/home/user-record-util.c
@@ -104,7 +104,7 @@ int user_record_synthesize(
}
int group_record_synthesize(GroupRecord *g, UserRecord *h) {
- _cleanup_free_ char *un = NULL, *rr = NULL, *group_name_and_realm = NULL;
+ _cleanup_free_ char *un = NULL, *rr = NULL, *group_name_and_realm = NULL, *description = NULL;
char smid[SD_ID128_STRING_MAX];
sd_id128_t mid;
int r;
@@ -133,10 +133,15 @@ int group_record_synthesize(GroupRecord *g, UserRecord *h) {
return -ENOMEM;
}
+ description = strjoin("Primary Group of User ", un);
+ if (!description)
+ return -ENOMEM;
+
r = json_build(&g->json,
JSON_BUILD_OBJECT(
JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(un)),
JSON_BUILD_PAIR_CONDITION(!!rr, "realm", JSON_BUILD_STRING(rr)),
+ JSON_BUILD_PAIR("description", JSON_BUILD_STRING(description)),
JSON_BUILD_PAIR("binding", JSON_BUILD_OBJECT(
JSON_BUILD_PAIR(sd_id128_to_string(mid, smid), JSON_BUILD_OBJECT(
JSON_BUILD_PAIR("gid", JSON_BUILD_UNSIGNED(user_record_gid(h))))))),