summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* logger man page: update --size docRainer Gerhards2015-03-101-4/+7
| | | | | | now we have strict sizes Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: bugfix: missing sanity checks with --prio-prefix optionRainer Gerhards2015-03-101-37/+48
| | | | | | | | | | | | | | | | | | | | | | | | There were no apparent sanity checks other than applying the logmask when reading PRI values from files. As such, invalid PRIs (tested with values 192, 210, and 2100) are accepted. This in turn can trigger problems in various receivers, especially older versions. See here for details: http://www.rsyslog.com/remote-syslog-pri-vulnerability-cve-2014-3683/ Note that 2100 was changed to 52 as described in above link. This patch refactors PRI processing. Invalid PRIs are detected and in this case the message is sent with the default priority, with the invalid pri being part of the message to be sent. This is along the line of what 2.26 did when it detected the PRI was invalid. The refactoring now also enables pricese tracking of syslog header length in all cases, so --size is now strictly obeyed. [kzak@redhat.com: - fix compiler warning [-Wunused-variable]] Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: refactor message generationRainer Gerhards2015-03-101-44/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the message format was generated in one big step. Now this is refactored to generate the header independently. This not only provides a better isolation of functionality, but enables to calculate the size of the header *before* generating the user part of the message. That in turn is needed in order to precisely enforce the message size limit. This is especially important while processing files, as here parts of the message may be lost if the receiver truncates the message. The file reader itself tries to guard against this by reading only the permitted number of bytes, but without knowing the header size, it would mis-guess here. Note that when --prio-prefix is given, we still do not know exactly the header length, because the PRI value is between 1 and 3 bytes. Unfortunately, we do not know the actual size before reading. With the current (simple) approach, we need to read the full line before getting the PRI, so this is a hen-egg problem. To solve this, a more complex reader would be required. It is questionable if this is necessary for a tool like logger. So currently, we still have a 2-byte window of uncertainty if --prio-prefix is given. [kzak@redhat.com: - fix compiler warnings [-Wunused-but-set-variable]] Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: permit to send messages larger than 1024 charactersRainer Gerhards2015-03-103-8/+32
| | | | | | | | | | | | | | | | | | This is an important capability that has been specified in RFC5424. However, messages larger than 1024 chars are being accepted for years now by at least rsyslog and syslog-ng. This patch adds the option --size to permit setting a new max size, with 1024 being the default. Note that the size limit is only approximative, as we do not take the header size in account (RFC talks about total message length). [[kzak@redhat.com: - add 'S' to getopt_long(), - rename --message-size to --size - add the option to bash-completion] Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: reload issue on --autologin --login-pause tooKarel Zak2015-03-091-79/+92
| | | | | | | | The current "agetty --reload" implementation does not refresh issue file output on autologin. Let's support this use-case too. Reported-by: Sitsofe Wheeler <sitsofe@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: make sure that reload file existsKarel Zak2015-03-091-5/+16
| | | | | | | | | | agetty monitors /run/agetty.reload file, unfortunately if the file does not exist when agetty starts up then "agetty" --reload does not work. This patch forces agetty to create the file before inotify is enabled. Reported-by: Sitsofe Wheeler <sitsofe@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix typoKarel Zak2015-03-061-1/+1
|
* Revert "build-sys: remove static builds from make-check"Karel Zak2015-03-061-0/+1
| | | | | | The problem should be fixed now. This reverts commit 948b87581e7f1a430f258e169282a1755bb68edd.
* build-sys: cleanup realtime lib usageKarel Zak2015-03-065-21/+22
| | | | | | | | * check for timer_create() * define dependence on timer_create() for flock * rename CLOCKGETTIME_LIBS to REALTIME_LIBS Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/timer: use separate file for timersKarel Zak2015-03-067-60/+76
| | | | | | | | It seems that static builds require -lpthread for timer_* functions. It's better to keep it out of our libs (e.g. libmount) to avoid unnecessary dependence. Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'logger-man-syslog-routine' of ↵Karel Zak2015-03-061-3/+3
|\ | | | | | | | | | | | | | | https://github.com/rgerhards/util-linux * 'logger-man-syslog-routine' of https://github.com/rgerhards/util-linux: logger man page: bump man page date to current logger man page: fix some "syslog(3) routine" remnants
| * logger man page: bump man page date to currentRainer Gerhards2015-03-061-1/+1
| |
| * logger man page: fix some "syslog(3) routine" remnantsRainer Gerhards2015-03-061-2/+2
| |
* | Merge branch 'logger-fix-tcp-framing' of https://github.com/rgerhards/util-linuxKarel Zak2015-03-061-13/+27
|\ \ | |/ |/| | | | | | | * 'logger-fix-tcp-framing' of https://github.com/rgerhards/util-linux: logger: bugfix: tcp syslog framing is broken, -T unusable logger: refactor the way output is written
| * logger: bugfix: tcp syslog framing is broken, -T unusableRainer Gerhards2015-03-061-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logger can send via plain tcp syslog if -n -T options are given. However, the framing is broken so that a syslog receiver can not know where the first message ends and the next one starts. It actually looks like no framing at all is used. Plain TCP syslog framing is described in RFC6587. This patch adds RFC6587 octet-stuffed framing to TCP syslog. For local logging, this is always fine, for remote logging this is NOT recommended by the IETF (the RFC is historic). However, a full blown RFC5425 TLS sender seems to be out of scope for a tool like logger IMO. This patch also refactors the way output is written, seperating the message format generators from the output writer.
| * logger: refactor the way output is writtenRainer Gerhards2015-03-061-13/+12Star
| | | | | | | | | | | | Previously, output was written in exactly the same way in three different places. This is now combined into a single function. This hopefully makes it easier to adapt to changing output needs.
* | logger: use username as the default tagKarel Zak2015-03-061-1/+1
| | | | | | | | | | Reported-by: Rainer Gerhards <rgerhards@adiscon.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* | logger: remove "interface to syslog(3)" from man pageKarel Zak2015-03-061-5/+1Star
|/ | | | | | | since v2.26 logger does not use syslog(3) anymore Reported-by: Rainer Gerhards <rgerhards@adiscon.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'logger-kernel-regression' of ↵Karel Zak2015-03-061-1/+3
|\ | | | | | | | | | | | | | | https://github.com/rgerhards/util-linux * 'logger-kernel-regression' of https://github.com/rgerhards/util-linux: logger: fix -p kern.* priority is accepted regression logger: messages are logged with kern.* priority by default
| * logger: fix -p kern.* priority is accepted regressionRainer Gerhards2015-03-051-0/+2
| | | | | | | | | | Pre 2.26, syslog(3) was used for local logging, and it did not accept kern.* priorities. This is re-enabled by the patch.
| * logger: messages are logged with kern.* priority by defaultRainer Gerhards2015-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | The default should be user.notice and kern.* should never be used (syslog(3) forbids this). This is a severe regression, as messages are now logged to the wrong bin or not at all. So they get lost and may confuse readers of the kernel bin. regression from 2.25.2 to 2.26
* | logger: fix whitespace and compiler warning [-Wunused-variable]Karel Zak2015-03-061-2/+1Star
| | | | | | | | | | | | | | misc-utils/logger.c: In function ‘syslog_rfc3164’: misc-utils/logger.c:336:9: warning: unused variable ‘now’ [-Wunused-variable] Signed-off-by: Karel Zak <kzak@redhat.com>
* | Merge branch 'logger-fix-local-timestamp' of ↵Karel Zak2015-03-061-13/+29
|\ \ | | | | | | | | | | | | | | | | | | https://github.com/rgerhards/util-linux * 'logger-fix-local-timestamp' of https://github.com/rgerhards/util-linux: logger: fix invalid timestamp regression in local format
| * | logger: fix invalid timestamp regression in local formatRainer Gerhards2015-03-051-13/+29
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 1d57503378bdcd838365d625f6d2d0a09da9c29d logger no longer uses the syslog(3) call. The way the local timestamp is generated did not match the syslog(3) format. Most importantly, the month name is formatted based on the user's local. For example: $ ./logger --stderr test with logger 2.26.39-eb651-dirty <5>Mär 5 14:17:47 logger: test with logger 2.26.39-eb651-dirty "Mär" like in German "März" for "March". previously: $ logger --stderr test with logger 2.25.2 rger: test with logger 2.25.2 In the system log file, this results to the following: Mar 5 14:17:47 host Mär 5 14:17:47 logger: test with logger 2.26.39-eb651-dirty Mar 5 14:18:01 host rger: test with logger 2.25.2 This local naming is invalid as of RFC3164. One may argue that the local log socket traditionally does not have RFC3164 format, but the timestamp always was as defined in RFC3164 (and along the lines of the ctime() call). Anything else would also be impractical, as a syslog parser would otherwise need to know about all potential locale-specific representations of month names. This patch corrects the problem and also refactors the timestamp handling a bit. The same timestamp is needed in local and rfc3164 processing, so there now is a new function to create that stamp.
* | logger: add commentKarel Zak2015-03-061-1/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | Merge branch 'logger-format-fix' of https://github.com/rgerhards/util-linuxKarel Zak2015-03-061-8/+6Star
|\ \ | | | | | | | | | | | | * 'logger-format-fix' of https://github.com/rgerhards/util-linux: logger: fix inconsistent format regression when logging locally
| * | logger: fix inconsistent format regression when logging locallyRainer Gerhards2015-03-051-8/+6Star
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The message format when writing to local sockets is inconsistent. Example: $ ./logger --stderr test <5>Mär 4 11:03:30 logger: test $ ./logger -u /dev/log --stderr test <5>1 2015-03-04T11:03:31.699841+0100 ubuntu1404esp rger - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="29000"] test The regression was introduced with 4de2e8a03859aaab2c25dc98f33409cd28de6acc As far as the commit comments and man page indicates, this was meant to affect remote system logging only, but it also affects local logging when the -u option is given. This causes problems with receivers who do not expect full-blown RFC format on the log socket, like rsyslog. In consequence, this can also affect log analysis programs and invalidate some of their results. The patch corrects the behaviour so that the same old-style format is used for any type of local logging. New-style can always be selected by command line-options. RFC5424 is still the default for remote logging, as intended in the orignal commit. Result with the patch: $ ./logger --stderr test <5>Mär 4 11:15:35 logger: test $ ./logger -u /dev/log --stderr test <5>Mär 4 11:15:40 logger: test $ ./logger -u /dev/log --rfc5424 --stderr test <5>1 2015-03-04T11:21:28.796170+0100 ubuntu1404esp rger - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="27500"] test
* | libblkid: fix compiler warning [-Wunused-variable]Karel Zak2015-03-061-1/+0Star
| | | | | | | | | | | | | | libblkid/src/superblocks/zfs.c: In function 'probe_zfs': libblkid/src/superblocks/zfs.c:199:11: warning: unused variable 'swab_magic' [-Wunused-variable] Signed-off-by: Karel Zak <kzak@redhat.com>
* | Merge branch 'zfs' of https://github.com/mihu/util-linuxKarel Zak2015-03-061-29/+62
|\ \ | | | | | | | | | | | | | | | * 'zfs' of https://github.com/mihu/util-linux: zfs: make less syscalls blkid: make zfs detection more robust
| * | zfs: make less syscallsMichal Humpula2015-02-281-37/+58
| | |
| * | blkid: make zfs detection more robustMichal Humpula2015-02-251-15/+27
| | | | | | | | | | | | Try to use all the possible uberblock locations.
* | | build-sys: remove static builds from make-checkKarel Zak2015-03-051-1/+0Star
| |/ |/| | | | | | | | | | | | | | | .. temporary, the final solution has to cleanup timer_* functions usage. The function are unnecessary for libmount, but we use lib/monotme.c in the library and it probably requires -lrt and *also* -lpthread for static builds. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/monotonic: fix compiler warningsKarel Zak2015-03-051-0/+3
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | agetty: support /usr/lib/os-release tooKarel Zak2015-03-053-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | http://www.freedesktop.org/software/systemd/man/os-release.html The file /etc/os-release takes precedence over /usr/lib/os-release. Applications should check for the former, and exclusively use its data if it exists, and only fall back to /usr/lib/os-release if it is missing. Reported-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* | Merge branch 'logger-fix-rfc5424-timestamp' of ↵Karel Zak2015-03-051-2/+6
|\ \ | | | | | | | | | | | | | | | | | | https://github.com/rgerhards/util-linux * 'logger-fix-rfc5424-timestamp' of https://github.com/rgerhards/util-linux: logger: fix invalid timestamp in rfc5425 format
| * | logger: fix invalid timestamp in rfc5425 formatRainer Gerhards2015-03-041-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The timestamp is written as 2015-03-04T15:02:02.566782+0100 unfortunately, this is not an RFC3339 timestamp as demanded by rfc5424. The colon in the time offset field is missing. The correct timestamp is 2015-03-04T15:02:02.566782+01:00 (Note "+0100" vs. "+01:00")
* | | tailf: use size_t and fwrite()Karel Zak2015-03-051-18/+14Star
| | | | | | | | | | | | | | | | | | | | | Let's use size_t for number of output lines and use fwrite() rather than while() { putchar() }; Signed-off-by: Karel Zak <kzak@redhat.com>
* | | flock: fix timeout handler pointer usageKarel Zak2015-03-052-3/+5
| | | | | | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | | whereis: make "-BMS <dir> -f" more obvious in usage()Karel Zak2015-03-051-1/+1
| | | | | | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | | logger: fix -i argument parsing regressionSami Kerola2015-03-052-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With earlier logger it's possible to combine the option -i with other options, such as -s. But currently: $:~> logger -is logger: failed to parse id: 's' The changed behaviour breaks existing scripts like dhcpcd-run-hooks from dhcpcd. Broken-since: aab5b44405b9a6ada92e419e5a84cc0d1d4afee9 Reference: http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/9683 Reported-by: Juergen Daubert <jue@jue.li> Reviewed-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | | tailf: ensure file argument really is a fileSami Kerola2015-03-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tailf(1) never worked very well with block or character devices, sockets, fifos and such. Now after mmap() is used to find last lines even the little command used to work for example pipes is broken, so test the tailf is asked to follow a file and when not fail. That said symlinks are OK, as long they point to a file. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | | tailf: do not allow minus signed last lines argumentSami Kerola2015-03-051-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before mmap() the command behavior was not completely correct, as demonstrated below, and after the mmap() it tried to print some eighteen quintillion lines. $ tailf -n-1 x tailf: cannot allocate 18446744073709543424 bytes: Cannot allocate memory Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | | tailf: count last lines correctly at initial print outSami Kerola2015-03-051-41/+36Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | When last lines happen to be greater than string buffer size for fgets() the number of printed lines resulted to too few. To avoid miscounts due insufficient buffer size use mmap() to map the whole file and rewind until requested number of new lines is found. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | | tunelp: use parse_switch()Sami Kerola2015-03-051-16/+5Star
| | | | | | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | | flock: improve timeout handlingSami Kerola2015-03-057-44/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signal ALRM raised by the timer, and the timer only, will be considered as a timeout criteria. Secondly time interval is made to use monotonic clock. Documentation of ITIMER_REAL is unclear whether that time is affected various sources of clock skew, or does it even tick when system is suspended. Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | | flock: add --verbose optionSami Kerola2015-03-033-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | Jenkins script jobs using flock are a great example of a situation in which one may want an automation to be verbose, so that when unexpected events happen there is more hints in logs. Reviewed-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | | whereis: tell when mandatory option is missingSami Kerola2015-03-031-1/+11
|/ / | | | | | | | | | | | | | | | | The <dirs> list is terminated by any arbitrary option, but to be simple when none is specified complain about -f being missing. Reviewed-by: Benno Schulenberg <bensberg@justemail.net> Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | build-sys: add --enable-usrdir-pathKarel Zak2015-03-032-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The directories /{sbin,bin} are symliks to /usr/{sbin,bin} on many systems. This patch add new ./configure option to remove the non-usr paths from the default $PATH environment variable. The default $PATH is hardcoded in login(1) and can be overwritten by /etc/login.defs. default: ./test_pathnames | grep DEFPATH _PATH_DEFPATH /usr/local/bin:/bin:/usr/bin _PATH_DEFPATH_ROOT /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin --enable-usrdir-path: ./test_pathnames | grep DEFPATH _PATH_DEFPATH /usr/local/bin:/usr/bin _PATH_DEFPATH_ROOT /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin This patch does not modify install paths, you still have to care about --{bin,lib}dir configure options. Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: add {first,last}-lba header to sfdisk scritpsKarel Zak2015-03-022-10/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current sfdisk does not allow to create partition that starts before the default libfdisk First LBA (~1MiB). It means that # sfdisk --dump /dev/sda > foo # sfdisk /dev/sdb < foo does not work on systems where 1st partition does not start at offset 2048. This patch add new headers to scripts to inform libfdisk about different First/Last LBA ranges. For example: label: gpt first-lba: 34 allows to override the library default. Signed-off-by: Karel Zak <kzak@redhat.com>
* | docs: fstab(5) grammar / English fixes, and some other updatesPeter Cordes2015-02-271-41/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I proofread the whole thing. I fixed everything that I thought could use improvement. various grammar and man page style-guide fixes (commas, word order, etc.). Reworded a couple things to hopefully make it clear to someone that didn't already know about fstab. Re-ordered the intro paragraphs for easier skimming. And added an example line. Expanded on a couple things other things. Tightened up the wording in some other places to get the point across faster and in less space. Thanks to Benno Schulenberg <bensberg@justemail.net> for several improvements. Signed-off-by: Peter Cordes <peter@cordes.ca>