Commit Graph
127 Commits
Author SHA1 Message Date
Joachim Nilsson 1dc67acd40 chargen: Make sure to check target buffer size
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-12-05 08:37:41 +01:00
Joachim Nilsson b9ae4d04ef bootmisc: Replace homegrown desym() with realpath()
Followup to issue #49.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-21 15:01:59 +01:00
Joachim Nilsson 47060c9738 bootclean: Resolve any symlinks in tmpfs check
Followup to issue #49.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-21 09:41:30 +01:00
Joachim Nilsson 846692ca03 Fix #49: Skip tmpfs directories at bootclean
We can safely skip tmpfs, nothing to clean from previous boot there.
In fact, if we clean it we may spoil things for udev, which saves
pre-boot files in /run/udev.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-20 19:29:42 +01:00
Joachim Nilsson bab13c9cef bootclean: Followup to a013e48, reduced verbosity
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-23 11:28:24 +02:00
Joachim Nilsson 67c55145b9 Fix warning for comment in comment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-10 00:03:08 +02:00
Joachim Nilsson fc2489d9e1 Remove or mark unused variables
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-10 00:02:45 +02:00
Joachim Nilsson a384a95529 Add missing warning flags and enable STD:GNU99
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-10 00:02:10 +02:00
Joachim Nilsson a013e48ab5 Run bootclean() from bootmisc plugin instead
This patch moves both the definition and the call to bootclean() from
finit.c to the bootmisc plugin.  We want to call bootclean() *after*
any /run and /var file systems have been mounted.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-09 23:15:06 +02:00
Joachim Nilsson 34bdbdb3b1 resolvconf: Simplify and fix buglet
- The /dev/shm/ directories are no longer needed
- Do not create the resolv.conf symlink

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 13:14:16 +02:00
Joachim Nilsson 83af7e8e9d resolvconf: Initial cleanup of plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 13:06:03 +02:00
Joachim Nilsson 4eb5f8a0dc bootmisc: /var/lock/subsys created by D-Bus plugin
No need to create it twice.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 12:05:27 +02:00
Joachim Nilsson e03b358ff0 Fix #46: Set correct umask() before makedir() and chmod()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-10-02 11:42:40 +02:00
Wang He dd87c81adc Create missing /var/lock/subsys dir in dbus plugin
Signed-off-by: Wang He <xw897002528@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 12:09:05 +02:00
Joachim Nilsson f7d6d269c7 Change to runlevel 0/6 on reboot/halt/poweroff
This patch fixes a long-standing issue with how Finit handles shutdown,
reboot and poweroff -- and even runlevel changes to runlevel 0 and 6.

Prior to this patch sig.c:do_shutdown() was called immediately on any
of the above events, disregarding any services that a user might have
wanted to run as part of the shutdown/reboot.

With this change the handling is unified in all frontends to instead
do a runlevel change followed by the do_shutdown() action.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 11:50:07 +02:00
Joachim Nilsson f9732a6fb9 Fix warnings: type mismatch and unused parameters
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-18 10:27:03 +02:00
Joachim Nilsson 19b81cf434 Fix #40, #39: initctl plugin started too early, before /run FS existed
Delay setup of initctl plugin to after the base filesystems are up and
after the bootmisc plugin has run.

This patch factors out the I/O initialization of plugins so it does not
have to run when plugins are loaded.  Instead, plugins can now call this
API to register an I/O callback when they are ready.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-08 12:58:28 +02:00
Joachim Nilsson 9fc1f50678 bootmisc: The getgroup() API returns int not gid_t
Must use int to check for error code (-1) from getgroup() API.
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-05 00:55:21 +02:00
Joachim Nilsson 5ddc35d387 echo: Mark callback argument as unused
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-05 00:54:29 +02:00
Joachim Nilsson bb7208c591 bootmisc: Check return value from chmod() API
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 23:23:37 +02:00
Joachim Nilsson bb0505f57c bootmisc: Check return value from getgroup() API
Found by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 23:13:51 +02:00
Joachim Nilsson 74eb2bf4d2 initctl: Add dependency on bootmisc
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-09-04 17:13:38 +02:00
Joachim Nilsson 3f71ed352d initctl: Remove confusing/wrong debug message
The 's' runlevel after boot is the traditional single-user rescue mode.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-24 22:08:46 +02:00
Joachim Nilsson d670e7d3e8 Clean up logging, log to stderr until syslogd has started
This patch removes internal logging macros and adds support for logging
to stderr until a syslogd is up and running, i.e. /dev/log appears.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-18 01:18:31 +02:00
Joachim Nilsson 3ad149fb28 Workaround for uninstalling .so plugins
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-14 13:19:35 +02:00
Joachim Nilsson 8c54fde36c Fix D-Bus plugin, remove old #ifdefs
Still TODO, replace `run_interactive()` start of dbus-daemon with a
proper service.  Possibly only service_register() is needed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-09 00:12:47 +02:00
Joachim Nilsson f8def336d4 Fix ordering of UTMP events: reboot, then runlevel
This patch fixes the ordering of UTMP events. The first event that is
expected in /var/run/utmp is reboot, next is the runlevel change to
the configured runlevel, e.g. from S --> 2.

Let the bootmisc plugin handle this, it knows when /var/run/utmp has
been created and is writable.  It is not the eact boot time, but close
enough for most usees.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-09 00:12:47 +02:00
Joachim Nilsson 27899feea0 bootmisc: Add /var/log/btmp 0600 support
The file /var/log/btmp holds bad login attempts and must be created with
0600 perms.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-08-08 00:05:34 +02:00
Joachim Nilsson 94d41e38f8 Close inotify watcher when TTY plugin is unloaded
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-30 15:54:37 +02:00
Joachim Nilsson 42800a1cc8 ALSA plugin: only run if /usr/sbin/alsactl exists
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-30 15:54:37 +02:00
Joachim Nilsson 4cf60b7491 initctl: Add SysV compat support for setenv
- Fix compat INIT_CMD_ defines so Finit clients can talk to SysV init
- Add setenv support, only for INIT_HALT={POWERDOWN,HALT} to runlevel 6

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-30 15:54:37 +02:00
Joachim Nilsson 8002704a5f bootmisc: Create /var/run/network/ for ifupdown
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-27 19:25:50 +02:00
Joachim Nilsson 744bb9dd14 Workaround for loopback interface
We never get any NEWLINK message for lo since it as an interface exists
very early.  So we add this workaround when lo comes up so services can
depend on exists for lo as well as for other interfaces.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-21 14:04:37 +02:00
Joachim Nilsson 5b81d14e51 x11-common: If restorecon exists, run it
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-20 19:58:42 +02:00
Joachim Nilsson 33ce1592c1 bootmisc: Create /var/log/wtmp and lastlog too
Set correct permission bits, the utmp group must have write permission.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-20 19:57:39 +02:00
Joachim Nilsson aced97c2e6 Handle systems with new /run tmpfs
Modern systems today use a RAM disk for /run and /run/lock, with
symlinks to the FHS locations in /var/run and /var/lock.  See the
following link for details http://lwn.net/Articles/436012/

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-20 17:30:29 +02:00
Joachim Nilsson 1121965167 Do not build inetd plugins if inetd is disabled
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-18 17:30:29 +02:00
Joachim Nilsson 7dfdc2395b Add protection against UDP inetd looping attacks
This patch adds protection against a common inetd attack vector wherein
the reply port to UDP inetd services is forged to an internal inetd
service port.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-18 17:27:37 +02:00
Joachim Nilsson 5723b2e75b Refactor RFC 868, time protocol plugin
- Always do a dummy read to get peer address.
- Refactor to new format used by other built-ins

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-18 12:28:40 +02:00
Joachim Nilsson d4fdf50636 Add optional support for RFC867, Daytime Protocol
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-18 12:06:59 +02:00
Joachim Nilsson 4f7366640b Add optional support for RFC864, Character Generator Protocol
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-18 11:48:04 +02:00
Joachim Nilsson 90497af7bb Add optional support for RFC863, Discard Protocol
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-18 09:55:19 +02:00
Joachim Nilsson f0cda83d24 Clean up AC_ARG_WITH and use config.h also for default paths
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-15 13:17:09 +02:00
Joachim Nilsson 6ff9cb2ff3 Rename condition net/gw --> net/route/default in netlink plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-14 15:41:47 +02:00
Joachim Nilsson 171ae7dc85 Add support for disabling the Netlink plugin
Some vendors provide their own Netlink plugin to Finit.  This patch
makes it possible to disable the default netlink plugin from being
built.  However, even before this patch it was possible to overload
the plugin.  This just discards it from being built.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-13 13:23:07 +02:00
Joachim Nilsson 88a4ebf9e7 Use <> instead of "" for external header includes
Libraries and system headers should be included with <> instead of "".
This makes a great difference for the automatic dependency tracking.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-12 15:32:36 +02:00
Joachim Nilsson 51f61939da Do not build insecure inetd time (rdate) plugin by default
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-12 13:36:47 +02:00
Joachim Nilsson affc6a97b9 Add support for inetd RFC862 echo server
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-12 09:58:25 +02:00
Joachim Nilsson 927956bf78 Set correct initial bootstrap runlevel 'S'
This patch corrects a long standing issue with Finit.  System initial
bootstrap runlevel must be set to 'S' (0), not the configured fallback
runlevel 'RUNLEVEL', which likely is '2'.

Also, minor cleanup, reduce code duplication.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-09 10:24:15 +02:00
Joachim Nilsson 05938a88ce Fix #33: Set up directory required by D-Bus plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-07-09 10:04:34 +02:00