Compare commits

..

6 Commits

Author SHA1 Message Date
RussianNeuroMancer 714fdbad84 Prevent triple reporting of rfkill button on HP Elite x2 1013 G3, plus five other hotkeys
1. rfkill hotkey is reported from three source: keyboard, Intel HID and HP Wireless hotkeys. Let's block first two.
2. Correct mapping for calendar, micmute, display and brightness hotkeys.
2020-09-28 12:45:12 +02:00
Anita Zhang 7d9eea2bd3 core: move reset_arguments() to the end of main's finish
Fixes #16991

fb39af4ce4 replaced `free_arguments()` with
`reset_arguments()`, which frees arg_* variables as before, but also resets all
of them to the default values. `reset_arguments()` was positioned
in such a way that it overrode some arg_* values still in use at shutdown.

To avoid further unintentional resets, I moved `reset_arguments()`
right before the return, when nothing else will be using the arg_* variables.
2020-09-28 12:39:30 +02:00
RussianNeuroMancer e535434d47 Add accel mount matrix for Irbis NB111 transformer 2020-09-28 12:36:45 +02:00
bauen1 19cd4e1967 core: ensure that namespace tmp directories always get the correct label
If a namespace with PrivateTmp=true is constructed we need to restore
the context of the namespaces /tmp directory (i.e.
/tmp/systemd-private-XXXXX/tmp) to the (default) context of /tmp .
Otherwise filetransitions might result in the namespaces tmp directory
having the wrong context.
2020-09-28 12:36:07 +02:00
Samuel BF d99d1aaa21 Removing unused n_fields in journal-gatewayd 2020-09-28 12:18:17 +02:00
Luca Boccassi feee7f6288 libcrypt-util: use build-time check for crypt_preferred_method
After https://github.com/systemd/systemd/pull/16981 only the presence of crypt_gensalt_ra
is checked, but there are cases where that function is available but crypt_preferred_method
is not, and they are used in the same ifdef.
Add a check for the latter as well.
2020-09-28 10:23:48 +02:00
7 changed files with 39 additions and 31 deletions

View File

@ -541,6 +541,18 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHP*:pn*[sS][pP][eE][cC][tT][rR][eE]*x360Convert
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHP*:pnHPSpectrex360Convertible13*:pvr* evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHP*:pnHPSpectrex360Convertible13*:pvr*
KEYBOARD_KEY_82=f20 # Fn+F12; Microphone mute button, should be micmute KEYBOARD_KEY_82=f20 # Fn+F12; Microphone mute button, should be micmute
# HP Elite x2 1013 G3
evdev:atkbd:dmi:bvn*:bvr*:svnHP*:pnHPElitex21013G3:*
KEYBOARD_KEY_f8=unknown # rfkill is also reported by HP Wireless hotkeys
KEYBOARD_KEY_64=calendar
KEYBOARD_KEY_81=f20 # Microphone mute button
KEYBOARD_KEY_ee=switchvideomode # Switch display outputs
KEYBOARD_KEY_92=brightnessdown
KEYBOARD_KEY_97=brightnessup
evdev:name:Intel HID events:dmi:bvn*:bvr*:svnHP*:pnHPElitex21013G3:*
KEYBOARD_KEY_08=unknown # rfkill is also reported by HP Wireless hotkeys
# Elitebook # Elitebook
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*Compaq*:pvr* evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*Compaq*:pvr*
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*EliteBook*:pvr* evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*EliteBook*:pvr*

View File

@ -397,6 +397,10 @@ sensor:modalias:acpi:BMA250*:dmi:*:bvritWORKS.G.WI71C.JGBMRB*:*:svnInsyde:pni71c
sensor:modalias:acpi:BOSC0200*:dmi:*:svnIRBIS:pnTW90:* sensor:modalias:acpi:BOSC0200*:dmi:*:svnIRBIS:pnTW90:*
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1 ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
# NB111
sensor:modalias:acpi:KIOX010A*:dmi:*svn*IRBIS*:*pn*NB111*
ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1
#TW118 #TW118
sensor:modalias:acpi:BOSC0200*:dmi:*:svnIRBIS:pnTW118:* sensor:modalias:acpi:BOSC0200*:dmi:*:svnIRBIS:pnTW118:*
ACCEL_MOUNT_MATRIX=1, 0, 0; 0, -1, 0; 0, 0, 1 ACCEL_MOUNT_MATRIX=1, 0, 0; 0, -1, 0; 0, 0, 1

View File

@ -884,8 +884,9 @@ libcrypt = cc.find_library('crypt')
crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>''' crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
foreach ident : [ foreach ident : [
['crypt_ra', crypt_header], ['crypt_ra', crypt_header],
['crypt_gensalt_ra', crypt_header]] ['crypt_preferred_method', crypt_header],
['crypt_gensalt_ra', crypt_header]]
have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE', have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
dependencies : libcrypt) dependencies : libcrypt)

View File

@ -2868,7 +2868,6 @@ finish:
m = manager_free(m); m = manager_free(m);
} }
reset_arguments();
mac_selinux_finish(); mac_selinux_finish();
if (reexecute) if (reexecute)
@ -2895,6 +2894,7 @@ finish:
* in become_shutdown() so normally we cannot free them yet. */ * in become_shutdown() so normally we cannot free them yet. */
watchdog_free_device(); watchdog_free_device();
arg_watchdog_device = mfree(arg_watchdog_device); arg_watchdog_device = mfree(arg_watchdog_device);
reset_arguments();
return retval; return retval;
} }
#endif #endif
@ -2920,5 +2920,6 @@ finish:
freeze_or_exit_or_reboot(); freeze_or_exit_or_reboot();
} }
reset_arguments();
return retval; return retval;
} }

View File

@ -2114,25 +2114,9 @@ static int make_tmp_prefix(const char *prefix) {
} }
static int make_tmp_subdir(const char *parent, char **ret) {
_cleanup_free_ char *y = NULL;
y = path_join(parent, "/tmp");
if (!y)
return -ENOMEM;
RUN_WITH_UMASK(0000) {
if (mkdir(y, 0777 | S_ISVTX) < 0)
return -errno;
}
if (ret)
*ret = TAKE_PTR(y);
return 0;
}
static int setup_one_tmp_dir(const char *id, const char *prefix, char **path, char **tmp_path) { static int setup_one_tmp_dir(const char *id, const char *prefix, char **path, char **tmp_path) {
_cleanup_free_ char *x = NULL; _cleanup_free_ char *x = NULL;
_cleanup_free_ char *y = NULL;
char bid[SD_ID128_STRING_MAX]; char bid[SD_ID128_STRING_MAX];
sd_id128_t boot_id; sd_id128_t boot_id;
bool rw = true; bool rw = true;
@ -2166,9 +2150,21 @@ static int setup_one_tmp_dir(const char *id, const char *prefix, char **path, ch
} }
if (rw) { if (rw) {
r = make_tmp_subdir(x, tmp_path); y = strjoin(x, "/tmp");
if (!y)
return -ENOMEM;
RUN_WITH_UMASK(0000) {
if (mkdir(y, 0777 | S_ISVTX) < 0)
return -errno;
}
r = label_fix_container(y, prefix, 0);
if (r < 0) if (r < 0)
return r; return r;
if (tmp_path)
*tmp_path = TAKE_PTR(y);
} else { } else {
/* Trouble: we failed to create the directory. Instead of failing, let's simulate /tmp being /* Trouble: we failed to create the directory. Instead of failing, let's simulate /tmp being
* read-only. This way the service will get the EROFS result as if it was writing to the real * read-only. This way the service will get the EROFS result as if it was writing to the real

View File

@ -58,9 +58,6 @@ typedef struct RequestMeta {
bool follow; bool follow;
bool discrete; bool discrete;
uint64_t n_fields;
bool n_fields_set;
} RequestMeta; } RequestMeta;
static const char* const mime_types[_OUTPUT_MODE_MAX] = { static const char* const mime_types[_OUTPUT_MODE_MAX] = {
@ -554,10 +551,6 @@ static ssize_t request_reader_fields(
/* End of this field, so let's serialize the next /* End of this field, so let's serialize the next
* one */ * one */
if (m->n_fields_set &&
m->n_fields <= 0)
return MHD_CONTENT_READER_END_OF_STREAM;
r = sd_journal_enumerate_unique(m->journal, &d, &l); r = sd_journal_enumerate_unique(m->journal, &d, &l);
if (r < 0) { if (r < 0) {
log_error_errno(r, "Failed to advance field index: %m"); log_error_errno(r, "Failed to advance field index: %m");
@ -568,9 +561,6 @@ static ssize_t request_reader_fields(
pos -= m->size; pos -= m->size;
m->delta += m->size; m->delta += m->size;
if (m->n_fields_set)
m->n_fields -= 1;
r = request_meta_ensure_tmp(m); r = request_meta_ensure_tmp(m);
if (r < 0) { if (r < 0) {
log_error_errno(r, "Failed to create temporary file: %m"); log_error_errno(r, "Failed to create temporary file: %m");

View File

@ -40,7 +40,11 @@ int make_salt(char **ret) {
e = secure_getenv("SYSTEMD_CRYPT_PREFIX"); e = secure_getenv("SYSTEMD_CRYPT_PREFIX");
if (!e) if (!e)
#if HAVE_CRYPT_PREFERRED_METHOD
e = crypt_preferred_method(); e = crypt_preferred_method();
#else
e = "$6$";
#endif
log_debug("Generating salt for hash prefix: %s", e); log_debug("Generating salt for hash prefix: %s", e);