Karel Zak [Mon, 12 Jan 2015 11:19:54 +0000 (12:19 +0100)]
setarch: cleanup options usage
* call --help, --verbose and --list from one place only
* add 'archwrapper' variable to detect when called by symplink
* make --list available only got setchar(8) (but no for symlinks)
Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
setarch: differentiate between "unrecognized" and "cannot set"
When the provided string does not match any architecture that
setarch knows about, the response stays "Unrecognized architecture",
but when trying to set the specified architecture does not have any
effect, then respond with "Kernel cannot set architecture to...".
Karel Zak [Fri, 9 Jan 2015 12:05:49 +0000 (13:05 +0100)]
libfdisk: (gpt) cleanup header size usage
Kay reported that Windows 8.1 installed does not recognize GPT created
by libfdisk, but parted works as expected.
It seems (according to the header hexdump) that the problem is
HeaderSize GPT field where libfdisk uses 512 (header + reserved area),
but parted uses 92. The both is pretty valid according to the current
EFI standard, but 92 is probably more backwardly compatible.
I also found places in code where libfdisk gpt driver is inconsistent
and uses sometimes all sector and simetimes sizeof(gpt_header) only.
The right solution is to read all sector (into zeroized memory) and
later write again all sector to the device.
Reported-by: Kay Sievers <kay@vrfy.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 9 Jan 2015 09:54:56 +0000 (10:54 +0100)]
Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
tests: Add UDF hdd image created by NetBSD newfs_udf (from UDFclient 0.7.7)
tests: Add UDF hdd image created by NetBSD newfs_udf (from UDFclient 0.7.5)
tests: Add UDF hdd image created by Linux mkudffs with custom params
tests: Add UDF hdd image created by Linux mkudffs
tests: Add UDF hdd image created by Windows 7
JWP [Thu, 8 Jan 2015 04:18:52 +0000 (23:18 -0500)]
hwclock: update man page for v2.26 rc
Authored new section: DATE-TIME CONFIGURATION.
Subsections: Keeping Time..., LOCAL vs UTC, POSIX vs 'RIGHT'.
Errata and drop outdated language.
Updates for v2.26
Signed-off-by: J William Piggott <elseifthen@gmx.com>
With no /etc/adjtime file the current behavior is:
hwclock --utc --adjust #Creates a UTC file.
hwclock --localtime --adjust #File is not created.
That is the opposite of what UTC default should do.
With this patch the behavior is:
hwclock --utc --adjust #File is not created.
hwclock --localtime --adjust #Creates a LOCAL file.
'Creates a xxxx file' means: An /etc/adjtime file
is created with zero for all parameters except the
Hardware Clock's timescale field, which is set to
the value indicated by xxxx.
The second item missed in the patch was a test in
the save_adjtime() function that defaults to LOCAL.
Theoretically we cannot get to the save function
without having a value set for adjtime.local_utc,
but the test is there so it needs be correct.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Karel Zak [Thu, 8 Jan 2015 11:52:43 +0000 (12:52 +0100)]
nsenter: add --preserve-credentials and cleanup setgroups() usage
The new option --preserve-credentials completely disables all
operations related to UIGs and GIDs.
The patch also calls setgroups() before we enter user namespace (so
root can always clear their groups) and after we enter user namespace
(to detect /proc/self/setgroups "deny"). If both fail then nsenter
complains.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 8 Jan 2015 11:27:59 +0000 (12:27 +0100)]
nsenter: keep semantic consistent
The current nseneter behavior is inconsistent and depends on way how
namespace is specified on command line
# nsenter --user
vs.
# nseneter --user=filename
if the namespace is specified by <filename> than nsenter does not do
additinal setting and actions (e.g. does not call setgroups, setuid).
This is bug.
Karel Zak [Thu, 8 Jan 2015 10:51:58 +0000 (11:51 +0100)]
unshare: add --setgroups=deny|allow
Since Linux 3.19 the file /proc/self/setgroups controls setgroups(2)
syscall usage in user namespaces. This patch provides command line knob
for this feature.
The new --setgroups does not automatically implies --user to avoid
complexity, it's user's responsibility to use it in right context. The
exception is --map-root-user which is mutually exclusive to
--setgroups=allow.
CC: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Karel Zak <kzak@redhat.com>
unshare: Fix --map-root-user to work on new kernels
In rare cases droping groups with setgroups(0, NULL) is an operation
that can grant a user additional privileges. User namespaces were
allwoing that operation to unprivileged users and that had to be
fixed.
Update unshare --map-root-user to disable the setgroups operation
before setting the gid_map.
This is needed as after the security fix gid_map is restricted to
privileged users unless setgroups has been disabled.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Version from UDFclient 0.7.5 does not generate default Volume set identifier
according to OSTA UDF specification. But it is used so for test is usefull.
When calling mkudffs with --vsid param there is bug which cause that garbage
from application stack is copied into Volume set identifier after 8th character.
Characters 1 -- 16 are used in libblkid for generating UUID, so this is perfect
test example that everything is working!
Karel Zak [Thu, 8 Jan 2015 13:53:01 +0000 (14:53 +0100)]
Merge branch '2015wk01' of https://github.com/kerolasa/lelux-utiliteetit
* '2015wk01' of https://github.com/kerolasa/lelux-utiliteetit:
eject: add verbosity to cdrom door lock error
libblkid: assume strtoull() is available
ipcs: remove FIXME markup
ul: remove unexplained TERM=lpr override
look: remove dead code
docs: make tools/checkmans.sh to pass without warnings
build-sys: fix make checkincludes warnings
docs: add howto-pull-request.txt
docs: small improvements to howto-contribute.txt
Karel Zak [Thu, 8 Jan 2015 13:36:20 +0000 (14:36 +0100)]
Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
tests: update UDF test (add identifiers)
libblkid: udf: Fix reading LABEL, add support for UUID and other udf identifiers
libblkid: superblocks: Add function blkid_probe_set_utf8_id_label for setting utf8 id label
Sami Kerola [Wed, 7 Jan 2015 22:05:43 +0000 (22:05 +0000)]
libblkid: assume strtoull() is available
The strtoull() is part of ISO/IEC 9899:1999 (aka C99) and the function
has been happily used in prlimit(1) since 2011-10-19 without anyone
complaining compatibility issues.
Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/strtoul.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sat, 3 Jan 2015 09:20:05 +0000 (09:20 +0000)]
fsck.minix: fix segmentation fault
Return from check_file() and check_file2() functions when maximum name
depth is reached. The use unsafe strncpy() is also removed just to be on
safe side.
Addresses: https://bugs.debian.org/773892 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Wed, 31 Dec 2014 23:01:21 +0000 (23:01 +0000)]
maint: fix shadow declaration
This change fixes all shadow declarations. The worth while to mention
fix is with libfdisk sun geometry. It comes from bitops.h cpu_to_be16
macro that further expands from include/bits/byteswap.h that has the
shadowing.
libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow]
libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow]
That could have caused earlier some unexpected results.
Karel Zak [Wed, 17 Dec 2014 11:50:29 +0000 (12:50 +0100)]
libmount: (monitor) use inotify for utab lock file
It's better than monitor utab directly. The utab is updated by
rename(2) and it's really tricky for inotify, because it's necessary
to monitor all /run/mount directory and then it's necessary to verify
that the renamed file is really "utab".
The new concept is without possible false positives and it also
triggers the change when utab update is really done.
setarch: make the usage synopsis comprehensible for translators
Use two separate strings for the two different forms of setarch,
instead of filling in an untranslated word into a single string.
Also use the standard angular brackets for nonliteral arguments.
docs: restore the alternative form of setarch in its man page
Commit c372860ddb4a768f7f6c50cd26d60119370d5cd accidentally removed
the alternative form of setarch in which the command name specifies
the architecture to be set. Also improve some formatting.
ipcs: in usage show resource option as nonoptional when used with -i
Also, the resource option -a is not valid with -i, so show the valid
ones explicitly. Also gettextize the synopsis as a single string, as
the two lines are tightly related and other synopses do this too.
Sami Kerola [Sat, 20 Dec 2014 12:23:06 +0000 (12:23 +0000)]
newgrp: simplify if else clauses
The 'if' clauses that have termination as either of the control flow
results will never need 'else'. Making the termination to happen true
flow is enough.
Sami Kerola [Fri, 19 Dec 2014 19:28:19 +0000 (19:28 +0000)]
chsh: rewrite function interacting with user to get path to new shell
Rename prompt() to ask_new_shell(). Remove fixed size buffer and
allocate path to new shell, that should make Hurd people happy. Use
strutils.h for white space trimming.
Karel Zak [Fri, 19 Dec 2014 13:28:42 +0000 (14:28 +0100)]
Merge remote-tracking branch 'sami/2014wk49'
* sami/2014wk49:
chfn: make command to obey login.defs CHFN_RESTRICT instructions
chfn: remove set_changed_data() and add add_missing()
chfn: rename prompt() to ask_new_field()
chfn: move new and old finger structs to chfn control struct
chfn: clean up parse_argv()
chfn: add minimalistic struct chfn_control
chfn: simplify parse_passwd() by using strsep()
chfn: fix usage() regression
chfn: use xasprintf() rather than bunch of strlen() and malloc() calls
chfn: rewrite prompt() to use strutils
chfn: remove function prototypes
lslogins: use hardcoded paths from pathnames.h
lslogins: add space to systemd journal header and message
lslogins: reject unknown time format arguments
lslogins: fix short options
lslogins: tell why command failed
lslogins: make journald last logs time stamps to honor --time-format
lslogins: allow changing password changed and expiration time formats