localed: skip verification when libxkbcommon is not installed
When compliled without libxkbcommon, we do no verification and accept the arguments as given. When compliled against with, if dlopen() works, we do the verification. But if dlopen() fails, we would refuse the call and return SD_BUS_ERROR_INVALID_ARGS.5de344704dadded things this way when converting to dlopen(), but it seems not very useful: it can be expected that when the library is supported but missing at runtime, we degrade softly, and that the behaviour is something inbetween the cases of hard disable at compilation time and full support. But right now we behave more strictly then if disabled at compilation. Change the code to just warn if dlopen fails, but accept the arguments. (There are various minimization scenarios where forcing the installation of libxkbcommon is not useful. E.g. a small installation where we want to set the keymap via logind, but the configuration is managed by a configuration management system and is known to be valid. Verification via libxkbcommon is just overhead in this case.)800f65f827moved the check earlier, so now even a noop case of setting the values that were already in place can fail. C.f. https://bugzilla.redhat.com/show_bug.cgi?id=2175244.
This commit is contained in:
committed by
Yu Watanabe
parent
81707069fc
commit
82c2095a5e
@@ -614,13 +614,13 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err
|
||||
|
||||
r = verify_xkb_rmlvo(in.model, in.layout, in.variant, in.options);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %m",
|
||||
strempty(in.model), strempty(in.layout), strempty(in.variant), strempty(in.options));
|
||||
log_full_errno(r == -EOPNOTSUPP ? LOG_NOTICE : LOG_ERR, r,
|
||||
"Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %m",
|
||||
strempty(in.model), strempty(in.layout), strempty(in.variant), strempty(in.options));
|
||||
|
||||
if (r == -EOPNOTSUPP)
|
||||
return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "Local keyboard configuration not supported on this system.");
|
||||
|
||||
return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Specified keymap cannot be compiled, refusing as invalid.");
|
||||
if (r != -EOPNOTSUPP)
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
|
||||
"Specified keymap cannot be compiled, refusing as invalid.");
|
||||
}
|
||||
|
||||
r = vconsole_read_data(c, m);
|
||||
|
||||
Reference in New Issue
Block a user