Commit Graph

4482 Commits

Author SHA1 Message Date
Sami Kerola 7961acce46 fileutils: differentiate xmkstemp and xfmkstemp
Let developer to choose, case by case, what sort of return value is
best in her code.  The xmkstemp() is for users who want file
descriptor as return value of the function, xfmkstemp() will return
FILE pointer.

Proposed-By: Karel Zak <kzak@redhat.com>
CC: Davidlohr Bueso <dave@gnu.org>
Reference: http://marc.info/?l=util-linux-ng&m=133129570124003&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:29:38 +01:00
Sami Kerola fd2e8c693e lslocks: use xasprintf for safe allocation
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:29:38 +01:00
Sami Kerola bb9da58e80 tools: add asprintf to checkxalloc script
Reported-By: Dave Reisner <d@falconindy.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Sami Kerola 6500ec90de build-sys: fix chkdupexe regression
Commit 2897f50a6a resulted breaking
shebang substitution for chkdupexe.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Sami Kerola 6f312c8957 xalloc: use xasprintf in all files
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Sami Kerola eeb31db9b9 include: add asprintf wrapper
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Sami Kerola 1a0708a21d docs: TODO removal, ldattach usage is done
Done at Nov 2011.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Sami Kerola 6a91958bf8 pathnames: clean up various user database paths
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Sami Kerola 46b6bcca5f vipw: use xmkstemp() and lckpwdf()
Get rid private locking schema and use libc instead.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola decd963251 setpwnam: use xmkstemp() and lckpwdf()
Get rid private locking schema and use libc instead.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola a000bbb613 wall: use xmkstemp for temporary file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola 6b79eb38ba lib: add fileutils function collection
The fileutils contains xmkstemp function will create temporary file
safe and reusable manner.

Reference: http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO.html#TEMPORARY-FILES
CC: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola c900336d8b chsh: use pathnames.h for paths
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola 8c3221890a chfn: use pathnames.h for paths
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola 2ca1f4e91e docs: TODO removal, rpmatch task is done
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola 4c5e1f8e79 vipw: use rpmatch to yes/no question
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola 041b8ab252 mesg: use rpmatch to yes/no question
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola 34ca51dcc7 sfdisk: use rpmatch to yes/no question
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola b3f66f183a docs: TODO removal, login-utils error printing
Error printing was fixed at November 2010.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola ba0c903004 docs: add deprecation comments
Markup deprecation to command header to avoid people wasting time in
fixing these utilities.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:03 +01:00
Dave Reisner fed52fd5ca login: add USER to initial environment
Add this value from the passwd struct to the environment, as it is
expected by shells, and generally useful to users.

This also clarifies a poorly worded sentence in the vicinity of the
manpage change.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-13 12:24:25 +01:00
Dave Reisner abd4e8a52f lsblk: RQ-SIZE is part of the --topology output (man page bugfix)
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-13 12:22:11 +01:00
Daniel Drake ce65b29ac4 losetup: Fix setting of sizelimit on new loop devices
"losetup --offset 10 --sizelimit 20 foo.img" was producing
a loop device with offset 20 and no sizelimit. Looks like a typo,
fix it.

Signed-off-by: Daniel Drake <dsd@laptop.org>
2012-03-13 12:21:49 +01:00
Karel Zak de2174895a build-sys: add --diable-sulogin (enabled by default)
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 15:16:09 +01:00
Karel Zak 29d2011abb build-sys: note sulogin in configure help
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 14:53:18 +01:00
Karel Zak 59ef660f04 sulogin: share vc initialization with agetty
The virtual console initialization has been removed by Dave's
commit 5ec4a799c2.

We already use this tty initialization for agetty, so reuse the same
code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 14:41:00 +01:00
Karel Zak 879a7ab470 agetty: move vc initialization to ttyutils.h
... to make the code usable for sulogin.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 14:39:32 +01:00
Karel Zak 7c6bc22b5c sulogin: add note about port to util-linux to the man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 12:55:26 +01:00
Karel Zak c3e706a9ba sulogin: fix selinux build
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 12:47:37 +01:00
Karel Zak 1d28b828fa sulogin: parse timeout more carefully
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 12:43:53 +01:00
Karel Zak 24ff2f5758 sulogin: initialize nls stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 12:36:39 +01:00
Karel Zak adf97f0780 sulogin: check chdir and getcwd return values [-Wunused-result]
sulogin.c: In function ‘sushell’:
sulogin.c:338:7: warning: ignoring return value of ‘chdir’, declared
with attribute warn_unused_result [-Wunused-result]
sulogin.c:359:8: warning: ignoring return value of ‘getcwd’, declared
with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 12:32:03 +01:00
Karel Zak 8614335f6b sulogin: add long options
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 12:23:29 +01:00
Karel Zak cd8703ade9 sulogin: use EXIT_*
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 11:51:19 +01:00
Karel Zak d45e5dff34 sulogin: use err.h stuff
and print "Login incorrect" to stderr like login(1).

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 11:48:33 +01:00
Karel Zak b6506dc914 sulogin: replace perror() with warx()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 11:38:12 +01:00
Karel Zak adfbaecff7 sulogin: cleanup comments
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 11:29:09 +01:00
Dave Reisner 36e1b56db3 sulogin: add i18n strings
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:47 +01:00
Dave Reisner 9211be3043 sulogin: use a more standard usage output
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:45 +01:00
Dave Reisner 5fe090d8e2 sulogin: header/include cleanup
- use our own crypt.h compile time check
- remove ttydefaults.h include -- get this via termios.h, the same as
  agetty

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:43 +01:00
Dave Reisner 97e04909ed sulogin: use pathnames.h for file locations
This covers /etc/shadow and /etc/passwd. We don't have a define for
/bin/sh -- just replace the macro with the hardcoded string as done
elsewhere.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:41 +01:00
Dave Reisner b1619c88d3 sulogin: get rid of calls to /bin/sash
This probably doesn't exist on most systems, and if the root's shell and
/bin/sh fail to execute, it seems unlikely that /bin/sash will save us.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:39 +01:00
Dave Reisner ffd6e1e4e0 sulogin: use size_t for iterator to avoid cast
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:36 +01:00
Dave Reisner 5ec4a799c2 sulogin: remove USE_ONELINE and SANE_TIO defines
This was only ever compiled in for a single distro, with no clear
indication of why.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:35 +01:00
Dave Reisner 1df0ee1f05 sulogin: remove CHECK_{DES,MD5} defines
Remove these always-true defines along with their #ifdef statements.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:33 +01:00
Dave Reisner 97795a73e9 sulogin: replace older signal() with sigaction()
This provides a more reliable means of saving and restoring signal
handlers and avoids ugly (invalid) function pointer assignments. This
also removes the #ifdef blocking usage of a GCC attribute, which is
widely used in the rest of the codebase.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:31 +01:00
Dave Reisner 6070662664 sulogin: whitespace fixes
Use a code style more inline with the rest of the project.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:29 +01:00
Dave Reisner 6f760f3a08 sulogin.8: refactor manpage
- Use a more standard layout using .IP macros for options
- Avoid direct references to sysvinit

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:24 +01:00
Dave Reisner 7d8a8d2cd9 sulogin: initial import from sysvinit
Import the source and manpage of sulogin. Only the selinux #ifdef is
changed to match our autotool setup.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:21 +01:00
Dave Reisner 208848ef27 fstab.5: fix misspelling of deprecated
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-12 11:17:18 +01:00