Commit Graph

10311 Commits

Author SHA1 Message Date
Lennart Poettering
00772eaeba mac: rename all calls that apply a label mac_{selinux|smack}_apply_xyz(), and all that reset it to defaults mac_{selinux|smack}_fix()
Let's clean up the naming schemes a bit and use the same one for SMACK
and for SELINUX.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 18:31:53 -04:00
Lennart Poettering
575644587b selinux: make use of cleanup gcc magic
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 18:30:37 -04:00
Michal Schmidt
4531818f12 hashmap: introduce hashmap_reserve()
With the current hashmap implementation that uses chaining, placing a
reservation can serve two purposes:
 - To optimize putting of entries if the number of entries to put is
   known. The reservation allocates buckets, so later resizing can be
   avoided.
 - To avoid having very long bucket chains after using
   hashmap_move(_one).

In an alternative hashmap implementation it will serve an additional
purpose:
 - To guarantee a subsequent hashmap_move(_one) will not fail with
   -ENOMEM (this never happens in the current implementation).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 18:18:26 -04:00
Michal Schmidt
ac2d134b8c hashmap: return more information from resize_buckets()
Return 0 if no resize was needed, 1 if successfully resized and
negative on error.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 14:36:13 -04:00
Michal Schmidt
3d43ac3b56 shared: split mempool implementation from hashmaps
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 14:28:31 -04:00
Lennart Poettering
53f0b01f22 time: don't do comparison twice
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 14:12:42 -04:00
Lennart Poettering
d9c4f21a13 mac: also rename use_{smack,selinux,apparmor}() calls so that they share the new mac_{smack,selinux,apparmor}_xyz() convention
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 14:03:47 -04:00
Anthony G. Basile
538bf2441f src/udev/udevd.c: rename apis in static_dev_create_from_modules() also
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 14:01:42 -04:00
WaLyong Cho
596470312a mac: rename apis with mac_{selinux/smack}_ prefix
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 13:53:41 -04:00
Anthony G. Basile
d51b1d3cb9 src/shared/util.h: import realloc_multiply() from upstream
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 13:45:05 -04:00
WaLyong Cho
1b6c7e7255 label: rearrange mandatory access control(MAC) apis
move label apis to selinux-util.ch or smack-util.ch appropriately.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 13:28:03 -04:00
Zbigniew Jędrzejewski-Szmek
a79876e097 shared/log: add log_trace as compile-time optional debugging
Repetetive messages can be annoying when running with
SYSTEMD_LOG_LEVEL=debug, but they are sometimes very useful
when debugging problems. Add log_trace which is like log_debug
but becomes a noop unless LOG_TRACE is defined during compilation.
This makes it easy to enable very verbose logging for a subset
of programs when compiling from source.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 11:40:24 -04:00
Zbigniew Jędrzejewski-Szmek
e5d31af2df man: make udev.event-timeout more visible
Evidently some people had trouble finding it in the documentation.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 11:32:18 -04:00
Hans de Goede
4e8a74b75a hwdb: Add mapping for special keys on compaq ku 0133 keyboards
The compaq ku 0133 keyboard has 8 special keys at the top:
http://lackof.org/taggart/hacking/keyboard/cpqwireless.jpg

3 of these use standard HID usage codes from the consumer page, the 5
others use part of the reserved 0x07 - 0x1f range.

This commit adds mapping for this keyboard for these reserved codes, making
the other 5 keys work.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-25 11:24:22 -04:00
Lennart Poettering
86d54f4f8c strv: add an additional overflow check when enlarging strv()s
https://bugs.freedesktop.org/show_bug.cgi?id=76745

This also adds:
strv: use realloc_multiply() to check for multiplication overflow
by Michal Schmidt <mschmidt@redhat.com>

This could overflow on 32bit, where size_t is the same as unsigned.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-22 07:20:57 -04:00
Anthony G. Basile
8c02834721 src/shared/util.c: remove unneeded error check, following upstream
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-13 09:00:21 -04:00
Anthony G. Basile
737d6ff89b src/shared/util.c: final cosmetic change
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-13 08:39:08 -04:00
Anthony G. Basile
b7b6d29a59 src/shared/util.c: more cosmetic changes
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-13 08:16:51 -04:00
Anthony G. Basile
db7f2f6e89 src/shared/util.c: cosmetic changes to more easily follow upstream
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-13 07:57:49 -04:00
Martin Pitt
914f56525b keymap: Fix touchpad toggle key on Asus laptops
https://launchpad.net/bugs/1377352

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-07 15:40:22 -04:00
Martin Pitt
40db1e2b6e keymap: Fix touchpad toggle on Toshiba Satellite P75-A7200
Just like everywhere else we use KEY_F21 instead of KEY_TOUCHPAD_TOGGLE for X
friendliness.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-07 15:39:43 -04:00
Marcel Holtmann
18466174a8 hwdb: Update database of Bluetooth company identifiers
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-10-02 06:06:15 -04:00
Stefan Brüns
7031c49bf6 udev/hwdb: New Entry for Dell XPS12 9Q33 keyboard
https://bugs.freedesktop.org/show_bug.cgi?id=84437

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-30 16:07:52 -04:00
Zbigniew Jędrzejewski-Szmek
19a52be96c Do not format USEC_INFINITY as NULL
systemctl would print 'CPUQuotaPerSecUSec=(null)' for no limit. This
does not look right.

Since USEC_INFINITY is one of the valid values, format_timespan()
could return NULL, and we should wrap every use of it in strna() or
similar. But most callers didn't do that, and it seems more robust to
return a string ("infinity") that makes sense most of the time, even
if in some places the result will not be grammatically correct.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-30 15:57:53 -04:00
Tom Gundersen
d7447bb0ba test: udev - restrict nemuric uid's to existing ones
We now verify the existence of uid's before applying them to devicenodes, so change the
test accordingly. We assume that both uid/gid 1 and 2 exist on the test system.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-24 18:55:46 -04:00
Anthony G. Basile
ad68964501 src: minor code cleanup
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 19:58:58 -04:00
Tom Gundersen
4364e777eb udevd: don't fail if /run/udev exists
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:59:59 -04:00
Tom Gundersen
d3715a4b2a udev: fix typos
Spotted by Andreas Henriksson.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:59:24 -04:00
Tom Gundersen
90950ff547 udev: ctrl - log if setting SO_PASSCRED fails
No functional change.

Found by Coverity. Fixes CID #1237533.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:58:06 -04:00
Anthony G. Basile
2345245fdf src/udev/udev-node.c: replace our error handling with upstreams
eudev has had this error handling for a while.  upstream finally
added it with the following commit

    543afdc63c02a5af3cf6bd2a264162f23474346a

by Tom Gundersen <teg@jklm.no>.  Both methods are equivalent, but
we adopt upstreams for easier maintenance.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:55:54 -04:00
Tom Gundersen
b75d8b25e4 udevadm: hwdb - check return value of fseeko()
Fonud by Coverity. Fixes CID #996255.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:53:24 -04:00
Tom Gundersen
3a9daa4bed udevd: check return of various functions
One reported by Coverity. Fixes CID #996252.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:52:43 -04:00
Tom Gundersen
2f7510f312 udevd: parse_argv - warn if argumens are invalid
Found by Coverity. Fixes CID #1238780.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:50:45 -04:00
Robert Milasan
a580624ac3 udev: fix path for database names on 'change' event
If a device does not have a major/minor number attached, we use different
database names than if it does. On "change" events, we didn't copy the
devnum over, therefore, we used different paths than on 'add' or 'remove'
events (where devnum was properly copied).

Fix this by always copying the devnum into the udev-device.

(David: added commit-log from email)

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:48:25 -04:00
Tom Gundersen
abc50f3d92 libudev: monitor - warn if we fail to request SO_PASSCRED
The function still succeeds, so there is no functional change. This fixes CID #996288.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:47:23 -04:00
Anthony G. Basile
15f72fb472 src/shared: import upstream code needed for recent commits
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:46:21 -04:00
Tom Gundersen
1e446d862a udev: util - use log_level_from_string()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:30:35 -04:00
Tom Gundersen
be74fc7ab1 udev: event - modernize spawn_exec()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:24:50 -04:00
Tom Gundersen
fb510149ad udev: event - explicitly don't read() from invalid fd
This fixes CID #1237641.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:24:12 -04:00
Tom Gundersen
5d1b2ef564 udev: event - modernize spawn_read()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:23:12 -04:00
Tom Gundersen
dad4b71c8a udev: rules - close empty file
If the file is found to be empty, we exit early without closing the file first.

Found by coverity. Fixes CID #1237759.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:23:00 -04:00
Tom Gundersen
744749bd2e udev: rules - add missing whitespace to log message
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:22:51 -04:00
Tom Gundersen
cb6d2d864c udevd: use safe_ato*() in place of strto*()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:12:41 -04:00
Tom Gundersen
39f24db770 libudev: util - drop util_delete_path()
Use rmdir_parents() from src/shared instead.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:10:42 -04:00
Tom Gundersen
5216331b7d libudev: drop util_lookup_{user,group}
Use shared versions instead. Difference is with overwriting of repeated user/group
name, and lack of logging.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:07:21 -04:00
Tom Gundersen
136e0eef04 udev: apply permissions to static nodes before signallying READY
Processes expecting static nodes to have the right permissions may order themselves after systemd-udevd.service,
make sure that actually guarantees what is expected.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:01:42 -04:00
Tom Gundersen
1aa456d4b9 udev: only print after final log level has been determined
This delays label_init(), and drops the (duplicate) printing of version
information.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:59:59 -04:00
Tom Gundersen
af353f0f00 udevd: initialize epoll_event structs on allocation
Also move the rest of event initialization next to the event loop (no functional change).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:58:09 -04:00
Tom Gundersen
b2399d9b72 udev: don't close std{in,out,err}
Rather than printing debug output to stderr and redirecting this to /dev/null when not wanted,
use the correct log_*() function in the first place.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:57:19 -04:00
Tom Gundersen
a3fd1c6811 udev: drop duplicate logging
Once upon a time logging during early boot was unreliable, so extra logging messages were
sent by udev to stderr. That is no longer a concern, so drop all fprintf() calls from udved.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:49:26 -04:00