mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
Merge pull request #18346 from yuwata/hostnamectl-try-to-set-transient-hostname
hostnamectl: try to set transient hostname even if setting static or pretty hostname failed
This commit is contained in:
commit
f47df388a0
@ -11,8 +11,11 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "architecture.h"
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-map-properties.h"
|
||||
#include "format-table.h"
|
||||
#include "hostname-setup.h"
|
||||
#include "hostname-util.h"
|
||||
#include "main-func.h"
|
||||
#include "pretty-print.h"
|
||||
@ -47,46 +50,109 @@ typedef struct StatusInfo {
|
||||
const char *hardware_model;
|
||||
} StatusInfo;
|
||||
|
||||
static void print_status_info(StatusInfo *i) {
|
||||
static int print_status_info(StatusInfo *i) {
|
||||
_cleanup_(table_unrefp) Table *table = NULL;
|
||||
sd_id128_t mid = {}, bid = {};
|
||||
TableCell *cell;
|
||||
int r;
|
||||
|
||||
assert(i);
|
||||
|
||||
printf(" Static hostname: %s\n", strna(i->static_hostname));
|
||||
table = table_new("key", "value");
|
||||
if (!table)
|
||||
return log_oom();
|
||||
|
||||
assert_se(cell = table_get_cell(table, 0, 0));
|
||||
(void) table_set_ellipsize_percent(table, cell, 100);
|
||||
(void) table_set_align_percent(table, cell, 100);
|
||||
|
||||
table_set_header(table, false);
|
||||
|
||||
r = table_set_empty_string(table, "n/a");
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Static hostname:",
|
||||
TABLE_STRING, i->static_hostname);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
|
||||
if (!isempty(i->pretty_hostname) &&
|
||||
!streq_ptr(i->pretty_hostname, i->static_hostname))
|
||||
printf(" Pretty hostname: %s\n", i->pretty_hostname);
|
||||
!streq_ptr(i->pretty_hostname, i->static_hostname)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Pretty hostname:",
|
||||
TABLE_STRING, i->pretty_hostname);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->hostname) &&
|
||||
!streq_ptr(i->hostname, i->static_hostname))
|
||||
printf("Transient hostname: %s\n", i->hostname);
|
||||
!streq_ptr(i->hostname, i->static_hostname)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Transient hostname:",
|
||||
TABLE_STRING, i->hostname);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->icon_name))
|
||||
printf(" Icon name: %s\n",
|
||||
strna(i->icon_name));
|
||||
if (!isempty(i->icon_name)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Icon name:",
|
||||
TABLE_STRING, i->icon_name);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->chassis))
|
||||
printf(" Chassis: %s\n",
|
||||
strna(i->chassis));
|
||||
if (!isempty(i->chassis)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Chassis:",
|
||||
TABLE_STRING, i->chassis);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->deployment))
|
||||
printf(" Deployment: %s\n", i->deployment);
|
||||
if (!isempty(i->deployment)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Deployment:",
|
||||
TABLE_STRING, i->deployment);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->location))
|
||||
printf(" Location: %s\n", i->location);
|
||||
if (!isempty(i->location)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Location:",
|
||||
TABLE_STRING, i->location);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
r = sd_id128_get_machine(&mid);
|
||||
if (r >= 0)
|
||||
printf(" Machine ID: " SD_ID128_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(mid));
|
||||
if (r >= 0) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Machine ID:",
|
||||
TABLE_ID128, mid);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
r = sd_id128_get_boot(&bid);
|
||||
if (r >= 0)
|
||||
printf(" Boot ID: " SD_ID128_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(bid));
|
||||
if (r >= 0) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Boot ID:",
|
||||
TABLE_ID128, bid);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->virtualization))
|
||||
printf(" Virtualization: %s\n", i->virtualization);
|
||||
if (!isempty(i->virtualization)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Virtualization:",
|
||||
TABLE_STRING, i->virtualization);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->os_pretty_name)) {
|
||||
_cleanup_free_ char *formatted = NULL;
|
||||
@ -97,31 +163,74 @@ static void print_status_info(StatusInfo *i) {
|
||||
t = formatted;
|
||||
}
|
||||
|
||||
printf(" Operating System: %s\n", t);
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Operating System:",
|
||||
TABLE_STRING, t);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->os_cpe_name))
|
||||
printf(" CPE OS Name: %s\n", i->os_cpe_name);
|
||||
if (!isempty(i->os_cpe_name)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "CPE OS Name:",
|
||||
TABLE_STRING, i->os_cpe_name);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->kernel_name) && !isempty(i->kernel_release))
|
||||
printf(" Kernel: %s %s\n", i->kernel_name, i->kernel_release);
|
||||
if (!isempty(i->kernel_name) && !isempty(i->kernel_release)) {
|
||||
const char *v;
|
||||
|
||||
if (!isempty(i->architecture))
|
||||
printf(" Architecture: %s\n", i->architecture);
|
||||
v = strjoina(i->kernel_name, " ", i->kernel_release);
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Kernel:",
|
||||
TABLE_STRING, v);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->hardware_vendor))
|
||||
printf(" Hardware Vendor: %s\n", i->hardware_vendor);
|
||||
if (!isempty(i->architecture)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Architecture:",
|
||||
TABLE_STRING, i->architecture);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->hardware_model))
|
||||
printf(" Hardware Model: %s\n", i->hardware_model);
|
||||
if (!isempty(i->hardware_vendor)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Hardware Vendor:",
|
||||
TABLE_STRING, i->hardware_vendor);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (!isempty(i->hardware_model)) {
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Hardware Model:",
|
||||
TABLE_STRING, i->hardware_model);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
r = table_print(table, NULL);
|
||||
if (r < 0)
|
||||
return table_log_print_error(r);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int show_one_name(sd_bus *bus, const char* attr) {
|
||||
static int get_one_name(sd_bus *bus, const char* attr, char **ret) {
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
const char *s;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
assert(attr);
|
||||
|
||||
/* This obtains one string property, and copy it if 'ret' is set, or print it otherwise. */
|
||||
|
||||
r = sd_bus_get_property(
|
||||
bus,
|
||||
"org.freedesktop.hostname1",
|
||||
@ -136,12 +245,21 @@ static int show_one_name(sd_bus *bus, const char* attr) {
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
printf("%s\n", s);
|
||||
if (ret) {
|
||||
char *str;
|
||||
|
||||
str = strdup(s);
|
||||
if (!str)
|
||||
return log_oom();
|
||||
|
||||
*ret = str;
|
||||
} else
|
||||
printf("%s\n", s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int show_all_names(sd_bus *bus, sd_bus_error *error) {
|
||||
static int show_all_names(sd_bus *bus) {
|
||||
StatusInfo info = {};
|
||||
|
||||
static const struct bus_properties_map hostname_map[] = {
|
||||
@ -169,6 +287,7 @@ static int show_all_names(sd_bus *bus, sd_bus_error *error) {
|
||||
};
|
||||
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *host_message = NULL, *manager_message = NULL;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
int r;
|
||||
|
||||
r = bus_map_all_properties(bus,
|
||||
@ -176,29 +295,28 @@ static int show_all_names(sd_bus *bus, sd_bus_error *error) {
|
||||
"/org/freedesktop/hostname1",
|
||||
hostname_map,
|
||||
0,
|
||||
error,
|
||||
&error,
|
||||
&host_message,
|
||||
&info);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return log_error_errno(r, "Failed to query system properties: %s", bus_error_message(&error, r));
|
||||
|
||||
r = bus_map_all_properties(bus,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
manager_map,
|
||||
0,
|
||||
error,
|
||||
&error,
|
||||
&manager_message,
|
||||
&info);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to query system properties: %s", bus_error_message(&error, r));
|
||||
|
||||
print_status_info(&info);
|
||||
|
||||
return r;
|
||||
return print_status_info(&info);
|
||||
}
|
||||
|
||||
static int show_status(int argc, char **argv, void *userdata) {
|
||||
sd_bus *bus = userdata;
|
||||
int r;
|
||||
|
||||
if (arg_pretty || arg_static || arg_transient) {
|
||||
const char *attr;
|
||||
@ -210,61 +328,83 @@ static int show_status(int argc, char **argv, void *userdata) {
|
||||
attr = arg_pretty ? "PrettyHostname" :
|
||||
arg_static ? "StaticHostname" : "Hostname";
|
||||
|
||||
return show_one_name(bus, attr);
|
||||
} else {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
|
||||
r = show_all_names(bus, &error);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to query system properties: %s", bus_error_message(&error, r));
|
||||
|
||||
return 0;
|
||||
return get_one_name(bus, attr, NULL);
|
||||
}
|
||||
|
||||
return show_all_names(bus);
|
||||
}
|
||||
|
||||
static int set_simple_string(sd_bus *bus, const char *method, const char *value) {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
int r = 0;
|
||||
static int set_simple_string_internal(sd_bus *bus, sd_bus_error *error, const char *target, const char *method, const char *value) {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error e = SD_BUS_ERROR_NULL;
|
||||
int r;
|
||||
|
||||
polkit_agent_open_if_enabled(arg_transport, arg_ask_password);
|
||||
|
||||
if (!error)
|
||||
error = &e;
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
"org.freedesktop.hostname1",
|
||||
"/org/freedesktop/hostname1",
|
||||
"org.freedesktop.hostname1",
|
||||
method,
|
||||
&error, NULL,
|
||||
error, NULL,
|
||||
"sb", value, arg_ask_password);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set property: %s", bus_error_message(&error, r));
|
||||
return log_error_errno(r, "Could not set %s: %s", target, bus_error_message(error, r));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_simple_string(sd_bus *bus, const char *target, const char *method, const char *value) {
|
||||
return set_simple_string_internal(bus, NULL, target, method, value);
|
||||
}
|
||||
|
||||
static int set_hostname(int argc, char **argv, void *userdata) {
|
||||
_cleanup_free_ char *h = NULL;
|
||||
const char *hostname = argv[1];
|
||||
sd_bus *bus = userdata;
|
||||
int r;
|
||||
bool implicit = false, show_hint = false;
|
||||
int r, ret = 0;
|
||||
|
||||
if (!arg_pretty && !arg_static && !arg_transient)
|
||||
arg_pretty = arg_static = arg_transient = true;
|
||||
arg_pretty = arg_static = arg_transient = implicit = true;
|
||||
|
||||
if (!implicit && !arg_static && arg_transient) {
|
||||
_cleanup_free_ char *source = NULL;
|
||||
|
||||
r = get_one_name(bus, "HostnameSource", &source);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (hostname_source_from_string(source) == HOSTNAME_STATIC)
|
||||
log_info("Hint: static hostname is already set, so the specified transient hostname will not be used.");
|
||||
}
|
||||
|
||||
if (arg_pretty) {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
const char *p;
|
||||
|
||||
/* If the passed hostname is already valid, then assume the user doesn't know anything about pretty
|
||||
* hostnames, so let's unset the pretty hostname, and just set the passed hostname as static/dynamic
|
||||
* hostname. */
|
||||
if (arg_static && hostname_is_valid(hostname, VALID_HOSTNAME_TRAILING_DOT))
|
||||
if (implicit && hostname_is_valid(hostname, VALID_HOSTNAME_TRAILING_DOT))
|
||||
p = ""; /* No pretty hostname (as it is redundant), just a static one */
|
||||
else
|
||||
p = hostname; /* Use the passed name as pretty hostname */
|
||||
|
||||
r = set_simple_string(bus, "SetPrettyHostname", p);
|
||||
if (r < 0)
|
||||
return r;
|
||||
r = set_simple_string_internal(bus, &error, "pretty hostname", "SetPrettyHostname", p);
|
||||
if (r < 0) {
|
||||
if (implicit &&
|
||||
sd_bus_error_has_names(&error,
|
||||
BUS_ERROR_FILE_IS_PROTECTED,
|
||||
BUS_ERROR_READ_ONLY_FILESYSTEM)) {
|
||||
show_hint = true;
|
||||
ret = r;
|
||||
} else
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Now that we set the pretty hostname, let's clean up the parameter and use that as static
|
||||
* hostname. If the hostname was already valid as static hostname, this will only chop off the trailing
|
||||
@ -280,34 +420,47 @@ static int set_hostname(int argc, char **argv, void *userdata) {
|
||||
}
|
||||
|
||||
if (arg_static) {
|
||||
r = set_simple_string(bus, "SetStaticHostname", hostname);
|
||||
if (r < 0)
|
||||
return r;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
|
||||
r = set_simple_string_internal(bus, &error, "static hostname", "SetStaticHostname", hostname);
|
||||
if (r < 0) {
|
||||
if (implicit &&
|
||||
sd_bus_error_has_names(&error,
|
||||
BUS_ERROR_FILE_IS_PROTECTED,
|
||||
BUS_ERROR_READ_ONLY_FILESYSTEM)) {
|
||||
show_hint = true;
|
||||
ret = r;
|
||||
} else
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
if (arg_transient) {
|
||||
r = set_simple_string(bus, "SetHostname", hostname);
|
||||
r = set_simple_string(bus, "transient hostname", "SetHostname", hostname);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (show_hint)
|
||||
log_info("Hint: use --transient option when /etc/machine-info or /etc/hostname cannot be modified (e.g. located in read-only filesystem).");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int set_icon_name(int argc, char **argv, void *userdata) {
|
||||
return set_simple_string(userdata, "SetIconName", argv[1]);
|
||||
return set_simple_string(userdata, "icon", "SetIconName", argv[1]);
|
||||
}
|
||||
|
||||
static int set_chassis(int argc, char **argv, void *userdata) {
|
||||
return set_simple_string(userdata, "SetChassis", argv[1]);
|
||||
return set_simple_string(userdata, "chassis", "SetChassis", argv[1]);
|
||||
}
|
||||
|
||||
static int set_deployment(int argc, char **argv, void *userdata) {
|
||||
return set_simple_string(userdata, "SetDeployment", argv[1]);
|
||||
return set_simple_string(userdata, "deployment", "SetDeployment", argv[1]);
|
||||
}
|
||||
|
||||
static int set_location(int argc, char **argv, void *userdata) {
|
||||
return set_simple_string(userdata, "SetLocation", argv[1]);
|
||||
return set_simple_string(userdata, "location", "SetLocation", argv[1]);
|
||||
}
|
||||
|
||||
static int help(void) {
|
||||
|
@ -367,20 +367,41 @@ static int context_update_kernel_hostname(
|
||||
return r; /* 0 if no change, 1 if something was done */
|
||||
}
|
||||
|
||||
static void unset_statp(struct stat **p) {
|
||||
if (!*p)
|
||||
return;
|
||||
|
||||
**p = (struct stat) {};
|
||||
}
|
||||
|
||||
static int context_write_data_static_hostname(Context *c) {
|
||||
_cleanup_(unset_statp) struct stat *s = NULL;
|
||||
int r;
|
||||
|
||||
assert(c);
|
||||
|
||||
/* Make sure that if we fail here, we invalidate the cached information, since it was updated
|
||||
* already, even if we can't make it hit the disk. */
|
||||
s = &c->etc_hostname_stat;
|
||||
|
||||
if (isempty(c->data[PROP_STATIC_HOSTNAME])) {
|
||||
if (unlink("/etc/hostname") < 0)
|
||||
return errno == ENOENT ? 0 : -errno;
|
||||
if (unlink("/etc/hostname") < 0 && errno != ENOENT)
|
||||
return -errno;
|
||||
|
||||
TAKE_PTR(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]);
|
||||
r = write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
TAKE_PTR(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int context_write_data_machine_info(Context *c) {
|
||||
|
||||
_cleanup_(unset_statp) struct stat *s = NULL;
|
||||
static const char * const name[_PROP_MAX] = {
|
||||
[PROP_PRETTY_HOSTNAME] = "PRETTY_HOSTNAME",
|
||||
[PROP_ICON_NAME] = "ICON_NAME",
|
||||
@ -388,12 +409,15 @@ static int context_write_data_machine_info(Context *c) {
|
||||
[PROP_DEPLOYMENT] = "DEPLOYMENT",
|
||||
[PROP_LOCATION] = "LOCATION",
|
||||
};
|
||||
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
int r;
|
||||
|
||||
assert(c);
|
||||
|
||||
/* Make sure that if we fail here, we invalidate the cached information, since it was updated
|
||||
* already, even if we can't make it hit the disk. */
|
||||
s = &c->etc_machine_info_stat;
|
||||
|
||||
r = load_env_file(NULL, "/etc/machine-info", &l);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
return r;
|
||||
@ -421,13 +445,19 @@ static int context_write_data_machine_info(Context *c) {
|
||||
}
|
||||
|
||||
if (strv_isempty(l)) {
|
||||
if (unlink("/etc/machine-info") < 0)
|
||||
return errno == ENOENT ? 0 : -errno;
|
||||
if (unlink("/etc/machine-info") < 0 && errno != ENOENT)
|
||||
return -errno;
|
||||
|
||||
TAKE_PTR(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return write_env_file_label("/etc/machine-info", l);
|
||||
r = write_env_file_label("/etc/machine-info", l);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
TAKE_PTR(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int property_get_hardware_vendor(
|
||||
@ -760,13 +790,17 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_
|
||||
if (r == 0)
|
||||
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
|
||||
|
||||
r = free_and_strdup(&c->data[PROP_STATIC_HOSTNAME], name);
|
||||
r = free_and_strdup_warn(&c->data[PROP_STATIC_HOSTNAME], name);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = context_write_data_static_hostname(c);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to write static hostname: %m");
|
||||
if (ERRNO_IS_PRIVILEGE(r))
|
||||
return sd_bus_error_set(error, BUS_ERROR_FILE_IS_PROTECTED, "Not allowed to update /etc/hostname.");
|
||||
if (r == -EROFS)
|
||||
return sd_bus_error_set(error, BUS_ERROR_READ_ONLY_FILESYSTEM, "/etc/hostname is in a read-only filesystem.");
|
||||
return sd_bus_error_set_errnof(error, r, "Failed to set static hostname: %m");
|
||||
}
|
||||
|
||||
@ -836,13 +870,17 @@ static int set_machine_info(Context *c, sd_bus_message *m, int prop, sd_bus_mess
|
||||
if (r == 0)
|
||||
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
|
||||
|
||||
r = free_and_strdup(&c->data[prop], name);
|
||||
r = free_and_strdup_warn(&c->data[prop], name);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = context_write_data_machine_info(c);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to write machine info: %m");
|
||||
if (ERRNO_IS_PRIVILEGE(r))
|
||||
return sd_bus_error_set(error, BUS_ERROR_FILE_IS_PROTECTED, "Not allowed to update /etc/machine-info.");
|
||||
if (r == -EROFS)
|
||||
return sd_bus_error_set(error, BUS_ERROR_READ_ONLY_FILESYSTEM, "/etc/machine-info is in a read-only filesystem.");
|
||||
return sd_bus_error_set_errnof(error, r, "Failed to write machine info: %m");
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_common_errors[] = {
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_TRANSFER_IN_PROGRESS, EBUSY),
|
||||
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_NO_PRODUCT_UUID, EOPNOTSUPP),
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_FILE_IS_PROTECTED, EACCES),
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_READ_ONLY_FILESYSTEM, EROFS),
|
||||
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_SPEED_METER_INACTIVE, EOPNOTSUPP),
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_UNMANAGED_INTERFACE, EOPNOTSUPP),
|
||||
|
@ -3,121 +3,124 @@
|
||||
|
||||
#include "bus-error.h"
|
||||
|
||||
#define BUS_ERROR_NO_SUCH_UNIT "org.freedesktop.systemd1.NoSuchUnit"
|
||||
#define BUS_ERROR_NO_UNIT_FOR_PID "org.freedesktop.systemd1.NoUnitForPID"
|
||||
#define BUS_ERROR_NO_UNIT_FOR_INVOCATION_ID "org.freedesktop.systemd1.NoUnitForInvocationID"
|
||||
#define BUS_ERROR_UNIT_EXISTS "org.freedesktop.systemd1.UnitExists"
|
||||
#define BUS_ERROR_LOAD_FAILED "org.freedesktop.systemd1.LoadFailed"
|
||||
#define BUS_ERROR_BAD_UNIT_SETTING "org.freedesktop.systemd1.BadUnitSetting"
|
||||
#define BUS_ERROR_JOB_FAILED "org.freedesktop.systemd1.JobFailed"
|
||||
#define BUS_ERROR_NO_SUCH_JOB "org.freedesktop.systemd1.NoSuchJob"
|
||||
#define BUS_ERROR_NOT_SUBSCRIBED "org.freedesktop.systemd1.NotSubscribed"
|
||||
#define BUS_ERROR_ALREADY_SUBSCRIBED "org.freedesktop.systemd1.AlreadySubscribed"
|
||||
#define BUS_ERROR_ONLY_BY_DEPENDENCY "org.freedesktop.systemd1.OnlyByDependency"
|
||||
#define BUS_ERROR_NO_SUCH_UNIT "org.freedesktop.systemd1.NoSuchUnit"
|
||||
#define BUS_ERROR_NO_UNIT_FOR_PID "org.freedesktop.systemd1.NoUnitForPID"
|
||||
#define BUS_ERROR_NO_UNIT_FOR_INVOCATION_ID "org.freedesktop.systemd1.NoUnitForInvocationID"
|
||||
#define BUS_ERROR_UNIT_EXISTS "org.freedesktop.systemd1.UnitExists"
|
||||
#define BUS_ERROR_LOAD_FAILED "org.freedesktop.systemd1.LoadFailed"
|
||||
#define BUS_ERROR_BAD_UNIT_SETTING "org.freedesktop.systemd1.BadUnitSetting"
|
||||
#define BUS_ERROR_JOB_FAILED "org.freedesktop.systemd1.JobFailed"
|
||||
#define BUS_ERROR_NO_SUCH_JOB "org.freedesktop.systemd1.NoSuchJob"
|
||||
#define BUS_ERROR_NOT_SUBSCRIBED "org.freedesktop.systemd1.NotSubscribed"
|
||||
#define BUS_ERROR_ALREADY_SUBSCRIBED "org.freedesktop.systemd1.AlreadySubscribed"
|
||||
#define BUS_ERROR_ONLY_BY_DEPENDENCY "org.freedesktop.systemd1.OnlyByDependency"
|
||||
#define BUS_ERROR_TRANSACTION_JOBS_CONFLICTING "org.freedesktop.systemd1.TransactionJobsConflicting"
|
||||
#define BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC "org.freedesktop.systemd1.TransactionOrderIsCyclic"
|
||||
#define BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE "org.freedesktop.systemd1.TransactionIsDestructive"
|
||||
#define BUS_ERROR_UNIT_MASKED "org.freedesktop.systemd1.UnitMasked"
|
||||
#define BUS_ERROR_UNIT_GENERATED "org.freedesktop.systemd1.UnitGenerated"
|
||||
#define BUS_ERROR_UNIT_LINKED "org.freedesktop.systemd1.UnitLinked"
|
||||
#define BUS_ERROR_JOB_TYPE_NOT_APPLICABLE "org.freedesktop.systemd1.JobTypeNotApplicable"
|
||||
#define BUS_ERROR_NO_ISOLATION "org.freedesktop.systemd1.NoIsolation"
|
||||
#define BUS_ERROR_SHUTTING_DOWN "org.freedesktop.systemd1.ShuttingDown"
|
||||
#define BUS_ERROR_SCOPE_NOT_RUNNING "org.freedesktop.systemd1.ScopeNotRunning"
|
||||
#define BUS_ERROR_NO_SUCH_DYNAMIC_USER "org.freedesktop.systemd1.NoSuchDynamicUser"
|
||||
#define BUS_ERROR_NOT_REFERENCED "org.freedesktop.systemd1.NotReferenced"
|
||||
#define BUS_ERROR_DISK_FULL "org.freedesktop.systemd1.DiskFull"
|
||||
#define BUS_ERROR_NOTHING_TO_CLEAN "org.freedesktop.systemd1.NothingToClean"
|
||||
#define BUS_ERROR_UNIT_BUSY "org.freedesktop.systemd1.UnitBusy"
|
||||
#define BUS_ERROR_UNIT_INACTIVE "org.freedesktop.systemd1.UnitInactive"
|
||||
#define BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC "org.freedesktop.systemd1.TransactionOrderIsCyclic"
|
||||
#define BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE "org.freedesktop.systemd1.TransactionIsDestructive"
|
||||
#define BUS_ERROR_UNIT_MASKED "org.freedesktop.systemd1.UnitMasked"
|
||||
#define BUS_ERROR_UNIT_GENERATED "org.freedesktop.systemd1.UnitGenerated"
|
||||
#define BUS_ERROR_UNIT_LINKED "org.freedesktop.systemd1.UnitLinked"
|
||||
#define BUS_ERROR_JOB_TYPE_NOT_APPLICABLE "org.freedesktop.systemd1.JobTypeNotApplicable"
|
||||
#define BUS_ERROR_NO_ISOLATION "org.freedesktop.systemd1.NoIsolation"
|
||||
#define BUS_ERROR_SHUTTING_DOWN "org.freedesktop.systemd1.ShuttingDown"
|
||||
#define BUS_ERROR_SCOPE_NOT_RUNNING "org.freedesktop.systemd1.ScopeNotRunning"
|
||||
#define BUS_ERROR_NO_SUCH_DYNAMIC_USER "org.freedesktop.systemd1.NoSuchDynamicUser"
|
||||
#define BUS_ERROR_NOT_REFERENCED "org.freedesktop.systemd1.NotReferenced"
|
||||
#define BUS_ERROR_DISK_FULL "org.freedesktop.systemd1.DiskFull"
|
||||
#define BUS_ERROR_NOTHING_TO_CLEAN "org.freedesktop.systemd1.NothingToClean"
|
||||
#define BUS_ERROR_UNIT_BUSY "org.freedesktop.systemd1.UnitBusy"
|
||||
#define BUS_ERROR_UNIT_INACTIVE "org.freedesktop.systemd1.UnitInactive"
|
||||
|
||||
#define BUS_ERROR_NO_SUCH_MACHINE "org.freedesktop.machine1.NoSuchMachine"
|
||||
#define BUS_ERROR_NO_SUCH_IMAGE "org.freedesktop.machine1.NoSuchImage"
|
||||
#define BUS_ERROR_NO_MACHINE_FOR_PID "org.freedesktop.machine1.NoMachineForPID"
|
||||
#define BUS_ERROR_MACHINE_EXISTS "org.freedesktop.machine1.MachineExists"
|
||||
#define BUS_ERROR_NO_PRIVATE_NETWORKING "org.freedesktop.machine1.NoPrivateNetworking"
|
||||
#define BUS_ERROR_NO_SUCH_USER_MAPPING "org.freedesktop.machine1.NoSuchUserMapping"
|
||||
#define BUS_ERROR_NO_SUCH_GROUP_MAPPING "org.freedesktop.machine1.NoSuchGroupMapping"
|
||||
#define BUS_ERROR_NO_SUCH_MACHINE "org.freedesktop.machine1.NoSuchMachine"
|
||||
#define BUS_ERROR_NO_SUCH_IMAGE "org.freedesktop.machine1.NoSuchImage"
|
||||
#define BUS_ERROR_NO_MACHINE_FOR_PID "org.freedesktop.machine1.NoMachineForPID"
|
||||
#define BUS_ERROR_MACHINE_EXISTS "org.freedesktop.machine1.MachineExists"
|
||||
#define BUS_ERROR_NO_PRIVATE_NETWORKING "org.freedesktop.machine1.NoPrivateNetworking"
|
||||
#define BUS_ERROR_NO_SUCH_USER_MAPPING "org.freedesktop.machine1.NoSuchUserMapping"
|
||||
#define BUS_ERROR_NO_SUCH_GROUP_MAPPING "org.freedesktop.machine1.NoSuchGroupMapping"
|
||||
|
||||
#define BUS_ERROR_NO_SUCH_PORTABLE_IMAGE "org.freedesktop.portable1.NoSuchImage"
|
||||
#define BUS_ERROR_BAD_PORTABLE_IMAGE_TYPE "org.freedesktop.portable1.BadImageType"
|
||||
#define BUS_ERROR_NO_SUCH_PORTABLE_IMAGE "org.freedesktop.portable1.NoSuchImage"
|
||||
#define BUS_ERROR_BAD_PORTABLE_IMAGE_TYPE "org.freedesktop.portable1.BadImageType"
|
||||
|
||||
#define BUS_ERROR_NO_SUCH_SESSION "org.freedesktop.login1.NoSuchSession"
|
||||
#define BUS_ERROR_NO_SESSION_FOR_PID "org.freedesktop.login1.NoSessionForPID"
|
||||
#define BUS_ERROR_NO_SUCH_USER "org.freedesktop.login1.NoSuchUser"
|
||||
#define BUS_ERROR_NO_USER_FOR_PID "org.freedesktop.login1.NoUserForPID"
|
||||
#define BUS_ERROR_NO_SUCH_SEAT "org.freedesktop.login1.NoSuchSeat"
|
||||
#define BUS_ERROR_SESSION_NOT_ON_SEAT "org.freedesktop.login1.SessionNotOnSeat"
|
||||
#define BUS_ERROR_NOT_IN_CONTROL "org.freedesktop.login1.NotInControl"
|
||||
#define BUS_ERROR_DEVICE_IS_TAKEN "org.freedesktop.login1.DeviceIsTaken"
|
||||
#define BUS_ERROR_DEVICE_NOT_TAKEN "org.freedesktop.login1.DeviceNotTaken"
|
||||
#define BUS_ERROR_OPERATION_IN_PROGRESS "org.freedesktop.login1.OperationInProgress"
|
||||
#define BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED "org.freedesktop.login1.SleepVerbNotSupported"
|
||||
#define BUS_ERROR_SESSION_BUSY "org.freedesktop.login1.SessionBusy"
|
||||
#define BUS_ERROR_NOT_YOUR_DEVICE "org.freedesktop.login1.NotYourDevice"
|
||||
#define BUS_ERROR_NO_SUCH_SESSION "org.freedesktop.login1.NoSuchSession"
|
||||
#define BUS_ERROR_NO_SESSION_FOR_PID "org.freedesktop.login1.NoSessionForPID"
|
||||
#define BUS_ERROR_NO_SUCH_USER "org.freedesktop.login1.NoSuchUser"
|
||||
#define BUS_ERROR_NO_USER_FOR_PID "org.freedesktop.login1.NoUserForPID"
|
||||
#define BUS_ERROR_NO_SUCH_SEAT "org.freedesktop.login1.NoSuchSeat"
|
||||
#define BUS_ERROR_SESSION_NOT_ON_SEAT "org.freedesktop.login1.SessionNotOnSeat"
|
||||
#define BUS_ERROR_NOT_IN_CONTROL "org.freedesktop.login1.NotInControl"
|
||||
#define BUS_ERROR_DEVICE_IS_TAKEN "org.freedesktop.login1.DeviceIsTaken"
|
||||
#define BUS_ERROR_DEVICE_NOT_TAKEN "org.freedesktop.login1.DeviceNotTaken"
|
||||
#define BUS_ERROR_OPERATION_IN_PROGRESS "org.freedesktop.login1.OperationInProgress"
|
||||
#define BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED "org.freedesktop.login1.SleepVerbNotSupported"
|
||||
#define BUS_ERROR_SESSION_BUSY "org.freedesktop.login1.SessionBusy"
|
||||
#define BUS_ERROR_NOT_YOUR_DEVICE "org.freedesktop.login1.NotYourDevice"
|
||||
|
||||
#define BUS_ERROR_AUTOMATIC_TIME_SYNC_ENABLED "org.freedesktop.timedate1.AutomaticTimeSyncEnabled"
|
||||
#define BUS_ERROR_NO_NTP_SUPPORT "org.freedesktop.timedate1.NoNTPSupport"
|
||||
#define BUS_ERROR_AUTOMATIC_TIME_SYNC_ENABLED "org.freedesktop.timedate1.AutomaticTimeSyncEnabled"
|
||||
#define BUS_ERROR_NO_NTP_SUPPORT "org.freedesktop.timedate1.NoNTPSupport"
|
||||
|
||||
#define BUS_ERROR_NO_SUCH_PROCESS "org.freedesktop.systemd1.NoSuchProcess"
|
||||
#define BUS_ERROR_NO_SUCH_PROCESS "org.freedesktop.systemd1.NoSuchProcess"
|
||||
|
||||
#define BUS_ERROR_NO_NAME_SERVERS "org.freedesktop.resolve1.NoNameServers"
|
||||
#define BUS_ERROR_INVALID_REPLY "org.freedesktop.resolve1.InvalidReply"
|
||||
#define BUS_ERROR_NO_SUCH_RR "org.freedesktop.resolve1.NoSuchRR"
|
||||
#define BUS_ERROR_CNAME_LOOP "org.freedesktop.resolve1.CNameLoop"
|
||||
#define BUS_ERROR_ABORTED "org.freedesktop.resolve1.Aborted"
|
||||
#define BUS_ERROR_NO_SUCH_SERVICE "org.freedesktop.resolve1.NoSuchService"
|
||||
#define BUS_ERROR_DNSSEC_FAILED "org.freedesktop.resolve1.DnssecFailed"
|
||||
#define BUS_ERROR_NO_TRUST_ANCHOR "org.freedesktop.resolve1.NoTrustAnchor"
|
||||
#define BUS_ERROR_RR_TYPE_UNSUPPORTED "org.freedesktop.resolve1.ResourceRecordTypeUnsupported"
|
||||
#define BUS_ERROR_NO_SUCH_LINK "org.freedesktop.resolve1.NoSuchLink"
|
||||
#define BUS_ERROR_LINK_BUSY "org.freedesktop.resolve1.LinkBusy"
|
||||
#define BUS_ERROR_NETWORK_DOWN "org.freedesktop.resolve1.NetworkDown"
|
||||
#define BUS_ERROR_NO_SUCH_DNSSD_SERVICE "org.freedesktop.resolve1.NoSuchDnssdService"
|
||||
#define BUS_ERROR_DNSSD_SERVICE_EXISTS "org.freedesktop.resolve1.DnssdServiceExists"
|
||||
#define _BUS_ERROR_DNS "org.freedesktop.resolve1.DnsError."
|
||||
#define BUS_ERROR_NO_NAME_SERVERS "org.freedesktop.resolve1.NoNameServers"
|
||||
#define BUS_ERROR_INVALID_REPLY "org.freedesktop.resolve1.InvalidReply"
|
||||
#define BUS_ERROR_NO_SUCH_RR "org.freedesktop.resolve1.NoSuchRR"
|
||||
#define BUS_ERROR_CNAME_LOOP "org.freedesktop.resolve1.CNameLoop"
|
||||
#define BUS_ERROR_ABORTED "org.freedesktop.resolve1.Aborted"
|
||||
#define BUS_ERROR_NO_SUCH_SERVICE "org.freedesktop.resolve1.NoSuchService"
|
||||
#define BUS_ERROR_DNSSEC_FAILED "org.freedesktop.resolve1.DnssecFailed"
|
||||
#define BUS_ERROR_NO_TRUST_ANCHOR "org.freedesktop.resolve1.NoTrustAnchor"
|
||||
#define BUS_ERROR_RR_TYPE_UNSUPPORTED "org.freedesktop.resolve1.ResourceRecordTypeUnsupported"
|
||||
#define BUS_ERROR_NO_SUCH_LINK "org.freedesktop.resolve1.NoSuchLink"
|
||||
#define BUS_ERROR_LINK_BUSY "org.freedesktop.resolve1.LinkBusy"
|
||||
#define BUS_ERROR_NETWORK_DOWN "org.freedesktop.resolve1.NetworkDown"
|
||||
#define BUS_ERROR_NO_SUCH_DNSSD_SERVICE "org.freedesktop.resolve1.NoSuchDnssdService"
|
||||
#define BUS_ERROR_DNSSD_SERVICE_EXISTS "org.freedesktop.resolve1.DnssdServiceExists"
|
||||
#define _BUS_ERROR_DNS "org.freedesktop.resolve1.DnsError."
|
||||
|
||||
#define BUS_ERROR_NO_SUCH_TRANSFER "org.freedesktop.import1.NoSuchTransfer"
|
||||
#define BUS_ERROR_TRANSFER_IN_PROGRESS "org.freedesktop.import1.TransferInProgress"
|
||||
#define BUS_ERROR_NO_SUCH_TRANSFER "org.freedesktop.import1.NoSuchTransfer"
|
||||
#define BUS_ERROR_TRANSFER_IN_PROGRESS "org.freedesktop.import1.TransferInProgress"
|
||||
|
||||
#define BUS_ERROR_NO_PRODUCT_UUID "org.freedesktop.hostname1.NoProductUUID"
|
||||
#define BUS_ERROR_NO_PRODUCT_UUID "org.freedesktop.hostname1.NoProductUUID"
|
||||
#define BUS_ERROR_FILE_IS_PROTECTED "org.freedesktop.hostname1.FileIsProtected"
|
||||
#define BUS_ERROR_READ_ONLY_FILESYSTEM "org.freedesktop.hostname1.ReadOnlyFilesystem"
|
||||
|
||||
#define BUS_ERROR_SPEED_METER_INACTIVE "org.freedesktop.network1.SpeedMeterInactive"
|
||||
#define BUS_ERROR_UNMANAGED_INTERFACE "org.freedesktop.network1.UnmanagedInterface"
|
||||
#define BUS_ERROR_SPEED_METER_INACTIVE "org.freedesktop.network1.SpeedMeterInactive"
|
||||
#define BUS_ERROR_UNMANAGED_INTERFACE "org.freedesktop.network1.UnmanagedInterface"
|
||||
|
||||
#define BUS_ERROR_NO_SUCH_HOME "org.freedesktop.home1.NoSuchHome"
|
||||
#define BUS_ERROR_UID_IN_USE "org.freedesktop.home1.UIDInUse"
|
||||
#define BUS_ERROR_USER_NAME_EXISTS "org.freedesktop.home1.UserNameExists"
|
||||
#define BUS_ERROR_HOME_EXISTS "org.freedesktop.home1.HomeExists"
|
||||
#define BUS_ERROR_HOME_ALREADY_ACTIVE "org.freedesktop.home1.HomeAlreadyActive"
|
||||
#define BUS_ERROR_HOME_ALREADY_FIXATED "org.freedesktop.home1.HomeAlreadyFixated"
|
||||
#define BUS_ERROR_HOME_UNFIXATED "org.freedesktop.home1.HomeUnfixated"
|
||||
#define BUS_ERROR_HOME_NOT_ACTIVE "org.freedesktop.home1.HomeNotActive"
|
||||
#define BUS_ERROR_HOME_ABSENT "org.freedesktop.home1.HomeAbsent"
|
||||
#define BUS_ERROR_HOME_BUSY "org.freedesktop.home1.HomeBusy"
|
||||
#define BUS_ERROR_BAD_PASSWORD "org.freedesktop.home1.BadPassword"
|
||||
#define BUS_ERROR_BAD_RECOVERY_KEY "org.freedesktop.home1.BadRecoveryKey"
|
||||
#define BUS_ERROR_LOW_PASSWORD_QUALITY "org.freedesktop.home1.LowPasswordQuality"
|
||||
#define BUS_ERROR_BAD_PASSWORD_AND_NO_TOKEN "org.freedesktop.home1.BadPasswordAndNoToken"
|
||||
#define BUS_ERROR_TOKEN_PIN_NEEDED "org.freedesktop.home1.TokenPinNeeded"
|
||||
#define BUS_ERROR_TOKEN_PROTECTED_AUTHENTICATION_PATH_NEEDED "org.freedesktop.home1.TokenProtectedAuthenticationPathNeeded"
|
||||
#define BUS_ERROR_TOKEN_USER_PRESENCE_NEEDED "org.freedesktop.home1.TokenUserPresenceNeeded"
|
||||
#define BUS_ERROR_TOKEN_ACTION_TIMEOUT "org.freedesktop.home1.TokenActionTimeout"
|
||||
#define BUS_ERROR_TOKEN_PIN_LOCKED "org.freedesktop.home1.TokenPinLocked"
|
||||
#define BUS_ERROR_TOKEN_BAD_PIN "org.freedesktop.home1.BadPin"
|
||||
#define BUS_ERROR_NO_SUCH_HOME "org.freedesktop.home1.NoSuchHome"
|
||||
#define BUS_ERROR_UID_IN_USE "org.freedesktop.home1.UIDInUse"
|
||||
#define BUS_ERROR_USER_NAME_EXISTS "org.freedesktop.home1.UserNameExists"
|
||||
#define BUS_ERROR_HOME_EXISTS "org.freedesktop.home1.HomeExists"
|
||||
#define BUS_ERROR_HOME_ALREADY_ACTIVE "org.freedesktop.home1.HomeAlreadyActive"
|
||||
#define BUS_ERROR_HOME_ALREADY_FIXATED "org.freedesktop.home1.HomeAlreadyFixated"
|
||||
#define BUS_ERROR_HOME_UNFIXATED "org.freedesktop.home1.HomeUnfixated"
|
||||
#define BUS_ERROR_HOME_NOT_ACTIVE "org.freedesktop.home1.HomeNotActive"
|
||||
#define BUS_ERROR_HOME_ABSENT "org.freedesktop.home1.HomeAbsent"
|
||||
#define BUS_ERROR_HOME_BUSY "org.freedesktop.home1.HomeBusy"
|
||||
#define BUS_ERROR_BAD_PASSWORD "org.freedesktop.home1.BadPassword"
|
||||
#define BUS_ERROR_BAD_RECOVERY_KEY "org.freedesktop.home1.BadRecoveryKey"
|
||||
#define BUS_ERROR_LOW_PASSWORD_QUALITY "org.freedesktop.home1.LowPasswordQuality"
|
||||
#define BUS_ERROR_BAD_PASSWORD_AND_NO_TOKEN "org.freedesktop.home1.BadPasswordAndNoToken"
|
||||
#define BUS_ERROR_TOKEN_PIN_NEEDED "org.freedesktop.home1.TokenPinNeeded"
|
||||
#define BUS_ERROR_TOKEN_PROTECTED_AUTHENTICATION_PATH_NEEDED \
|
||||
"org.freedesktop.home1.TokenProtectedAuthenticationPathNeeded"
|
||||
#define BUS_ERROR_TOKEN_USER_PRESENCE_NEEDED "org.freedesktop.home1.TokenUserPresenceNeeded"
|
||||
#define BUS_ERROR_TOKEN_ACTION_TIMEOUT "org.freedesktop.home1.TokenActionTimeout"
|
||||
#define BUS_ERROR_TOKEN_PIN_LOCKED "org.freedesktop.home1.TokenPinLocked"
|
||||
#define BUS_ERROR_TOKEN_BAD_PIN "org.freedesktop.home1.BadPin"
|
||||
#define BUS_ERROR_TOKEN_BAD_PIN_FEW_TRIES_LEFT "org.freedesktop.home1.BadPinFewTriesLeft"
|
||||
#define BUS_ERROR_TOKEN_BAD_PIN_ONE_TRY_LEFT "org.freedesktop.home1.BadPinOneTryLeft"
|
||||
#define BUS_ERROR_BAD_SIGNATURE "org.freedesktop.home1.BadSignature"
|
||||
#define BUS_ERROR_HOME_RECORD_MISMATCH "org.freedesktop.home1.RecordMismatch"
|
||||
#define BUS_ERROR_HOME_RECORD_DOWNGRADE "org.freedesktop.home1.RecordDowngrade"
|
||||
#define BUS_ERROR_HOME_RECORD_SIGNED "org.freedesktop.home1.RecordSigned"
|
||||
#define BUS_ERROR_BAD_HOME_SIZE "org.freedesktop.home1.BadHomeSize"
|
||||
#define BUS_ERROR_NO_PRIVATE_KEY "org.freedesktop.home1.NoPrivateKey"
|
||||
#define BUS_ERROR_HOME_LOCKED "org.freedesktop.home1.HomeLocked"
|
||||
#define BUS_ERROR_HOME_NOT_LOCKED "org.freedesktop.home1.HomeNotLocked"
|
||||
#define BUS_ERROR_NO_DISK_SPACE "org.freedesktop.home1.NoDiskSpace"
|
||||
#define BUS_ERROR_TOO_MANY_OPERATIONS "org.freedesktop.home1.TooManyOperations"
|
||||
#define BUS_ERROR_AUTHENTICATION_LIMIT_HIT "org.freedesktop.home1.AuthenticationLimitHit"
|
||||
#define BUS_ERROR_HOME_CANT_AUTHENTICATE "org.freedesktop.home1.HomeCantAuthenticate"
|
||||
#define BUS_ERROR_TOKEN_BAD_PIN_ONE_TRY_LEFT "org.freedesktop.home1.BadPinOneTryLeft"
|
||||
#define BUS_ERROR_BAD_SIGNATURE "org.freedesktop.home1.BadSignature"
|
||||
#define BUS_ERROR_HOME_RECORD_MISMATCH "org.freedesktop.home1.RecordMismatch"
|
||||
#define BUS_ERROR_HOME_RECORD_DOWNGRADE "org.freedesktop.home1.RecordDowngrade"
|
||||
#define BUS_ERROR_HOME_RECORD_SIGNED "org.freedesktop.home1.RecordSigned"
|
||||
#define BUS_ERROR_BAD_HOME_SIZE "org.freedesktop.home1.BadHomeSize"
|
||||
#define BUS_ERROR_NO_PRIVATE_KEY "org.freedesktop.home1.NoPrivateKey"
|
||||
#define BUS_ERROR_HOME_LOCKED "org.freedesktop.home1.HomeLocked"
|
||||
#define BUS_ERROR_HOME_NOT_LOCKED "org.freedesktop.home1.HomeNotLocked"
|
||||
#define BUS_ERROR_NO_DISK_SPACE "org.freedesktop.home1.NoDiskSpace"
|
||||
#define BUS_ERROR_TOO_MANY_OPERATIONS "org.freedesktop.home1.TooManyOperations"
|
||||
#define BUS_ERROR_AUTHENTICATION_LIMIT_HIT "org.freedesktop.home1.AuthenticationLimitHit"
|
||||
#define BUS_ERROR_HOME_CANT_AUTHENTICATE "org.freedesktop.home1.HomeCantAuthenticate"
|
||||
|
||||
BUS_ERROR_MAP_ELF_USE(bus_common_errors);
|
||||
|
@ -233,4 +233,4 @@ static const char* const hostname_source_table[] = {
|
||||
[HOSTNAME_FALLBACK] = "fallback",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP_TO_STRING(hostname_source, HostnameSource);
|
||||
DEFINE_STRING_TABLE_LOOKUP(hostname_source, HostnameSource);
|
||||
|
@ -11,7 +11,9 @@ typedef enum HostnameSource {
|
||||
_HOSTNAME_INVALID = -1,
|
||||
} HostnameSource;
|
||||
|
||||
const char* hostname_source_to_string(HostnameSource source);
|
||||
const char* hostname_source_to_string(HostnameSource source) _const_;
|
||||
HostnameSource hostname_source_from_string(const char *str) _pure_;
|
||||
|
||||
int sethostname_idempotent(const char *s);
|
||||
|
||||
int shorten_overlong(const char *s, char **ret);
|
||||
|
Loading…
x
Reference in New Issue
Block a user