dbus-execute.c revision 06f2ccf949efd111d298302b632be8a085dea26b
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen This file is part of systemd.
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen Copyright 2010 Lennart Poettering
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen systemd is free software; you can redistribute it and/or modify it
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen under the terms of the GNU Lesser General Public License as published by
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen (at your option) any later version.
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen systemd is distributed in the hope that it will be useful, but
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen Lesser General Public License for more details.
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen You should have received a copy of the GNU Lesser General Public License
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
ee104e11e303499a637c5cd8157bd12ad5cc116dLennart PoetteringBUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersenstatic BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersenstatic BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_utmp_mode, exec_utmp_mode, ExecUtmpMode);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersenstatic BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_protect_home, protect_home, ProtectHome);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersenstatic BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_protect_system, protect_system, ProtectSystem);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_open_container(reply, 'a', "(sb)");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *fn = *j;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_append(reply, "(sb)", fn[0] == '-' ? fn + 1 : fn, fn[0] == '-');
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen /* rlim_t might have different sizes, let's map
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen * RLIMIT_INFINITY to (uint64_t) -1, so that it is the same on
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen * all archs */
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen u = x == RLIM_INFINITY ? (uint64_t) -1 : (uint64_t) x;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen if (read_one_line_file("/proc/self/oom_score_adj", &t) >= 0)
e53fc357a9bb9d0a5362ccc4246d598cb0febd5eLennart Poettering return sd_bus_message_append(reply, "i", n);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen struct sched_param p = {};
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen if (sched_getparam(0, &p) >= 0)
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append_array(reply, 'y', c->cpuset, CPU_ALLOC_SIZE(c->cpuset_ncpus));
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append_array(reply, 'y', NULL, 0);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersenstatic int property_get_capability_bounding_set(
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen /* We store this negated internally, to match the kernel, but
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen * we expose it normalized. */
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append(reply, "t", ~c->capability_bounding_set_drop);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *s;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_open_container(reply, 'r', "bas");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_append(reply, "b", c->syscall_whitelist);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen name = seccomp_syscall_resolve_num_arch(SCMP_ARCH_NATIVE, PTR_TO_INT(id) - 1);
4df4fd1127df4b70f78d952a37a51a8c69e3243fTom Gundersen name = seccomp_arch_to_string(PTR_TO_UINT32(id) - 1);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append(reply, "i", (int32_t) c->syscall_errno);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append(reply, "(bs)", c->selinux_context_ignore, c->selinux_context);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append(reply, "(bs)", c->apparmor_profile_ignore, c->apparmor_profile);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append(reply, "(bs)", c->smack_process_label_ignore, c->smack_process_label);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append(reply, "s", personality_to_string(c->personality));
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_open_container(reply, 'r', "bas");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_append(reply, "b", c->address_families_whitelist);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *wd;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append(reply, "i", LOG_PRI(c->syslog_priority));
d854ba50a82f28b776c670d27156f0e9881fde8aMartin Pitt const char *path,
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_message_append(reply, "i", LOG_FAC(c->syslog_priority));
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("Environment", "as", NULL, offsetof(ExecContext, environment), SD_BUS_VTABLE_PROPERTY_CONST),
d854ba50a82f28b776c670d27156f0e9881fde8aMartin Pitt SD_BUS_PROPERTY("EnvironmentFiles", "a(sb)", property_get_environment_files, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("UMask", "u", bus_property_get_mode, offsetof(ExecContext, umask), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("LimitCPU", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_CPU]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("LimitFSIZE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_FSIZE]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("LimitDATA", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_DATA]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("LimitSTACK", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_STACK]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("LimitCORE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_CORE]), SD_BUS_VTABLE_PROPERTY_CONST),
d854ba50a82f28b776c670d27156f0e9881fde8aMartin Pitt SD_BUS_PROPERTY("LimitRSS", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RSS]), SD_BUS_VTABLE_PROPERTY_CONST),
d854ba50a82f28b776c670d27156f0e9881fde8aMartin Pitt SD_BUS_PROPERTY("LimitNOFILE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NOFILE]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("LimitAS", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_AS]), SD_BUS_VTABLE_PROPERTY_CONST),
d854ba50a82f28b776c670d27156f0e9881fde8aMartin Pitt SD_BUS_PROPERTY("LimitNPROC", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NPROC]), SD_BUS_VTABLE_PROPERTY_CONST),
d854ba50a82f28b776c670d27156f0e9881fde8aMartin Pitt SD_BUS_PROPERTY("LimitMEMLOCK", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_MEMLOCK]), SD_BUS_VTABLE_PROPERTY_CONST),
d854ba50a82f28b776c670d27156f0e9881fde8aMartin Pitt SD_BUS_PROPERTY("LimitLOCKS", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_LOCKS]), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("LimitSIGPENDING", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_SIGPENDING]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("LimitMSGQUEUE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_MSGQUEUE]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("LimitNICE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NICE]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("LimitRTPRIO", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RTPRIO]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("LimitRTTIME", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RTTIME]), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("WorkingDirectory", "s", property_get_working_directory, 0, SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("RootDirectory", "s", NULL, offsetof(ExecContext, root_directory), SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("OOMScoreAdjust", "i", property_get_oom_score_adjust, 0, SD_BUS_VTABLE_PROPERTY_CONST),
ccc1002a1c510b7d4631833eaf60225f028f2280Tom Gundersen SD_BUS_PROPERTY("Nice", "i", property_get_nice, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("IOScheduling", "i", property_get_ioprio, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("CPUSchedulingPolicy", "i", property_get_cpu_sched_policy, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("CPUSchedulingPriority", "i", property_get_cpu_sched_priority, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("CPUAffinity", "ay", property_get_cpu_affinity, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("TimerSlackNSec", "t", property_get_timer_slack_nsec, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("CPUSchedulingResetOnFork", "b", bus_property_get_bool, offsetof(ExecContext, cpu_sched_reset_on_fork), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("NonBlocking", "b", bus_property_get_bool, offsetof(ExecContext, non_blocking), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("StandardInput", "s", property_get_exec_input, offsetof(ExecContext, std_input), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("StandardOutput", "s", bus_property_get_exec_output, offsetof(ExecContext, std_output), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("StandardError", "s", bus_property_get_exec_output, offsetof(ExecContext, std_error), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("TTYPath", "s", NULL, offsetof(ExecContext, tty_path), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("TTYReset", "b", bus_property_get_bool, offsetof(ExecContext, tty_reset), SD_BUS_VTABLE_PROPERTY_CONST),
aa20f49a1c5816e6e7e97f2e2ba209be47f3c0a3Tom Gundersen SD_BUS_PROPERTY("TTYVHangup", "b", bus_property_get_bool, offsetof(ExecContext, tty_vhangup), SD_BUS_VTABLE_PROPERTY_CONST),
aa20f49a1c5816e6e7e97f2e2ba209be47f3c0a3Tom Gundersen SD_BUS_PROPERTY("TTYVTDisallocate", "b", bus_property_get_bool, offsetof(ExecContext, tty_vt_disallocate), SD_BUS_VTABLE_PROPERTY_CONST),
aa20f49a1c5816e6e7e97f2e2ba209be47f3c0a3Tom Gundersen SD_BUS_PROPERTY("SyslogPriority", "i", bus_property_get_int, offsetof(ExecContext, syslog_priority), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SyslogIdentifier", "s", NULL, offsetof(ExecContext, syslog_identifier), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SyslogLevelPrefix", "b", bus_property_get_bool, offsetof(ExecContext, syslog_level_prefix), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SyslogLevel", "i", property_get_syslog_level, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SyslogFacility", "i", property_get_syslog_facility, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("Capabilities", "s", property_get_capabilities, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SecureBits", "i", bus_property_get_int, offsetof(ExecContext, secure_bits), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("CapabilityBoundingSet", "t", property_get_capability_bounding_set, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("User", "s", NULL, offsetof(ExecContext, user), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("Group", "s", NULL, offsetof(ExecContext, group), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SupplementaryGroups", "as", NULL, offsetof(ExecContext, supplementary_groups), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("PAMName", "s", NULL, offsetof(ExecContext, pam_name), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("ReadWriteDirectories", "as", NULL, offsetof(ExecContext, read_write_dirs), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("ReadOnlyDirectories", "as", NULL, offsetof(ExecContext, read_only_dirs), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("InaccessibleDirectories", "as", NULL, offsetof(ExecContext, inaccessible_dirs), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("MountFlags", "t", bus_property_get_ulong, offsetof(ExecContext, mount_flags), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("PrivateTmp", "b", bus_property_get_bool, offsetof(ExecContext, private_tmp), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("PrivateNetwork", "b", bus_property_get_bool, offsetof(ExecContext, private_network), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("PrivateDevices", "b", bus_property_get_bool, offsetof(ExecContext, private_devices), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("ProtectHome", "s", bus_property_get_protect_home, offsetof(ExecContext, protect_home), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("ProtectSystem", "s", bus_property_get_protect_system, offsetof(ExecContext, protect_system), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SameProcessGroup", "b", bus_property_get_bool, offsetof(ExecContext, same_pgrp), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("UtmpIdentifier", "s", NULL, offsetof(ExecContext, utmp_id), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("UtmpMode", "s", property_get_exec_utmp_mode, offsetof(ExecContext, utmp_mode), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SELinuxContext", "(bs)", property_get_selinux_context, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("AppArmorProfile", "(bs)", property_get_apparmor_profile, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SmackProcessLabel", "(bs)", property_get_smack_process_label, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("IgnoreSIGPIPE", "b", bus_property_get_bool, offsetof(ExecContext, ignore_sigpipe), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("NoNewPrivileges", "b", bus_property_get_bool, offsetof(ExecContext, no_new_privileges), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SystemCallFilter", "(bas)", property_get_syscall_filter, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SystemCallArchitectures", "as", property_get_syscall_archs, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("SystemCallErrorNumber", "i", property_get_syscall_errno, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("Personality", "s", property_get_personality, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("RestrictAddressFamilies", "(bas)", property_get_address_families, 0, SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("RuntimeDirectoryMode", "u", bus_property_get_mode, offsetof(ExecContext, runtime_directory_mode), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen SD_BUS_PROPERTY("RuntimeDirectory", "as", NULL, offsetof(ExecContext, runtime_directory), SD_BUS_VTABLE_PROPERTY_CONST),
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersenstatic int append_exec_command(sd_bus_message *reply, ExecCommand *c) {
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_open_container(reply, 'r', "sasbttttuii");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_append(reply, "s", c->path);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_append_strv(reply, c->argv);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_open_container(reply, 'a', "(sasbttttuii)");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = sd_bus_message_open_container(reply, 'a', "(sasbttttuii)");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *uu;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "User=%s\n", uu);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *gg;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "Group=%s\n", gg);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *id;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen c->syslog_identifier = mfree(c->syslog_identifier);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "SyslogIdentifier=%s\n", id);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Nice value out of range");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "Nice=%i\n", n);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen } else if (STR_IN_SET(name, "TTYPath", "RootDirectory")) {
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *s;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s takes an absolute path", name);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "%s=%s\n", name, s);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *s;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen if (s[0] == '-') {
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "WorkingDirectory= expects an absolute path or '~'");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen c->working_directory = mfree(c->working_directory);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = free_and_strdup(&c->working_directory, s);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "WorkingDirectory=%s%s", missing_ok ? "-" : "", s);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *s;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid standard input name");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "StandardInput=%s\n", exec_input_to_string(p));
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *s;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid standard output name");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "StandardOutput=%s\n", exec_output_to_string(p));
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *s;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid standard error name");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "StandardError=%s\n", exec_output_to_string(p));
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen "PrivateTmp", "PrivateDevices", "PrivateNetwork",
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering unit_write_drop_in_private_format(u, mode, name, "%s=%s\n", name, yes_no(b));
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *id;
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen else if (free_and_strdup(&c->utmp_id, id) < 0)
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen unit_write_drop_in_private_format(u, mode, name, "UtmpIdentifier=%s\n", strempty(id));
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen const char *s;
m = exec_utmp_mode_from_string(s);
c->utmp_mode = m;
if (isempty(n))
return -ENOMEM;
if (!strv_env_is_valid(l))
return -ENOMEM;
c->environment = e;
if (!joined)
return -ENOMEM;
rlim_t x;
x = RLIM_INFINITY;
return -ERANGE;
if (!c->rlimit[z]) {
if (!c->rlimit[z])
return -ENOMEM;
if (x == RLIM_INFINITY)