mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 16:37:19 +09:00
This adds some basic client-side user/group filtering to "userdbctl": 1. by uid/gid min/max 2. by user "disposition" (i.e. show only regular users with "userdbctl user -R") 3. by fuzzy name (i.e. search by substring/levenshtein of user name, real name, and other identifiers of the user/group record). In the long run we also want to support this server side, but let's start out with doing this client-side, since many backends won't support server-side filtering anytime soon anyway, so we need it in either case.
50 lines
1.4 KiB
C
50 lines
1.4 KiB
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
#pragma once
|
|
|
|
#include "sd-json.h"
|
|
|
|
#include "user-record.h"
|
|
|
|
typedef struct GroupRecord {
|
|
unsigned n_ref;
|
|
UserRecordMask mask;
|
|
bool incomplete;
|
|
|
|
char *group_name;
|
|
char *realm;
|
|
char *group_name_and_realm_auto;
|
|
|
|
char *description;
|
|
|
|
UserDisposition disposition;
|
|
uint64_t last_change_usec;
|
|
|
|
gid_t gid;
|
|
|
|
char **members;
|
|
|
|
char *service;
|
|
|
|
/* The following exist mostly so that we can cover the full /etc/gshadow set of fields, we currently
|
|
* do not actually make use of these */
|
|
char **administrators; /* maps to 'struct sgrp' .sg_adm field */
|
|
char **hashed_password; /* maps to 'struct sgrp' .sg_passwd field */
|
|
|
|
sd_json_variant *json;
|
|
} GroupRecord;
|
|
|
|
GroupRecord* group_record_new(void);
|
|
GroupRecord* group_record_ref(GroupRecord *g);
|
|
GroupRecord* group_record_unref(GroupRecord *g);
|
|
|
|
DEFINE_TRIVIAL_CLEANUP_FUNC(GroupRecord*, group_record_unref);
|
|
|
|
int group_record_load(GroupRecord *h, sd_json_variant *v, UserRecordLoadFlags flags);
|
|
int group_record_build(GroupRecord **ret, ...);
|
|
int group_record_clone(GroupRecord *g, UserRecordLoadFlags flags, GroupRecord **ret);
|
|
|
|
int group_record_match(GroupRecord *h, const UserDBMatch *match);
|
|
|
|
const char* group_record_group_name_and_realm(GroupRecord *h);
|
|
UserDisposition group_record_disposition(GroupRecord *h);
|