File: | build-scan/../src/core/dbus-execute.c |
Warning: | line 1411, column 40 Potential leak of memory pointed to by 'copy' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* SPDX-License-Identifier: LGPL-2.1+ */ | |||
2 | ||||
3 | #include <sys/mount.h> | |||
4 | #include <sys/prctl.h> | |||
5 | #include <stdio_ext.h> | |||
6 | ||||
7 | #if HAVE_SECCOMP1 | |||
8 | #include <seccomp.h> | |||
9 | #endif | |||
10 | ||||
11 | #include "af-list.h" | |||
12 | #include "alloc-util.h" | |||
13 | #include "bus-util.h" | |||
14 | #include "cap-list.h" | |||
15 | #include "capability-util.h" | |||
16 | #include "cpu-set-util.h" | |||
17 | #include "dbus-execute.h" | |||
18 | #include "dbus-util.h" | |||
19 | #include "env-util.h" | |||
20 | #include "errno-list.h" | |||
21 | #include "escape.h" | |||
22 | #include "execute.h" | |||
23 | #include "fd-util.h" | |||
24 | #include "fileio.h" | |||
25 | #include "hexdecoct.h" | |||
26 | #include "io-util.h" | |||
27 | #include "ioprio.h" | |||
28 | #include "journal-util.h" | |||
29 | #include "missing.h" | |||
30 | #include "mount-util.h" | |||
31 | #include "namespace.h" | |||
32 | #include "parse-util.h" | |||
33 | #include "path-util.h" | |||
34 | #include "process-util.h" | |||
35 | #include "rlimit-util.h" | |||
36 | #if HAVE_SECCOMP1 | |||
37 | #include "seccomp-util.h" | |||
38 | #endif | |||
39 | #include "securebits-util.h" | |||
40 | #include "specifier.h" | |||
41 | #include "strv.h" | |||
42 | #include "syslog-util.h" | |||
43 | #include "unit-printf.h" | |||
44 | #include "user-util.h" | |||
45 | #include "utf8.h" | |||
46 | ||||
47 | BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput)int bus_property_get_exec_output(sd_bus *bus, const char *path , const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { ExecOutput *data = userdata; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 47 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 47, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 47 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", exec_output_to_string((*(data)))); }; | |||
48 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput)int property_get_exec_input(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { ExecInput *data = userdata ; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 48 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 48, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 48 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", exec_input_to_string((*(data)))); }; | |||
49 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_utmp_mode, exec_utmp_mode, ExecUtmpMode)int property_get_exec_utmp_mode(sd_bus *bus, const char *path , const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { ExecUtmpMode * data = userdata; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 49 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 49, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 49 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", exec_utmp_mode_to_string((*(data)))); }; | |||
50 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_preserve_mode, exec_preserve_mode, ExecPreserveMode)int property_get_exec_preserve_mode(sd_bus *bus, const char * path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { ExecPreserveMode *data = userdata; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c" , 50, __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 50, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 50 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", exec_preserve_mode_to_string((*(data)))); }; | |||
51 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_keyring_mode, exec_keyring_mode, ExecKeyringMode)int property_get_exec_keyring_mode(sd_bus *bus, const char *path , const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { ExecKeyringMode *data = userdata; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c" , 51, __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 51, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 51 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", exec_keyring_mode_to_string((*(data)))); }; | |||
52 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_protect_home, protect_home, ProtectHome)int property_get_protect_home(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { ProtectHome *data = userdata ; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 52 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 52, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 52 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", protect_home_to_string((*(data)))); }; | |||
53 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_protect_system, protect_system, ProtectSystem)int property_get_protect_system(sd_bus *bus, const char *path , const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { ProtectSystem *data = userdata; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c" , 53, __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 53, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 53 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", protect_system_to_string((*(data)))); }; | |||
54 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_personality, personality, unsigned long)int property_get_personality(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { unsigned long *data = userdata; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 54 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 54, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 54 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", personality_to_string((*(data)))); }; | |||
55 | static BUS_DEFINE_PROPERTY_GET(property_get_ioprio, "i", ExecContext, exec_context_get_effective_ioprio)int property_get_ioprio(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { ExecContext *data = userdata ; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 55 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 55, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 55 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "i", (exec_context_get_effective_ioprio(data))); }; | |||
56 | static BUS_DEFINE_PROPERTY_GET2(property_get_ioprio_class, "i", ExecContext, exec_context_get_effective_ioprio, IOPRIO_PRIO_CLASS)int property_get_ioprio_class(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { ExecContext *data = userdata ; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 56 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 56, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 56 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "i", ((exec_context_get_effective_ioprio(data)) >> 13)); }; | |||
57 | static BUS_DEFINE_PROPERTY_GET2(property_get_ioprio_priority, "i", ExecContext, exec_context_get_effective_ioprio, IOPRIO_PRIO_DATA)int property_get_ioprio_priority(sd_bus *bus, const char *path , const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { ExecContext * data = userdata; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 57 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 57, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 57 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "i", ((exec_context_get_effective_ioprio(data)) & ((1UL << 13) - 1))); }; | |||
58 | static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_empty_string, "s", NULL)int property_get_empty_string(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { do { if ((__builtin_expect (!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ( "bus"), "../src/core/dbus-execute.c", 58, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 58 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", ((void*)0)); }; | |||
59 | static BUS_DEFINE_PROPERTY_GET_REF(property_get_syslog_level, "i", int, LOG_PRI)int property_get_syslog_level(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { int *data = userdata ; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 59 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 59, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 59 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "i", (((*(data))) & 0x07)); }; | |||
60 | static BUS_DEFINE_PROPERTY_GET_REF(property_get_syslog_facility, "i", int, LOG_FAC)int property_get_syslog_facility(sd_bus *bus, const char *path , const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { int *data = userdata ; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 60 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 60, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 60 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "i", ((((*(data))) & 0x03f8) >> 3)); }; | |||
61 | static BUS_DEFINE_PROPERTY_GET(property_get_cpu_affinity_from_numa, "b", ExecContext, exec_context_get_cpu_affinity_from_numa)int property_get_cpu_affinity_from_numa(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { ExecContext * data = userdata; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 61 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 61, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-execute.c", 61 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "b", (exec_context_get_cpu_affinity_from_numa(data))) ; }; | |||
62 | ||||
63 | ||||
64 | static int property_get_environment_files( | |||
65 | sd_bus *bus, | |||
66 | const char *path, | |||
67 | const char *interface, | |||
68 | const char *property, | |||
69 | sd_bus_message *reply, | |||
70 | void *userdata, | |||
71 | sd_bus_error *error) { | |||
72 | ||||
73 | ExecContext *c = userdata; | |||
74 | char **j; | |||
75 | int r; | |||
76 | ||||
77 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 77 , __PRETTY_FUNCTION__); } while (0); | |||
78 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 78 , __PRETTY_FUNCTION__); } while (0); | |||
79 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 79, __PRETTY_FUNCTION__ ); } while (0); | |||
80 | ||||
81 | r = sd_bus_message_open_container(reply, 'a', "(sb)"); | |||
82 | if (r < 0) | |||
83 | return r; | |||
84 | ||||
85 | STRV_FOREACH(j, c->environment_files)for ((j) = (c->environment_files); (j) && *(j); (j )++) { | |||
86 | const char *fn = *j; | |||
87 | ||||
88 | r = sd_bus_message_append(reply, "(sb)", fn[0] == '-' ? fn + 1 : fn, fn[0] == '-'); | |||
89 | if (r < 0) | |||
90 | return r; | |||
91 | } | |||
92 | ||||
93 | return sd_bus_message_close_container(reply); | |||
94 | } | |||
95 | ||||
96 | static int property_get_oom_score_adjust( | |||
97 | sd_bus *bus, | |||
98 | const char *path, | |||
99 | const char *interface, | |||
100 | const char *property, | |||
101 | sd_bus_message *reply, | |||
102 | void *userdata, | |||
103 | sd_bus_error *error) { | |||
104 | ||||
105 | ExecContext *c = userdata; | |||
106 | int32_t n; | |||
107 | ||||
108 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 108 , __PRETTY_FUNCTION__); } while (0); | |||
109 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 109 , __PRETTY_FUNCTION__); } while (0); | |||
110 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 110, __PRETTY_FUNCTION__); } while (0); | |||
111 | ||||
112 | if (c->oom_score_adjust_set) | |||
113 | n = c->oom_score_adjust; | |||
114 | else { | |||
115 | _cleanup_free___attribute__((cleanup(freep))) char *t = NULL((void*)0); | |||
116 | ||||
117 | n = 0; | |||
118 | if (read_one_line_file("/proc/self/oom_score_adj", &t) >= 0) | |||
119 | safe_atoi32(t, &n); | |||
120 | } | |||
121 | ||||
122 | return sd_bus_message_append(reply, "i", n); | |||
123 | } | |||
124 | ||||
125 | static int property_get_nice( | |||
126 | sd_bus *bus, | |||
127 | const char *path, | |||
128 | const char *interface, | |||
129 | const char *property, | |||
130 | sd_bus_message *reply, | |||
131 | void *userdata, | |||
132 | sd_bus_error *error) { | |||
133 | ||||
134 | ExecContext *c = userdata; | |||
135 | int32_t n; | |||
136 | ||||
137 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 137 , __PRETTY_FUNCTION__); } while (0); | |||
138 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 138 , __PRETTY_FUNCTION__); } while (0); | |||
139 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 139, __PRETTY_FUNCTION__); } while (0); | |||
140 | ||||
141 | if (c->nice_set) | |||
142 | n = c->nice; | |||
143 | else { | |||
144 | errno(*__errno_location ()) = 0; | |||
145 | n = getpriority(PRIO_PROCESSPRIO_PROCESS, 0); | |||
146 | if (errno(*__errno_location ()) > 0) | |||
147 | n = 0; | |||
148 | } | |||
149 | ||||
150 | return sd_bus_message_append(reply, "i", n); | |||
151 | } | |||
152 | ||||
153 | static int property_get_cpu_sched_policy( | |||
154 | sd_bus *bus, | |||
155 | const char *path, | |||
156 | const char *interface, | |||
157 | const char *property, | |||
158 | sd_bus_message *reply, | |||
159 | void *userdata, | |||
160 | sd_bus_error *error) { | |||
161 | ||||
162 | ExecContext *c = userdata; | |||
163 | int32_t n; | |||
164 | ||||
165 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 165 , __PRETTY_FUNCTION__); } while (0); | |||
166 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 166 , __PRETTY_FUNCTION__); } while (0); | |||
167 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 167, __PRETTY_FUNCTION__); } while (0); | |||
168 | ||||
169 | if (c->cpu_sched_set) | |||
170 | n = c->cpu_sched_policy; | |||
171 | else { | |||
172 | n = sched_getscheduler(0); | |||
173 | if (n < 0) | |||
174 | n = SCHED_OTHER0; | |||
175 | } | |||
176 | ||||
177 | return sd_bus_message_append(reply, "i", n); | |||
178 | } | |||
179 | ||||
180 | static int property_get_cpu_sched_priority( | |||
181 | sd_bus *bus, | |||
182 | const char *path, | |||
183 | const char *interface, | |||
184 | const char *property, | |||
185 | sd_bus_message *reply, | |||
186 | void *userdata, | |||
187 | sd_bus_error *error) { | |||
188 | ||||
189 | ExecContext *c = userdata; | |||
190 | int32_t n; | |||
191 | ||||
192 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 192 , __PRETTY_FUNCTION__); } while (0); | |||
193 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 193 , __PRETTY_FUNCTION__); } while (0); | |||
194 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 194, __PRETTY_FUNCTION__); } while (0); | |||
195 | ||||
196 | if (c->cpu_sched_set) | |||
197 | n = c->cpu_sched_priority; | |||
198 | else { | |||
199 | struct sched_param p = {}; | |||
200 | ||||
201 | if (sched_getparam(0, &p) >= 0) | |||
202 | n = p.sched_prioritysched_priority; | |||
203 | else | |||
204 | n = 0; | |||
205 | } | |||
206 | ||||
207 | return sd_bus_message_append(reply, "i", n); | |||
208 | } | |||
209 | ||||
210 | static int property_get_cpu_affinity( | |||
211 | sd_bus *bus, | |||
212 | const char *path, | |||
213 | const char *interface, | |||
214 | const char *property, | |||
215 | sd_bus_message *reply, | |||
216 | void *userdata, | |||
217 | sd_bus_error *error) { | |||
218 | ||||
219 | ExecContext *c = userdata; | |||
220 | _cleanup_(cpu_set_reset)__attribute__((cleanup(cpu_set_reset))) CPUSet s = {}; | |||
221 | _cleanup_free___attribute__((cleanup(freep))) uint8_t *array = NULL((void*)0); | |||
222 | size_t allocated; | |||
223 | ||||
224 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 224 , __PRETTY_FUNCTION__); } while (0); | |||
225 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 225 , __PRETTY_FUNCTION__); } while (0); | |||
226 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 226, __PRETTY_FUNCTION__); } while (0); | |||
227 | ||||
228 | if (c->cpu_affinity_from_numa) { | |||
229 | int r; | |||
230 | ||||
231 | r = numa_to_cpu_set(&c->numa_policy, &s); | |||
232 | if (r < 0) | |||
233 | return r; | |||
234 | } | |||
235 | ||||
236 | (void) cpu_set_to_dbus(c->cpu_affinity_from_numa ? &s : &c->cpu_set, &array, &allocated); | |||
237 | ||||
238 | return sd_bus_message_append_array(reply, 'y', array, allocated); | |||
239 | } | |||
240 | ||||
241 | static int property_get_numa_mask( | |||
242 | sd_bus *bus, | |||
243 | const char *path, | |||
244 | const char *interface, | |||
245 | const char *property, | |||
246 | sd_bus_message *reply, | |||
247 | void *userdata, | |||
248 | sd_bus_error *error) { | |||
249 | ||||
250 | ExecContext *c = userdata; | |||
251 | _cleanup_free___attribute__((cleanup(freep))) uint8_t *array = NULL((void*)0); | |||
252 | size_t allocated; | |||
253 | ||||
254 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 254 , __PRETTY_FUNCTION__); } while (0); | |||
255 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 255 , __PRETTY_FUNCTION__); } while (0); | |||
256 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 256, __PRETTY_FUNCTION__); } while (0); | |||
257 | ||||
258 | (void) cpu_set_to_dbus(&c->numa_policy.nodes, &array, &allocated); | |||
259 | ||||
260 | return sd_bus_message_append_array(reply, 'y', array, allocated); | |||
261 | } | |||
262 | ||||
263 | static int property_get_numa_policy( | |||
264 | sd_bus *bus, | |||
265 | const char *path, | |||
266 | const char *interface, | |||
267 | const char *property, | |||
268 | sd_bus_message *reply, | |||
269 | void *userdata, | |||
270 | sd_bus_error *error) { | |||
271 | ExecContext *c = userdata; | |||
272 | int32_t policy; | |||
273 | ||||
274 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 274 , __PRETTY_FUNCTION__); } while (0); | |||
275 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 275 , __PRETTY_FUNCTION__); } while (0); | |||
276 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 276, __PRETTY_FUNCTION__); } while (0); | |||
277 | ||||
278 | policy = numa_policy_get_type(&c->numa_policy); | |||
279 | ||||
280 | return sd_bus_message_append_basic(reply, 'i', &policy); | |||
281 | } | |||
282 | ||||
283 | static int property_get_timer_slack_nsec( | |||
284 | sd_bus *bus, | |||
285 | const char *path, | |||
286 | const char *interface, | |||
287 | const char *property, | |||
288 | sd_bus_message *reply, | |||
289 | void *userdata, | |||
290 | sd_bus_error *error) { | |||
291 | ||||
292 | ExecContext *c = userdata; | |||
293 | uint64_t u; | |||
294 | ||||
295 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 295 , __PRETTY_FUNCTION__); } while (0); | |||
296 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 296 , __PRETTY_FUNCTION__); } while (0); | |||
297 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 297, __PRETTY_FUNCTION__); } while (0); | |||
298 | ||||
299 | if (c->timer_slack_nsec != NSEC_INFINITY((nsec_t) -1)) | |||
300 | u = (uint64_t) c->timer_slack_nsec; | |||
301 | else | |||
302 | u = (uint64_t) prctl(PR_GET_TIMERSLACK30); | |||
303 | ||||
304 | return sd_bus_message_append(reply, "t", u); | |||
305 | } | |||
306 | ||||
307 | static int property_get_syscall_filter( | |||
308 | sd_bus *bus, | |||
309 | const char *path, | |||
310 | const char *interface, | |||
311 | const char *property, | |||
312 | sd_bus_message *reply, | |||
313 | void *userdata, | |||
314 | sd_bus_error *error) { | |||
315 | ||||
316 | ExecContext *c = userdata; | |||
317 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
318 | int r; | |||
319 | ||||
320 | #if HAVE_SECCOMP1 | |||
321 | Iterator i; | |||
322 | void *id, *val; | |||
323 | #endif | |||
324 | ||||
325 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 325 , __PRETTY_FUNCTION__); } while (0); | |||
326 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 326 , __PRETTY_FUNCTION__); } while (0); | |||
327 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 327, __PRETTY_FUNCTION__); } while (0); | |||
328 | ||||
329 | r = sd_bus_message_open_container(reply, 'r', "bas"); | |||
330 | if (r < 0) | |||
331 | return r; | |||
332 | ||||
333 | r = sd_bus_message_append(reply, "b", c->syscall_whitelist); | |||
334 | if (r < 0) | |||
335 | return r; | |||
336 | ||||
337 | #if HAVE_SECCOMP1 | |||
338 | HASHMAP_FOREACH_KEY(val, id, c->syscall_filter, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), . next_key = ((void*)0) }); hashmap_iterate((c->syscall_filter ), &(i), (void**)&(val), (const void**) &(id)); ) { | |||
339 | _cleanup_free___attribute__((cleanup(freep))) char *name = NULL((void*)0); | |||
340 | const char *e = NULL((void*)0); | |||
341 | char *s; | |||
342 | int num = PTR_TO_INT(val)((int) ((intptr_t) (val))); | |||
343 | ||||
344 | name = seccomp_syscall_resolve_num_arch(SCMP_ARCH_NATIVE0, PTR_TO_INT(id)((int) ((intptr_t) (id))) - 1); | |||
345 | if (!name) | |||
346 | continue; | |||
347 | ||||
348 | if (num >= 0) { | |||
349 | e = errno_to_name(num); | |||
350 | if (e) { | |||
351 | s = strjoin(name, ":", e)strjoin_real((name), ":", e, ((void*)0)); | |||
352 | if (!s) | |||
353 | return -ENOMEM12; | |||
354 | } else { | |||
355 | r = asprintf(&s, "%s:%d", name, num); | |||
356 | if (r < 0) | |||
357 | return -ENOMEM12; | |||
358 | } | |||
359 | } else | |||
360 | s = TAKE_PTR(name)({ typeof(name) _ptr_ = (name); (name) = ((void*)0); _ptr_; } ); | |||
361 | ||||
362 | r = strv_consume(&l, s); | |||
363 | if (r < 0) | |||
364 | return r; | |||
365 | } | |||
366 | #endif | |||
367 | ||||
368 | strv_sort(l); | |||
369 | ||||
370 | r = sd_bus_message_append_strv(reply, l); | |||
371 | if (r < 0) | |||
372 | return r; | |||
373 | ||||
374 | return sd_bus_message_close_container(reply); | |||
375 | } | |||
376 | ||||
377 | static int property_get_syscall_archs( | |||
378 | sd_bus *bus, | |||
379 | const char *path, | |||
380 | const char *interface, | |||
381 | const char *property, | |||
382 | sd_bus_message *reply, | |||
383 | void *userdata, | |||
384 | sd_bus_error *error) { | |||
385 | ||||
386 | ExecContext *c = userdata; | |||
387 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
388 | int r; | |||
389 | ||||
390 | #if HAVE_SECCOMP1 | |||
391 | Iterator i; | |||
392 | void *id; | |||
393 | #endif | |||
394 | ||||
395 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 395 , __PRETTY_FUNCTION__); } while (0); | |||
396 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 396 , __PRETTY_FUNCTION__); } while (0); | |||
397 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 397, __PRETTY_FUNCTION__); } while (0); | |||
398 | ||||
399 | #if HAVE_SECCOMP1 | |||
400 | SET_FOREACH(id, c->syscall_archs, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), . next_key = ((void*)0) }); set_iterate((c->syscall_archs), & (i), (void**)&(id)); ) { | |||
401 | const char *name; | |||
402 | ||||
403 | name = seccomp_arch_to_string(PTR_TO_UINT32(id)((uint32_t) ((uintptr_t) (id))) - 1); | |||
404 | if (!name) | |||
405 | continue; | |||
406 | ||||
407 | r = strv_extend(&l, name); | |||
408 | if (r < 0) | |||
409 | return -ENOMEM12; | |||
410 | } | |||
411 | #endif | |||
412 | ||||
413 | strv_sort(l); | |||
414 | ||||
415 | r = sd_bus_message_append_strv(reply, l); | |||
416 | if (r < 0) | |||
417 | return r; | |||
418 | ||||
419 | return 0; | |||
420 | } | |||
421 | ||||
422 | static int property_get_selinux_context( | |||
423 | sd_bus *bus, | |||
424 | const char *path, | |||
425 | const char *interface, | |||
426 | const char *property, | |||
427 | sd_bus_message *reply, | |||
428 | void *userdata, | |||
429 | sd_bus_error *error) { | |||
430 | ||||
431 | ExecContext *c = userdata; | |||
432 | ||||
433 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 433 , __PRETTY_FUNCTION__); } while (0); | |||
434 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 434 , __PRETTY_FUNCTION__); } while (0); | |||
435 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 435, __PRETTY_FUNCTION__); } while (0); | |||
436 | ||||
437 | return sd_bus_message_append(reply, "(bs)", c->selinux_context_ignore, c->selinux_context); | |||
438 | } | |||
439 | ||||
440 | static int property_get_apparmor_profile( | |||
441 | sd_bus *bus, | |||
442 | const char *path, | |||
443 | const char *interface, | |||
444 | const char *property, | |||
445 | sd_bus_message *reply, | |||
446 | void *userdata, | |||
447 | sd_bus_error *error) { | |||
448 | ||||
449 | ExecContext *c = userdata; | |||
450 | ||||
451 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 451 , __PRETTY_FUNCTION__); } while (0); | |||
452 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 452 , __PRETTY_FUNCTION__); } while (0); | |||
453 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 453, __PRETTY_FUNCTION__); } while (0); | |||
454 | ||||
455 | return sd_bus_message_append(reply, "(bs)", c->apparmor_profile_ignore, c->apparmor_profile); | |||
456 | } | |||
457 | ||||
458 | static int property_get_smack_process_label( | |||
459 | sd_bus *bus, | |||
460 | const char *path, | |||
461 | const char *interface, | |||
462 | const char *property, | |||
463 | sd_bus_message *reply, | |||
464 | void *userdata, | |||
465 | sd_bus_error *error) { | |||
466 | ||||
467 | ExecContext *c = userdata; | |||
468 | ||||
469 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 469 , __PRETTY_FUNCTION__); } while (0); | |||
470 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 470 , __PRETTY_FUNCTION__); } while (0); | |||
471 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 471, __PRETTY_FUNCTION__); } while (0); | |||
472 | ||||
473 | return sd_bus_message_append(reply, "(bs)", c->smack_process_label_ignore, c->smack_process_label); | |||
474 | } | |||
475 | ||||
476 | static int property_get_address_families( | |||
477 | sd_bus *bus, | |||
478 | const char *path, | |||
479 | const char *interface, | |||
480 | const char *property, | |||
481 | sd_bus_message *reply, | |||
482 | void *userdata, | |||
483 | sd_bus_error *error) { | |||
484 | ||||
485 | ExecContext *c = userdata; | |||
486 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
487 | Iterator i; | |||
488 | void *af; | |||
489 | int r; | |||
490 | ||||
491 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 491 , __PRETTY_FUNCTION__); } while (0); | |||
492 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 492 , __PRETTY_FUNCTION__); } while (0); | |||
493 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 493, __PRETTY_FUNCTION__); } while (0); | |||
494 | ||||
495 | r = sd_bus_message_open_container(reply, 'r', "bas"); | |||
496 | if (r < 0) | |||
497 | return r; | |||
498 | ||||
499 | r = sd_bus_message_append(reply, "b", c->address_families_whitelist); | |||
500 | if (r < 0) | |||
501 | return r; | |||
502 | ||||
503 | SET_FOREACH(af, c->address_families, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), . next_key = ((void*)0) }); set_iterate((c->address_families ), &(i), (void**)&(af)); ) { | |||
504 | const char *name; | |||
505 | ||||
506 | name = af_to_name(PTR_TO_INT(af)((int) ((intptr_t) (af)))); | |||
507 | if (!name) | |||
508 | continue; | |||
509 | ||||
510 | r = strv_extend(&l, name); | |||
511 | if (r < 0) | |||
512 | return -ENOMEM12; | |||
513 | } | |||
514 | ||||
515 | strv_sort(l); | |||
516 | ||||
517 | r = sd_bus_message_append_strv(reply, l); | |||
518 | if (r < 0) | |||
519 | return r; | |||
520 | ||||
521 | return sd_bus_message_close_container(reply); | |||
522 | } | |||
523 | ||||
524 | static int property_get_working_directory( | |||
525 | sd_bus *bus, | |||
526 | const char *path, | |||
527 | const char *interface, | |||
528 | const char *property, | |||
529 | sd_bus_message *reply, | |||
530 | void *userdata, | |||
531 | sd_bus_error *error) { | |||
532 | ||||
533 | ExecContext *c = userdata; | |||
534 | const char *wd; | |||
535 | ||||
536 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 536 , __PRETTY_FUNCTION__); } while (0); | |||
537 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 537 , __PRETTY_FUNCTION__); } while (0); | |||
538 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 538, __PRETTY_FUNCTION__); } while (0); | |||
539 | ||||
540 | if (c->working_directory_home) | |||
541 | wd = "~"; | |||
542 | else | |||
543 | wd = c->working_directory; | |||
544 | ||||
545 | if (c->working_directory_missing_ok) | |||
546 | wd = strjoina("!", wd)({ const char *_appendees_[] = { "!", wd }; char *_d_, *_p_; size_t _len_ = 0; size_t _i_; for (_i_ = 0; _i_ < __extension__ ( __builtin_choose_expr( !__builtin_types_compatible_p(typeof(_appendees_ ), typeof(&*(_appendees_))), sizeof(_appendees_)/sizeof(( _appendees_)[0]), ((void)0))) && _appendees_[_i_]; _i_ ++) _len_ += strlen(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1); for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr ( !__builtin_types_compatible_p(typeof(_appendees_), typeof(& *(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0] ), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy (_p_, _appendees_[_i_]); *_p_ = 0; _d_; }); | |||
547 | ||||
548 | return sd_bus_message_append(reply, "s", wd); | |||
549 | } | |||
550 | ||||
551 | static int property_get_stdio_fdname( | |||
552 | sd_bus *bus, | |||
553 | const char *path, | |||
554 | const char *interface, | |||
555 | const char *property, | |||
556 | sd_bus_message *reply, | |||
557 | void *userdata, | |||
558 | sd_bus_error *error) { | |||
559 | ||||
560 | ExecContext *c = userdata; | |||
561 | int fileno; | |||
562 | ||||
563 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 563 , __PRETTY_FUNCTION__); } while (0); | |||
564 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 564, __PRETTY_FUNCTION__); } while (0); | |||
565 | assert(property)do { if ((__builtin_expect(!!(!(property)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("property"), "../src/core/dbus-execute.c" , 565, __PRETTY_FUNCTION__); } while (0); | |||
566 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 566 , __PRETTY_FUNCTION__); } while (0); | |||
567 | ||||
568 | if (streq(property, "StandardInputFileDescriptorName")(strcmp((property),("StandardInputFileDescriptorName")) == 0)) | |||
569 | fileno = STDIN_FILENO0; | |||
570 | else if (streq(property, "StandardOutputFileDescriptorName")(strcmp((property),("StandardOutputFileDescriptorName")) == 0 )) | |||
571 | fileno = STDOUT_FILENO1; | |||
572 | else { | |||
573 | assert(streq(property, "StandardErrorFileDescriptorName"))do { if ((__builtin_expect(!!(!((strcmp((property),("StandardErrorFileDescriptorName" )) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(property, \"StandardErrorFileDescriptorName\")" ), "../src/core/dbus-execute.c", 573, __PRETTY_FUNCTION__); } while (0); | |||
574 | fileno = STDERR_FILENO2; | |||
575 | } | |||
576 | ||||
577 | return sd_bus_message_append(reply, "s", exec_context_fdname(c, fileno)); | |||
578 | } | |||
579 | ||||
580 | static int property_get_input_data( | |||
581 | sd_bus *bus, | |||
582 | const char *path, | |||
583 | const char *interface, | |||
584 | const char *property, | |||
585 | sd_bus_message *reply, | |||
586 | void *userdata, | |||
587 | sd_bus_error *error) { | |||
588 | ||||
589 | ExecContext *c = userdata; | |||
590 | ||||
591 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 591 , __PRETTY_FUNCTION__); } while (0); | |||
592 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 592, __PRETTY_FUNCTION__); } while (0); | |||
593 | assert(property)do { if ((__builtin_expect(!!(!(property)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("property"), "../src/core/dbus-execute.c" , 593, __PRETTY_FUNCTION__); } while (0); | |||
594 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 594 , __PRETTY_FUNCTION__); } while (0); | |||
595 | ||||
596 | return sd_bus_message_append_array(reply, 'y', c->stdin_data, c->stdin_data_size); | |||
597 | } | |||
598 | ||||
599 | static int property_get_bind_paths( | |||
600 | sd_bus *bus, | |||
601 | const char *path, | |||
602 | const char *interface, | |||
603 | const char *property, | |||
604 | sd_bus_message *reply, | |||
605 | void *userdata, | |||
606 | sd_bus_error *error) { | |||
607 | ||||
608 | ExecContext *c = userdata; | |||
609 | unsigned i; | |||
610 | bool_Bool ro; | |||
611 | int r; | |||
612 | ||||
613 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 613 , __PRETTY_FUNCTION__); } while (0); | |||
614 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 614, __PRETTY_FUNCTION__); } while (0); | |||
615 | assert(property)do { if ((__builtin_expect(!!(!(property)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("property"), "../src/core/dbus-execute.c" , 615, __PRETTY_FUNCTION__); } while (0); | |||
616 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 616 , __PRETTY_FUNCTION__); } while (0); | |||
617 | ||||
618 | ro = strstr(property, "ReadOnly"); | |||
619 | ||||
620 | r = sd_bus_message_open_container(reply, 'a', "(ssbt)"); | |||
621 | if (r < 0) | |||
622 | return r; | |||
623 | ||||
624 | for (i = 0; i < c->n_bind_mounts; i++) { | |||
625 | ||||
626 | if (ro != c->bind_mounts[i].read_only) | |||
627 | continue; | |||
628 | ||||
629 | r = sd_bus_message_append( | |||
630 | reply, "(ssbt)", | |||
631 | c->bind_mounts[i].source, | |||
632 | c->bind_mounts[i].destination, | |||
633 | c->bind_mounts[i].ignore_enoent, | |||
634 | c->bind_mounts[i].recursive ? (uint64_t) MS_RECMS_REC : (uint64_t) 0); | |||
635 | if (r < 0) | |||
636 | return r; | |||
637 | } | |||
638 | ||||
639 | return sd_bus_message_close_container(reply); | |||
640 | } | |||
641 | ||||
642 | static int property_get_temporary_filesystems( | |||
643 | sd_bus *bus, | |||
644 | const char *path, | |||
645 | const char *interface, | |||
646 | const char *property, | |||
647 | sd_bus_message *reply, | |||
648 | void *userdata, | |||
649 | sd_bus_error *error) { | |||
650 | ||||
651 | ExecContext *c = userdata; | |||
652 | unsigned i; | |||
653 | int r; | |||
654 | ||||
655 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 655 , __PRETTY_FUNCTION__); } while (0); | |||
656 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 656, __PRETTY_FUNCTION__); } while (0); | |||
657 | assert(property)do { if ((__builtin_expect(!!(!(property)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("property"), "../src/core/dbus-execute.c" , 657, __PRETTY_FUNCTION__); } while (0); | |||
658 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 658 , __PRETTY_FUNCTION__); } while (0); | |||
659 | ||||
660 | r = sd_bus_message_open_container(reply, 'a', "(ss)"); | |||
661 | if (r < 0) | |||
662 | return r; | |||
663 | ||||
664 | for (i = 0; i < c->n_temporary_filesystems; i++) { | |||
665 | TemporaryFileSystem *t = c->temporary_filesystems + i; | |||
666 | ||||
667 | r = sd_bus_message_append( | |||
668 | reply, "(ss)", | |||
669 | t->path, | |||
670 | t->options); | |||
671 | if (r < 0) | |||
672 | return r; | |||
673 | } | |||
674 | ||||
675 | return sd_bus_message_close_container(reply); | |||
676 | } | |||
677 | ||||
678 | static int property_get_log_extra_fields( | |||
679 | sd_bus *bus, | |||
680 | const char *path, | |||
681 | const char *interface, | |||
682 | const char *property, | |||
683 | sd_bus_message *reply, | |||
684 | void *userdata, | |||
685 | sd_bus_error *error) { | |||
686 | ||||
687 | ExecContext *c = userdata; | |||
688 | size_t i; | |||
689 | int r; | |||
690 | ||||
691 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 691 , __PRETTY_FUNCTION__); } while (0); | |||
692 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 692, __PRETTY_FUNCTION__); } while (0); | |||
693 | assert(property)do { if ((__builtin_expect(!!(!(property)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("property"), "../src/core/dbus-execute.c" , 693, __PRETTY_FUNCTION__); } while (0); | |||
694 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 694 , __PRETTY_FUNCTION__); } while (0); | |||
695 | ||||
696 | r = sd_bus_message_open_container(reply, 'a', "ay"); | |||
697 | if (r < 0) | |||
698 | return r; | |||
699 | ||||
700 | for (i = 0; i < c->n_log_extra_fields; i++) { | |||
701 | r = sd_bus_message_append_array(reply, 'y', c->log_extra_fields[i].iov_base, c->log_extra_fields[i].iov_len); | |||
702 | if (r < 0) | |||
703 | return r; | |||
704 | } | |||
705 | ||||
706 | return sd_bus_message_close_container(reply); | |||
707 | } | |||
708 | ||||
709 | const sd_bus_vtable bus_exec_vtable[] = { | |||
710 | SD_BUS_VTABLE_START(0){ .type = _SD_BUS_VTABLE_START, .flags = 0, .x = { .start = { .element_size = sizeof(sd_bus_vtable) }, }, }, | |||
711 | SD_BUS_PROPERTY("Environment", "as", NULL, offsetof(ExecContext, environment), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "Environment", .signature = "as" , .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, environment), }, }, }, | |||
712 | SD_BUS_PROPERTY("EnvironmentFiles", "a(sb)", property_get_environment_files, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "EnvironmentFiles", .signature = "a(sb)", .get = property_get_environment_files, .set = ((void *)0), .offset = 0, }, }, }, | |||
713 | SD_BUS_PROPERTY("PassEnvironment", "as", NULL, offsetof(ExecContext, pass_environment), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "PassEnvironment", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, pass_environment), }, }, }, | |||
714 | SD_BUS_PROPERTY("UnsetEnvironment", "as", NULL, offsetof(ExecContext, unset_environment), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "UnsetEnvironment", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, unset_environment), }, }, }, | |||
715 | SD_BUS_PROPERTY("UMask", "u", bus_property_get_mode, offsetof(ExecContext, umask), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "UMask", .signature = "u", . get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0) , .offset = __builtin_offsetof(ExecContext, umask), }, }, }, | |||
716 | SD_BUS_PROPERTY("LimitCPU", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_CPU]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitCPU", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_CPU]), }, }, }, | |||
717 | SD_BUS_PROPERTY("LimitCPUSoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_CPU]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitCPUSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_CPU]), }, }, }, | |||
718 | SD_BUS_PROPERTY("LimitFSIZE", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_FSIZE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitFSIZE", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_FSIZE]), }, }, }, | |||
719 | SD_BUS_PROPERTY("LimitFSIZESoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_FSIZE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitFSIZESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_FSIZE]), }, } , }, | |||
720 | SD_BUS_PROPERTY("LimitDATA", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_DATA]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitDATA", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_DATA]), }, }, }, | |||
721 | SD_BUS_PROPERTY("LimitDATASoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_DATA]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitDATASoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_DATA]), }, } , }, | |||
722 | SD_BUS_PROPERTY("LimitSTACK", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_STACK]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitSTACK", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_STACK]), }, }, }, | |||
723 | SD_BUS_PROPERTY("LimitSTACKSoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_STACK]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitSTACKSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_STACK]), }, } , }, | |||
724 | SD_BUS_PROPERTY("LimitCORE", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_CORE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitCORE", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_CORE]), }, }, }, | |||
725 | SD_BUS_PROPERTY("LimitCORESoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_CORE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitCORESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_CORE]), }, } , }, | |||
726 | SD_BUS_PROPERTY("LimitRSS", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RSS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitRSS", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_RSS]), }, }, }, | |||
727 | SD_BUS_PROPERTY("LimitRSSSoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RSS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitRSSSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_RSS]), }, } , }, | |||
728 | SD_BUS_PROPERTY("LimitNOFILE", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NOFILE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitNOFILE", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_NOFILE]), }, } , }, | |||
729 | SD_BUS_PROPERTY("LimitNOFILESoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NOFILE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitNOFILESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_NOFILE]), }, }, }, | |||
730 | SD_BUS_PROPERTY("LimitAS", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_AS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitAS", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_AS]), }, }, }, | |||
731 | SD_BUS_PROPERTY("LimitASSoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_AS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitASSoft", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[RLIMIT_AS]), }, }, }, | |||
732 | SD_BUS_PROPERTY("LimitNPROC", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NPROC]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitNPROC", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_NPROC]), }, } , }, | |||
733 | SD_BUS_PROPERTY("LimitNPROCSoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NPROC]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitNPROCSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_NPROC]), } , }, }, | |||
734 | SD_BUS_PROPERTY("LimitMEMLOCK", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_MEMLOCK]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitMEMLOCK", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_MEMLOCK]), }, }, }, | |||
735 | SD_BUS_PROPERTY("LimitMEMLOCKSoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_MEMLOCK]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitMEMLOCKSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_MEMLOCK]), }, }, }, | |||
736 | SD_BUS_PROPERTY("LimitLOCKS", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_LOCKS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitLOCKS", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_LOCKS]), }, } , }, | |||
737 | SD_BUS_PROPERTY("LimitLOCKSSoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_LOCKS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitLOCKSSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_LOCKS]), } , }, }, | |||
738 | SD_BUS_PROPERTY("LimitSIGPENDING", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_SIGPENDING]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitSIGPENDING", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_SIGPENDING ]), }, }, }, | |||
739 | SD_BUS_PROPERTY("LimitSIGPENDINGSoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_SIGPENDING]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitSIGPENDINGSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_SIGPENDING ]), }, }, }, | |||
740 | SD_BUS_PROPERTY("LimitMSGQUEUE", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_MSGQUEUE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitMSGQUEUE", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_MSGQUEUE]) , }, }, }, | |||
741 | SD_BUS_PROPERTY("LimitMSGQUEUESoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_MSGQUEUE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitMSGQUEUESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_MSGQUEUE]) , }, }, }, | |||
742 | SD_BUS_PROPERTY("LimitNICE", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NICE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitNICE", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_NICE]), }, } , }, | |||
743 | SD_BUS_PROPERTY("LimitNICESoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NICE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitNICESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_NICE]), }, }, }, | |||
744 | SD_BUS_PROPERTY("LimitRTPRIO", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RTPRIO]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitRTPRIO", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_RTPRIO]), }, }, }, | |||
745 | SD_BUS_PROPERTY("LimitRTPRIOSoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RTPRIO]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitRTPRIOSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_RTPRIO]), } , }, }, | |||
746 | SD_BUS_PROPERTY("LimitRTTIME", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RTTIME]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitRTTIME", .signature = "t" , .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_RTTIME]), }, }, }, | |||
747 | SD_BUS_PROPERTY("LimitRTTIMESoft", "t", bus_property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RTTIME]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LimitRTTIMESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, rlimit[__RLIMIT_RTTIME]), } , }, }, | |||
748 | SD_BUS_PROPERTY("WorkingDirectory", "s", property_get_working_directory, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "WorkingDirectory", .signature = "s", .get = property_get_working_directory, .set = ((void* )0), .offset = 0, }, }, }, | |||
749 | SD_BUS_PROPERTY("RootDirectory", "s", NULL, offsetof(ExecContext, root_directory), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RootDirectory", .signature = "s", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, root_directory), }, }, }, | |||
750 | SD_BUS_PROPERTY("RootImage", "s", NULL, offsetof(ExecContext, root_image), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RootImage", .signature = "s" , .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, root_image), }, }, }, | |||
751 | SD_BUS_PROPERTY("OOMScoreAdjust", "i", property_get_oom_score_adjust, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "OOMScoreAdjust", .signature = "i", .get = property_get_oom_score_adjust, .set = ((void*) 0), .offset = 0, }, }, }, | |||
752 | SD_BUS_PROPERTY("Nice", "i", property_get_nice, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "Nice", .signature = "i", .get = property_get_nice, .set = ((void*)0), .offset = 0, }, }, }, | |||
753 | SD_BUS_PROPERTY("IOSchedulingClass", "i", property_get_ioprio_class, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "IOSchedulingClass", .signature = "i", .get = property_get_ioprio_class, .set = ((void*)0), . offset = 0, }, }, }, | |||
754 | SD_BUS_PROPERTY("IOSchedulingPriority", "i", property_get_ioprio_priority, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "IOSchedulingPriority", .signature = "i", .get = property_get_ioprio_priority, .set = ((void*)0 ), .offset = 0, }, }, }, | |||
755 | SD_BUS_PROPERTY("CPUSchedulingPolicy", "i", property_get_cpu_sched_policy, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "CPUSchedulingPolicy", .signature = "i", .get = property_get_cpu_sched_policy, .set = ((void*) 0), .offset = 0, }, }, }, | |||
756 | SD_BUS_PROPERTY("CPUSchedulingPriority", "i", property_get_cpu_sched_priority, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "CPUSchedulingPriority", .signature = "i", .get = property_get_cpu_sched_priority, .set = ((void *)0), .offset = 0, }, }, }, | |||
757 | SD_BUS_PROPERTY("CPUAffinity", "ay", property_get_cpu_affinity, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "CPUAffinity", .signature = "ay" , .get = property_get_cpu_affinity, .set = ((void*)0), .offset = 0, }, }, }, | |||
758 | SD_BUS_PROPERTY("CPUAffinityFromNUMA", "b", property_get_cpu_affinity_from_numa, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "CPUAffinityFromNUMA", .signature = "b", .get = property_get_cpu_affinity_from_numa, .set = (( void*)0), .offset = 0, }, }, }, | |||
759 | SD_BUS_PROPERTY("NUMAPolicy", "i", property_get_numa_policy, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "NUMAPolicy", .signature = "i" , .get = property_get_numa_policy, .set = ((void*)0), .offset = 0, }, }, }, | |||
760 | SD_BUS_PROPERTY("NUMAMask", "ay", property_get_numa_mask, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "NUMAMask", .signature = "ay" , .get = property_get_numa_mask, .set = ((void*)0), .offset = 0, }, }, }, | |||
761 | SD_BUS_PROPERTY("TimerSlackNSec", "t", property_get_timer_slack_nsec, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "TimerSlackNSec", .signature = "t", .get = property_get_timer_slack_nsec, .set = ((void*) 0), .offset = 0, }, }, }, | |||
762 | SD_BUS_PROPERTY("CPUSchedulingResetOnFork", "b", bus_property_get_bool, offsetof(ExecContext, cpu_sched_reset_on_fork), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "CPUSchedulingResetOnFork", . signature = "b", .get = bus_property_get_bool, .set = ((void* )0), .offset = __builtin_offsetof(ExecContext, cpu_sched_reset_on_fork ), }, }, }, | |||
763 | SD_BUS_PROPERTY("NonBlocking", "b", bus_property_get_bool, offsetof(ExecContext, non_blocking), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "NonBlocking", .signature = "b" , .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, non_blocking), }, }, }, | |||
764 | SD_BUS_PROPERTY("StandardInput", "s", property_get_exec_input, offsetof(ExecContext, std_input), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "StandardInput", .signature = "s", .get = property_get_exec_input, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, std_input), }, }, }, | |||
765 | SD_BUS_PROPERTY("StandardInputFileDescriptorName", "s", property_get_stdio_fdname, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "StandardInputFileDescriptorName" , .signature = "s", .get = property_get_stdio_fdname, .set = ( (void*)0), .offset = 0, }, }, }, | |||
766 | SD_BUS_PROPERTY("StandardInputData", "ay", property_get_input_data, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "StandardInputData", .signature = "ay", .get = property_get_input_data, .set = ((void*)0), . offset = 0, }, }, }, | |||
767 | SD_BUS_PROPERTY("StandardOutput", "s", bus_property_get_exec_output, offsetof(ExecContext, std_output), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "StandardOutput", .signature = "s", .get = bus_property_get_exec_output, .set = ((void*)0 ), .offset = __builtin_offsetof(ExecContext, std_output), }, } , }, | |||
768 | SD_BUS_PROPERTY("StandardOutputFileDescriptorName", "s", property_get_stdio_fdname, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "StandardOutputFileDescriptorName" , .signature = "s", .get = property_get_stdio_fdname, .set = ( (void*)0), .offset = 0, }, }, }, | |||
769 | SD_BUS_PROPERTY("StandardError", "s", bus_property_get_exec_output, offsetof(ExecContext, std_error), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "StandardError", .signature = "s", .get = bus_property_get_exec_output, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, std_error), }, }, }, | |||
770 | SD_BUS_PROPERTY("StandardErrorFileDescriptorName", "s", property_get_stdio_fdname, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "StandardErrorFileDescriptorName" , .signature = "s", .get = property_get_stdio_fdname, .set = ( (void*)0), .offset = 0, }, }, }, | |||
771 | SD_BUS_PROPERTY("TTYPath", "s", NULL, offsetof(ExecContext, tty_path), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "TTYPath", .signature = "s", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, tty_path), }, }, }, | |||
772 | SD_BUS_PROPERTY("TTYReset", "b", bus_property_get_bool, offsetof(ExecContext, tty_reset), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "TTYReset", .signature = "b" , .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, tty_reset), }, }, }, | |||
773 | SD_BUS_PROPERTY("TTYVHangup", "b", bus_property_get_bool, offsetof(ExecContext, tty_vhangup), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "TTYVHangup", .signature = "b" , .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, tty_vhangup), }, }, }, | |||
774 | SD_BUS_PROPERTY("TTYVTDisallocate", "b", bus_property_get_bool, offsetof(ExecContext, tty_vt_disallocate), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "TTYVTDisallocate", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, tty_vt_disallocate), }, }, }, | |||
775 | SD_BUS_PROPERTY("SyslogPriority", "i", bus_property_get_int, offsetof(ExecContext, syslog_priority), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SyslogPriority", .signature = "i", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(ExecContext, syslog_priority ), }, }, }, | |||
776 | SD_BUS_PROPERTY("SyslogIdentifier", "s", NULL, offsetof(ExecContext, syslog_identifier), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SyslogIdentifier", .signature = "s", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, syslog_identifier), }, }, }, | |||
777 | SD_BUS_PROPERTY("SyslogLevelPrefix", "b", bus_property_get_bool, offsetof(ExecContext, syslog_level_prefix), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SyslogLevelPrefix", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, syslog_level_prefix), }, } , }, | |||
778 | SD_BUS_PROPERTY("SyslogLevel", "i", property_get_syslog_level, offsetof(ExecContext, syslog_priority), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SyslogLevel", .signature = "i" , .get = property_get_syslog_level, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, syslog_priority), }, }, }, | |||
779 | SD_BUS_PROPERTY("SyslogFacility", "i", property_get_syslog_facility, offsetof(ExecContext, syslog_priority), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SyslogFacility", .signature = "i", .get = property_get_syslog_facility, .set = ((void*)0 ), .offset = __builtin_offsetof(ExecContext, syslog_priority) , }, }, }, | |||
780 | SD_BUS_PROPERTY("LogLevelMax", "i", bus_property_get_int, offsetof(ExecContext, log_level_max), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LogLevelMax", .signature = "i" , .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void* )0), .offset = __builtin_offsetof(ExecContext, log_level_max) , }, }, }, | |||
781 | SD_BUS_PROPERTY("LogRateLimitIntervalUSec", "t", bus_property_get_usec, offsetof(ExecContext, log_rate_limit_interval_usec), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LogRateLimitIntervalUSec", . signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, log_rate_limit_interval_usec), }, }, }, | |||
782 | SD_BUS_PROPERTY("LogRateLimitBurst", "u", bus_property_get_unsigned, offsetof(ExecContext, log_rate_limit_burst), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LogRateLimitBurst", .signature = "u", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(ExecContext, log_rate_limit_burst ), }, }, }, | |||
783 | SD_BUS_PROPERTY("LogExtraFields", "aay", property_get_log_extra_fields, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LogExtraFields", .signature = "aay", .get = property_get_log_extra_fields, .set = ((void *)0), .offset = 0, }, }, }, | |||
784 | SD_BUS_PROPERTY("SecureBits", "i", bus_property_get_int, offsetof(ExecContext, secure_bits), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SecureBits", .signature = "i" , .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void* )0), .offset = __builtin_offsetof(ExecContext, secure_bits), } , }, }, | |||
785 | SD_BUS_PROPERTY("CapabilityBoundingSet", "t", NULL, offsetof(ExecContext, capability_bounding_set), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "CapabilityBoundingSet", .signature = "t", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, capability_bounding_set), }, }, }, | |||
786 | SD_BUS_PROPERTY("AmbientCapabilities", "t", NULL, offsetof(ExecContext, capability_ambient_set), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "AmbientCapabilities", .signature = "t", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, capability_ambient_set), }, }, }, | |||
787 | SD_BUS_PROPERTY("User", "s", NULL, offsetof(ExecContext, user), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "User", .signature = "s", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, user), }, }, }, | |||
788 | SD_BUS_PROPERTY("Group", "s", NULL, offsetof(ExecContext, group), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "Group", .signature = "s", . get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, group), }, }, }, | |||
789 | SD_BUS_PROPERTY("DynamicUser", "b", bus_property_get_bool, offsetof(ExecContext, dynamic_user), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DynamicUser", .signature = "b" , .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, dynamic_user), }, }, }, | |||
790 | SD_BUS_PROPERTY("RemoveIPC", "b", bus_property_get_bool, offsetof(ExecContext, remove_ipc), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RemoveIPC", .signature = "b" , .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, remove_ipc), }, }, }, | |||
791 | SD_BUS_PROPERTY("SupplementaryGroups", "as", NULL, offsetof(ExecContext, supplementary_groups), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SupplementaryGroups", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, supplementary_groups), }, }, }, | |||
792 | SD_BUS_PROPERTY("PAMName", "s", NULL, offsetof(ExecContext, pam_name), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "PAMName", .signature = "s", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, pam_name), }, }, }, | |||
793 | SD_BUS_PROPERTY("ReadWritePaths", "as", NULL, offsetof(ExecContext, read_write_paths), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ReadWritePaths", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, read_write_paths), }, }, }, | |||
794 | SD_BUS_PROPERTY("ReadOnlyPaths", "as", NULL, offsetof(ExecContext, read_only_paths), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ReadOnlyPaths", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, read_only_paths), }, }, }, | |||
795 | SD_BUS_PROPERTY("InaccessiblePaths", "as", NULL, offsetof(ExecContext, inaccessible_paths), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "InaccessiblePaths", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, inaccessible_paths), }, }, }, | |||
796 | SD_BUS_PROPERTY("MountFlags", "t", bus_property_get_ulong, offsetof(ExecContext, mount_flags), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "MountFlags", .signature = "t" , .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void* )0), .offset = __builtin_offsetof(ExecContext, mount_flags), } , }, }, | |||
797 | SD_BUS_PROPERTY("PrivateTmp", "b", bus_property_get_bool, offsetof(ExecContext, private_tmp), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "PrivateTmp", .signature = "b" , .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, private_tmp), }, }, }, | |||
798 | SD_BUS_PROPERTY("PrivateDevices", "b", bus_property_get_bool, offsetof(ExecContext, private_devices), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "PrivateDevices", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, private_devices), }, }, }, | |||
799 | SD_BUS_PROPERTY("ProtectKernelTunables", "b", bus_property_get_bool, offsetof(ExecContext, protect_kernel_tunables), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ProtectKernelTunables", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, protect_kernel_tunables), } , }, }, | |||
800 | SD_BUS_PROPERTY("ProtectKernelModules", "b", bus_property_get_bool, offsetof(ExecContext, protect_kernel_modules), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ProtectKernelModules", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, protect_kernel_modules), } , }, }, | |||
801 | SD_BUS_PROPERTY("ProtectControlGroups", "b", bus_property_get_bool, offsetof(ExecContext, protect_control_groups), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ProtectControlGroups", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, protect_control_groups), } , }, }, | |||
802 | SD_BUS_PROPERTY("PrivateNetwork", "b", bus_property_get_bool, offsetof(ExecContext, private_network), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "PrivateNetwork", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, private_network), }, }, }, | |||
803 | SD_BUS_PROPERTY("PrivateUsers", "b", bus_property_get_bool, offsetof(ExecContext, private_users), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "PrivateUsers", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, private_users), }, }, }, | |||
804 | SD_BUS_PROPERTY("PrivateMounts", "b", bus_property_get_bool, offsetof(ExecContext, private_mounts), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "PrivateMounts", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, private_mounts), }, }, }, | |||
805 | SD_BUS_PROPERTY("ProtectHome", "s", property_get_protect_home, offsetof(ExecContext, protect_home), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ProtectHome", .signature = "s" , .get = property_get_protect_home, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, protect_home), }, }, }, | |||
806 | SD_BUS_PROPERTY("ProtectSystem", "s", property_get_protect_system, offsetof(ExecContext, protect_system), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ProtectSystem", .signature = "s", .get = property_get_protect_system, .set = ((void*)0), . offset = __builtin_offsetof(ExecContext, protect_system), }, } , }, | |||
807 | SD_BUS_PROPERTY("SameProcessGroup", "b", bus_property_get_bool, offsetof(ExecContext, same_pgrp), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SameProcessGroup", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, same_pgrp), }, }, }, | |||
808 | SD_BUS_PROPERTY("UtmpIdentifier", "s", NULL, offsetof(ExecContext, utmp_id), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "UtmpIdentifier", .signature = "s", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, utmp_id), }, }, }, | |||
809 | SD_BUS_PROPERTY("UtmpMode", "s", property_get_exec_utmp_mode, offsetof(ExecContext, utmp_mode), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "UtmpMode", .signature = "s" , .get = property_get_exec_utmp_mode, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, utmp_mode), }, }, }, | |||
810 | SD_BUS_PROPERTY("SELinuxContext", "(bs)", property_get_selinux_context, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SELinuxContext", .signature = "(bs)", .get = property_get_selinux_context, .set = ((void *)0), .offset = 0, }, }, }, | |||
811 | SD_BUS_PROPERTY("AppArmorProfile", "(bs)", property_get_apparmor_profile, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "AppArmorProfile", .signature = "(bs)", .get = property_get_apparmor_profile, .set = ((void *)0), .offset = 0, }, }, }, | |||
812 | SD_BUS_PROPERTY("SmackProcessLabel", "(bs)", property_get_smack_process_label, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SmackProcessLabel", .signature = "(bs)", .get = property_get_smack_process_label, .set = (( void*)0), .offset = 0, }, }, }, | |||
813 | SD_BUS_PROPERTY("IgnoreSIGPIPE", "b", bus_property_get_bool, offsetof(ExecContext, ignore_sigpipe), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "IgnoreSIGPIPE", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, ignore_sigpipe), }, }, }, | |||
814 | SD_BUS_PROPERTY("NoNewPrivileges", "b", bus_property_get_bool, offsetof(ExecContext, no_new_privileges), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "NoNewPrivileges", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, no_new_privileges), }, }, }, | |||
815 | SD_BUS_PROPERTY("SystemCallFilter", "(bas)", property_get_syscall_filter, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SystemCallFilter", .signature = "(bas)", .get = property_get_syscall_filter, .set = ((void *)0), .offset = 0, }, }, }, | |||
816 | SD_BUS_PROPERTY("SystemCallArchitectures", "as", property_get_syscall_archs, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SystemCallArchitectures", . signature = "as", .get = property_get_syscall_archs, .set = ( (void*)0), .offset = 0, }, }, }, | |||
817 | SD_BUS_PROPERTY("SystemCallErrorNumber", "i", bus_property_get_int, offsetof(ExecContext, syscall_errno), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "SystemCallErrorNumber", .signature = "i", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(ExecContext, syscall_errno ), }, }, }, | |||
818 | SD_BUS_PROPERTY("Personality", "s", property_get_personality, offsetof(ExecContext, personality), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "Personality", .signature = "s" , .get = property_get_personality, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, personality), }, }, }, | |||
819 | SD_BUS_PROPERTY("LockPersonality", "b", bus_property_get_bool, offsetof(ExecContext, lock_personality), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LockPersonality", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, lock_personality), }, }, }, | |||
820 | SD_BUS_PROPERTY("RestrictAddressFamilies", "(bas)", property_get_address_families, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RestrictAddressFamilies", . signature = "(bas)", .get = property_get_address_families, .set = ((void*)0), .offset = 0, }, }, }, | |||
821 | SD_BUS_PROPERTY("RuntimeDirectoryPreserve", "s", property_get_exec_preserve_mode, offsetof(ExecContext, runtime_directory_preserve_mode), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RuntimeDirectoryPreserve", . signature = "s", .get = property_get_exec_preserve_mode, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, runtime_directory_preserve_mode ), }, }, }, | |||
822 | SD_BUS_PROPERTY("RuntimeDirectoryMode", "u", bus_property_get_mode, offsetof(ExecContext, directories[EXEC_DIRECTORY_RUNTIME].mode), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RuntimeDirectoryMode", .signature = "u", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(ExecContext, directories [EXEC_DIRECTORY_RUNTIME].mode), }, }, }, | |||
823 | SD_BUS_PROPERTY("RuntimeDirectory", "as", NULL, offsetof(ExecContext, directories[EXEC_DIRECTORY_RUNTIME].paths), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RuntimeDirectory", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, directories[EXEC_DIRECTORY_RUNTIME].paths), }, } , }, | |||
824 | SD_BUS_PROPERTY("StateDirectoryMode", "u", bus_property_get_mode, offsetof(ExecContext, directories[EXEC_DIRECTORY_STATE].mode), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "StateDirectoryMode", .signature = "u", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(ExecContext, directories [EXEC_DIRECTORY_STATE].mode), }, }, }, | |||
825 | SD_BUS_PROPERTY("StateDirectory", "as", NULL, offsetof(ExecContext, directories[EXEC_DIRECTORY_STATE].paths), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "StateDirectory", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, directories[EXEC_DIRECTORY_STATE].paths), }, }, }, | |||
826 | SD_BUS_PROPERTY("CacheDirectoryMode", "u", bus_property_get_mode, offsetof(ExecContext, directories[EXEC_DIRECTORY_CACHE].mode), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "CacheDirectoryMode", .signature = "u", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(ExecContext, directories [EXEC_DIRECTORY_CACHE].mode), }, }, }, | |||
827 | SD_BUS_PROPERTY("CacheDirectory", "as", NULL, offsetof(ExecContext, directories[EXEC_DIRECTORY_CACHE].paths), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "CacheDirectory", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, directories[EXEC_DIRECTORY_CACHE].paths), }, }, }, | |||
828 | SD_BUS_PROPERTY("LogsDirectoryMode", "u", bus_property_get_mode, offsetof(ExecContext, directories[EXEC_DIRECTORY_LOGS].mode), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LogsDirectoryMode", .signature = "u", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(ExecContext, directories [EXEC_DIRECTORY_LOGS].mode), }, }, }, | |||
829 | SD_BUS_PROPERTY("LogsDirectory", "as", NULL, offsetof(ExecContext, directories[EXEC_DIRECTORY_LOGS].paths), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "LogsDirectory", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, directories[EXEC_DIRECTORY_LOGS].paths), }, }, }, | |||
830 | SD_BUS_PROPERTY("ConfigurationDirectoryMode", "u", bus_property_get_mode, offsetof(ExecContext, directories[EXEC_DIRECTORY_CONFIGURATION].mode), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ConfigurationDirectoryMode" , .signature = "u", .get = ((sd_bus_property_get_t) ((void*)0 )), .set = ((void*)0), .offset = __builtin_offsetof(ExecContext , directories[EXEC_DIRECTORY_CONFIGURATION].mode), }, }, }, | |||
831 | SD_BUS_PROPERTY("ConfigurationDirectory", "as", NULL, offsetof(ExecContext, directories[EXEC_DIRECTORY_CONFIGURATION].paths), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ConfigurationDirectory", .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, directories[EXEC_DIRECTORY_CONFIGURATION].paths ), }, }, }, | |||
832 | SD_BUS_PROPERTY("MemoryDenyWriteExecute", "b", bus_property_get_bool, offsetof(ExecContext, memory_deny_write_execute), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "MemoryDenyWriteExecute", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, memory_deny_write_execute) , }, }, }, | |||
833 | SD_BUS_PROPERTY("RestrictRealtime", "b", bus_property_get_bool, offsetof(ExecContext, restrict_realtime), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RestrictRealtime", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, restrict_realtime), }, }, }, | |||
834 | SD_BUS_PROPERTY("RestrictSUIDSGID", "b", bus_property_get_bool, offsetof(ExecContext, restrict_suid_sgid), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RestrictSUIDSGID", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, restrict_suid_sgid), }, }, }, | |||
835 | SD_BUS_PROPERTY("RestrictNamespaces", "t", bus_property_get_ulong, offsetof(ExecContext, restrict_namespaces), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "RestrictNamespaces", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(ExecContext, restrict_namespaces ), }, }, }, | |||
836 | SD_BUS_PROPERTY("BindPaths", "a(ssbt)", property_get_bind_paths, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "BindPaths", .signature = "a(ssbt)" , .get = property_get_bind_paths, .set = ((void*)0), .offset = 0, }, }, }, | |||
837 | SD_BUS_PROPERTY("BindReadOnlyPaths", "a(ssbt)", property_get_bind_paths, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "BindReadOnlyPaths", .signature = "a(ssbt)", .get = property_get_bind_paths, .set = ((void*) 0), .offset = 0, }, }, }, | |||
838 | SD_BUS_PROPERTY("TemporaryFileSystem", "a(ss)", property_get_temporary_filesystems, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "TemporaryFileSystem", .signature = "a(ss)", .get = property_get_temporary_filesystems, .set = ((void*)0), .offset = 0, }, }, }, | |||
839 | SD_BUS_PROPERTY("MountAPIVFS", "b", bus_property_get_bool, offsetof(ExecContext, mount_apivfs), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "MountAPIVFS", .signature = "b" , .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof (ExecContext, mount_apivfs), }, }, }, | |||
840 | SD_BUS_PROPERTY("KeyringMode", "s", property_get_exec_keyring_mode, offsetof(ExecContext, keyring_mode), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "KeyringMode", .signature = "s" , .get = property_get_exec_keyring_mode, .set = ((void*)0), . offset = __builtin_offsetof(ExecContext, keyring_mode), }, }, }, | |||
841 | ||||
842 | /* Obsolete/redundant properties: */ | |||
843 | SD_BUS_PROPERTY("Capabilities", "s", property_get_empty_string, 0, SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST |SD_BUS_VTABLE_HIDDEN, .x = { .property = { .member = "Capabilities" , .signature = "s", .get = property_get_empty_string, .set = ( (void*)0), .offset = 0, }, }, }, | |||
844 | SD_BUS_PROPERTY("ReadWriteDirectories", "as", NULL, offsetof(ExecContext, read_write_paths), SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST |SD_BUS_VTABLE_HIDDEN, .x = { .property = { .member = "ReadWriteDirectories" , .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, read_write_paths), }, }, }, | |||
845 | SD_BUS_PROPERTY("ReadOnlyDirectories", "as", NULL, offsetof(ExecContext, read_only_paths), SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST |SD_BUS_VTABLE_HIDDEN, .x = { .property = { .member = "ReadOnlyDirectories" , .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, read_only_paths), }, }, }, | |||
846 | SD_BUS_PROPERTY("InaccessibleDirectories", "as", NULL, offsetof(ExecContext, inaccessible_paths), SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST |SD_BUS_VTABLE_HIDDEN, .x = { .property = { .member = "InaccessibleDirectories" , .signature = "as", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof(ExecContext, inaccessible_paths), }, }, }, | |||
847 | SD_BUS_PROPERTY("IOScheduling", "i", property_get_ioprio, 0, SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST |SD_BUS_VTABLE_HIDDEN, .x = { .property = { .member = "IOScheduling" , .signature = "i", .get = property_get_ioprio, .set = ((void *)0), .offset = 0, }, }, }, | |||
848 | ||||
849 | SD_BUS_VTABLE_END{ .type = _SD_BUS_VTABLE_END, .flags = 0, .x = { { 0 } }, } | |||
850 | }; | |||
851 | ||||
852 | static int append_exec_command(sd_bus_message *reply, ExecCommand *c) { | |||
853 | int r; | |||
854 | ||||
855 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 855 , __PRETTY_FUNCTION__); } while (0); | |||
856 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 856, __PRETTY_FUNCTION__); } while (0); | |||
857 | ||||
858 | if (!c->path) | |||
859 | return 0; | |||
860 | ||||
861 | r = sd_bus_message_open_container(reply, 'r', "sasbttttuii"); | |||
862 | if (r < 0) | |||
863 | return r; | |||
864 | ||||
865 | r = sd_bus_message_append(reply, "s", c->path); | |||
866 | if (r < 0) | |||
867 | return r; | |||
868 | ||||
869 | r = sd_bus_message_append_strv(reply, c->argv); | |||
870 | if (r < 0) | |||
871 | return r; | |||
872 | ||||
873 | r = sd_bus_message_append(reply, "bttttuii", | |||
874 | !!(c->flags & EXEC_COMMAND_IGNORE_FAILURE), | |||
875 | c->exec_status.start_timestamp.realtime, | |||
876 | c->exec_status.start_timestamp.monotonic, | |||
877 | c->exec_status.exit_timestamp.realtime, | |||
878 | c->exec_status.exit_timestamp.monotonic, | |||
879 | (uint32_t) c->exec_status.pid, | |||
880 | (int32_t) c->exec_status.code, | |||
881 | (int32_t) c->exec_status.status); | |||
882 | if (r < 0) | |||
883 | return r; | |||
884 | ||||
885 | return sd_bus_message_close_container(reply); | |||
886 | } | |||
887 | ||||
888 | int bus_property_get_exec_command( | |||
889 | sd_bus *bus, | |||
890 | const char *path, | |||
891 | const char *interface, | |||
892 | const char *property, | |||
893 | sd_bus_message *reply, | |||
894 | void *userdata, | |||
895 | sd_bus_error *ret_error) { | |||
896 | ||||
897 | ExecCommand *c = (ExecCommand*) userdata; | |||
898 | int r; | |||
899 | ||||
900 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 900 , __PRETTY_FUNCTION__); } while (0); | |||
901 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 901 , __PRETTY_FUNCTION__); } while (0); | |||
902 | ||||
903 | r = sd_bus_message_open_container(reply, 'a', "(sasbttttuii)"); | |||
904 | if (r < 0) | |||
905 | return r; | |||
906 | ||||
907 | r = append_exec_command(reply, c); | |||
908 | if (r < 0) | |||
909 | return r; | |||
910 | ||||
911 | return sd_bus_message_close_container(reply); | |||
912 | } | |||
913 | ||||
914 | int bus_property_get_exec_command_list( | |||
915 | sd_bus *bus, | |||
916 | const char *path, | |||
917 | const char *interface, | |||
918 | const char *property, | |||
919 | sd_bus_message *reply, | |||
920 | void *userdata, | |||
921 | sd_bus_error *ret_error) { | |||
922 | ||||
923 | ExecCommand *c = *(ExecCommand**) userdata; | |||
924 | int r; | |||
925 | ||||
926 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-execute.c", 926 , __PRETTY_FUNCTION__); } while (0); | |||
927 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-execute.c", 927 , __PRETTY_FUNCTION__); } while (0); | |||
928 | ||||
929 | r = sd_bus_message_open_container(reply, 'a', "(sasbttttuii)"); | |||
930 | if (r < 0) | |||
931 | return r; | |||
932 | ||||
933 | LIST_FOREACH(command, c, c)for ((c) = (c); (c); (c) = (c)->command_next) { | |||
934 | r = append_exec_command(reply, c); | |||
935 | if (r < 0) | |||
936 | return r; | |||
937 | } | |||
938 | ||||
939 | return sd_bus_message_close_container(reply); | |||
940 | } | |||
941 | ||||
942 | int bus_set_transient_exec_command( | |||
943 | Unit *u, | |||
944 | const char *name, | |||
945 | ExecCommand **exec_command, | |||
946 | sd_bus_message *message, | |||
947 | UnitWriteFlags flags, | |||
948 | sd_bus_error *error) { | |||
949 | unsigned n = 0; | |||
950 | int r; | |||
951 | ||||
952 | r = sd_bus_message_enter_container(message, 'a', "(sasb)"); | |||
953 | if (r < 0) | |||
954 | return r; | |||
955 | ||||
956 | while ((r = sd_bus_message_enter_container(message, 'r', "sasb")) > 0) { | |||
957 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **argv = NULL((void*)0); | |||
958 | const char *path; | |||
959 | int b; | |||
960 | ||||
961 | r = sd_bus_message_read(message, "s", &path); | |||
962 | if (r < 0) | |||
963 | return r; | |||
964 | ||||
965 | if (!path_is_absolute(path)) | |||
966 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path %s is not absolute.", path); | |||
967 | ||||
968 | r = sd_bus_message_read_strv(message, &argv); | |||
969 | if (r < 0) | |||
970 | return r; | |||
971 | ||||
972 | r = sd_bus_message_read(message, "b", &b); | |||
973 | if (r < 0) | |||
974 | return r; | |||
975 | ||||
976 | r = sd_bus_message_exit_container(message); | |||
977 | if (r < 0) | |||
978 | return r; | |||
979 | ||||
980 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
981 | ExecCommand *c; | |||
982 | ||||
983 | c = new0(ExecCommand, 1)((ExecCommand*) calloc((1), sizeof(ExecCommand))); | |||
984 | if (!c) | |||
985 | return -ENOMEM12; | |||
986 | ||||
987 | c->path = strdup(path); | |||
988 | if (!c->path) { | |||
989 | free(c); | |||
990 | return -ENOMEM12; | |||
991 | } | |||
992 | ||||
993 | c->argv = TAKE_PTR(argv)({ typeof(argv) _ptr_ = (argv); (argv) = ((void*)0); _ptr_; } ); | |||
994 | ||||
995 | c->flags = b ? EXEC_COMMAND_IGNORE_FAILURE : 0; | |||
996 | ||||
997 | path_simplify(c->path, false0); | |||
998 | exec_command_append_list(exec_command, c); | |||
999 | } | |||
1000 | ||||
1001 | n++; | |||
1002 | } | |||
1003 | if (r < 0) | |||
1004 | return r; | |||
1005 | ||||
1006 | r = sd_bus_message_exit_container(message); | |||
1007 | if (r < 0) | |||
1008 | return r; | |||
1009 | ||||
1010 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1011 | _cleanup_free___attribute__((cleanup(freep))) char *buf = NULL((void*)0); | |||
1012 | _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0); | |||
1013 | ExecCommand *c; | |||
1014 | size_t size = 0; | |||
1015 | ||||
1016 | if (n == 0) | |||
1017 | *exec_command = exec_command_free_list(*exec_command); | |||
1018 | ||||
1019 | f = open_memstream(&buf, &size); | |||
1020 | if (!f) | |||
1021 | return -ENOMEM12; | |||
1022 | ||||
1023 | (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER); | |||
1024 | ||||
1025 | fputs("ExecStart=\n", f); | |||
1026 | ||||
1027 | LIST_FOREACH(command, c, *exec_command)for ((c) = (*exec_command); (c); (c) = (c)->command_next) { | |||
1028 | _cleanup_free___attribute__((cleanup(freep))) char *a = NULL((void*)0), *t = NULL((void*)0); | |||
1029 | const char *p; | |||
1030 | ||||
1031 | p = unit_escape_setting(c->path, UNIT_ESCAPE_C|UNIT_ESCAPE_SPECIFIERS, &t); | |||
1032 | if (!p) | |||
1033 | return -ENOMEM12; | |||
1034 | ||||
1035 | a = unit_concat_strv(c->argv, UNIT_ESCAPE_C|UNIT_ESCAPE_SPECIFIERS); | |||
1036 | if (!a) | |||
1037 | return -ENOMEM12; | |||
1038 | ||||
1039 | fprintf(f, "%s=%s@%s %s\n", | |||
1040 | name, | |||
1041 | c->flags & EXEC_COMMAND_IGNORE_FAILURE ? "-" : "", | |||
1042 | p, | |||
1043 | a); | |||
1044 | } | |||
1045 | ||||
1046 | r = fflush_and_check(f); | |||
1047 | if (r < 0) | |||
1048 | return r; | |||
1049 | ||||
1050 | unit_write_setting(u, flags, name, buf); | |||
1051 | } | |||
1052 | ||||
1053 | return 1; | |||
1054 | } | |||
1055 | ||||
1056 | static int parse_personality(const char *s, unsigned long *p) { | |||
1057 | unsigned long v; | |||
1058 | ||||
1059 | assert(p)do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c", 1059 , __PRETTY_FUNCTION__); } while (0); | |||
1060 | ||||
1061 | v = personality_from_string(s); | |||
1062 | if (v == PERSONALITY_INVALID0xffffffffLU) | |||
1063 | return -EINVAL22; | |||
1064 | ||||
1065 | *p = v; | |||
1066 | return 0; | |||
1067 | } | |||
1068 | ||||
1069 | static const char* mount_propagation_flags_to_string_with_check(unsigned long n) { | |||
1070 | if (!IN_SET(n, 0, MS_SHARED, MS_PRIVATE, MS_SLAVE)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended [20 - sizeof((int[]){0, MS_SHARED, MS_PRIVATE, MS_SLAVE})/sizeof (int)]; switch(n) { case 0: case MS_SHARED: case MS_PRIVATE: case MS_SLAVE: _found = 1; break; default: break; } _found; })) | |||
1071 | return NULL((void*)0); | |||
1072 | ||||
1073 | return mount_propagation_flags_to_string(n); | |||
1074 | } | |||
1075 | ||||
1076 | static BUS_DEFINE_SET_TRANSIENT(nsec, "t", uint64_t, nsec_t, NSEC_FMT)int bus_set_transient_nsec( Unit *u, const char *name, nsec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect(!!(! (p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c" , 1076, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "t", &v); if (r < 0) return r; if (!(((flags ) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = (nsec_t ) v; unit_write_settingf(u, flags, name, "%s=" "%" "l" "u", name , v); } return 1; }; | |||
1077 | static BUS_DEFINE_SET_TRANSIENT_IS_VALID(log_level, "i", int32_t, int, "%" PRIi32, log_level_is_valid)int bus_set_transient_log_level( Unit *u, const char *name, int *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { int32_t v; int r; do { if ((__builtin_expect(!!(!( p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c" , 1077, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "i", &v); if (r < 0) return r; if (!log_level_is_valid (v)) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: " "%" "i", name, v); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = (int) v; unit_write_settingf (u, flags, name, "%s=" "%" "i", name, v); } return 1; }; | |||
1078 | #if HAVE_SECCOMP1 | |||
1079 | static BUS_DEFINE_SET_TRANSIENT_IS_VALID(errno, "i", int32_t, int, "%" PRIi32, errno_is_valid)int bus_set_transient_errno( Unit *u, const char *name, int * p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { int32_t v; int r; do { if ((__builtin_expect(!!(!( p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c" , 1079, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "i", &v); if (r < 0) return r; if (!errno_is_valid (v)) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: " "%" "i", name, v); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = (int) v; unit_write_settingf (u, flags, name, "%s=" "%" "i", name, v); } return 1; }; | |||
1080 | #endif | |||
1081 | static BUS_DEFINE_SET_TRANSIENT_IS_VALID(sched_priority, "i", int32_t, int, "%" PRIi32, sched_priority_is_valid)int bus_set_transient_sched_priority( Unit *u, const char *name , int *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { int32_t v; int r; do { if ((__builtin_expect(!!(!( p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c" , 1081, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "i", &v); if (r < 0) return r; if (!sched_priority_is_valid (v)) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: " "%" "i", name, v); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = (int) v; unit_write_settingf (u, flags, name, "%s=" "%" "i", name, v); } return 1; }; | |||
1082 | static BUS_DEFINE_SET_TRANSIENT_IS_VALID(nice, "i", int32_t, int, "%" PRIi32, nice_is_valid)int bus_set_transient_nice( Unit *u, const char *name, int *p , sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { int32_t v; int r; do { if ((__builtin_expect(!!(!( p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c" , 1082, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "i", &v); if (r < 0) return r; if (!nice_is_valid (v)) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: " "%" "i", name, v); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = (int) v; unit_write_settingf (u, flags, name, "%s=" "%" "i", name, v); } return 1; }; | |||
1083 | static BUS_DEFINE_SET_TRANSIENT_PARSE(std_input, ExecInput, exec_input_from_string)int bus_set_transient_std_input( Unit *u, const char *name, ExecInput *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { const char *s; ExecInput v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-execute.c", 1083, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "s", &s); if (r < 0) return r; v = exec_input_from_string(s); if (v < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: %s", name, s); if (!(((flags) & (UNIT_RUNTIME |UNIT_PERSISTENT)) == 0)) { *p = v; unit_write_settingf(u, flags , name, "%s=%s", name, s); } return 1; }; | |||
1084 | static BUS_DEFINE_SET_TRANSIENT_PARSE(std_output, ExecOutput, exec_output_from_string)int bus_set_transient_std_output( Unit *u, const char *name, ExecOutput *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { const char *s; ExecOutput v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-execute.c", 1084, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "s", &s); if (r < 0) return r; v = exec_output_from_string(s); if (v < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: %s", name, s); if (!(((flags) & (UNIT_RUNTIME |UNIT_PERSISTENT)) == 0)) { *p = v; unit_write_settingf(u, flags , name, "%s=%s", name, s); } return 1; }; | |||
1085 | static BUS_DEFINE_SET_TRANSIENT_PARSE(utmp_mode, ExecUtmpMode, exec_utmp_mode_from_string)int bus_set_transient_utmp_mode( Unit *u, const char *name, ExecUtmpMode *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { const char *s; ExecUtmpMode v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-execute.c", 1085, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "s", &s); if (r < 0) return r; v = exec_utmp_mode_from_string(s); if ( v < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: %s", name, s); if (!(((flags) & (UNIT_RUNTIME |UNIT_PERSISTENT)) == 0)) { *p = v; unit_write_settingf(u, flags , name, "%s=%s", name, s); } return 1; }; | |||
1086 | static BUS_DEFINE_SET_TRANSIENT_PARSE(protect_system, ProtectSystem, protect_system_from_string)int bus_set_transient_protect_system( Unit *u, const char *name , ProtectSystem *p, sd_bus_message *message, UnitWriteFlags flags , sd_bus_error *error) { const char *s; ProtectSystem v; int r ; do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c", 1086 , __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read( message, "s", &s); if (r < 0) return r; v = protect_system_from_string (s); if (v < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: %s", name, s); if (!(((flags) & (UNIT_RUNTIME |UNIT_PERSISTENT)) == 0)) { *p = v; unit_write_settingf(u, flags , name, "%s=%s", name, s); } return 1; }; | |||
1087 | static BUS_DEFINE_SET_TRANSIENT_PARSE(protect_home, ProtectHome, protect_home_from_string)int bus_set_transient_protect_home( Unit *u, const char *name , ProtectHome *p, sd_bus_message *message, UnitWriteFlags flags , sd_bus_error *error) { const char *s; ProtectHome v; int r; do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c", 1087 , __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read( message, "s", &s); if (r < 0) return r; v = protect_home_from_string (s); if (v < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: %s", name, s); if (!(((flags) & (UNIT_RUNTIME |UNIT_PERSISTENT)) == 0)) { *p = v; unit_write_settingf(u, flags , name, "%s=%s", name, s); } return 1; }; | |||
1088 | static BUS_DEFINE_SET_TRANSIENT_PARSE(keyring_mode, ExecKeyringMode, exec_keyring_mode_from_string)int bus_set_transient_keyring_mode( Unit *u, const char *name , ExecKeyringMode *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { const char *s; ExecKeyringMode v; int r; do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c", 1088 , __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read( message, "s", &s); if (r < 0) return r; v = exec_keyring_mode_from_string (s); if (v < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: %s", name, s); if (!(((flags) & (UNIT_RUNTIME |UNIT_PERSISTENT)) == 0)) { *p = v; unit_write_settingf(u, flags , name, "%s=%s", name, s); } return 1; }; | |||
1089 | static BUS_DEFINE_SET_TRANSIENT_PARSE(preserve_mode, ExecPreserveMode, exec_preserve_mode_from_string)int bus_set_transient_preserve_mode( Unit *u, const char *name , ExecPreserveMode *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { const char *s; ExecPreserveMode v; int r; do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c", 1089 , __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read( message, "s", &s); if (r < 0) return r; v = exec_preserve_mode_from_string (s); if (v < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: %s", name, s); if (!(((flags) & (UNIT_RUNTIME |UNIT_PERSISTENT)) == 0)) { *p = v; unit_write_settingf(u, flags , name, "%s=%s", name, s); } return 1; }; | |||
1090 | static BUS_DEFINE_SET_TRANSIENT_PARSE_PTR(personality, unsigned long, parse_personality)int bus_set_transient_personality( Unit *u, const char *name, unsigned long *p, sd_bus_message *message, UnitWriteFlags flags , sd_bus_error *error) { const char *s; unsigned long v; int r ; do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c", 1090 , __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read( message, "s", &s); if (r < 0) return r; r = parse_personality (s, &v); if (r < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: %s", name, s); if (!(((flags) & (UNIT_RUNTIME |UNIT_PERSISTENT)) == 0)) { *p = v; unit_write_settingf(u, flags , name, "%s=%s", name, strempty(s)); } return 1; }; | |||
1091 | static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(secure_bits, "i", int32_t, int, "%" PRIi32, secure_bits_to_string_alloc_with_check)int bus_set_transient_secure_bits( Unit *u, const char *name, int *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { __attribute__((cleanup(freep))) char *s = ((void*) 0); int32_t v; int r; do { if ((__builtin_expect(!!(!(p)),0)) ) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c" , 1091, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "i", &v); if (r < 0) return r; r = secure_bits_to_string_alloc_with_check (v, &s); if (r == -22) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: " "%" "i", name, v); if (r < 0) return r; if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0 )) { *p = (int) v; unit_write_settingf(u, flags, name, "%s=%s" , name, s); } return 1; }; | |||
1092 | static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(capability, "t", uint64_t, uint64_t, "%" PRIu64, capability_set_to_string_alloc)int bus_set_transient_capability( Unit *u, const char *name, uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { __attribute__((cleanup(freep))) char *s = ((void*) 0); uint64_t v; int r; do { if ((__builtin_expect(!!(!(p)),0) )) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c" , 1092, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "t", &v); if (r < 0) return r; r = capability_set_to_string_alloc (v, &s); if (r == -22) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: " "%" "l" "u", name, v); if (r < 0) return r; if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT )) == 0)) { *p = (uint64_t) v; unit_write_settingf(u, flags, name , "%s=%s", name, s); } return 1; }; | |||
1093 | static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(sched_policy, "i", int32_t, int, "%" PRIi32, sched_policy_to_string_alloc_with_check)int bus_set_transient_sched_policy( Unit *u, const char *name , int *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { __attribute__((cleanup(freep))) char *s = ((void*) 0); int32_t v; int r; do { if ((__builtin_expect(!!(!(p)),0)) ) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c" , 1093, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "i", &v); if (r < 0) return r; r = sched_policy_to_string_alloc_with_check (v, &s); if (r == -22) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: " "%" "i", name, v); if (r < 0) return r; if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0 )) { *p = (int) v; unit_write_settingf(u, flags, name, "%s=%s" , name, s); } return 1; }; | |||
1094 | static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(namespace_flag, "t", uint64_t, unsigned long, "%" PRIu64, namespace_flags_to_string)int bus_set_transient_namespace_flag( Unit *u, const char *name , unsigned long *p, sd_bus_message *message, UnitWriteFlags flags , sd_bus_error *error) { __attribute__((cleanup(freep))) char *s = ((void*)0); uint64_t v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-execute.c", 1094, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "t", &v); if (r < 0) return r; r = namespace_flags_to_string(v, &s ); if (r == -22) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: " "%" "l" "u", name, v); if (r < 0) return r; if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT )) == 0)) { *p = (unsigned long) v; unit_write_settingf(u, flags , name, "%s=%s", name, s); } return 1; }; | |||
1095 | static BUS_DEFINE_SET_TRANSIENT_TO_STRING(mount_flags, "t", uint64_t, unsigned long, "%" PRIu64, mount_propagation_flags_to_string_with_check)int bus_set_transient_mount_flags( Unit *u, const char *name, unsigned long *p, sd_bus_message *message, UnitWriteFlags flags , sd_bus_error *error) { const char *s; uint64_t v; int r; do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-execute.c", 1095 , __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read( message, "t", &v); if (r < 0) return r; s = mount_propagation_flags_to_string_with_check (v); if (!s) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Invalid %s setting: " "%" "l" "u", name, v); if (!(((flags ) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = (unsigned long) v; unit_write_settingf(u, flags, name, "%s=%s", name, s ); } return 1; }; | |||
1096 | ||||
1097 | int bus_exec_context_set_transient_property( | |||
1098 | Unit *u, | |||
1099 | ExecContext *c, | |||
1100 | const char *name, | |||
1101 | sd_bus_message *message, | |||
1102 | UnitWriteFlags flags, | |||
1103 | sd_bus_error *error) { | |||
1104 | ||||
1105 | const char *suffix; | |||
1106 | int r; | |||
1107 | ||||
1108 | assert(u)do { if ((__builtin_expect(!!(!(u)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("u"), "../src/core/dbus-execute.c", 1108 , __PRETTY_FUNCTION__); } while (0); | |||
| ||||
1109 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-execute.c", 1109 , __PRETTY_FUNCTION__); } while (0); | |||
1110 | assert(name)do { if ((__builtin_expect(!!(!(name)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("name"), "../src/core/dbus-execute.c", 1110 , __PRETTY_FUNCTION__); } while (0); | |||
1111 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-execute.c" , 1111, __PRETTY_FUNCTION__); } while (0); | |||
1112 | ||||
1113 | flags |= UNIT_PRIVATE; | |||
1114 | ||||
1115 | if (streq(name, "User")(strcmp((name),("User")) == 0)) | |||
1116 | return bus_set_transient_user_relaxed(u, name, &c->user, message, flags, error); | |||
1117 | ||||
1118 | if (streq(name, "Group")(strcmp((name),("Group")) == 0)) | |||
1119 | return bus_set_transient_user_relaxed(u, name, &c->group, message, flags, error); | |||
1120 | ||||
1121 | if (streq(name, "TTYPath")(strcmp((name),("TTYPath")) == 0)) | |||
1122 | return bus_set_transient_path(u, name, &c->tty_path, message, flags, error); | |||
1123 | ||||
1124 | if (streq(name, "RootImage")(strcmp((name),("RootImage")) == 0)) | |||
1125 | return bus_set_transient_path(u, name, &c->root_image, message, flags, error); | |||
1126 | ||||
1127 | if (streq(name, "RootDirectory")(strcmp((name),("RootDirectory")) == 0)) | |||
1128 | return bus_set_transient_path(u, name, &c->root_directory, message, flags, error); | |||
1129 | ||||
1130 | if (streq(name, "SyslogIdentifier")(strcmp((name),("SyslogIdentifier")) == 0)) | |||
1131 | return bus_set_transient_string(u, name, &c->syslog_identifier, message, flags, error); | |||
1132 | ||||
1133 | if (streq(name, "LogLevelMax")(strcmp((name),("LogLevelMax")) == 0)) | |||
1134 | return bus_set_transient_log_level(u, name, &c->log_level_max, message, flags, error); | |||
1135 | ||||
1136 | if (streq(name, "CPUSchedulingPriority")(strcmp((name),("CPUSchedulingPriority")) == 0)) | |||
1137 | return bus_set_transient_sched_priority(u, name, &c->cpu_sched_priority, message, flags, error); | |||
1138 | ||||
1139 | if (streq(name, "LogRateLimitIntervalUSec")(strcmp((name),("LogRateLimitIntervalUSec")) == 0)) | |||
1140 | return bus_set_transient_usec(u, name, &c->log_rate_limit_interval_usec, message, flags, error); | |||
1141 | ||||
1142 | if (streq(name, "LogRateLimitBurst")(strcmp((name),("LogRateLimitBurst")) == 0)) | |||
1143 | return bus_set_transient_unsigned(u, name, &c->log_rate_limit_burst, message, flags, error); | |||
1144 | ||||
1145 | if (streq(name, "Personality")(strcmp((name),("Personality")) == 0)) | |||
1146 | return bus_set_transient_personality(u, name, &c->personality, message, flags, error); | |||
1147 | ||||
1148 | if (streq(name, "Nice")(strcmp((name),("Nice")) == 0)) | |||
1149 | return bus_set_transient_nice(u, name, &c->nice, message, flags, error); | |||
1150 | ||||
1151 | if (streq(name, "StandardInput")(strcmp((name),("StandardInput")) == 0)) | |||
1152 | return bus_set_transient_std_input(u, name, &c->std_input, message, flags, error); | |||
1153 | ||||
1154 | if (streq(name, "StandardOutput")(strcmp((name),("StandardOutput")) == 0)) | |||
1155 | return bus_set_transient_std_output(u, name, &c->std_output, message, flags, error); | |||
1156 | ||||
1157 | if (streq(name, "StandardError")(strcmp((name),("StandardError")) == 0)) | |||
1158 | return bus_set_transient_std_output(u, name, &c->std_error, message, flags, error); | |||
1159 | ||||
1160 | if (streq(name, "IgnoreSIGPIPE")(strcmp((name),("IgnoreSIGPIPE")) == 0)) | |||
1161 | return bus_set_transient_bool(u, name, &c->ignore_sigpipe, message, flags, error); | |||
1162 | ||||
1163 | if (streq(name, "TTYVHangup")(strcmp((name),("TTYVHangup")) == 0)) | |||
1164 | return bus_set_transient_bool(u, name, &c->tty_vhangup, message, flags, error); | |||
1165 | ||||
1166 | if (streq(name, "TTYReset")(strcmp((name),("TTYReset")) == 0)) | |||
1167 | return bus_set_transient_bool(u, name, &c->tty_reset, message, flags, error); | |||
1168 | ||||
1169 | if (streq(name, "TTYVTDisallocate")(strcmp((name),("TTYVTDisallocate")) == 0)) | |||
1170 | return bus_set_transient_bool(u, name, &c->tty_vt_disallocate, message, flags, error); | |||
1171 | ||||
1172 | if (streq(name, "PrivateTmp")(strcmp((name),("PrivateTmp")) == 0)) | |||
1173 | return bus_set_transient_bool(u, name, &c->private_tmp, message, flags, error); | |||
1174 | ||||
1175 | if (streq(name, "PrivateDevices")(strcmp((name),("PrivateDevices")) == 0)) | |||
1176 | return bus_set_transient_bool(u, name, &c->private_devices, message, flags, error); | |||
1177 | ||||
1178 | if (streq(name, "PrivateMounts")(strcmp((name),("PrivateMounts")) == 0)) | |||
1179 | return bus_set_transient_bool(u, name, &c->private_mounts, message, flags, error); | |||
1180 | ||||
1181 | if (streq(name, "PrivateNetwork")(strcmp((name),("PrivateNetwork")) == 0)) | |||
1182 | return bus_set_transient_bool(u, name, &c->private_network, message, flags, error); | |||
1183 | ||||
1184 | if (streq(name, "PrivateUsers")(strcmp((name),("PrivateUsers")) == 0)) | |||
1185 | return bus_set_transient_bool(u, name, &c->private_users, message, flags, error); | |||
1186 | ||||
1187 | if (streq(name, "NoNewPrivileges")(strcmp((name),("NoNewPrivileges")) == 0)) | |||
1188 | return bus_set_transient_bool(u, name, &c->no_new_privileges, message, flags, error); | |||
1189 | ||||
1190 | if (streq(name, "SyslogLevelPrefix")(strcmp((name),("SyslogLevelPrefix")) == 0)) | |||
1191 | return bus_set_transient_bool(u, name, &c->syslog_level_prefix, message, flags, error); | |||
1192 | ||||
1193 | if (streq(name, "MemoryDenyWriteExecute")(strcmp((name),("MemoryDenyWriteExecute")) == 0)) | |||
1194 | return bus_set_transient_bool(u, name, &c->memory_deny_write_execute, message, flags, error); | |||
1195 | ||||
1196 | if (streq(name, "RestrictRealtime")(strcmp((name),("RestrictRealtime")) == 0)) | |||
1197 | return bus_set_transient_bool(u, name, &c->restrict_realtime, message, flags, error); | |||
1198 | ||||
1199 | if (streq(name, "RestrictSUIDSGID")(strcmp((name),("RestrictSUIDSGID")) == 0)) | |||
1200 | return bus_set_transient_bool(u, name, &c->restrict_suid_sgid, message, flags, error); | |||
1201 | ||||
1202 | if (streq(name, "DynamicUser")(strcmp((name),("DynamicUser")) == 0)) | |||
1203 | return bus_set_transient_bool(u, name, &c->dynamic_user, message, flags, error); | |||
1204 | ||||
1205 | if (streq(name, "RemoveIPC")(strcmp((name),("RemoveIPC")) == 0)) | |||
1206 | return bus_set_transient_bool(u, name, &c->remove_ipc, message, flags, error); | |||
1207 | ||||
1208 | if (streq(name, "ProtectKernelTunables")(strcmp((name),("ProtectKernelTunables")) == 0)) | |||
1209 | return bus_set_transient_bool(u, name, &c->protect_kernel_tunables, message, flags, error); | |||
1210 | ||||
1211 | if (streq(name, "ProtectKernelModules")(strcmp((name),("ProtectKernelModules")) == 0)) | |||
1212 | return bus_set_transient_bool(u, name, &c->protect_kernel_modules, message, flags, error); | |||
1213 | ||||
1214 | if (streq(name, "ProtectControlGroups")(strcmp((name),("ProtectControlGroups")) == 0)) | |||
1215 | return bus_set_transient_bool(u, name, &c->protect_control_groups, message, flags, error); | |||
1216 | ||||
1217 | if (streq(name, "MountAPIVFS")(strcmp((name),("MountAPIVFS")) == 0)) | |||
1218 | return bus_set_transient_bool(u, name, &c->mount_apivfs, message, flags, error); | |||
1219 | ||||
1220 | if (streq(name, "CPUSchedulingResetOnFork")(strcmp((name),("CPUSchedulingResetOnFork")) == 0)) | |||
1221 | return bus_set_transient_bool(u, name, &c->cpu_sched_reset_on_fork, message, flags, error); | |||
1222 | ||||
1223 | if (streq(name, "NonBlocking")(strcmp((name),("NonBlocking")) == 0)) | |||
1224 | return bus_set_transient_bool(u, name, &c->non_blocking, message, flags, error); | |||
1225 | ||||
1226 | if (streq(name, "LockPersonality")(strcmp((name),("LockPersonality")) == 0)) | |||
1227 | return bus_set_transient_bool(u, name, &c->lock_personality, message, flags, error); | |||
1228 | ||||
1229 | if (streq(name, "UtmpIdentifier")(strcmp((name),("UtmpIdentifier")) == 0)) | |||
1230 | return bus_set_transient_string(u, name, &c->utmp_id, message, flags, error); | |||
1231 | ||||
1232 | if (streq(name, "UtmpMode")(strcmp((name),("UtmpMode")) == 0)) | |||
1233 | return bus_set_transient_utmp_mode(u, name, &c->utmp_mode, message, flags, error); | |||
1234 | ||||
1235 | if (streq(name, "PAMName")(strcmp((name),("PAMName")) == 0)) | |||
1236 | return bus_set_transient_string(u, name, &c->pam_name, message, flags, error); | |||
1237 | ||||
1238 | if (streq(name, "TimerSlackNSec")(strcmp((name),("TimerSlackNSec")) == 0)) | |||
1239 | return bus_set_transient_nsec(u, name, &c->timer_slack_nsec, message, flags, error); | |||
1240 | ||||
1241 | if (streq(name, "ProtectSystem")(strcmp((name),("ProtectSystem")) == 0)) | |||
1242 | return bus_set_transient_protect_system(u, name, &c->protect_system, message, flags, error); | |||
1243 | ||||
1244 | if (streq(name, "ProtectHome")(strcmp((name),("ProtectHome")) == 0)) | |||
1245 | return bus_set_transient_protect_home(u, name, &c->protect_home, message, flags, error); | |||
1246 | ||||
1247 | if (streq(name, "KeyringMode")(strcmp((name),("KeyringMode")) == 0)) | |||
1248 | return bus_set_transient_keyring_mode(u, name, &c->keyring_mode, message, flags, error); | |||
1249 | ||||
1250 | if (streq(name, "RuntimeDirectoryPreserve")(strcmp((name),("RuntimeDirectoryPreserve")) == 0)) | |||
1251 | return bus_set_transient_preserve_mode(u, name, &c->runtime_directory_preserve_mode, message, flags, error); | |||
1252 | ||||
1253 | if (streq(name, "UMask")(strcmp((name),("UMask")) == 0)) | |||
1254 | return bus_set_transient_mode_t(u, name, &c->umask, message, flags, error); | |||
1255 | ||||
1256 | if (streq(name, "RuntimeDirectoryMode")(strcmp((name),("RuntimeDirectoryMode")) == 0)) | |||
1257 | return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_RUNTIME].mode, message, flags, error); | |||
1258 | ||||
1259 | if (streq(name, "StateDirectoryMode")(strcmp((name),("StateDirectoryMode")) == 0)) | |||
1260 | return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_STATE].mode, message, flags, error); | |||
1261 | ||||
1262 | if (streq(name, "CacheDirectoryMode")(strcmp((name),("CacheDirectoryMode")) == 0)) | |||
1263 | return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_CACHE].mode, message, flags, error); | |||
1264 | ||||
1265 | if (streq(name, "LogsDirectoryMode")(strcmp((name),("LogsDirectoryMode")) == 0)) | |||
1266 | return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_LOGS].mode, message, flags, error); | |||
1267 | ||||
1268 | if (streq(name, "ConfigurationDirectoryMode")(strcmp((name),("ConfigurationDirectoryMode")) == 0)) | |||
1269 | return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_CONFIGURATION].mode, message, flags, error); | |||
1270 | ||||
1271 | if (streq(name, "SELinuxContext")(strcmp((name),("SELinuxContext")) == 0)) | |||
1272 | return bus_set_transient_string(u, name, &c->selinux_context, message, flags, error); | |||
1273 | ||||
1274 | if (streq(name, "SecureBits")(strcmp((name),("SecureBits")) == 0)) | |||
1275 | return bus_set_transient_secure_bits(u, name, &c->secure_bits, message, flags, error); | |||
1276 | ||||
1277 | if (streq(name, "CapabilityBoundingSet")(strcmp((name),("CapabilityBoundingSet")) == 0)) | |||
1278 | return bus_set_transient_capability(u, name, &c->capability_bounding_set, message, flags, error); | |||
1279 | ||||
1280 | if (streq(name, "AmbientCapabilities")(strcmp((name),("AmbientCapabilities")) == 0)) | |||
1281 | return bus_set_transient_capability(u, name, &c->capability_ambient_set, message, flags, error); | |||
1282 | ||||
1283 | if (streq(name, "CPUSchedulingPolicy")(strcmp((name),("CPUSchedulingPolicy")) == 0)) | |||
1284 | return bus_set_transient_sched_policy(u, name, &c->cpu_sched_policy, message, flags, error); | |||
1285 | ||||
1286 | if (streq(name, "RestrictNamespaces")(strcmp((name),("RestrictNamespaces")) == 0)) | |||
1287 | return bus_set_transient_namespace_flag(u, name, &c->restrict_namespaces, message, flags, error); | |||
1288 | ||||
1289 | if (streq(name, "MountFlags")(strcmp((name),("MountFlags")) == 0)) | |||
1290 | return bus_set_transient_mount_flags(u, name, &c->mount_flags, message, flags, error); | |||
1291 | ||||
1292 | if (streq(name, "SupplementaryGroups")(strcmp((name),("SupplementaryGroups")) == 0)) { | |||
1293 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
1294 | char **p; | |||
1295 | ||||
1296 | r = sd_bus_message_read_strv(message, &l); | |||
1297 | if (r < 0) | |||
1298 | return r; | |||
1299 | ||||
1300 | STRV_FOREACH(p, l)for ((p) = (l); (p) && *(p); (p)++) | |||
1301 | if (!isempty(*p) && !valid_user_group_name(*p, VALID_USER_ALLOW_NUMERIC|VALID_USER_RELAX|VALID_USER_WARN)) | |||
1302 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", | |||
1303 | "Invalid supplementary group names"); | |||
1304 | ||||
1305 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1306 | if (strv_isempty(l)) { | |||
1307 | c->supplementary_groups = strv_free(c->supplementary_groups); | |||
1308 | unit_write_settingf(u, flags, name, "%s=", name); | |||
1309 | } else { | |||
1310 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
1311 | ||||
1312 | r = strv_extend_strv(&c->supplementary_groups, l, true1); | |||
1313 | if (r < 0) | |||
1314 | return -ENOMEM12; | |||
1315 | ||||
1316 | joined = strv_join(c->supplementary_groups, " "); | |||
1317 | if (!joined) | |||
1318 | return -ENOMEM12; | |||
1319 | ||||
1320 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "%s=%s", name, joined); | |||
1321 | } | |||
1322 | } | |||
1323 | ||||
1324 | return 1; | |||
1325 | ||||
1326 | } else if (streq(name, "SyslogLevel")(strcmp((name),("SyslogLevel")) == 0)) { | |||
1327 | int32_t level; | |||
1328 | ||||
1329 | r = sd_bus_message_read(message, "i", &level); | |||
1330 | if (r < 0) | |||
1331 | return r; | |||
1332 | ||||
1333 | if (!log_level_is_valid(level)) | |||
1334 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Log level value out of range"); | |||
1335 | ||||
1336 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1337 | c->syslog_priority = (c->syslog_priority & LOG_FACMASK0x03f8) | level; | |||
1338 | unit_write_settingf(u, flags, name, "SyslogLevel=%i", level); | |||
1339 | } | |||
1340 | ||||
1341 | return 1; | |||
1342 | ||||
1343 | } else if (streq(name, "SyslogFacility")(strcmp((name),("SyslogFacility")) == 0)) { | |||
1344 | int32_t facility; | |||
1345 | ||||
1346 | r = sd_bus_message_read(message, "i", &facility); | |||
1347 | if (r < 0) | |||
1348 | return r; | |||
1349 | ||||
1350 | if (!log_facility_unshifted_is_valid(facility)) | |||
1351 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Log facility value out of range"); | |||
1352 | ||||
1353 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1354 | c->syslog_priority = (facility << 3) | LOG_PRI(c->syslog_priority)((c->syslog_priority) & 0x07); | |||
1355 | unit_write_settingf(u, flags, name, "SyslogFacility=%i", facility); | |||
1356 | } | |||
1357 | ||||
1358 | return 1; | |||
1359 | ||||
1360 | } else if (streq(name, "LogExtraFields")(strcmp((name),("LogExtraFields")) == 0)) { | |||
1361 | size_t n = 0; | |||
1362 | ||||
1363 | r = sd_bus_message_enter_container(message, 'a', "ay"); | |||
1364 | if (r < 0) | |||
1365 | return r; | |||
1366 | ||||
1367 | for (;;) { | |||
1368 | _cleanup_free___attribute__((cleanup(freep))) void *copy = NULL((void*)0); | |||
1369 | struct iovec *t; | |||
1370 | const char *eq; | |||
1371 | const void *p; | |||
1372 | size_t sz; | |||
1373 | ||||
1374 | /* Note that we expect a byte array for each field, instead of a string. That's because on the | |||
1375 | * lower-level journal fields can actually contain binary data and are not restricted to text, | |||
1376 | * and we should not "lose precision" in our types on the way. That said, I am pretty sure | |||
1377 | * actually encoding binary data as unit metadata is not a good idea. Hence we actually refuse | |||
1378 | * any actual binary data, and only accept UTF-8. This allows us to eventually lift this | |||
1379 | * limitation, should a good, valid usecase arise. */ | |||
1380 | ||||
1381 | r = sd_bus_message_read_array(message, 'y', &p, &sz); | |||
1382 | if (r < 0) | |||
1383 | return r; | |||
1384 | if (r == 0) | |||
1385 | break; | |||
1386 | ||||
1387 | if (memchr(p, 0, sz)) | |||
1388 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Journal field contains zero byte"); | |||
1389 | ||||
1390 | eq = memchr(p, '=', sz); | |||
1391 | if (!eq) | |||
1392 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Journal field contains no '=' character"); | |||
1393 | if (!journal_field_valid(p, eq - (const char*) p, false0)) | |||
1394 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Journal field invalid"); | |||
1395 | ||||
1396 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1397 | t = reallocarray(c->log_extra_fields, c->n_log_extra_fields+1, sizeof(struct iovec)); | |||
1398 | if (!t) | |||
1399 | return -ENOMEM12; | |||
1400 | c->log_extra_fields = t; | |||
1401 | } | |||
1402 | ||||
1403 | copy = malloc(sz + 1); | |||
1404 | if (!copy) | |||
1405 | return -ENOMEM12; | |||
1406 | ||||
1407 | memcpy(copy, p, sz); | |||
1408 | ((uint8_t*) copy)[sz] = 0; | |||
1409 | ||||
1410 | if (!utf8_is_valid(copy)) | |||
1411 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Journal field is not valid UTF-8"); | |||
| ||||
1412 | ||||
1413 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1414 | c->log_extra_fields[c->n_log_extra_fields++] = IOVEC_MAKE(copy, sz)(struct iovec) { .iov_base = (copy), .iov_len = (sz) }; | |||
1415 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS|UNIT_ESCAPE_C, name, "LogExtraFields=%s", (char*) copy); | |||
1416 | ||||
1417 | copy = NULL((void*)0); | |||
1418 | } | |||
1419 | ||||
1420 | n++; | |||
1421 | } | |||
1422 | ||||
1423 | r = sd_bus_message_exit_container(message); | |||
1424 | if (r < 0) | |||
1425 | return r; | |||
1426 | ||||
1427 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0) && n == 0) { | |||
1428 | exec_context_free_log_extra_fields(c); | |||
1429 | unit_write_setting(u, flags, name, "LogExtraFields="); | |||
1430 | } | |||
1431 | ||||
1432 | return 1; | |||
1433 | } | |||
1434 | ||||
1435 | #if HAVE_SECCOMP1 | |||
1436 | ||||
1437 | if (streq(name, "SystemCallErrorNumber")(strcmp((name),("SystemCallErrorNumber")) == 0)) | |||
1438 | return bus_set_transient_errno(u, name, &c->syscall_errno, message, flags, error); | |||
1439 | ||||
1440 | if (streq(name, "SystemCallFilter")(strcmp((name),("SystemCallFilter")) == 0)) { | |||
1441 | int whitelist; | |||
1442 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
1443 | ||||
1444 | r = sd_bus_message_enter_container(message, 'r', "bas"); | |||
1445 | if (r < 0) | |||
1446 | return r; | |||
1447 | ||||
1448 | r = sd_bus_message_read(message, "b", &whitelist); | |||
1449 | if (r < 0) | |||
1450 | return r; | |||
1451 | ||||
1452 | r = sd_bus_message_read_strv(message, &l); | |||
1453 | if (r < 0) | |||
1454 | return r; | |||
1455 | ||||
1456 | r = sd_bus_message_exit_container(message); | |||
1457 | if (r < 0) | |||
1458 | return r; | |||
1459 | ||||
1460 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1461 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
1462 | bool_Bool invert = !whitelist; | |||
1463 | char **s; | |||
1464 | ||||
1465 | if (strv_isempty(l)) { | |||
1466 | c->syscall_whitelist = false0; | |||
1467 | c->syscall_filter = hashmap_free(c->syscall_filter); | |||
1468 | ||||
1469 | unit_write_settingf(u, flags, name, "SystemCallFilter="); | |||
1470 | return 1; | |||
1471 | } | |||
1472 | ||||
1473 | if (!c->syscall_filter) { | |||
1474 | c->syscall_filter = hashmap_new(NULL)internal_hashmap_new(((void*)0) ); | |||
1475 | if (!c->syscall_filter) | |||
1476 | return log_oom()log_oom_internal(LOG_REALM_SYSTEMD, "../src/core/dbus-execute.c" , 1476, __func__); | |||
1477 | ||||
1478 | c->syscall_whitelist = whitelist; | |||
1479 | ||||
1480 | if (c->syscall_whitelist) { | |||
1481 | r = seccomp_parse_syscall_filter("@default", -1, c->syscall_filter, SECCOMP_PARSE_WHITELIST | (invert ? SECCOMP_PARSE_INVERT : 0)); | |||
1482 | if (r < 0) | |||
1483 | return r; | |||
1484 | } | |||
1485 | } | |||
1486 | ||||
1487 | STRV_FOREACH(s, l)for ((s) = (l); (s) && *(s); (s)++) { | |||
1488 | _cleanup_free___attribute__((cleanup(freep))) char *n = NULL((void*)0); | |||
1489 | int e; | |||
1490 | ||||
1491 | r = parse_syscall_and_errno(*s, &n, &e); | |||
1492 | if (r < 0) | |||
1493 | return r; | |||
1494 | ||||
1495 | r = seccomp_parse_syscall_filter(n, e, c->syscall_filter, (invert ? SECCOMP_PARSE_INVERT : 0) | (c->syscall_whitelist ? SECCOMP_PARSE_WHITELIST : 0)); | |||
1496 | if (r < 0) | |||
1497 | return r; | |||
1498 | } | |||
1499 | ||||
1500 | joined = strv_join(l, " "); | |||
1501 | if (!joined) | |||
1502 | return -ENOMEM12; | |||
1503 | ||||
1504 | unit_write_settingf(u, flags, name, "SystemCallFilter=%s%s", whitelist ? "" : "~", joined); | |||
1505 | } | |||
1506 | ||||
1507 | return 1; | |||
1508 | ||||
1509 | } else if (streq(name, "SystemCallArchitectures")(strcmp((name),("SystemCallArchitectures")) == 0)) { | |||
1510 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
1511 | ||||
1512 | r = sd_bus_message_read_strv(message, &l); | |||
1513 | if (r < 0) | |||
1514 | return r; | |||
1515 | ||||
1516 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1517 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
1518 | ||||
1519 | if (strv_isempty(l)) | |||
1520 | c->syscall_archs = set_free(c->syscall_archs); | |||
1521 | else { | |||
1522 | char **s; | |||
1523 | ||||
1524 | r = set_ensure_allocated(&c->syscall_archs, NULL)internal_set_ensure_allocated(&c->syscall_archs, ((void *)0) ); | |||
1525 | if (r < 0) | |||
1526 | return r; | |||
1527 | ||||
1528 | STRV_FOREACH(s, l)for ((s) = (l); (s) && *(s); (s)++) { | |||
1529 | uint32_t a; | |||
1530 | ||||
1531 | r = seccomp_arch_from_string(*s, &a); | |||
1532 | if (r < 0) | |||
1533 | return r; | |||
1534 | ||||
1535 | r = set_put(c->syscall_archs, UINT32_TO_PTR(a + 1)((void *) ((uintptr_t) (a + 1)))); | |||
1536 | if (r < 0) | |||
1537 | return r; | |||
1538 | } | |||
1539 | ||||
1540 | } | |||
1541 | ||||
1542 | joined = strv_join(l, " "); | |||
1543 | if (!joined) | |||
1544 | return -ENOMEM12; | |||
1545 | ||||
1546 | unit_write_settingf(u, flags, name, "%s=%s", name, joined); | |||
1547 | } | |||
1548 | ||||
1549 | return 1; | |||
1550 | ||||
1551 | } else if (streq(name, "RestrictAddressFamilies")(strcmp((name),("RestrictAddressFamilies")) == 0)) { | |||
1552 | int whitelist; | |||
1553 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
1554 | ||||
1555 | r = sd_bus_message_enter_container(message, 'r', "bas"); | |||
1556 | if (r < 0) | |||
1557 | return r; | |||
1558 | ||||
1559 | r = sd_bus_message_read(message, "b", &whitelist); | |||
1560 | if (r < 0) | |||
1561 | return r; | |||
1562 | ||||
1563 | r = sd_bus_message_read_strv(message, &l); | |||
1564 | if (r < 0) | |||
1565 | return r; | |||
1566 | ||||
1567 | r = sd_bus_message_exit_container(message); | |||
1568 | if (r < 0) | |||
1569 | return r; | |||
1570 | ||||
1571 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1572 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
1573 | bool_Bool invert = !whitelist; | |||
1574 | char **s; | |||
1575 | ||||
1576 | if (strv_isempty(l)) { | |||
1577 | c->address_families_whitelist = false0; | |||
1578 | c->address_families = set_free(c->address_families); | |||
1579 | ||||
1580 | unit_write_settingf(u, flags, name, "RestrictAddressFamilies="); | |||
1581 | return 1; | |||
1582 | } | |||
1583 | ||||
1584 | if (!c->address_families) { | |||
1585 | c->address_families = set_new(NULL)internal_set_new(((void*)0) ); | |||
1586 | if (!c->address_families) | |||
1587 | return log_oom()log_oom_internal(LOG_REALM_SYSTEMD, "../src/core/dbus-execute.c" , 1587, __func__); | |||
1588 | ||||
1589 | c->address_families_whitelist = whitelist; | |||
1590 | } | |||
1591 | ||||
1592 | STRV_FOREACH(s, l)for ((s) = (l); (s) && *(s); (s)++) { | |||
1593 | int af; | |||
1594 | ||||
1595 | af = af_from_name(*s); | |||
1596 | if (af <= 0) | |||
1597 | return -EINVAL22; | |||
1598 | ||||
1599 | if (!invert == c->address_families_whitelist) { | |||
1600 | r = set_put(c->address_families, INT_TO_PTR(af)((void *) ((intptr_t) (af)))); | |||
1601 | if (r < 0) | |||
1602 | return r; | |||
1603 | } else | |||
1604 | (void) set_remove(c->address_families, INT_TO_PTR(af)((void *) ((intptr_t) (af)))); | |||
1605 | } | |||
1606 | ||||
1607 | joined = strv_join(l, " "); | |||
1608 | if (!joined) | |||
1609 | return -ENOMEM12; | |||
1610 | ||||
1611 | unit_write_settingf(u, flags, name, "RestrictAddressFamilies=%s%s", whitelist ? "" : "~", joined); | |||
1612 | } | |||
1613 | ||||
1614 | return 1; | |||
1615 | } | |||
1616 | #endif | |||
1617 | if (STR_IN_SET(name, "CPUAffinity", "NUMAMask")(!!strv_find((((char**) ((const char*[]) { "CPUAffinity", "NUMAMask" , ((void*)0) }))), (name)))) { | |||
1618 | const void *a; | |||
1619 | size_t n; | |||
1620 | bool_Bool affinity = streq(name, "CPUAffinity")(strcmp((name),("CPUAffinity")) == 0); | |||
1621 | _cleanup_(cpu_set_reset)__attribute__((cleanup(cpu_set_reset))) CPUSet set = {}; | |||
1622 | ||||
1623 | r = sd_bus_message_read_array(message, 'y', &a, &n); | |||
1624 | if (r < 0) | |||
1625 | return r; | |||
1626 | ||||
1627 | r = cpu_set_from_dbus(a, n, &set); | |||
1628 | if (r < 0) | |||
1629 | return r; | |||
1630 | ||||
1631 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1632 | if (n == 0) { | |||
1633 | cpu_set_reset(affinity ? &c->cpu_set : &c->numa_policy.nodes); | |||
1634 | unit_write_settingf(u, flags, name, "%s=", name); | |||
1635 | } else { | |||
1636 | _cleanup_free___attribute__((cleanup(freep))) char *str = NULL((void*)0); | |||
1637 | ||||
1638 | str = cpu_set_to_string(&set); | |||
1639 | if (!str) | |||
1640 | return -ENOMEM12; | |||
1641 | ||||
1642 | /* We forego any optimizations here, and always create the structure using | |||
1643 | * cpu_set_add_all(), because we don't want to care if the existing size we | |||
1644 | * got over dbus is appropriate. */ | |||
1645 | r = cpu_set_add_all(affinity ? &c->cpu_set : &c->numa_policy.nodes, &set); | |||
1646 | if (r < 0) | |||
1647 | return r; | |||
1648 | ||||
1649 | unit_write_settingf(u, flags, name, "%s=%s", name, str); | |||
1650 | } | |||
1651 | } | |||
1652 | ||||
1653 | return 1; | |||
1654 | ||||
1655 | } else if (streq(name, "CPUAffinityFromNUMA")(strcmp((name),("CPUAffinityFromNUMA")) == 0)) { | |||
1656 | int q; | |||
1657 | ||||
1658 | r = sd_bus_message_read_basic(message, 'b', &q); | |||
1659 | if (r < 0) | |||
1660 | return r; | |||
1661 | ||||
1662 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1663 | c->cpu_affinity_from_numa = q; | |||
1664 | unit_write_settingf(u, flags, name, "%s=%s", "CPUAffinity", "numa"); | |||
1665 | } | |||
1666 | ||||
1667 | return 1; | |||
1668 | ||||
1669 | } else if (streq(name, "NUMAPolicy")(strcmp((name),("NUMAPolicy")) == 0)) { | |||
1670 | int32_t type; | |||
1671 | ||||
1672 | r = sd_bus_message_read(message, "i", &type); | |||
1673 | if (r < 0) | |||
1674 | return r; | |||
1675 | ||||
1676 | if (!mpol_is_valid(type)) | |||
1677 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid NUMAPolicy value: %i", type); | |||
1678 | ||||
1679 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) | |||
1680 | c->numa_policy.type = type; | |||
1681 | ||||
1682 | return 1; | |||
1683 | ||||
1684 | } else if (streq(name, "IOSchedulingClass")(strcmp((name),("IOSchedulingClass")) == 0)) { | |||
1685 | int32_t q; | |||
1686 | ||||
1687 | r = sd_bus_message_read(message, "i", &q); | |||
1688 | if (r < 0) | |||
1689 | return r; | |||
1690 | ||||
1691 | if (!ioprio_class_is_valid(q)) | |||
1692 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid IO scheduling class: %i", q); | |||
1693 | ||||
1694 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1695 | _cleanup_free___attribute__((cleanup(freep))) char *s = NULL((void*)0); | |||
1696 | ||||
1697 | r = ioprio_class_to_string_alloc(q, &s); | |||
1698 | if (r < 0) | |||
1699 | return r; | |||
1700 | ||||
1701 | c->ioprio = IOPRIO_PRIO_VALUE(q, IOPRIO_PRIO_DATA(c->ioprio))(((q) << 13) | ((c->ioprio) & ((1UL << 13) - 1))); | |||
1702 | c->ioprio_set = true1; | |||
1703 | ||||
1704 | unit_write_settingf(u, flags, name, "IOSchedulingClass=%s", s); | |||
1705 | } | |||
1706 | ||||
1707 | return 1; | |||
1708 | ||||
1709 | } else if (streq(name, "IOSchedulingPriority")(strcmp((name),("IOSchedulingPriority")) == 0)) { | |||
1710 | int32_t p; | |||
1711 | ||||
1712 | r = sd_bus_message_read(message, "i", &p); | |||
1713 | if (r < 0) | |||
1714 | return r; | |||
1715 | ||||
1716 | if (!ioprio_priority_is_valid(p)) | |||
1717 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid IO scheduling priority: %i", p); | |||
1718 | ||||
1719 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1720 | c->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_PRIO_CLASS(c->ioprio), p)(((((c->ioprio) >> 13)) << 13) | p); | |||
1721 | c->ioprio_set = true1; | |||
1722 | ||||
1723 | unit_write_settingf(u, flags, name, "IOSchedulingPriority=%i", p); | |||
1724 | } | |||
1725 | ||||
1726 | return 1; | |||
1727 | ||||
1728 | } else if (streq(name, "WorkingDirectory")(strcmp((name),("WorkingDirectory")) == 0)) { | |||
1729 | const char *s; | |||
1730 | bool_Bool missing_ok; | |||
1731 | ||||
1732 | r = sd_bus_message_read(message, "s", &s); | |||
1733 | if (r < 0) | |||
1734 | return r; | |||
1735 | ||||
1736 | if (s[0] == '-') { | |||
1737 | missing_ok = true1; | |||
1738 | s++; | |||
1739 | } else | |||
1740 | missing_ok = false0; | |||
1741 | ||||
1742 | if (!isempty(s) && !streq(s, "~")(strcmp((s),("~")) == 0) && !path_is_absolute(s)) | |||
1743 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "WorkingDirectory= expects an absolute path or '~'"); | |||
1744 | ||||
1745 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1746 | if (streq(s, "~")(strcmp((s),("~")) == 0)) { | |||
1747 | c->working_directory = mfree(c->working_directory); | |||
1748 | c->working_directory_home = true1; | |||
1749 | } else { | |||
1750 | r = free_and_strdup(&c->working_directory, empty_to_null(s)); | |||
1751 | if (r < 0) | |||
1752 | return r; | |||
1753 | ||||
1754 | c->working_directory_home = false0; | |||
1755 | } | |||
1756 | ||||
1757 | c->working_directory_missing_ok = missing_ok; | |||
1758 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "WorkingDirectory=%s%s", missing_ok ? "-" : "", s); | |||
1759 | } | |||
1760 | ||||
1761 | return 1; | |||
1762 | ||||
1763 | } else if (STR_IN_SET(name,(!!strv_find((((char**) ((const char*[]) { "StandardInputFileDescriptorName" , "StandardOutputFileDescriptorName", "StandardErrorFileDescriptorName" , ((void*)0) }))), (name))) | |||
1764 | "StandardInputFileDescriptorName", "StandardOutputFileDescriptorName", "StandardErrorFileDescriptorName")(!!strv_find((((char**) ((const char*[]) { "StandardInputFileDescriptorName" , "StandardOutputFileDescriptorName", "StandardErrorFileDescriptorName" , ((void*)0) }))), (name)))) { | |||
1765 | const char *s; | |||
1766 | ||||
1767 | r = sd_bus_message_read(message, "s", &s); | |||
1768 | if (r < 0) | |||
1769 | return r; | |||
1770 | ||||
1771 | if (!isempty(s) && !fdname_is_valid(s)) | |||
1772 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid file descriptor name"); | |||
1773 | ||||
1774 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1775 | ||||
1776 | if (streq(name, "StandardInputFileDescriptorName")(strcmp((name),("StandardInputFileDescriptorName")) == 0)) { | |||
1777 | r = free_and_strdup(c->stdio_fdname + STDIN_FILENO0, empty_to_null(s)); | |||
1778 | if (r < 0) | |||
1779 | return r; | |||
1780 | ||||
1781 | c->std_input = EXEC_INPUT_NAMED_FD; | |||
1782 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "StandardInput=fd:%s", exec_context_fdname(c, STDIN_FILENO0)); | |||
1783 | ||||
1784 | } else if (streq(name, "StandardOutputFileDescriptorName")(strcmp((name),("StandardOutputFileDescriptorName")) == 0)) { | |||
1785 | r = free_and_strdup(c->stdio_fdname + STDOUT_FILENO1, empty_to_null(s)); | |||
1786 | if (r < 0) | |||
1787 | return r; | |||
1788 | ||||
1789 | c->std_output = EXEC_OUTPUT_NAMED_FD; | |||
1790 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "StandardOutput=fd:%s", exec_context_fdname(c, STDOUT_FILENO1)); | |||
1791 | ||||
1792 | } else { | |||
1793 | assert(streq(name, "StandardErrorFileDescriptorName"))do { if ((__builtin_expect(!!(!((strcmp((name),("StandardErrorFileDescriptorName" )) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(name, \"StandardErrorFileDescriptorName\")" ), "../src/core/dbus-execute.c", 1793, __PRETTY_FUNCTION__); } while (0); | |||
1794 | ||||
1795 | r = free_and_strdup(&c->stdio_fdname[STDERR_FILENO2], empty_to_null(s)); | |||
1796 | if (r < 0) | |||
1797 | return r; | |||
1798 | ||||
1799 | c->std_error = EXEC_OUTPUT_NAMED_FD; | |||
1800 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "StandardError=fd:%s", exec_context_fdname(c, STDERR_FILENO2)); | |||
1801 | } | |||
1802 | } | |||
1803 | ||||
1804 | return 1; | |||
1805 | ||||
1806 | } else if (STR_IN_SET(name,(!!strv_find((((char**) ((const char*[]) { "StandardInputFile" , "StandardOutputFile", "StandardOutputFileToCreate", "StandardOutputFileToAppend" , "StandardErrorFile", "StandardErrorFileToCreate", "StandardErrorFileToAppend" , ((void*)0) }))), (name))) | |||
1807 | "StandardInputFile",(!!strv_find((((char**) ((const char*[]) { "StandardInputFile" , "StandardOutputFile", "StandardOutputFileToCreate", "StandardOutputFileToAppend" , "StandardErrorFile", "StandardErrorFileToCreate", "StandardErrorFileToAppend" , ((void*)0) }))), (name))) | |||
1808 | "StandardOutputFile", "StandardOutputFileToCreate", "StandardOutputFileToAppend",(!!strv_find((((char**) ((const char*[]) { "StandardInputFile" , "StandardOutputFile", "StandardOutputFileToCreate", "StandardOutputFileToAppend" , "StandardErrorFile", "StandardErrorFileToCreate", "StandardErrorFileToAppend" , ((void*)0) }))), (name))) | |||
1809 | "StandardErrorFile", "StandardErrorFileToCreate", "StandardErrorFileToAppend")(!!strv_find((((char**) ((const char*[]) { "StandardInputFile" , "StandardOutputFile", "StandardOutputFileToCreate", "StandardOutputFileToAppend" , "StandardErrorFile", "StandardErrorFileToCreate", "StandardErrorFileToAppend" , ((void*)0) }))), (name)))) { | |||
1810 | const char *s; | |||
1811 | ||||
1812 | r = sd_bus_message_read(message, "s", &s); | |||
1813 | if (r < 0) | |||
1814 | return r; | |||
1815 | ||||
1816 | if (!isempty(s)) { | |||
1817 | if (!path_is_absolute(s)) | |||
1818 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path %s is not absolute", s); | |||
1819 | if (!path_is_normalized(s)) | |||
1820 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path %s is not normalized", s); | |||
1821 | } | |||
1822 | ||||
1823 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1824 | ||||
1825 | if (streq(name, "StandardInputFile")(strcmp((name),("StandardInputFile")) == 0)) { | |||
1826 | r = free_and_strdup(&c->stdio_file[STDIN_FILENO0], empty_to_null(s)); | |||
1827 | if (r < 0) | |||
1828 | return r; | |||
1829 | ||||
1830 | c->std_input = EXEC_INPUT_FILE; | |||
1831 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "StandardInput=file:%s", s); | |||
1832 | ||||
1833 | } else if (STR_IN_SET(name, "StandardOutputFile", "StandardOutputFileToAppend")(!!strv_find((((char**) ((const char*[]) { "StandardOutputFile" , "StandardOutputFileToAppend", ((void*)0) }))), (name)))) { | |||
1834 | r = free_and_strdup(&c->stdio_file[STDOUT_FILENO1], empty_to_null(s)); | |||
1835 | if (r < 0) | |||
1836 | return r; | |||
1837 | ||||
1838 | if (streq(name, "StandardOutputFile")(strcmp((name),("StandardOutputFile")) == 0)) { | |||
1839 | c->std_output = EXEC_OUTPUT_FILE; | |||
1840 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "StandardOutput=file:%s", s); | |||
1841 | } else { | |||
1842 | assert(streq(name, "StandardOutputFileToAppend"))do { if ((__builtin_expect(!!(!((strcmp((name),("StandardOutputFileToAppend" )) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(name, \"StandardOutputFileToAppend\")" ), "../src/core/dbus-execute.c", 1842, __PRETTY_FUNCTION__); } while (0); | |||
1843 | c->std_output = EXEC_OUTPUT_FILE_APPEND; | |||
1844 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "StandardOutput=append:%s", s); | |||
1845 | } | |||
1846 | } else { | |||
1847 | assert(STR_IN_SET(name, "StandardErrorFile", "StandardErrorFileToAppend"))do { if ((__builtin_expect(!!(!((!!strv_find((((char**) ((const char*[]) { "StandardErrorFile", "StandardErrorFileToAppend", ((void*)0) }))), (name))))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("STR_IN_SET(name, \"StandardErrorFile\", \"StandardErrorFileToAppend\")" ), "../src/core/dbus-execute.c", 1847, __PRETTY_FUNCTION__); } while (0); | |||
1848 | ||||
1849 | r = free_and_strdup(&c->stdio_file[STDERR_FILENO2], empty_to_null(s)); | |||
1850 | if (r < 0) | |||
1851 | return r; | |||
1852 | ||||
1853 | if (streq(name, "StandardErrorFile")(strcmp((name),("StandardErrorFile")) == 0)) { | |||
1854 | c->std_error = EXEC_OUTPUT_FILE; | |||
1855 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "StandardOutput=file:%s", s); | |||
1856 | } else { | |||
1857 | assert(streq(name, "StandardErrorFileToAppend"))do { if ((__builtin_expect(!!(!((strcmp((name),("StandardErrorFileToAppend" )) == 0))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("streq(name, \"StandardErrorFileToAppend\")" ), "../src/core/dbus-execute.c", 1857, __PRETTY_FUNCTION__); } while (0); | |||
1858 | c->std_error = EXEC_OUTPUT_FILE_APPEND; | |||
1859 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "StandardOutput=append:%s", s); | |||
1860 | } | |||
1861 | } | |||
1862 | } | |||
1863 | ||||
1864 | return 1; | |||
1865 | ||||
1866 | } else if (streq(name, "StandardInputData")(strcmp((name),("StandardInputData")) == 0)) { | |||
1867 | const void *p; | |||
1868 | size_t sz; | |||
1869 | ||||
1870 | r = sd_bus_message_read_array(message, 'y', &p, &sz); | |||
1871 | if (r < 0) | |||
1872 | return r; | |||
1873 | ||||
1874 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1875 | _cleanup_free___attribute__((cleanup(freep))) char *encoded = NULL((void*)0); | |||
1876 | ||||
1877 | if (sz == 0) { | |||
1878 | c->stdin_data = mfree(c->stdin_data); | |||
1879 | c->stdin_data_size = 0; | |||
1880 | ||||
1881 | unit_write_settingf(u, flags, name, "StandardInputData="); | |||
1882 | } else { | |||
1883 | void *q; | |||
1884 | ssize_t n; | |||
1885 | ||||
1886 | if (c->stdin_data_size + sz < c->stdin_data_size || /* check for overflow */ | |||
1887 | c->stdin_data_size + sz > EXEC_STDIN_DATA_MAX(64U*1024U*1024U)) | |||
1888 | return -E2BIG7; | |||
1889 | ||||
1890 | n = base64mem(p, sz, &encoded); | |||
1891 | if (n < 0) | |||
1892 | return (int) n; | |||
1893 | ||||
1894 | q = realloc(c->stdin_data, c->stdin_data_size + sz); | |||
1895 | if (!q) | |||
1896 | return -ENOMEM12; | |||
1897 | ||||
1898 | memcpy((uint8_t*) q + c->stdin_data_size, p, sz); | |||
1899 | ||||
1900 | c->stdin_data = q; | |||
1901 | c->stdin_data_size += sz; | |||
1902 | ||||
1903 | unit_write_settingf(u, flags, name, "StandardInputData=%s", encoded); | |||
1904 | } | |||
1905 | } | |||
1906 | ||||
1907 | return 1; | |||
1908 | ||||
1909 | } else if (streq(name, "Environment")(strcmp((name),("Environment")) == 0)) { | |||
1910 | ||||
1911 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
1912 | ||||
1913 | r = sd_bus_message_read_strv(message, &l); | |||
1914 | if (r < 0) | |||
1915 | return r; | |||
1916 | ||||
1917 | if (!strv_env_is_valid(l)) | |||
1918 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid environment block."); | |||
1919 | ||||
1920 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1921 | if (strv_isempty(l)) { | |||
1922 | c->environment = strv_free(c->environment); | |||
1923 | unit_write_setting(u, flags, name, "Environment="); | |||
1924 | } else { | |||
1925 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
1926 | char **e; | |||
1927 | ||||
1928 | joined = unit_concat_strv(l, UNIT_ESCAPE_SPECIFIERS|UNIT_ESCAPE_C); | |||
1929 | if (!joined) | |||
1930 | return -ENOMEM12; | |||
1931 | ||||
1932 | e = strv_env_merge(2, c->environment, l); | |||
1933 | if (!e) | |||
1934 | return -ENOMEM12; | |||
1935 | ||||
1936 | strv_free_and_replace(c->environment, e)({ strv_free(c->environment); (c->environment) = (e); ( e) = ((void*)0); 0; }); | |||
1937 | unit_write_settingf(u, flags, name, "Environment=%s", joined); | |||
1938 | } | |||
1939 | } | |||
1940 | ||||
1941 | return 1; | |||
1942 | ||||
1943 | } else if (streq(name, "UnsetEnvironment")(strcmp((name),("UnsetEnvironment")) == 0)) { | |||
1944 | ||||
1945 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
1946 | ||||
1947 | r = sd_bus_message_read_strv(message, &l); | |||
1948 | if (r < 0) | |||
1949 | return r; | |||
1950 | ||||
1951 | if (!strv_env_name_or_assignment_is_valid(l)) | |||
1952 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid UnsetEnvironment= list."); | |||
1953 | ||||
1954 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1955 | if (strv_isempty(l)) { | |||
1956 | c->unset_environment = strv_free(c->unset_environment); | |||
1957 | unit_write_setting(u, flags, name, "UnsetEnvironment="); | |||
1958 | } else { | |||
1959 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
1960 | char **e; | |||
1961 | ||||
1962 | joined = unit_concat_strv(l, UNIT_ESCAPE_SPECIFIERS|UNIT_ESCAPE_C); | |||
1963 | if (!joined) | |||
1964 | return -ENOMEM12; | |||
1965 | ||||
1966 | e = strv_env_merge(2, c->unset_environment, l); | |||
1967 | if (!e) | |||
1968 | return -ENOMEM12; | |||
1969 | ||||
1970 | strv_free_and_replace(c->unset_environment, e)({ strv_free(c->unset_environment); (c->unset_environment ) = (e); (e) = ((void*)0); 0; }); | |||
1971 | unit_write_settingf(u, flags, name, "UnsetEnvironment=%s", joined); | |||
1972 | } | |||
1973 | } | |||
1974 | ||||
1975 | return 1; | |||
1976 | ||||
1977 | } else if (streq(name, "OOMScoreAdjust")(strcmp((name),("OOMScoreAdjust")) == 0)) { | |||
1978 | int oa; | |||
1979 | ||||
1980 | r = sd_bus_message_read(message, "i", &oa); | |||
1981 | if (r < 0) | |||
1982 | return r; | |||
1983 | ||||
1984 | if (!oom_score_adjust_is_valid(oa)) | |||
1985 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "OOM score adjust value out of range"); | |||
1986 | ||||
1987 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
1988 | c->oom_score_adjust = oa; | |||
1989 | c->oom_score_adjust_set = true1; | |||
1990 | unit_write_settingf(u, flags, name, "OOMScoreAdjust=%i", oa); | |||
1991 | } | |||
1992 | ||||
1993 | return 1; | |||
1994 | ||||
1995 | } else if (streq(name, "EnvironmentFiles")(strcmp((name),("EnvironmentFiles")) == 0)) { | |||
1996 | ||||
1997 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
1998 | _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0); | |||
1999 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
2000 | size_t size = 0; | |||
2001 | char **i; | |||
2002 | ||||
2003 | r = sd_bus_message_enter_container(message, 'a', "(sb)"); | |||
2004 | if (r < 0) | |||
2005 | return r; | |||
2006 | ||||
2007 | f = open_memstream(&joined, &size); | |||
2008 | if (!f) | |||
2009 | return -ENOMEM12; | |||
2010 | ||||
2011 | (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER); | |||
2012 | ||||
2013 | fputs("EnvironmentFile=\n", f); | |||
2014 | ||||
2015 | STRV_FOREACH(i, c->environment_files)for ((i) = (c->environment_files); (i) && *(i); (i )++) { | |||
2016 | _cleanup_free___attribute__((cleanup(freep))) char *q = NULL((void*)0); | |||
2017 | ||||
2018 | q = specifier_escape(*i); | |||
2019 | if (!q) | |||
2020 | return -ENOMEM12; | |||
2021 | ||||
2022 | fprintf(f, "EnvironmentFile=%s\n", q); | |||
2023 | } | |||
2024 | ||||
2025 | while ((r = sd_bus_message_enter_container(message, 'r', "sb")) > 0) { | |||
2026 | const char *path; | |||
2027 | int b; | |||
2028 | ||||
2029 | r = sd_bus_message_read(message, "sb", &path, &b); | |||
2030 | if (r < 0) | |||
2031 | return r; | |||
2032 | ||||
2033 | r = sd_bus_message_exit_container(message); | |||
2034 | if (r < 0) | |||
2035 | return r; | |||
2036 | ||||
2037 | if (!path_is_absolute(path)) | |||
2038 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path %s is not absolute.", path); | |||
2039 | ||||
2040 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
2041 | _cleanup_free___attribute__((cleanup(freep))) char *q = NULL((void*)0); | |||
2042 | char *buf; | |||
2043 | ||||
2044 | buf = strjoin(b ? "-" : "", path)strjoin_real((b ? "-" : ""), path, ((void*)0)); | |||
2045 | if (!buf) | |||
2046 | return -ENOMEM12; | |||
2047 | ||||
2048 | q = specifier_escape(buf); | |||
2049 | if (!q) { | |||
2050 | free(buf); | |||
2051 | return -ENOMEM12; | |||
2052 | } | |||
2053 | ||||
2054 | fprintf(f, "EnvironmentFile=%s\n", q); | |||
2055 | ||||
2056 | r = strv_consume(&l, buf); | |||
2057 | if (r < 0) | |||
2058 | return r; | |||
2059 | } | |||
2060 | } | |||
2061 | if (r < 0) | |||
2062 | return r; | |||
2063 | ||||
2064 | r = sd_bus_message_exit_container(message); | |||
2065 | if (r < 0) | |||
2066 | return r; | |||
2067 | ||||
2068 | r = fflush_and_check(f); | |||
2069 | if (r < 0) | |||
2070 | return r; | |||
2071 | ||||
2072 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
2073 | if (strv_isempty(l)) { | |||
2074 | c->environment_files = strv_free(c->environment_files); | |||
2075 | unit_write_setting(u, flags, name, "EnvironmentFile="); | |||
2076 | } else { | |||
2077 | r = strv_extend_strv(&c->environment_files, l, true1); | |||
2078 | if (r < 0) | |||
2079 | return r; | |||
2080 | ||||
2081 | unit_write_setting(u, flags, name, joined); | |||
2082 | } | |||
2083 | } | |||
2084 | ||||
2085 | return 1; | |||
2086 | ||||
2087 | } else if (streq(name, "PassEnvironment")(strcmp((name),("PassEnvironment")) == 0)) { | |||
2088 | ||||
2089 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
2090 | ||||
2091 | r = sd_bus_message_read_strv(message, &l); | |||
2092 | if (r < 0) | |||
2093 | return r; | |||
2094 | ||||
2095 | if (!strv_env_name_is_valid(l)) | |||
2096 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid PassEnvironment= block."); | |||
2097 | ||||
2098 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
2099 | if (strv_isempty(l)) { | |||
2100 | c->pass_environment = strv_free(c->pass_environment); | |||
2101 | unit_write_setting(u, flags, name, "PassEnvironment="); | |||
2102 | } else { | |||
2103 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
2104 | ||||
2105 | r = strv_extend_strv(&c->pass_environment, l, true1); | |||
2106 | if (r < 0) | |||
2107 | return r; | |||
2108 | ||||
2109 | /* We write just the new settings out to file, with unresolved specifiers. */ | |||
2110 | joined = unit_concat_strv(l, UNIT_ESCAPE_SPECIFIERS); | |||
2111 | if (!joined) | |||
2112 | return -ENOMEM12; | |||
2113 | ||||
2114 | unit_write_settingf(u, flags, name, "PassEnvironment=%s", joined); | |||
2115 | } | |||
2116 | } | |||
2117 | ||||
2118 | return 1; | |||
2119 | ||||
2120 | } else if (STR_IN_SET(name, "ReadWriteDirectories", "ReadOnlyDirectories", "InaccessibleDirectories",(!!strv_find((((char**) ((const char*[]) { "ReadWriteDirectories" , "ReadOnlyDirectories", "InaccessibleDirectories", "ReadWritePaths" , "ReadOnlyPaths", "InaccessiblePaths", ((void*)0) }))), (name ))) | |||
2121 | "ReadWritePaths", "ReadOnlyPaths", "InaccessiblePaths")(!!strv_find((((char**) ((const char*[]) { "ReadWriteDirectories" , "ReadOnlyDirectories", "InaccessibleDirectories", "ReadWritePaths" , "ReadOnlyPaths", "InaccessiblePaths", ((void*)0) }))), (name )))) { | |||
2122 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
2123 | char ***dirs; | |||
2124 | char **p; | |||
2125 | ||||
2126 | r = sd_bus_message_read_strv(message, &l); | |||
2127 | if (r < 0) | |||
2128 | return r; | |||
2129 | ||||
2130 | STRV_FOREACH(p, l)for ((p) = (l); (p) && *(p); (p)++) { | |||
2131 | char *i = *p; | |||
2132 | size_t offset; | |||
2133 | ||||
2134 | offset = i[0] == '-'; | |||
2135 | offset += i[offset] == '+'; | |||
2136 | if (!path_is_absolute(i + offset)) | |||
2137 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid %s", name); | |||
2138 | ||||
2139 | path_simplify(i + offset, false0); | |||
2140 | } | |||
2141 | ||||
2142 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
2143 | if (STR_IN_SET(name, "ReadWriteDirectories", "ReadWritePaths")(!!strv_find((((char**) ((const char*[]) { "ReadWriteDirectories" , "ReadWritePaths", ((void*)0) }))), (name)))) | |||
2144 | dirs = &c->read_write_paths; | |||
2145 | else if (STR_IN_SET(name, "ReadOnlyDirectories", "ReadOnlyPaths")(!!strv_find((((char**) ((const char*[]) { "ReadOnlyDirectories" , "ReadOnlyPaths", ((void*)0) }))), (name)))) | |||
2146 | dirs = &c->read_only_paths; | |||
2147 | else /* "InaccessiblePaths" */ | |||
2148 | dirs = &c->inaccessible_paths; | |||
2149 | ||||
2150 | if (strv_isempty(l)) { | |||
2151 | *dirs = strv_free(*dirs); | |||
2152 | unit_write_settingf(u, flags, name, "%s=", name); | |||
2153 | } else { | |||
2154 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
2155 | ||||
2156 | joined = unit_concat_strv(l, UNIT_ESCAPE_SPECIFIERS); | |||
2157 | if (!joined) | |||
2158 | return -ENOMEM12; | |||
2159 | ||||
2160 | r = strv_extend_strv(dirs, l, true1); | |||
2161 | if (r < 0) | |||
2162 | return -ENOMEM12; | |||
2163 | ||||
2164 | unit_write_settingf(u, flags, name, "%s=%s", name, joined); | |||
2165 | } | |||
2166 | } | |||
2167 | ||||
2168 | return 1; | |||
2169 | ||||
2170 | } else if (STR_IN_SET(name, "RuntimeDirectory", "StateDirectory", "CacheDirectory", "LogsDirectory", "ConfigurationDirectory")(!!strv_find((((char**) ((const char*[]) { "RuntimeDirectory" , "StateDirectory", "CacheDirectory", "LogsDirectory", "ConfigurationDirectory" , ((void*)0) }))), (name)))) { | |||
2171 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
2172 | char **p; | |||
2173 | ||||
2174 | r = sd_bus_message_read_strv(message, &l); | |||
2175 | if (r < 0) | |||
2176 | return r; | |||
2177 | ||||
2178 | STRV_FOREACH(p, l)for ((p) = (l); (p) && *(p); (p)++) { | |||
2179 | if (!path_is_normalized(*p)) | |||
2180 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "%s= path is not normalized: %s", name, *p); | |||
2181 | ||||
2182 | if (path_is_absolute(*p)) | |||
2183 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "%s= path is absolute: %s", name, *p); | |||
2184 | ||||
2185 | if (path_startswith(*p, "private")) | |||
2186 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "%s= path can't be 'private': %s", name, *p); | |||
2187 | } | |||
2188 | ||||
2189 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
2190 | char ***dirs = NULL((void*)0); | |||
2191 | ExecDirectoryType i; | |||
2192 | ||||
2193 | for (i = 0; i < _EXEC_DIRECTORY_TYPE_MAX; i++) | |||
2194 | if (streq(name, exec_directory_type_to_string(i))(strcmp((name),(exec_directory_type_to_string(i))) == 0)) { | |||
2195 | dirs = &c->directories[i].paths; | |||
2196 | break; | |||
2197 | } | |||
2198 | ||||
2199 | assert(dirs)do { if ((__builtin_expect(!!(!(dirs)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("dirs"), "../src/core/dbus-execute.c", 2199 , __PRETTY_FUNCTION__); } while (0); | |||
2200 | ||||
2201 | if (strv_isempty(l)) { | |||
2202 | *dirs = strv_free(*dirs); | |||
2203 | unit_write_settingf(u, flags, name, "%s=", name); | |||
2204 | } else { | |||
2205 | _cleanup_free___attribute__((cleanup(freep))) char *joined = NULL((void*)0); | |||
2206 | ||||
2207 | r = strv_extend_strv(dirs, l, true1); | |||
2208 | if (r < 0) | |||
2209 | return -ENOMEM12; | |||
2210 | ||||
2211 | joined = unit_concat_strv(l, UNIT_ESCAPE_SPECIFIERS); | |||
2212 | if (!joined) | |||
2213 | return -ENOMEM12; | |||
2214 | ||||
2215 | unit_write_settingf(u, flags, name, "%s=%s", name, joined); | |||
2216 | } | |||
2217 | } | |||
2218 | ||||
2219 | return 1; | |||
2220 | ||||
2221 | } else if (STR_IN_SET(name, "AppArmorProfile", "SmackProcessLabel")(!!strv_find((((char**) ((const char*[]) { "AppArmorProfile", "SmackProcessLabel", ((void*)0) }))), (name)))) { | |||
2222 | int ignore; | |||
2223 | const char *s; | |||
2224 | ||||
2225 | r = sd_bus_message_read(message, "(bs)", &ignore, &s); | |||
2226 | if (r < 0) | |||
2227 | return r; | |||
2228 | ||||
2229 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
2230 | char **p; | |||
2231 | bool_Bool *b; | |||
2232 | ||||
2233 | if (streq(name, "AppArmorProfile")(strcmp((name),("AppArmorProfile")) == 0)) { | |||
2234 | p = &c->apparmor_profile; | |||
2235 | b = &c->apparmor_profile_ignore; | |||
2236 | } else { /* "SmackProcessLabel" */ | |||
2237 | p = &c->smack_process_label; | |||
2238 | b = &c->smack_process_label_ignore; | |||
2239 | } | |||
2240 | ||||
2241 | if (isempty(s)) { | |||
2242 | *p = mfree(*p); | |||
2243 | *b = false0; | |||
2244 | } else { | |||
2245 | if (free_and_strdup(p, s) < 0) | |||
2246 | return -ENOMEM12; | |||
2247 | *b = ignore; | |||
2248 | } | |||
2249 | ||||
2250 | unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "%s=%s%s", name, ignore ? "-" : "", strempty(s)); | |||
2251 | } | |||
2252 | ||||
2253 | return 1; | |||
2254 | ||||
2255 | } else if (STR_IN_SET(name, "BindPaths", "BindReadOnlyPaths")(!!strv_find((((char**) ((const char*[]) { "BindPaths", "BindReadOnlyPaths" , ((void*)0) }))), (name)))) { | |||
2256 | const char *source, *destination; | |||
2257 | int ignore_enoent; | |||
2258 | uint64_t mount_flags; | |||
2259 | bool_Bool empty = true1; | |||
2260 | ||||
2261 | r = sd_bus_message_enter_container(message, 'a', "(ssbt)"); | |||
2262 | if (r < 0) | |||
2263 | return r; | |||
2264 | ||||
2265 | while ((r = sd_bus_message_read(message, "(ssbt)", &source, &destination, &ignore_enoent, &mount_flags)) > 0) { | |||
2266 | ||||
2267 | if (!path_is_absolute(source)) | |||
2268 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Source path %s is not absolute.", source); | |||
2269 | if (!path_is_absolute(destination)) | |||
2270 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Destination path %s is not absolute.", destination); | |||
2271 | if (!IN_SET(mount_flags, 0, MS_REC)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended [20 - sizeof((int[]){0, MS_REC})/sizeof(int)]; switch(mount_flags ) { case 0: case MS_REC: _found = 1; break; default: break; } _found; })) | |||
2272 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Unknown mount flags."); | |||
2273 | ||||
2274 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
2275 | r = bind_mount_add(&c->bind_mounts, &c->n_bind_mounts, | |||
2276 | &(BindMount) { | |||
2277 | .source = strdup(source), | |||
2278 | .destination = strdup(destination), | |||
2279 | .read_only = !!strstr(name, "ReadOnly"), | |||
2280 | .recursive = !!(mount_flags & MS_RECMS_REC), | |||
2281 | .ignore_enoent = ignore_enoent, | |||
2282 | }); | |||
2283 | if (r < 0) | |||
2284 | return r; | |||
2285 | ||||
2286 | unit_write_settingf( | |||
2287 | u, flags|UNIT_ESCAPE_SPECIFIERS, name, | |||
2288 | "%s=%s%s:%s:%s", | |||
2289 | name, | |||
2290 | ignore_enoent ? "-" : "", | |||
2291 | source, | |||
2292 | destination, | |||
2293 | (mount_flags & MS_RECMS_REC) ? "rbind" : "norbind"); | |||
2294 | } | |||
2295 | ||||
2296 | empty = false0; | |||
2297 | } | |||
2298 | if (r < 0) | |||
2299 | return r; | |||
2300 | ||||
2301 | r = sd_bus_message_exit_container(message); | |||
2302 | if (r < 0) | |||
2303 | return r; | |||
2304 | ||||
2305 | if (empty) { | |||
2306 | bind_mount_free_many(c->bind_mounts, c->n_bind_mounts); | |||
2307 | c->bind_mounts = NULL((void*)0); | |||
2308 | c->n_bind_mounts = 0; | |||
2309 | ||||
2310 | unit_write_settingf(u, flags, name, "%s=", name); | |||
2311 | } | |||
2312 | ||||
2313 | return 1; | |||
2314 | ||||
2315 | } else if (streq(name, "TemporaryFileSystem")(strcmp((name),("TemporaryFileSystem")) == 0)) { | |||
2316 | const char *path, *options; | |||
2317 | bool_Bool empty = true1; | |||
2318 | ||||
2319 | r = sd_bus_message_enter_container(message, 'a', "(ss)"); | |||
2320 | if (r < 0) | |||
2321 | return r; | |||
2322 | ||||
2323 | while ((r = sd_bus_message_read(message, "(ss)", &path, &options)) > 0) { | |||
2324 | ||||
2325 | if (!path_is_absolute(path)) | |||
2326 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Mount point %s is not absolute.", path); | |||
2327 | ||||
2328 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
2329 | r = temporary_filesystem_add(&c->temporary_filesystems, &c->n_temporary_filesystems, path, options); | |||
2330 | if (r < 0) | |||
2331 | return r; | |||
2332 | ||||
2333 | unit_write_settingf( | |||
2334 | u, flags|UNIT_ESCAPE_SPECIFIERS, name, | |||
2335 | "%s=%s:%s", | |||
2336 | name, | |||
2337 | path, | |||
2338 | options); | |||
2339 | } | |||
2340 | ||||
2341 | empty = false0; | |||
2342 | } | |||
2343 | if (r < 0) | |||
2344 | return r; | |||
2345 | ||||
2346 | r = sd_bus_message_exit_container(message); | |||
2347 | if (r < 0) | |||
2348 | return r; | |||
2349 | ||||
2350 | if (empty) { | |||
2351 | temporary_filesystem_free_many(c->temporary_filesystems, c->n_temporary_filesystems); | |||
2352 | c->temporary_filesystems = NULL((void*)0); | |||
2353 | c->n_temporary_filesystems = 0; | |||
2354 | ||||
2355 | unit_write_settingf(u, flags, name, "%s=", name); | |||
2356 | } | |||
2357 | ||||
2358 | return 1; | |||
2359 | ||||
2360 | } else if ((suffix = startswith(name, "Limit"))) { | |||
2361 | const char *soft = NULL((void*)0); | |||
2362 | int ri; | |||
2363 | ||||
2364 | ri = rlimit_from_string(suffix); | |||
2365 | if (ri < 0) { | |||
2366 | soft = endswith(suffix, "Soft"); | |||
2367 | if (soft) { | |||
2368 | const char *n; | |||
2369 | ||||
2370 | n = strndupa(suffix, soft - suffix)(__extension__ ({ const char *__old = (suffix); size_t __len = strnlen (__old, (soft - suffix)); char *__new = (char *) __builtin_alloca (__len + 1); __new[__len] = '\0'; (char *) memcpy (__new, __old , __len); })); | |||
2371 | ri = rlimit_from_string(n); | |||
2372 | if (ri >= 0) | |||
2373 | name = strjoina("Limit", n)({ const char *_appendees_[] = { "Limit", n }; char *_d_, *_p_ ; size_t _len_ = 0; size_t _i_; for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr( !__builtin_types_compatible_p(typeof (_appendees_), typeof(&*(_appendees_))), sizeof(_appendees_ )/sizeof((_appendees_)[0]), ((void)0))) && _appendees_ [_i_]; _i_++) _len_ += strlen(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1); for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr ( !__builtin_types_compatible_p(typeof(_appendees_), typeof(& *(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0] ), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy (_p_, _appendees_[_i_]); *_p_ = 0; _d_; }); | |||
2374 | } | |||
2375 | } | |||
2376 | ||||
2377 | if (ri >= 0) { | |||
2378 | uint64_t rl; | |||
2379 | rlim_t x; | |||
2380 | ||||
2381 | r = sd_bus_message_read(message, "t", &rl); | |||
2382 | if (r < 0) | |||
2383 | return r; | |||
2384 | ||||
2385 | if (rl == (uint64_t) -1) | |||
2386 | x = RLIM_INFINITY0xffffffffffffffffuLL; | |||
2387 | else { | |||
2388 | x = (rlim_t) rl; | |||
2389 | ||||
2390 | if ((uint64_t) x != rl) | |||
2391 | return -ERANGE34; | |||
2392 | } | |||
2393 | ||||
2394 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { | |||
2395 | _cleanup_free___attribute__((cleanup(freep))) char *f = NULL((void*)0); | |||
2396 | struct rlimit nl; | |||
2397 | ||||
2398 | if (c->rlimit[ri]) { | |||
2399 | nl = *c->rlimit[ri]; | |||
2400 | ||||
2401 | if (soft) | |||
2402 | nl.rlim_cur = x; | |||
2403 | else | |||
2404 | nl.rlim_max = x; | |||
2405 | } else | |||
2406 | /* When the resource limit is not initialized yet, then assign the value to both fields */ | |||
2407 | nl = (struct rlimit) { | |||
2408 | .rlim_cur = x, | |||
2409 | .rlim_max = x, | |||
2410 | }; | |||
2411 | ||||
2412 | r = rlimit_format(&nl, &f); | |||
2413 | if (r < 0) | |||
2414 | return r; | |||
2415 | ||||
2416 | if (c->rlimit[ri]) | |||
2417 | *c->rlimit[ri] = nl; | |||
2418 | else { | |||
2419 | c->rlimit[ri] = newdup(struct rlimit, &nl, 1)((struct rlimit*) memdup_multiply(&nl, sizeof(struct rlimit ), (1))); | |||
2420 | if (!c->rlimit[ri]) | |||
2421 | return -ENOMEM12; | |||
2422 | } | |||
2423 | ||||
2424 | unit_write_settingf(u, flags, name, "%s=%s", name, f); | |||
2425 | } | |||
2426 | ||||
2427 | return 1; | |||
2428 | } | |||
2429 | ||||
2430 | } | |||
2431 | ||||
2432 | return 0; | |||
2433 | } |