]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Remove unused `logoutd` utility
authorIker Pedrosa <ipedrosa@redhat.com>
Mon, 25 Aug 2025 07:58:51 +0000 (09:58 +0200)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Mon, 12 Jan 2026 12:27:48 +0000 (13:27 +0100)
Link: <https://github.com/shadow-maint/shadow/issues/999>
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
19 files changed:
man/Makefile.am
man/cs/Makefile.am
man/da/Makefile.am
man/de/Makefile.am
man/fr/Makefile.am
man/it/Makefile.am
man/ja/Makefile.am
man/login.defs.5.xml
man/logoutd.8.xml [deleted file]
man/pl/Makefile.am
man/po/XMLFILES
man/ru/Makefile.am
man/sv/Makefile.am
man/uk/Makefile.am
man/zh_CN/Makefile.am
po/POTFILES.in
src/.gitignore
src/Makefile.am
src/logoutd.c [deleted file]

index f34ed7acfb34ecc7487ab748956774dc0674e09e..315bb0c273aebe8a1eeaa715a4b24cef13338f9b 100644 (file)
@@ -27,7 +27,6 @@ man_MANS = \
        man5/gshadow.5 \
        man1/login.1 \
        man5/login.defs.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/newusers.8 \
        man8/nologin.8 \
@@ -95,7 +94,6 @@ man_XMANS = \
        login.1.xml \
        login.access.5.xml \
        login.defs.5.xml \
-       logoutd.8.xml \
        newgidmap.1.xml \
        newgrp.1.xml \
        newuidmap.1.xml \
index 45aec38f9959e3c37500b14aaccff01a88d57390..ed6d4ae5359e23bf80266362742c9bc5d8226e9a 100644 (file)
@@ -22,6 +22,5 @@ man_MANS += man8/lastlog.8
 endif
 
 EXTRA_DIST = $(man_MANS) \
-       man8/groupmems.8 \
-       man8/logoutd.8
+       man8/groupmems.8
 
index c61b787d00e4a348ec7a577d0d6b09cc19da2589..0c85972b2456148332e15cad9fdf471064fbc078 100644 (file)
@@ -6,7 +6,6 @@ man_MANS = \
        man1/chfn.1 \
        man8/groupdel.8 \
        man5/gshadow.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/nologin.8 \
        man1/sg.1 \
index d3a6d6c1c35e9886c8d25e43f8115f5b65e56cdf..49505ef94949c3a7c6a8daadd42615a0854c8333 100644 (file)
@@ -22,7 +22,6 @@ man_MANS = \
        man5/gshadow.5 \
        man1/login.1 \
        man5/login.defs.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/newusers.8 \
        man8/nologin.8 \
index 2365e23b71465aed8f06104a64767f16ff69a3e6..48fcc40faf0e5dcf3767a1cffbd65720ae6a1d62 100644 (file)
@@ -22,7 +22,6 @@ man_MANS = \
        man5/gshadow.5 \
        man1/login.1 \
        man5/login.defs.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/newusers.8 \
        man8/nologin.8 \
index 736576c99e325d812b634450c1f9661e63c663ca..f833713b729b6d9f02d567c3abba272067169a97 100644 (file)
@@ -22,7 +22,6 @@ man_MANS = \
        man5/gshadow.5 \
        man1/login.1 \
        man5/login.defs.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/newusers.8 \
        man8/nologin.8 \
index b759726c6aedd6b82ea46f071254612bf3912ef1..9f3bbe4ae981611b765a50ca8b89687198c740bd 100644 (file)
@@ -18,7 +18,6 @@ man_MANS = \
        man8/grpunconv.8 \
        man1/login.1 \
        man5/login.defs.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/newusers.8 \
        man1/passwd.1 \
index 7263395cf20504178e38cbe0b1a1393d48792527..239154f029627c7ad4d4b5ee1f32ed6d19445770 100644 (file)
          </para>
        </listitem>
       </varlistentry>
-      <!-- logoutd: no variables -->
       <varlistentry>
        <term>newgrp / sg</term>
        <listitem>
diff --git a/man/logoutd.8.xml b/man/logoutd.8.xml
deleted file mode 100644 (file)
index d3f96e4..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-   SPDX-FileCopyrightText: 1991       , Julianne Frances Haugh
-   SPDX-FileCopyrightText: 2007 - 2008, Nicolas François
-   SPDX-License-Identifier: BSD-3-Clause
--->
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
-  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!-- SHADOW-CONFIG-HERE -->
-]>
-<refentry id='logoutd.8'>
-  <!-- $Id$ -->
-  <refentryinfo>
-    <author>
-      <firstname>Julianne Frances</firstname>
-      <surname>Haugh</surname>
-      <contrib>Creation, 1991</contrib>
-    </author>
-    <author>
-      <firstname>Thomas</firstname>
-      <surname>Kłoczko</surname>
-      <email>kloczek@pld.org.pl</email>
-      <contrib>shadow-utils maintainer, 2000 - 2007</contrib>
-    </author>
-    <author>
-      <firstname>Nicolas</firstname>
-      <surname>François</surname>
-      <email>nicolas.francois@centraliens.net</email>
-      <contrib>shadow-utils maintainer, 2007 - now</contrib>
-    </author>
-  </refentryinfo>
-  <refmeta>
-    <refentrytitle>logoutd</refentrytitle>
-    <manvolnum>8</manvolnum>
-    <refmiscinfo class="sectdesc">System Management Commands</refmiscinfo>
-    <refmiscinfo class="source">shadow-utils</refmiscinfo>
-    <refmiscinfo class="version">&SHADOW_UTILS_VERSION;</refmiscinfo>
-  </refmeta>
-  <refnamediv id='name'>
-    <refname>logoutd</refname>
-    <refpurpose>enforce login time restrictions</refpurpose>
-  </refnamediv>
-  <!-- body begins here -->
-  <refsynopsisdiv id='synopsis'>
-    <cmdsynopsis>
-      <command>logoutd</command>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-
-  <refsect1 id='description'>
-    <title>DESCRIPTION</title>
-    <para>
-      <command>logoutd</command> enforces the login time and port
-      restrictions specified in <filename>/etc/porttime</filename>. 
-      <command>logoutd</command> should be started from
-      <filename>/etc/rc</filename>. The <filename>/var/run/utmp</filename>
-      file is scanned periodically and each user name is checked to see if
-      the named user is permitted on the named port at the current time. 
-      Any login session which is violating the restrictions in
-      <filename>/etc/porttime</filename> is terminated.
-    </para>
-  </refsect1>
-
-  <refsect1 id='files'>
-    <title>FILES</title>
-    <variablelist>
-      <varlistentry>
-       <term><filename>/etc/porttime</filename></term>
-       <listitem>
-         <para>File containing port access.</para>
-       </listitem>
-      </varlistentry>
-      <varlistentry>
-       <term><filename>/var/run/utmp</filename></term>
-       <listitem>
-         <para>List of current login sessions.</para>
-       </listitem>
-      </varlistentry>
-    </variablelist>
-  </refsect1>
-</refentry>
index 2a015f3ae13dc59500af699eb9ed77ce31338e2f..c691231da4a2fc944a19174b3ec9f733c4ee6b9f 100644 (file)
@@ -14,7 +14,6 @@ man_MANS = \
        man8/groupmems.8 \
        man8/groupmod.8 \
        man8/grpck.8 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man1/sg.1 \
        man3/shadow.3 \
index bf08e6da0e450267a83779d03c9912ac2d5fdef8..f3a8e2f50ce4084446356549322fe1e4eb78e118 100644 (file)
@@ -20,7 +20,6 @@ XMLFILES = \
        $(top_srcdir)/man/login.1.xml \
        $(top_srcdir)/man/login.access.5.xml \
        $(top_srcdir)/man/login.defs.5.xml \
-       $(top_srcdir)/man/logoutd.8.xml \
        $(top_srcdir)/man/newgrp.1.xml \
        $(top_srcdir)/man/newusers.8.xml \
        $(top_srcdir)/man/nologin.8.xml \
index 845a603e779604eb5a2763059e3bcb9cab7dbea9..4ed352858ad3e8834ab00ae99d3bc0dbd73c5400 100644 (file)
@@ -22,7 +22,6 @@ man_MANS = \
        man5/gshadow.5 \
        man1/login.1 \
        man5/login.defs.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/newusers.8 \
        man8/nologin.8 \
index 1918af7299190032616d70cac060a41ea32a747f..9299548591202c309d99acc9a277e03a43043369 100644 (file)
@@ -14,7 +14,6 @@ man_MANS = \
        man8/groupmod.8 \
        man8/grpck.8 \
        man5/gshadow.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/nologin.8 \
        man1/passwd.1 \
index a0f106d66a444e73322aab6eb710900a57b71273..b23da85c73a96dce4407850fd2718c547eba638d 100644 (file)
@@ -22,7 +22,6 @@ man_MANS = \
        man5/gshadow.5 \
        man1/login.1 \
        man5/login.defs.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/newusers.8 \
        man8/nologin.8 \
index 59d1072dc331fa1bc3b51b3432235749baf867b5..937a620c6c9f940a63d0f3715f59ae15091c5b55 100644 (file)
@@ -22,7 +22,6 @@ man_MANS = \
        man5/gshadow.5 \
        man1/login.1 \
        man5/login.defs.5 \
-       man8/logoutd.8 \
        man1/newgrp.1 \
        man8/newusers.8 \
        man8/nologin.8 \
index 8d8ae28a48ef65c689a5e6c82ce3f424dcb1812b..0dae6966001137dd8f0428f242108a85ea63269d 100644 (file)
@@ -92,7 +92,6 @@ src/grpunconv.c
 src/lastlog.c
 src/login.c
 src/login_nopam.c
-src/logoutd.c
 src/newgidmap.c
 src/newgrp.c
 src/newuidmap.c
index 9ae06b424c11eb51ca2962267bfef76aff2b2126..2dc79ad5ffb22c4c17e069957910b119f26b1351 100644 (file)
@@ -15,7 +15,6 @@
 /grpunconv
 /lastlog
 /login
-/logoutd
 /newgrp
 /newgidmap
 /newuidmap
index ed0802cd131886fcaaff5ae1e94b7087a788bbe4..c387ef8a4ab7c3c6d95ce71fed1381c96da5238d 100644 (file)
@@ -48,7 +48,6 @@ usbin_PROGRAMS = \
        grpck \
        grpconv \
        grpunconv \
-       logoutd \
        newusers \
        pwck \
        pwconv \
diff --git a/src/logoutd.c b/src/logoutd.c
deleted file mode 100644 (file)
index c87b75c..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 1991 - 1993, Julianne Frances Haugh
- * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
- * SPDX-FileCopyrightText: 2001 - 2006, Tomasz Kłoczko
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include "config.h"
-
-#ident "$Id$"
-
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <utmpx.h>
-
-#include "defines.h"
-#include "prototypes.h"
-#include "shadowlog.h"
-#include "sizeof.h"
-#include "string/strcmp/strneq.h"
-#include "string/strcpy/strncat.h"
-#include "string/strdup/strndupa.h"
-
-
-/*
- * Global variables
- */
-static const char Prog[] = "logoutd";
-
-#ifndef DEFAULT_HUP_MESG
-#define DEFAULT_HUP_MESG _("login time exceeded\n\n")
-#endif
-
-#ifndef HUP_MESG_FILE
-#define HUP_MESG_FILE "/etc/logoutd.mesg"
-#endif
-
-
-/* local function prototypes */
-static int check_login (const struct utmpx *ut);
-static void send_mesg_to_tty (int tty_fd);
-
-
-/*
- * check_login - check if user (struct utmpx) allowed to stay logged in
- */
-static int
-check_login(const struct utmpx *ut)
-{
-       char    *user;
-       char    *line;
-       time_t  now;
-
-       user = strndupa_a(ut->ut_user);
-       line = strndupa_a(ut->ut_line);
-
-       now = time(NULL);
-
-       return isttytime(user, line, now);
-}
-
-
-static void send_mesg_to_tty (int tty_fd)
-{
-       TERMIO oldt, newt;
-       FILE *mesg_file, *tty_file;
-       bool is_tty;
-
-       tty_file = fdopen (tty_fd, "w");
-       if (NULL == tty_file) {
-               return;
-       }
-
-       is_tty = (GTTY (tty_fd, &oldt) == 0);
-       if (is_tty) {
-               /* Suggested by Ivan Nejgebauar <ian@unsux.ns.ac.yu>:
-                  set OPOST before writing the message. */
-               newt = oldt;
-               newt.c_oflag |= OPOST;
-               STTY (tty_fd, &newt);
-       }
-
-       mesg_file = fopen (HUP_MESG_FILE, "r");
-       if (NULL != mesg_file) {
-               int c;
-               while ((c = getc (mesg_file)) != EOF) {
-                       if (c == '\n') {
-                               putc ('\r', tty_file);
-                       }
-                       putc (c, tty_file);
-               }
-               fclose (mesg_file);
-       } else {
-               fputs (DEFAULT_HUP_MESG, tty_file);
-       }
-       fflush (tty_file);
-       fclose (tty_file);
-
-       if (is_tty) {
-               STTY (tty_fd, &oldt);
-       }
-}
-
-
-/*
- * logoutd - logout daemon to enforce /etc/porttime file policy
- *
- *     logoutd is started at system boot time and enforces the login
- *     time and port restrictions specified in /etc/porttime. The
- *     utmp file is periodically scanned and offending users are logged
- *     off from the system.
- */
-int
-main(int argc, char *[])
-{
-       pid_t  pid;
-
-       if (1 != argc) {
-               (void) fputs (_("Usage: logoutd\n"), stderr);
-       }
-
-       (void) setlocale (LC_ALL, "");
-       (void) bindtextdomain (PACKAGE, LOCALEDIR);
-       (void) textdomain (PACKAGE);
-
-#ifndef DEBUG
-       for (int i = 0; close(i) == 0; i++);
-
-       setpgrp ();
-
-       /*
-        * Put this process in the background.
-        */
-       pid = fork ();
-       if (pid > 0) {
-               /* parent */
-               exit (EXIT_SUCCESS);
-       } else if (pid < 0) {
-               /* error */
-               perror ("fork");
-               exit (EXIT_FAILURE);
-       }
-#endif                         /* !DEBUG */
-
-       /*
-        * Start syslogging everything
-        */
-       log_set_progname(Prog);
-       log_set_logfd(stderr);
-
-       OPENLOG (Prog);
-
-       /*
-        * Scan the utmp file once per minute looking for users that
-        * are not supposed to still be logged in.
-        */
-       while (true) {
-               struct utmpx  *ut;
-
-               /*
-                * Attempt to re-open the utmp file. The file is only
-                * open while it is being used.
-                */
-               setutxent();
-
-               /*
-                * Read all of the entries in the utmp file. The entries
-                * for login sessions will be checked to see if the user
-                * is permitted to be signed on at this time.
-                */
-               while (NULL != (ut = getutxent())) {
-                       int   tty_fd;
-                       char  tty_name[sizeof(ut->ut_line) + 6];  // /dev/ + NUL
-
-                       if (ut->ut_type != USER_PROCESS) {
-                               continue;
-                       }
-                       if (strneq_a(ut->ut_user, ""))
-                               continue;
-
-                       if (check_login (ut)) {
-                               continue;
-                       }
-
-                       /*
-                        * Put the rest of this in a child process. This
-                        * keeps the scan from waiting on other ports to die.
-                        */
-
-                       pid = fork ();
-                       if (pid > 0) {
-                               /* parent */
-                               continue;
-                       } else if (pid < 0) {
-                               /* failed - give up until the next scan */
-                               break;
-                       }
-                       /* child */
-
-                       if (strncmp(ut->ut_line, "/dev/", 5) != 0)
-                               strcpy(tty_name, "/dev/");
-                       else
-                               strcpy(tty_name, "");
-
-                       strncat_a(tty_name, ut->ut_line);
-#ifndef O_NOCTTY
-#define O_NOCTTY 0
-#endif
-                       tty_fd =
-                           open (tty_name, O_WRONLY | O_NDELAY | O_NOCTTY);
-                       if (tty_fd != -1) {
-                               send_mesg_to_tty (tty_fd);
-                               close (tty_fd);
-                               sleep (10);
-                       }
-
-                       if (ut->ut_pid > 1) {
-                               kill (-ut->ut_pid, SIGHUP);
-                               sleep (10);
-                               kill (-ut->ut_pid, SIGKILL);
-                       }
-
-                       SYSLOG ((LOG_NOTICE,
-                                "logged off user '%s' on '%s'",
-                                strndupa_a(ut->ut_user),
-                                tty_name));
-
-                       /*
-                        * This child has done all it can, drop dead.
-                        */
-                       exit (EXIT_SUCCESS);
-               }
-
-               endutxent();
-
-#ifndef DEBUG
-               sleep (60);
-#endif
-               /*
-                * Reap any dead babies ...
-                */
-               while (wait(NULL) != -1);
-       }
-
-       return EXIT_FAILURE;
-}
-