/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugins.d/splashy.c

  • Committer: Teddy Hogeborn
  • Date: 2019-08-05 14:31:51 UTC
  • Revision ID: teddy@recompile.se-20190805143151-lt5d97wqif3t8250
Client: Debian package fix: Make uninstall when using dracut(8) work

Use the same logic to rebuild the initramfs image when uninstalling as
when installing the package.

* debian/mandos-client.postrm (update_initramfs): Use the same logic
  as the update_initramfs function in debian/mandos-client.postinst.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Splashy - Read a password from splashy and output it
4
4
 * 
5
 
 * Copyright © 2008-2018, 2021-2022 Teddy Hogeborn
6
 
 * Copyright © 2008-2018, 2021-2022 Björn Påhlsson
 
5
 * Copyright © 2008-2018 Teddy Hogeborn
 
6
 * Copyright © 2008-2018 Björn Påhlsson
7
7
 * 
8
8
 * This file is part of Mandos.
9
9
 * 
23
23
 * Contact the authors at <mandos@recompile.se>.
24
24
 */
25
25
 
26
 
#define _GNU_SOURCE             /* vasprintf(),
27
 
                                   program_invocation_short_name,
28
 
                                   asprintf(), TEMP_FAILURE_RETRY() */
29
 
#include <sys/types.h>          /* sig_atomic_t, pid_t, setuid(),
30
 
                                   geteuid(), setsid() */
31
 
#include <stdarg.h>             /* va_list, va_start(), vfprintf() */
32
 
#include <stdio.h>              /* vasprintf(), fprintf(), stderr,
33
 
                                   vfprintf(), asprintf() */
34
 
#include <errno.h>              /* program_invocation_short_name,
35
 
                                   errno, EACCES, ENOTDIR, ELOOP,
 
26
#define _GNU_SOURCE             /* TEMP_FAILURE_RETRY(), asprintf() */
 
27
#include <signal.h>             /* sig_atomic_t, struct sigaction,
 
28
                                   sigemptyset(), sigaddset(), SIGINT,
 
29
                                   SIGHUP, SIGTERM, sigaction,
 
30
                                   SIG_IGN, kill(), SIGKILL */
 
31
#include <stddef.h>             /* NULL */
 
32
#include <stdlib.h>             /* getenv() */
 
33
#include <stdio.h>              /* asprintf(), vasprintf(), vprintf(),
 
34
                                   fprintf() */
 
35
#include <stdlib.h>             /* EXIT_FAILURE, free(),
 
36
                                   EXIT_SUCCESS */
 
37
#include <sys/types.h>          /* pid_t, DIR, struct dirent,
 
38
                                   ssize_t */
 
39
#include <dirent.h>             /* opendir(), readdir(), closedir() */
 
40
#include <inttypes.h>           /* intmax_t, strtoimax() */
 
41
#include <sys/stat.h>           /* struct stat, lstat(), S_ISLNK */
 
42
#include <iso646.h>             /* not, or, and */
 
43
#include <unistd.h>             /* readlink(), fork(), execl(),
 
44
                                   sleep(), dup2() STDERR_FILENO,
 
45
                                   STDOUT_FILENO, _exit(),
 
46
                                   pause() */
 
47
#include <string.h>             /* memcmp(), strerror() */
 
48
#include <errno.h>              /* errno, EACCES, ENOTDIR, ELOOP,
36
49
                                   ENOENT, ENAMETOOLONG, EMFILE,
37
50
                                   ENFILE, ENOMEM, ENOEXEC, EINVAL,
38
51
                                   E2BIG, EFAULT, EIO, ETXTBSY,
39
52
                                   EISDIR, ELIBBAD, EPERM, EINTR,
40
53
                                   ECHILD */
41
 
#include <string.h>             /* strerror(), memcmp() */
42
54
#include <error.h>              /* error() */
43
 
#include <stdlib.h>             /* free(), EXIT_FAILURE, getenv(),
44
 
                                   EXIT_SUCCESS, abort() */
45
 
#include <stddef.h>             /* NULL */
46
 
#include <dirent.h>             /* DIR, opendir(), struct dirent,
47
 
                                   readdir(), closedir() */
 
55
#include <sys/wait.h>           /* waitpid(), WIFEXITED(),
 
56
                                   WEXITSTATUS() */
48
57
#include <sysexits.h>           /* EX_OSERR, EX_OSFILE,
49
58
                                   EX_UNAVAILABLE */
50
 
#include <inttypes.h>           /* intmax_t, strtoimax() */
51
 
#include <iso646.h>             /* or, not, and */
52
 
#include <unistd.h>             /* ssize_t, readlink(), fork(),
53
 
                                   execl(), _exit(),
54
 
                                   TEMP_FAILURE_RETRY(), sleep(),
55
 
                                   setuid(), geteuid(), setsid(),
56
 
                                   chdir(), dup2(), STDERR_FILENO,
57
 
                                   STDOUT_FILENO, pause() */
58
 
#include <sys/stat.h>           /* struct stat, lstat(), S_ISLNK() */
59
 
#include <signal.h>             /* struct sigaction, sigemptyset(),
60
 
                                   sigaddset(), SIGINT, SIGHUP,
61
 
                                   SIGTERM, SIG_IGN, kill(), SIGKILL,
62
 
                                   SIG_DFL, raise() */
63
 
#include <sys/wait.h>           /* waitpid(), WIFEXITED(),
64
 
                                   WEXITSTATUS() */
 
59
#include <stdarg.h>             /* va_list, va_start(), ... */
65
60
 
66
61
sig_atomic_t interrupted_by_signal = 0;
67
62
int signal_received;