mirror of
https://github.com/systemd/systemd.git
synced 2024-12-13 04:03:35 +08:00
shared: add internal API for querying JSON user records via varlink
This new API can be used in place of NSS by our own internal code if more than the classic UNIX records are needed.
This commit is contained in:
parent
9b2d907877
commit
ec8e4a0ef1
@ -197,6 +197,8 @@ shared_sources = files('''
|
||||
user-record-nss.h
|
||||
user-record.c
|
||||
user-record.h
|
||||
userdb.c
|
||||
userdb.h
|
||||
utmp-wtmp.h
|
||||
varlink.c
|
||||
varlink.h
|
||||
|
1347
src/shared/userdb.c
Normal file
1347
src/shared/userdb.c
Normal file
File diff suppressed because it is too large
Load Diff
41
src/shared/userdb.h
Normal file
41
src/shared/userdb.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include "group-record.h"
|
||||
#include "user-record.h"
|
||||
|
||||
/* Inquire local services for user/group records */
|
||||
|
||||
typedef struct UserDBIterator UserDBIterator;
|
||||
|
||||
UserDBIterator *userdb_iterator_free(UserDBIterator *iterator);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(UserDBIterator*, userdb_iterator_free);
|
||||
|
||||
typedef enum UserDBFlags {
|
||||
USERDB_AVOID_NSS = 1 << 0, /* don't do client-side nor server-side NSS */
|
||||
USERDB_AVOID_DYNAMIC_USER = 1 << 1, /* exclude looking up in io.systemd.DynamicUser */
|
||||
USERDB_AVOID_MULTIPLEXER = 1 << 2, /* exclude looking up via io.systemd.Multiplexer */
|
||||
USERDB_DONT_SYNTHESIZE = 1 << 3, /* don't synthesize root/nobody */
|
||||
} UserDBFlags;
|
||||
|
||||
int userdb_by_name(const char *name, UserDBFlags flags, UserRecord **ret);
|
||||
int userdb_by_uid(uid_t uid, UserDBFlags flags, UserRecord **ret);
|
||||
int userdb_all(UserDBFlags flags, UserDBIterator **ret);
|
||||
int userdb_iterator_get(UserDBIterator *iterator, UserRecord **ret);
|
||||
|
||||
int groupdb_by_name(const char *name, UserDBFlags flags, GroupRecord **ret);
|
||||
int groupdb_by_gid(gid_t gid, UserDBFlags flags, GroupRecord **ret);
|
||||
int groupdb_all(UserDBFlags flags, UserDBIterator **ret);
|
||||
int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret);
|
||||
|
||||
int membershipdb_by_user(const char *name, UserDBFlags flags, UserDBIterator **ret);
|
||||
int membershipdb_by_group(const char *name, UserDBFlags flags, UserDBIterator **ret);
|
||||
int membershipdb_all(UserDBFlags flags, UserDBIterator **ret);
|
||||
int membershipdb_iterator_get(UserDBIterator *iterator, char **user, char **group);
|
||||
int membershipdb_by_group_strv(const char *name, UserDBFlags flags, char ***ret);
|
||||
|
||||
int userdb_nss_compat_is_enabled(void);
|
||||
int userdb_nss_compat_disable(void);
|
Loading…
Reference in New Issue
Block a user