mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
user-util: move UID/GID related macros from macro.h to user-util.h
This commit is contained in:
parent
49cf4170d0
commit
ee104e11e3
@ -27,6 +27,7 @@
|
||||
#include "path-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int unlink_noerrno(const char *path) {
|
||||
|
@ -295,14 +295,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
|
||||
#define PTR_TO_SIZE(p) ((size_t) ((uintptr_t) (p)))
|
||||
#define SIZE_TO_PTR(u) ((void *) ((uintptr_t) (u)))
|
||||
|
||||
/* The following macros add 1 when converting things, since UID 0 is a
|
||||
* valid UID, while the pointer NULL is special */
|
||||
#define PTR_TO_UID(p) ((uid_t) (((uintptr_t) (p))-1))
|
||||
#define UID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
|
||||
|
||||
#define PTR_TO_GID(p) ((gid_t) (((uintptr_t) (p))-1))
|
||||
#define GID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
|
||||
|
||||
#define PTR_TO_PID(p) ((pid_t) ((uintptr_t) p))
|
||||
#define PID_TO_PTR(p) ((void*) ((uintptr_t) p))
|
||||
|
||||
@ -466,8 +458,6 @@ do { \
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define UID_INVALID ((uid_t) -1)
|
||||
#define GID_INVALID ((gid_t) -1)
|
||||
#define MODE_INVALID ((mode_t) -1)
|
||||
|
||||
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "mkdir.h"
|
||||
#include "path-util.h"
|
||||
#include "stat-util.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkdir_func_t _mkdir) {
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "socket-util.h"
|
||||
#include "string-table.h"
|
||||
#include "string-util.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int socket_address_parse(SocketAddress *a, const char *s) {
|
||||
|
@ -54,3 +54,14 @@ int get_shell(char **_ret);
|
||||
int reset_uid_gid(void);
|
||||
|
||||
int take_etc_passwd_lock(const char *root);
|
||||
|
||||
#define UID_INVALID ((uid_t) -1)
|
||||
#define GID_INVALID ((gid_t) -1)
|
||||
|
||||
/* The following macros add 1 when converting things, since UID 0 is a
|
||||
* valid UID, while the pointer NULL is special */
|
||||
#define PTR_TO_UID(p) ((uid_t) (((uintptr_t) (p))-1))
|
||||
#define UID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
|
||||
|
||||
#define PTR_TO_GID(p) ((gid_t) (((uintptr_t) (p))-1))
|
||||
#define GID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "set.h"
|
||||
#include "strv.h"
|
||||
#include "synthesize.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
static int proxy_create_destination(Proxy *p, const char *destination, const char *local_sec, bool negotiate_fds) {
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "special.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
|
||||
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_load_state, unit_load_state, UnitLoadState);
|
||||
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_job_mode, job_mode, JobMode);
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "strxcpyx.h"
|
||||
#include "user-util.h"
|
||||
|
||||
#define CONNECTIONS_MAX 4096
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "set.h"
|
||||
#include "smack-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
#include "virt.h"
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "umask-util.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
typedef enum MountMode {
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "path-util.h"
|
||||
#include "selinux-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
#include "virt.h"
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "string-table.h"
|
||||
#include "strv.h"
|
||||
#include "syslog-util.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
#include "web-util.h"
|
||||
|
||||
|
@ -29,13 +29,14 @@
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "bus-bloom.h"
|
||||
#include "bus-control.h"
|
||||
#include "bus-internal.h"
|
||||
#include "bus-message.h"
|
||||
#include "bus-util.h"
|
||||
#include "capability-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "bus-control.h"
|
||||
#include "user-util.h"
|
||||
|
||||
_public_ int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
|
||||
int r;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "terminal-util.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
enum {
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "parse-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
#define UNIQUE_NAME_MAX (3+DECIMAL_STR_MAX(uint64_t))
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "strxcpyx.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int device_add_property(sd_device *device, const char *key, const char *value) {
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "path-util.h"
|
||||
#include "selinux-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
enum {
|
||||
|
@ -22,13 +22,14 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "bus-util.h"
|
||||
#include "strv.h"
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-label.h"
|
||||
#include "logind.h"
|
||||
#include "bus-util.h"
|
||||
#include "logind-seat.h"
|
||||
#include "logind.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
static int property_get_active_session(
|
||||
sd_bus *bus,
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "special.h"
|
||||
#include "string-table.h"
|
||||
#include "unit-name.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name) {
|
||||
|
@ -20,10 +20,11 @@
|
||||
***/
|
||||
|
||||
#include "bus-label.h"
|
||||
#include "strv.h"
|
||||
#include "bus-util.h"
|
||||
#include "machine-image.h"
|
||||
#include "image-dbus.h"
|
||||
#include "machine-image.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
|
||||
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, image_type, ImageType);
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "process-util.h"
|
||||
#include "strv.h"
|
||||
#include "terminal-util.h"
|
||||
#include "user-util.h"
|
||||
|
||||
static int property_get_id(
|
||||
sd_bus *bus,
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "stat-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
CustomMount* custom_mount_add(CustomMount **l, unsigned *n, CustomMountType t) {
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "macro.h"
|
||||
#include "string-util.h"
|
||||
#include "umask-util.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
typedef struct BaseFilesystem {
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "missing.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "proc-cmdline.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "set.h"
|
||||
#include "signal-util.h"
|
||||
@ -46,9 +47,9 @@
|
||||
#include "strv.h"
|
||||
#include "syslog-util.h"
|
||||
#include "unit-name.h"
|
||||
#include "user-util.h"
|
||||
#include "utf8.h"
|
||||
#include "util.h"
|
||||
#include "proc-cmdline.h"
|
||||
|
||||
static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
|
||||
sd_event *e = userdata;
|
||||
|
@ -23,10 +23,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "dev-setup.h"
|
||||
#include "label.h"
|
||||
#include "path-util.h"
|
||||
#include "dev-setup.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int dev_setup(const char *prefix, uid_t uid, gid_t gid) {
|
||||
static const char symlinks[] =
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "rm-rf.h"
|
||||
#include "string-util.h"
|
||||
#include "switch-root.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, unsigned long mountflags) {
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "process-util.h"
|
||||
#include "string-util.h"
|
||||
#include "test-helper.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
static void check_p_d_u(const char *path, int code, const char *result) {
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "rm-rf.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
static void setup_test_dir(char *tmp_dir, const char *files, ...) {
|
||||
|
@ -21,8 +21,9 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "uid-range.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
_cleanup_free_ UidRange *p = NULL;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "path-util.h"
|
||||
#include "selinux-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
#define NULL_ADJTIME_UTC "0.0 0 0\n0\nUTC\n"
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "terminal-util.h"
|
||||
#include "udev-util.h"
|
||||
#include "udev.h"
|
||||
#include "user-util.h"
|
||||
|
||||
static bool arg_debug = false;
|
||||
static int arg_daemonize = false;
|
||||
|
Loading…
Reference in New Issue
Block a user