| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "shared-forward.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 |
sd_id128_t uuid; |
| 16 |
|
| 17 |
char *description; |
| 18 |
|
| 19 |
UserDisposition disposition; |
| 20 |
uint64_t last_change_usec; |
| 21 |
|
| 22 |
gid_t gid; |
| 23 |
|
| 24 |
char **members; |
| 25 |
|
| 26 |
char *service; |
| 27 |
|
| 28 |
/* The following exist mostly so that we can cover the full /etc/gshadow set of fields, we currently |
| 29 |
* do not actually make use of these */ |
| 30 |
char **administrators; /* maps to 'struct sgrp' .sg_adm field */ |
| 31 |
char **hashed_password; /* maps to 'struct sgrp' .sg_passwd field */ |
| 32 |
|
| 33 |
sd_json_variant *json; |
| 34 |
} GroupRecord; |
| 35 |
|
| 36 |
GroupRecord* group_record_new(void); |
| 37 |
DECLARE_TRIVIAL_REF_UNREF_FUNC(GroupRecord, group_record); |
| 38 |
|
| 39 |
DEFINE_TRIVIAL_CLEANUP_FUNC(GroupRecord*, group_record_unref); |
| 40 |
|
| 41 |
int group_record_load(GroupRecord *h, sd_json_variant *v, UserRecordLoadFlags flags); |
| 42 |
int group_record_build(GroupRecord **ret, ...); |
| 43 |
#define group_record_buildo(ret, ...) \ |
| 44 |
group_record_build((ret), SD_JSON_BUILD_OBJECT(__VA_ARGS__)) |
| 45 |
int group_record_clone(GroupRecord *h, UserRecordLoadFlags flags, GroupRecord **ret); |
| 46 |
|
| 47 |
bool group_record_match(GroupRecord *h, const UserDBMatch *match); |
| 48 |
|
| 49 |
const char* group_record_group_name_and_realm(GroupRecord *h); |
| 50 |
UserDisposition group_record_disposition(GroupRecord *h); |
| 51 |
|
| 52 |
bool group_record_matches_group_name(const GroupRecord *g, const char *groupname); |
| 53 |
|
| 54 |
bool group_record_is_root(const GroupRecord *g) _pure_; |
| 55 |
bool group_record_is_nobody(const GroupRecord *g) _pure_; |