1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include "json.h" 5 #include "user-record.h" 6 7 typedef struct GroupRecord { 8 unsigned n_ref; 9 UserRecordMask mask; 10 bool incomplete; 11 12 char *group_name; 13 char *realm; 14 char *group_name_and_realm_auto; 15 16 char *description; 17 18 UserDisposition disposition; 19 uint64_t last_change_usec; 20 21 gid_t gid; 22 23 char **members; 24 25 char *service; 26 27 /* The following exist mostly so that we can cover the full /etc/gshadow set of fields, we currently 28 * do not actually make use of these */ 29 char **administrators; /* maps to 'struct sgrp' .sg_adm field */ 30 char **hashed_password; /* maps to 'struct sgrp' .sg_passwd field */ 31 32 JsonVariant *json; 33 } GroupRecord; 34 35 GroupRecord* group_record_new(void); 36 GroupRecord* group_record_ref(GroupRecord *g); 37 GroupRecord* group_record_unref(GroupRecord *g); 38 39 DEFINE_TRIVIAL_CLEANUP_FUNC(GroupRecord*, group_record_unref); 40 41 int group_record_load(GroupRecord *h, JsonVariant *v, UserRecordLoadFlags flags); 42 int group_record_build(GroupRecord **ret, ...); 43 int group_record_clone(GroupRecord *g, UserRecordLoadFlags flags, GroupRecord **ret); 44 45 const char *group_record_group_name_and_realm(GroupRecord *h); 46 UserDisposition group_record_disposition(GroupRecord *h); 47