Commit Graph

196 Commits

Author SHA1 Message Date
Jesse Smith
828c2704a1 Removed old LSM file.
Added .gitignore files to avoid git tracking object files.
Removed old start-stop-daemon from contrib directory.
2018-05-04 22:08:38 -03:00
Jesse Smith
e0cfd39728 Added "Fall through" comments to some switch statements where multiple
approaches are tried in order to prevent warnings from GCC 7 (and newer).

Added includes on Linux for sys/sysmacros.h as the old defines in
the sys/types.h file will be removed in the future.
2018-05-04 14:51:40 -03:00
Jesse Smith
cfb39b573f Updated init.c to remove some old notes and answer questions
that were flagged in comments or FIXME labels.
2018-04-23 00:09:49 -03:00
Jesse Smith
272f112c98 Added new signal handler for SIGUSR2. When init receives SIGUSR2
it closes (and leaves closed) the named pipe /run/initctl. This
can be used to make sure init does not have any files open. However,
it also means we cannot switch run levels or bring down the system.
The pipe can be re-opened by sending init the SIGUSR1 signal.

Updated the man pages for initctl and init to include this information.
2018-04-17 19:44:50 -03:00
Jesse Smith
f09da9cb55 Add check to make sure /run/initctl is open before we try to close
it when receiving SIGUSR1. Avoids crashing upon receiving signal.
2018-04-15 14:09:33 -03:00
Jesse Smith
266671c968 Added documentation page for initctl (/run/initctl). 2018-04-08 22:03:07 -03:00
Jesse Smith
a4508479f5 Updated shutdown to check if time has lapsed when we did not
notice. For example if the computer was in sleep mode pending
a shutdown. The shutdown command now notices time has past
and adjusts its countdown clock to compensate. Accurate
to the nearest minute.
Closes Savannah bug #36279
2018-04-04 23:12:25 -03:00
Jesse Smith
d9b6475d85 Removed unneeded "count" variable in utmpdump.c.
Fixed typo in accidental wrote_wtmp_rlevel == 0 || wrote_wtmp_rlevel
comparison so the latter is wrote_utmp_rlevel.

Simplified logic in mountpoint.c when testing for same device or same inode.

Thanks to David Binderman for pointing out the above three issues.
2018-03-30 22:15:04 -03:00
Jesse Smith
e02e001f7a Updated changelog in preparation for release. 2018-03-27 20:47:49 -03:00
Jesse Smith
a436cdc993 Merge branch 'mountpoint' 2018-03-27 20:33:52 -03:00
Jesse Smith
8c8172349e Updated mountpoint to search for circular mount points when using
the -p parameter. This works around mountpoint not recognizing
circular mounts where /a/b/c/d and /a/b are the same location
(ie the same device and same inode).
Closes Savannah bug #37114.
2018-03-07 16:25:53 -04:00
Jesse Smith
a8ef2a24c5 Updated changelog. 2018-03-07 13:59:51 -04:00
Jesse Smith
a3f38afc34 Updated documentation and install instructions. Refreshed copyright notice. 2018-02-27 17:28:10 -04:00
Jesse Smith
2e1f87635e Removed extra sleep() calls from shutting down process since we use
sync() anyway to pause and make sure data is written out to disk.
2018-02-22 21:07:51 -04:00
Jesse Smith
2b651b469e Fixed Clang compiler warning when calling sprintf() with
variable number of data parameters.
2018-02-21 18:05:58 -04:00
Jesse Smith
8c00f756ec Imported changelog from Jesse's source repo. 2018-02-20 19:42:51 -04:00
Jesse Smith
87032d1937 Moved initscript.sample from source to doc directory and committed it. 2018-02-20 19:39:07 -04:00
Jesse Smith
80dbcf3de3 Moved the named communication pipe from /dev/initctl to /run/initctl. This
patch was supplied by Robert Millan from Debian. FreeBSD apparently does not
like named piped in /dev, so we move it to /run for better cross-platform
compatibility.
2018-02-20 19:29:08 -04:00
Petter Reinholdtsen
ca4561271e Check exit code from dup() in spawn() and log error if it fail.
Patch from Michał Kulling.
2014-02-10 22:47:27 +00:00
Petter Reinholdtsen
d53cccb542 Use narrowly scoped file descriptor for handling opened TTY in
spawn().  Patch from Michał Kulling.
2014-02-10 22:44:15 +00:00
Petter Reinholdtsen
da988bb28e Make it possible to specify the initctl path as a compile time define INIT_FIFO. 2014-02-07 23:27:39 +00:00
Petter Reinholdtsen
4811afc88b Remove obsolete/ directory from tarball. None of it have been useful for many years. 2014-02-07 19:16:41 +00:00
Petter Reinholdtsen
67710ce13b Drop dsf part from version number. It no longer make sense to keep. 2014-02-07 19:04:25 +00:00
Petter Reinholdtsen
303f3465f6 Port ifdown.c to FreeBSD. Patch from Guillem Jover and Debian. 2014-02-07 17:55:37 +00:00
Petter Reinholdtsen
58b3b75728 Fix typo in fstab-decode(8) font escape. Patch from Bjarni Ingi
Gislason and Debian.
2014-02-07 17:44:15 +00:00
Petter Reinholdtsen
a05987e281 Document length limit for the process field in the inittab. Patch
from Johannes Truschnigg and Debian.
2014-02-07 17:41:58 +00:00
Petter Reinholdtsen
1b91c378b9 Adapt bootlogd TIOCCONS call to kfreebsd. Patch from Mats Erik
Andersson and Debian.
2014-02-07 17:03:04 +00:00
Petter Reinholdtsen
de1344feb8 Rewrite findtty() in bootlogd.c to not chance working directory, to
reduce the amount of failure that can happin in that function.
2014-02-07 11:06:57 +00:00
Petter Reinholdtsen
8478327498 Adjust makefile to make it easier to link all binaries statically.
Patch from Matias A. Fonzo and Dragora.
2014-01-28 22:11:34 +00:00
Petter Reinholdtsen
834bcebcaf Use sysconf(_SC_SYMLOOP_MAX) instead of MAXSYMLINKS. If sysconf
returns an error, fall back to MAXSYMLINKS on platforms that
define it.  Fixes build on Hurd.  Patch from Justus Winter and
Debian.
2014-01-28 10:13:10 +00:00
Petter Reinholdtsen
c26aaa4410 Define _XOPEN_SOURCE when building to get crypt() from <unistd.h> instead of using <crypt.h> in sulogin.c, to get the source building with the musl C library. 2014-01-27 22:05:54 +00:00
Petter Reinholdtsen
52b92185de Move dovoid() macro from #ifdef__GLIBC__ to #ifdef __linux__, to match the condutions of the place where it is used. Thanks to Matias A. Fonzo for noticing. 2014-01-27 21:55:57 +00:00
Petter Reinholdtsen
f11cdf9554 Adjust included headers to be compatible with the musl C library. Patch from Matias A. Fonzo and Dragora. 2014-01-26 22:00:42 +00:00
Petter Reinholdtsen
d2f82534cf Try harder to find libcrypt.*, even if there is no static library
available.  Also look in /usr/lib/*/ for the library, to handle
Debian multiarch systems.  Based on patch from Andrew Gregory.
2014-01-25 21:57:25 +00:00
Petter Reinholdtsen
45660f6ee6 Rename internal functions warn() and shutdown() in the shutdown
binary to avoid surprising dynamic library name resolution
conflict with NSS modules.  Patch from Richard Tollerton.
2014-01-25 21:50:09 +00:00
Petter Reinholdtsen
ffcb38faae Fix typo in changelog text. 2014-01-25 21:25:21 +00:00
Petter Reinholdtsen
571c45f3e6 Improve message printed when signaling processes to stop. Patch from Matias A. Fonzo at the dragora project. 2014-01-25 21:20:22 +00:00
Werner Fink
1017641f3e Shutdown: use PATH_DEFAULT as suggested by Paul Arthur in local bug #36101
Killall5/pidof: handle strange names of executables (local bug #36252)
Sulogin: be aware the crypt(3) may fail (local bug #36313)
2012-10-11 13:10:40 +00:00
Werner Fink
ec06765756 * Do not forget room for last NULL of new environment (was local bug 35866) 2012-03-19 12:50:36 +00:00
Werner Fink
99a0a2583f * Handle deleted binaries in pidof (was local bug #34992) 2012-03-16 16:46:06 +00:00
Werner Fink
d1a0609ab0 * Allow init to delte extra environment variables (was local bug
#35858)
* Avoid that init double environment variables for its childs
  (was local bug #35855)
2012-03-16 15:58:21 +00:00
Werner Fink
6fe3edd48c Add some code to be able to detect programs even as user with
kernel 3.0 and above
2011-10-17 12:53:27 +00:00
Werner Fink
4860983f8b Sulogin: respect byte order that is do not mix chars and ints 2011-07-27 10:49:05 +00:00
Werner Fink
09aa81cdbb Sulogin: if zero is read at reading the passwd guess it's done. 2011-07-26 12:03:13 +00:00
Werner Fink
eddea371ca Sulogin: enforce reconnection of stdin/stdout/stderr if a device
was specified.
2011-07-26 10:21:13 +00:00
Werner Fink
bfca7da0f5 * Remove man-db tag for encoding for canonical man 2011-04-27 13:41:04 +00:00
Werner Fink
4301a57e89 Sulogin: try to detect the real device(s) used for the system console
/dev/console if but only if /dev/console is used.  On Linux this can
be more than one device, e.g. a serial line as well as a virtual
console as well as a simple printer.
2011-04-04 13:57:54 +00:00
Werner Fink
d9122565a0 * Fix counting message lines in wall. Patch from Petr Lautrbach.
* Fix bad printf conversion specifier in wall. Patch from Sébastien Luttringer.
* Add patches from Openwall project. Thanks goes to Solar Designer.
2011-03-15 13:16:55 +00:00
Werner Fink
1ef9e7736c * Add code to detect the system consoles with the help of the
new /proc/consoles files of linux kernel 2.6.38+
2011-03-11 17:29:36 +00:00
Werner Fink
6dacdb9ad0 * Try to make utmpdump IPv6 valid, change based on suggestion from
Navdeep Bhatia (see local bug #32429)
2011-03-11 16:51:07 +00:00
Werner Fink
84e86ebbcd * Fix signal and alarm handling based on the patch from Florent Viard.
(was local bug #32304)
* Add fix for Redhat bug #573346: last incorrectly displays IPv6
  addresses (was local bug #29497)
2011-03-11 16:10:42 +00:00
Werner Fink
06972d9a7a Make quotes visible in example of the manual page of fstab-decode 2010-05-19 08:11:05 +00:00
Werner Fink
5114500187 Add fix for Debian bug #580272 2010-05-17 09:44:34 +00:00
Werner Fink
ba54bb9ac4 Fix sysvinit bug #29758 2010-05-04 07:50:12 +00:00
Werner Fink
27821f3c1b * Include limits.h in killall.c to enforce definition of PATH_MAX 2010-04-28 08:31:17 +00:00
Petter Reinholdtsen
cdb70c3a56 Only set the VSWTC field for termios in init if it is available, to get the source building on FreeBSD. 2010-04-27 19:51:01 +00:00
Petter Reinholdtsen
608673d2e3 Add #ifdef in bootlogd.c to avoid gcc warnings about unused variable on non-linux platforms. 2010-04-27 19:43:17 +00:00
Petter Reinholdtsen
9abf8cc828 The next release will be 2.89. 2010-04-27 14:33:32 +00:00
Werner Fink
d886c94c9f * Correct fix for Debian bug #547073: use IUTF8 flag if defined
and if already set to make sure the utf-8 flag is not cleared
  from the tty. Patch from Samuel Thibault.
2010-04-27 12:32:52 +00:00
Petter Reinholdtsen
208f7a52f8 Remove obsolete changelog entry. 2010-04-11 09:25:54 +00:00
Petter Reinholdtsen
59b0f661c6 Merge PAM related changelog entries. 2010-04-11 09:03:03 +00:00
Petter Reinholdtsen
d32b28e44e Do not strip binaries before installing them, to make it easier to get binaries with debug information installed. 2010-04-11 08:50:10 +00:00
Petter Reinholdtsen
b6ecd1eadc Incude definition for MNT_DETACH which is missing in older GNU libc headers. 2010-04-11 07:42:27 +00:00
Petter Reinholdtsen
66299c783d Add compatibility code to handle old path /etc/powerstatus for a while. 2010-04-11 07:41:25 +00:00
Werner Fink
1ef67cb310 * sulogin picking the SELinux context was broken. Patch by Daniel Walsh 2010-04-08 09:07:36 +00:00
Werner Fink
8d4557c16b * Remove PAM session start part from init as sulogin do not use
and will not use a PAM conv() function.  The current sulogin
   is able to handle DES as well as MD5, SHA, and Blowfish encrypted
   passwords due using getpwnam(3).
 * Enable the sulogin fallback password check to handle  MD5, SHA, and
   Blowfish encrypted passwords in case of getpwnam(3) fails.
2010-04-01 08:34:05 +00:00
Werner Fink
f92d8b1cb0 * ditto 2010-03-30 17:38:53 +00:00
Werner Fink
0c8868b54f * Extend sulogin to support additional encryption algorithms 2010-03-30 15:22:00 +00:00
Werner Fink
b2fec03199 * Test out PAM support, extend PAM support by providing environment
is specified by /etc/pam.d/init
 * Move utmp/wtmp before the execvp() in spawn() to be sure to
   use the correct pid even on a controlling tty
 * Remaining problem is that the pid of the second fork() for
   getting a controlling tty isn't that reported by spawn()
 * Re-enable writting utmp/wtmp for boot scripts
 * Provide a simply /etc/pam.d/init as without it will not work (sigh!)
2010-03-26 16:31:05 +00:00
Werner Fink
598cfa8acd * fix typo 2010-03-23 16:16:59 +00:00
Werner Fink
f69ea1f550 * Add fix for Debian bug #536574 -- Can be enabled by -DACCTON_OFF
* Add helper program fstab-decode to make it easier to handle
   /etc/mtab content. Patch by Miloslav Trmac and Fedora.
 * Add fix for Debian bug #335023 - Make sure TERM is set on FreeBSD.
 * Add fix for Debian bug #374038 - Make it clear that shutdown -c can
   only cancel a waiting shutdown, not an active one.
 * Add not to pidof manual page about the use of readlink(2). Patch by
   Bill Nottingham and Fedora.
 * Add changes for Debian bug #68621 - Add PAM support for programs spawned
   by init on the console like sulogin. Based on patch by Topi Miettinen.
2010-03-23 14:37:01 +00:00
Petter Reinholdtsen
19344a389c Merge in preparation of new release. 2010-03-20 07:32:19 +00:00
Werner Fink
210e6a26a6 * Fix some minor problems
* init - enable is_selinux_enabled() to detect selinuxfs
2010-03-19 16:53:57 +00:00
Werner Fink
b98dd2505c * sulogin - add the possibility to reset the terminal io 2010-03-12 18:18:28 +00:00
Werner Fink
d80bb06fec * init - avoid compiler warnings
* init - initialize console by using the macros from ttydefaults.h
  * init - add the possiblity to ignore further interrupts from keyboard
  * init - add the possiblity to set sane terminal line settings
2010-02-26 13:45:49 +00:00
Werner Fink
9e449b3f6d * pidof/killall5 - make omit pid list a dynamic one.
* pidof - provide '-n' to skip stat(2) syscall on network based FS.
2010-02-23 16:51:18 +00:00
Werner Fink
009d7247e4 * Set SHELL to /bin/sh in the environmant of shutdown.
* Retry to write out shutdown messages if interrupted.
2010-02-23 12:26:26 +00:00
Werner Fink
2c2d31cb4c * Detected also removable block devices at halt/reboot to be able
to flush data and send them the ATA standby command.  This should
    avoid data loss on USB sticks and other removable block devices.
  * Flush block devices on halt/reboot if not done by the kernel.
2010-02-22 14:59:58 +00:00
Werner Fink
1874af5c9c * Add option -w to the last command to display the full user and
domain names in the output.  Patch from Petr Lautrbach.
  * Add a manual page for utmpdump as this tool is sometimes
    very useful even if not intended for normal use.
  * Use paths.h macros for wall
  * Change path "/etc/powerstatus" to "/var/run/powerstatus"
2010-02-19 15:51:36 +00:00
Petter Reinholdtsen
61024466a2 Merge changelogs. 2009-11-24 17:37:31 +00:00
Werner Fink
fc8bf11327 Add changelog entry 2009-11-24 10:07:47 +00:00
Petter Reinholdtsen
5da772c28f Make sure bootlogd fflush() every line, even if asked not to flush
to disk using fdatasync().  Patch from Scott Gifford via Debian.
2009-11-22 22:23:14 +00:00
Petter Reinholdtsen
8debc401f8 Make sure bootlogd findpty() returns an error value when it fails to
find a usable pty.  Patch from Rob Leslie via Debian.
2009-11-22 22:22:09 +00:00
Petter Reinholdtsen
5b95f110af Rewrite findtty() in bootlogd to recursively search /dev/ for the
correct device, to handle terminal devices for example in /dev/pty/.
Patch from Debian.
2009-11-22 22:21:02 +00:00
Petter Reinholdtsen
de91f43eb8 Fix race condition in utmp writing. Patch from Gil Kloepfer via
Mike Frysinger and Gentoo.
2009-11-22 21:03:03 +00:00
Petter Reinholdtsen
b80d3844c1 Simplify build rules, based on patch from Mike Frysinger and Gentoo. 2009-11-20 22:55:47 +00:00
Petter Reinholdtsen
d56e3c239e Sync shutdown manual page and usage information. Patch from Mike
Frysinger and Gentoo.
2009-11-20 22:33:35 +00:00
Petter Reinholdtsen
6bf849d01d Print usage information when shutdown is used by non-root user. Patch from Mike Frysinger and Gentoo. 2009-11-14 21:35:42 +00:00
Petter Reinholdtsen
78f4178c4d Mention new home on Savannah in README. 2009-11-14 21:33:43 +00:00
Petter Reinholdtsen
bb3ff476da Add Makefile in toplevel directory. 2009-11-14 21:31:20 +00:00
Petter Reinholdtsen
0088601eef Change tty handling in init to make sure the UTF-8 flag is not cleared on boot. Patch from Samuel Thibault. 2009-11-14 21:28:32 +00:00
Petter Reinholdtsen
6d894fd45b Add casts to get rid of compiler warning about signed/unsigned issues. 2009-11-14 21:27:13 +00:00
Petter Reinholdtsen
8caa4e87f5 Fix minor bug in optimizing of argument parsing. Based on report from jakemus on freshmeat. 2009-11-14 21:12:00 +00:00
Petter Reinholdtsen
483db5bc72 Adjust makefile to make sure the install directories are created before files are copied into them. 2009-11-14 21:09:19 +00:00
Petter Reinholdtsen
cd2937d3b7 Revert change from Fedora/RedHat where the now obsolete command
INIT_CMD_CHANGECONS was introduced.  Based on feedback and patch
from Bill Nottingham.
2009-11-14 21:00:43 +00:00
Petter Reinholdtsen
2fe47a3c9f Drop hurd specific dependency on libc0.3 (>= 2.3.2.ds1-12). It is
no longer needed according to Michael Bunk.  Patch from Michael
Biebl.
2009-09-10 08:28:49 +00:00