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
Sami Kerola [Tue, 25 Nov 2014 20:04:44 +0000 (20:04 +0000)]
ipcs: fix two data type errors [AddressSanitizer]
==3218==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffa577e2b0 at pc 0x4501f9 bp 0x7fffa577e130 sp 0x7fffa577e108
WRITE of size 112 at 0x7fffa577e2b0 thread T0
#0 0x4501f8 in shmctl /home/users/aadgrand/LLVM/releases/ubuntu/final/llvm.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:2502
#1 0x48bd13 in ipc_shm_get_info /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcutils.c:157
#2 0x488884 in do_shm /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcs.c:279
#3 0x4844a8 in main /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcs.c:175
#4 0x2afb3f8c176c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
#5 0x48408c in _start (/home/travis/build/kerolasa/lelux-utiliteetit/ipcs+0x48408c)
Sami Kerola [Wed, 17 Dec 2014 22:28:49 +0000 (22:28 +0000)]
chfn: remove set_changed_data() and add add_missing()
The add_missing() and find_field() functions are needed when input data
is incomplete, such as in case when chfn is instructed to change only
selected fields with command line options.
Sami Kerola [Sun, 14 Dec 2014 17:44:11 +0000 (17:44 +0000)]
chfn: move new and old finger structs to chfn control struct
This change is a little bit messy, and requires a comment the struct
finfo should not have 'struct passwd *pw' as it's member. The earlier
struct design would have been burden to maintain, and confusing to use.
Sami Kerola [Sun, 14 Dec 2014 12:31:11 +0000 (12:31 +0000)]
chfn: fix usage() regression
Commit db433bf737a5fd4e1c7cca5e3603934743eebd1c changed -u for --help to
-h, that is not true. The -h is short hand for --home-phone. And the
--version is accompanied with -v not -V.
Sami Kerola [Sun, 14 Dec 2014 11:37:03 +0000 (11:37 +0000)]
chfn: rewrite prompt() to use strutils
The left and right white space trimming can be done with strutils.h
[lr]trim_whitespace() functions.
As a minor fix when user input exceeds maxium allowed gecos field length
the remaining characters in stdin are purged so that re-prompting works
correctly.
Additionally the prompt() is made to add message to check_gecos_string(),
so that there are less similar strings for translation project to deal.
Sami Kerola [Fri, 12 Dec 2014 22:46:04 +0000 (22:46 +0000)]
lslogins: allow changing password changed and expiration time formats
The password change and expiry has are marked with resolution of a day,
so add a new short iso-8601 format. With this system admins can easily
find users has not updated their password lately
docs: adjust the grammar, text, sorting and formatting of logger man page
The message argument is not an option and should not be listed among
those. Describe the optional argument of --rfc5424 better. Use the
= and no space for optional option arguments. Don't italicize words
unnecessarily. Use bold for literal things. And sort the options
alphabetically (apart from -V and -h).
Will Johansson [Mon, 15 Dec 2014 11:51:29 +0000 (03:51 -0800)]
login: Fix unused variables in login.c if _HAVE_UT_TV isn't defined
Wrap around the variable declaration for `tv' with ifdef so the compilers
don't warn about unused variables if we're compiling without UT_TV. This
happens with the musl libc, since it doesn't define _HAVE_UT_TV, even
though it _does_ have the ut_tv field in the utmp struct.
Signed-off-by: Will Johansson <will.johansson@gmail.com>
Karel Zak [Tue, 9 Dec 2014 10:53:39 +0000 (11:53 +0100)]
Merge branch '2014wk48' of git://github.com/kerolasa/lelux-utiliteetit
* '2014wk48' of git://github.com/kerolasa/lelux-utiliteetit:
getopt: avoid re-terminating long_option list at every update
getopt: change --shell argument parsing function
getopt: prefer switch-case rather than long if statement
getopt: remove unnecessary code
getopt: make normalize() print strings
getopt: use xstrdup rather than malloc + strcpy
getopt: add struct getopt_control and remove global variables
getopt: remove function prototypes
getopt: make nonoptions optstring comment correct
tests: add more getopt tests
tests: copy test-suite from Frodo Looijaard's getopt
getopt: sync with 1.1.6 release
line: use util-linux conventions
textual: improve error messages
login-utils: use libc error printing facility
Sami Kerola [Mon, 8 Dec 2014 22:20:56 +0000 (22:20 +0000)]
lslogins: align usage() and manual with struct option longopts
Short option -G goes together with long option --supp-groups, while
neither of -m or --groups-info has worked in a release so remove them
from usage() and manual.