Commit Graph

608 Commits

Author SHA1 Message Date
John Regan
4f1b54dd92 passwd: prevent segfault when running as root
When running as root, passwd attempts to compare the new password to
the old password, without having grabbed the old passwd.

This checks if the previous password hash was grabbed before comparing
it against the new password hash.
2019-01-30 11:57:49 +00:00
parazyd
7ffe3cfacc uptime: Fix user/s printing (grammar error) when users == 0.
Signed-off-by: parazyd <parazyd@dyne.org>
2019-01-30 11:25:33 +00:00
sin
604b66ae8b Add blkdiscard(8) 2018-07-02 14:03:57 +01:00
Ioan-Adrian Ratiu
4f5837147a mount: don't call realpath on root target
Musl libc realpath implementation calls readlink on a procfs
path it computes via __procfdname (code at [1] & [2]).

This is problematic if ubase mount is used in a PID 1 because procfs
is not mounted and the kernel passes the rootfs mounted read-only, so
the first step is to read-write remount the rootfs, which can't be
done because procfs is not mounted. Thus we are in a dependency cycle:
procfs can't be mounted because the root is read-only and so on.

To break this cycle, don't call readlink on "/" (it doesn't really make
sense anyway) so the rootfs can be remounted read-write, after which
proc itself can be mounted and the rest of mount calls will succeed
so systems running ubase + musl can succesfully boot into userspace.

[1] https://git.musl-libc.org/cgit/musl/tree/src/misc/realpath.c?h=v1.1.19
[2] https://git.musl-libc.org/cgit/musl/tree/src/internal/procfdname.c?h=v1.1.19

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
2018-06-30 17:38:07 +01:00
sin
11d2d1faaf Fix segfault in killall5 without -o
Original patch by Platon Ryzhikov <ihummer63@yandex.ru>
2018-06-30 17:31:53 +01:00
Mattias Andrée
2d58716c23 ps: fix argv0 position in usage line
Signed-off-by: Mattias Andrée <maandree@kth.se>
2018-06-30 17:27:45 +01:00
Eric Pruitt
55795531f0 dd: Use sigaction(2) to obviate select(2)
By setting the SIGINT handler with sigaction(2), automatic retries of
the splice(2) syscall can be disabled by not setting SA_RESTART. This
makes it possible to use Ctrl+C even if the "if" operand refers to the
controlling terminal. The SIGINT message has also been moved outside
the signal handler since fprintf(3) is not an async-signal-safe
function.
2017-10-10 16:28:15 +01:00
Michael Forney
fae9ca81a2 passwd: Use a random salt when encrypting passwords 2017-08-22 13:36:56 +02:00
Michael Forney
3a5939e810 mount: Don't pass {,no}auto to kernel 2017-08-22 13:36:28 +02:00
Mattias Andrée
e3dacbb542 respawn: reopen the fifo at end of line, and use read-only
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-09-26 09:57:54 +01:00
sin
fa7ae96e0f passwd: fix function def style 2016-04-24 17:47:28 +01:00
Mattias Andrée
5b16e8a4eb pwdx: fix off-by-one bug
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-04-20 23:08:51 +01:00
Mattias Andrée
f26a1449bf Add pwdx(1)
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-04-20 23:08:51 +01:00
Mattias Andrée
28795cffe2 fsfreeze: make it clear the either -f or -u must be specified, not optional
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-03-26 19:08:10 +00:00
sin
48728b2594 nologin: Sort includes 2016-03-26 19:08:10 +00:00
Mattias Andrée
6e7386edb3 Add nologin(8)
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-03-26 19:08:10 +00:00
Eivind Uggedal
e0dc3f9546 dd: implement conv=notrunc support 2016-03-16 10:17:51 +00:00
Eivind Uggedal
596663c1b1 dd: truncate file when using seek= 2016-03-16 10:17:51 +00:00
Eivind Uggedal
e358d74a80 dd: don't let failure to change pipe size affect exit code 2016-03-16 10:17:51 +00:00
Eivind Uggedal
c64b5b04c7 dd: allow count=0 2016-03-16 10:17:51 +00:00
Eivind Uggedal
e5d88b0f30 dd: remove if= noatime optimization 2016-03-16 10:17:51 +00:00
Eivind Uggedal
05a69d9d0d dd: always create of= even if seek= is used 2016-03-16 10:17:51 +00:00
Lucas Gabriel Vuotto
0e7ab0ca9e arg.h: fixed argv checks order
This prevents accessing to a potentially out-of-bounds memory section.

Signed-off-by: Lucas Gabriel Vuotto <l.vuotto92@gmail.com>
2016-02-22 14:36:21 +00:00
sin
ac4fcddd50 df: Don't scream if statvfs() fails 2016-02-16 15:20:10 +00:00
FRIGN
4c33cf2a98 Use estrlcat where possible 2016-02-11 14:36:54 +00:00
Brad Barden
4dbd00fc94 mount: fix mount helper fs option handling
If a mount helper is used, only argopts (given on commandline) are
passed to the helper via -o parameter. Option strings from fstab are
ignored.

This patch replaces global argopts pointer with a character array
fsopts. A maximum length for filesytem options is #defined (used by
fsopts and data), and argument/mntent options are length-checked to fit.
A filesystem with too long an option string will print an error, cause
mount to exit with an error status, and not attempt to mount the
filesystem. This obviates the need for overflow checking of data in
parseopts(), though it hasn't been removed.
2016-02-11 10:16:41 +00:00
Hiltjo Posthuma
4ece17d605 LICENSE: update year and bump to top 2016-02-11 10:16:41 +00:00
izabera
3af0bbd564 fix several problems in dd 2016-01-04 18:07:44 +00:00
sin
4c34f6b100 Update copyright years 2016-01-01 12:20:11 +00:00
sin
a8f95b2f9a Use SLIST instead of TAILQ for pidof(8) 2015-10-07 13:57:24 +01:00
sin
d3efa66c82 Use SLIST instead of TAILQ for killall5(8)
No need to teardown the list at the end.
2015-10-07 13:57:24 +01:00
FRIGN
3e7e1e9644 Fix fallocate(1) manpage
To be honest, I had a little misunderstanding of the fallocate(1)-
utility.
It turns out that it only adds preallocated space if the length
exceeds the size of an already existing file.
No truncation happens.

Thus, I fixed the wording accordingly.
2015-09-14 10:15:55 +01:00
FRIGN
e3b20bbda0 Refactor fallocate(1)
1) Simplify the manpage. Just refer to fallocate(2) and stop trying
   to list supported file systems. This can change and everbody
   with common sense can bring up the relevant manpages of a given
   operating system himself.
   Use the num-semantics.
2) Use estrtonum() instead of estrtol().
3) Allow multiple arguments.
2015-09-14 10:15:55 +01:00
FRIGN
90c7584089 Refactor eject(1)
Reword manpage to be more general (you do not only eject CD-ROM-drives,
but BluRay-drives, floppy drives, LaserDisk-readers, toaster, whatever).

Allow to specify multiple devices in the command line. Doesn't add
LOC (the few more lines added are due to stricter error-checking)
and might become handy for somebody in the future while not
breaking scripts that assume only one argument.

Crying like GNU coreutils when more than one device is given is
not suckless:

$ eject /dev/sr0 /dev/sr1
eject: too many arguments
2015-09-09 23:33:17 +01:00
FRIGN
4c714a9299 Minor newline fix in ctrlaltdel.8 2015-09-07 12:09:59 +01:00
FRIGN
2f766ec92d Add myself to LICENSE 2015-09-07 12:09:59 +01:00
FRIGN
2d38b7cb9e Refactor ctrlaltdel(8)
1) Rewrite the manpage, don't just copy the util-linux manpage.
2) Fix usage() to reflect exclusivity of flags
3) Style changes.
2015-09-07 12:09:59 +01:00
FRIGN
6dedded859 Remove stdlib.h from clear(1)
This is a remnant of the old EXIT_ days we all want to quickly forget...
2015-09-07 11:47:10 +01:00
FRIGN
7b27c7f87c Refactor clear(1)
Adopting best practices(tm) we developed with sbase.
2015-09-07 11:47:10 +01:00
FRIGN
b6669b5f19 Refactor chvt(1)
1) Properly implement arg.h.
2) Use estrtonum instead of estrtol.
3) Check close().
4) Small fixes.
5) Update manpage.
2015-09-07 11:47:10 +01:00
FRIGN
cdaa7b860e Fix build
Dimitris forgot to change one line, which could, depending on the
environment, break the build ($LD would be empty).
2015-09-07 11:47:10 +01:00
sin
570a2bf4ce Use CC for ubase-box, remove LD 2015-09-03 19:57:21 +01:00
Ypnose
52a0874624 uptime.c: Use the UTMP_PATH from config.def.h 2015-09-03 19:57:21 +01:00
Hiltjo Posthuma
71da5628d1 mount: helper support + improvements
- helper support (mount.type).
  - helpers need to be in $PATH, if needed we can add a check for
    /sbin/mount.XXXX
  - pass -B, -M, -R to helper, its more reliable to pass these named
    options with -o however.
- allow prefix "no" for which type no action should be taken:
  mount -a -t nonfs,ext4

fix bugs:
- dont modify me->mnt_opts (used strtok).
2015-05-11 23:35:54 +01:00
Hiltjo Posthuma
ee5b04a7a3 switch_root: execv: show error string 2015-05-10 13:41:23 +01:00
Hiltjo Posthuma
78ddef361c mountpoint: -q should not print errors 2015-05-10 13:41:23 +01:00
Hiltjo Posthuma
7f42fe77c3 strlcpy, strlcat: print program name, use for usage
... same as sbase libutil/strl{cat,cpy}.c. Fix comment in util.h
2015-05-10 13:41:23 +01:00
Hiltjo Posthuma
06e895a67d mountpoint: style, order flags 2015-05-10 12:59:23 +01:00
tm512
d988f01f0f id: Implement -n 2015-04-26 10:40:09 +01:00
Ypnose
91cd388a39 Makefile: missing ubase-box-install in PHONY 2015-04-03 23:10:14 +01:00