/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/plymouth.c

  • Committer: Teddy Hogeborn
  • Date: 2019-02-10 04:20:26 UTC
  • Revision ID: teddy@recompile.se-20190210042026-3ntr3anw5scz07s0
Update copyright year to 2019

* DBUS-API: Update copyright year to 2019.
* debian/copyright: - '' -
* intro.xml: - '' -
* mandos: - '' -
* mandos-clients.conf.xml: - '' -
* mandos-ctl: - '' -
* mandos-ctl.xml: - '' -
* mandos-keygen: - '' -
* mandos-keygen.xml: - '' -
* mandos-monitor: - '' -
* mandos-monitor.xml: - '' -
* mandos.conf.xml: - '' -
* mandos.xml: - '' -
* plugin-runner.xml: - '' -
* plugins.d/askpass-fifo.xml: - '' -
* plugins.d/mandos-client.c: - '' -
* plugins.d/mandos-client.xml: - '' -
* plugins.d/password-prompt.xml: - '' -
* plugins.d/plymouth.xml: - '' -
* plugins.d/splashy.xml: - '' -
* plugins.d/usplash.xml: - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  -*- coding: utf-8 -*- */
 
2
/*
 
3
 * Plymouth - Read a password from Plymouth and output it
 
4
 * 
 
5
 * Copyright © 2010-2018 Teddy Hogeborn
 
6
 * Copyright © 2010-2018 Björn Påhlsson
 
7
 * 
 
8
 * This file is part of Mandos.
 
9
 * 
 
10
 * Mandos is free software: you can redistribute it and/or modify it
 
11
 * under the terms of the GNU General Public License as published by
 
12
 * the Free Software Foundation, either version 3 of the License, or
 
13
 * (at your option) any later version.
 
14
 * 
 
15
 * Mandos is distributed in the hope that it will be useful, but
 
16
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
18
 * General Public License for more details.
 
19
 * 
 
20
 * You should have received a copy of the GNU General Public License
 
21
 * along with Mandos.  If not, see <http://www.gnu.org/licenses/>.
 
22
 * 
 
23
 * Contact the authors at <mandos@recompile.se>.
 
24
 */
 
25
 
1
26
#define _GNU_SOURCE             /* asprintf(), TEMP_FAILURE_RETRY() */
2
27
#include <signal.h>             /* sig_atomic_t, struct sigaction,
3
28
                                   sigemptyset(), sigaddset(), SIGINT,
6
31
#include <stdbool.h>            /* bool, false, true */
7
32
#include <fcntl.h>              /* open(), O_RDONLY */
8
33
#include <iso646.h>             /* and, or, not*/
9
 
#include <sys/types.h>          /* size_t, ssize_t, pid_t, struct dirent,
10
 
                                   waitpid() */
 
34
#include <sys/types.h>          /* size_t, ssize_t, pid_t, struct
 
35
                                   dirent, waitpid() */
11
36
#include <sys/wait.h>           /* waitpid() */
12
37
#include <stddef.h>             /* NULL */
13
38
#include <string.h>             /* strchr(), memcmp() */
14
 
#include <stdio.h>              /* asprintf(), perror(), fopen(), fscanf() */
15
 
#include <unistd.h>             /* close(), readlink(), read(), fork()
16
 
                                   setsid(), chdir(), dup2()
 
39
#include <stdio.h>              /* asprintf(), perror(), fopen(),
 
40
                                   fscanf(), vasprintf(), fprintf(),
 
41
                                   vfprintf() */
 
42
#include <unistd.h>             /* close(), readlink(), read(),
 
43
                                   fork(), setsid(), chdir(), dup2(),
17
44
                                   STDERR_FILENO, execv(), access() */
18
45
#include <stdlib.h>             /* free(), EXIT_FAILURE, realloc(),
19
46
                                   EXIT_SUCCESS, malloc(), _exit(),
21
48
#include <dirent.h>             /* scandir(), alphasort() */
22
49
#include <inttypes.h>           /* intmax_t, strtoumax(), SCNuMAX */
23
50
#include <sys/stat.h>           /* struct stat, lstat() */
24
 
#include <sysexits.h>           /* EX_OSERR */
 
51
#include <sysexits.h>           /* EX_OSERR, EX_UNAVAILABLE */
25
52
#include <error.h>              /* error() */
26
53
#include <errno.h>              /* TEMP_FAILURE_RETRY */
27
54
#include <argz.h>               /* argz_count(), argz_extract() */
 
55
#include <stdarg.h>             /* va_list, va_start(), ... */
28
56
 
29
57
sig_atomic_t interrupted_by_signal = 0;
30
 
const char plymouth_pid[] = "/dev/.initramfs/plymouth.pid";
 
58
 
 
59
/* Used by Ubuntu 11.04 (Natty Narwahl) */
 
60
const char plymouth_old_old_pid[] = "/dev/.initramfs/plymouth.pid";
 
61
/* Used by Ubuntu 11.10 (Oneiric Ocelot) */
 
62
const char plymouth_old_pid[] = "/run/initramfs/plymouth.pid";
 
63
/* Used by Debian 9 (stretch) */
 
64
const char plymouth_pid[] = "/run/plymouth/pid";
 
65
 
31
66
const char plymouth_path[] = "/bin/plymouth";
32
67
const char plymouthd_path[] = "/sbin/plymouthd";
33
 
const char *plymouthd_default_argv[] = {"/sbin/plymouthd", "--mode=boot",
 
68
const char *plymouthd_default_argv[] = {"/sbin/plymouthd",
 
69
                                        "--mode=boot",
34
70
                                        "--attach-to-session",
35
 
                                        "--pid-file=/dev/.initramfs/plymouth.pid",
36
71
                                        NULL };
37
72
 
38
73
static void termination_handler(__attribute__((unused))int signum){
42
77
  interrupted_by_signal = 1;
43
78
}
44
79
 
 
80
/* Function to use when printing errors */
 
81
__attribute__((format (gnu_printf, 3, 4)))
 
82
void error_plus(int status, int errnum, const char *formatstring,
 
83
                ...){
 
84
  va_list ap;
 
85
  char *text;
 
86
  int ret;
 
87
  
 
88
  va_start(ap, formatstring);
 
89
  ret = vasprintf(&text, formatstring, ap);
 
90
  if(ret == -1){
 
91
    fprintf(stderr, "Mandos plugin %s: ",
 
92
            program_invocation_short_name);
 
93
    vfprintf(stderr, formatstring, ap);
 
94
    fprintf(stderr, ": ");
 
95
    fprintf(stderr, "%s\n", strerror(errnum));
 
96
    error(status, errno, "vasprintf while printing error");
 
97
    return;
 
98
  }
 
99
  fprintf(stderr, "Mandos plugin ");
 
100
  error(status, errnum, "%s", text);
 
101
  free(text);
 
102
}
 
103
 
45
104
/* Create prompt string */
46
105
char *makeprompt(void){
47
106
  int ret = 0;
48
107
  char *prompt;
49
108
  const char *const cryptsource = getenv("cryptsource");
50
109
  const char *const crypttarget = getenv("crypttarget");
51
 
  const char prompt_start[] = "Enter passphrase to unlock the disk";
 
110
  const char prompt_start[] = "Unlocking the disk";
 
111
  const char prompt_end[] = "Enter passphrase";
52
112
  
53
113
  if(cryptsource == NULL){
54
114
    if(crypttarget == NULL){
55
 
      ret = asprintf(&prompt, "%s: ", prompt_start);
 
115
      ret = asprintf(&prompt, "%s\n%s", prompt_start, prompt_end);
56
116
    } else {
57
 
      ret = asprintf(&prompt, "%s (%s): ", prompt_start,
58
 
                     crypttarget);
 
117
      ret = asprintf(&prompt, "%s (%s)\n%s", prompt_start,
 
118
                     crypttarget, prompt_end);
59
119
    }
60
120
  } else {
61
121
    if(crypttarget == NULL){
62
 
      ret = asprintf(&prompt, "%s %s: ", prompt_start, cryptsource);
 
122
      ret = asprintf(&prompt, "%s %s\n%s", prompt_start, cryptsource,
 
123
                     prompt_end);
63
124
    } else {
64
 
      ret = asprintf(&prompt, "%s %s (%s): ", prompt_start,
65
 
                     cryptsource, crypttarget);
 
125
      ret = asprintf(&prompt, "%s %s (%s)\n%s", prompt_start,
 
126
                     cryptsource, crypttarget, prompt_end);
66
127
    }
67
128
  }
68
129
  if(ret == -1){
79
140
bool become_a_daemon(void){
80
141
  int ret = setuid(geteuid());
81
142
  if(ret == -1){
82
 
    error(0, errno, "setuid");
 
143
    error_plus(0, errno, "setuid");
83
144
  }
84
145
    
85
146
  setsid();
86
147
  ret = chdir("/");
87
148
  if(ret == -1){
88
 
    error(0, errno, "chdir");
 
149
    error_plus(0, errno, "chdir");
89
150
    return false;
90
151
  }
91
152
  ret = dup2(STDERR_FILENO, STDOUT_FILENO); /* replace our stdout */
92
153
  if(ret == -1){
93
 
    error(0, errno, "dup2");
 
154
    error_plus(0, errno, "dup2");
94
155
    return false;
95
156
  }
96
157
  return true;
97
158
}
98
159
 
 
160
__attribute__((nonnull (2, 3)))
99
161
bool exec_and_wait(pid_t *pid_return, const char *path,
100
 
                   const char **argv, bool interruptable,
 
162
                   const char * const *argv, bool interruptable,
101
163
                   bool daemonize){
102
164
  int status;
103
165
  int ret;
104
166
  pid_t pid;
105
167
  pid = fork();
106
168
  if(pid == -1){
107
 
    error(0, errno, "fork");
 
169
    error_plus(0, errno, "fork");
108
170
    return false;
109
171
  }
110
172
  if(pid == 0){
114
176
        _exit(EX_OSERR);
115
177
      }
116
178
    }
117
 
 
118
 
    char **new_argv = NULL;
119
 
    char *tmp;
 
179
    
 
180
    char **new_argv = malloc(sizeof(const char *));
 
181
    if(new_argv == NULL){
 
182
      error_plus(0, errno, "malloc");
 
183
      _exit(EX_OSERR);
 
184
    }
 
185
    char **tmp;
120
186
    int i = 0;
121
 
    for (; argv[i]!=(char *)NULL; i++){
122
 
      tmp = realloc(new_argv, sizeof(const char *) * ((size_t)i + 1));
123
 
      if (tmp == NULL){
124
 
        error(0, errno, "realloc");
 
187
    for (; argv[i] != NULL; i++){
 
188
      tmp = realloc(new_argv, sizeof(const char *) * ((size_t)i + 2));
 
189
      if(tmp == NULL){
 
190
        error_plus(0, errno, "realloc");
125
191
        free(new_argv);
126
 
        _exit(EXIT_FAILURE);
 
192
        _exit(EX_OSERR);
127
193
      }
128
 
      new_argv = (char **)tmp;
 
194
      new_argv = tmp;
129
195
      new_argv[i] = strdup(argv[i]);
130
196
    }
131
 
    new_argv[i] = (char *) NULL;
 
197
    new_argv[i] = NULL;
132
198
    
133
199
    execv(path, (char *const *)new_argv);
134
 
    error(0, errno, "execv");
 
200
    error_plus(0, errno, "execv");
135
201
    _exit(EXIT_FAILURE);
136
202
  }
137
203
  if(pid_return != NULL){
146
212
    return false;
147
213
  }
148
214
  if(ret == -1){
149
 
    error(0, errno, "waitpid");
 
215
    error_plus(0, errno, "waitpid");
150
216
    return false;
151
217
  }
152
 
  if(WIFEXITED(status) and WEXITSTATUS(status) == 0){
 
218
  if(WIFEXITED(status) and (WEXITSTATUS(status) == 0)){
153
219
    return true;
154
220
  }
155
221
  return false;
156
222
}
157
223
 
 
224
__attribute__((nonnull))
158
225
int is_plymouth(const struct dirent *proc_entry){
159
226
  int ret;
160
227
  {
161
 
    uintmax_t maxvalue;
 
228
    uintmax_t proc_id;
162
229
    char *tmp;
163
230
    errno = 0;
164
 
    maxvalue = strtoumax(proc_entry->d_name, &tmp, 10);
 
231
    proc_id = strtoumax(proc_entry->d_name, &tmp, 10);
165
232
 
166
 
    if(errno != 0 or *tmp != '\0' or maxvalue != (uintmax_t)((pid_t)maxvalue)){
 
233
    if(errno != 0 or *tmp != '\0'
 
234
       or proc_id != (uintmax_t)((pid_t)proc_id)){
167
235
      return 0;
168
236
    }
169
237
  }
170
 
  char exe_target[sizeof(plymouth_path)];
 
238
  char exe_target[sizeof(plymouthd_path)];
171
239
  char *exe_link;
172
240
  ret = asprintf(&exe_link, "/proc/%s/exe", proc_entry->d_name);
173
241
  if(ret == -1){
174
 
    error(0, errno, "asprintf");
 
242
    error_plus(0, errno, "asprintf");
175
243
    return 0;
176
244
  }
177
 
 
 
245
  
178
246
  struct stat exe_stat;
179
247
  ret = lstat(exe_link, &exe_stat);
180
248
  if(ret == -1){
181
249
    free(exe_link);
182
250
    if(errno != ENOENT){
183
 
      error(0, errno, "lstat");
 
251
      error_plus(0, errno, "lstat");
184
252
    }
185
253
    return 0;
186
254
  }
191
259
    free(exe_link);
192
260
    return 0;
193
261
  }
194
 
 
 
262
  
195
263
  ssize_t sret = readlink(exe_link, exe_target, sizeof(exe_target));
196
264
  free(exe_link);
197
 
  if((sret != (ssize_t)sizeof(plymouth_path)-1) or
198
 
      (memcmp(plymouth_path, exe_target,
199
 
              sizeof(plymouth_path)-1) != 0)){
 
265
  if((sret != (ssize_t)sizeof(plymouthd_path)-1) or
 
266
      (memcmp(plymouthd_path, exe_target,
 
267
              sizeof(plymouthd_path)-1) != 0)){
200
268
    return 0;
201
269
  }
202
270
  return 1;
204
272
 
205
273
pid_t get_pid(void){
206
274
  int ret;
 
275
  uintmax_t proc_id = 0;
207
276
  FILE *pidfile = fopen(plymouth_pid, "r");
208
 
  uintmax_t maxvalue = 0;
 
277
  /* Try the new pid file location */
209
278
  if(pidfile != NULL){
210
 
    ret = fscanf(pidfile, "%" SCNuMAX, &maxvalue);
 
279
    ret = fscanf(pidfile, "%" SCNuMAX, &proc_id);
211
280
    if(ret != 1){
212
 
      maxvalue = 0;
 
281
      proc_id = 0;
213
282
    }
214
283
    fclose(pidfile);
215
284
  }
216
 
  if(maxvalue == 0){
217
 
    struct dirent **direntries;
 
285
  /* Try the old pid file location */
 
286
  if(proc_id == 0){
 
287
    pidfile = fopen(plymouth_old_pid, "r");
 
288
    if(pidfile != NULL){
 
289
      ret = fscanf(pidfile, "%" SCNuMAX, &proc_id);
 
290
      if(ret != 1){
 
291
        proc_id = 0;
 
292
      }
 
293
      fclose(pidfile);
 
294
    }
 
295
  }
 
296
  /* Try the old old pid file location */
 
297
  if(proc_id == 0){
 
298
    pidfile = fopen(plymouth_old_old_pid, "r");
 
299
    if(pidfile != NULL){
 
300
      ret = fscanf(pidfile, "%" SCNuMAX, &proc_id);
 
301
      if(ret != 1){
 
302
        proc_id = 0;
 
303
      }
 
304
      fclose(pidfile);
 
305
    }
 
306
  }
 
307
  /* Look for a plymouth process */
 
308
  if(proc_id == 0){
 
309
    struct dirent **direntries = NULL;
218
310
    ret = scandir("/proc", &direntries, is_plymouth, alphasort);
219
 
    sscanf(direntries[0]->d_name, "%" SCNuMAX, &maxvalue);
 
311
    if(ret == -1){
 
312
      error_plus(0, errno, "scandir");
 
313
    }
 
314
    if(ret > 0){
 
315
      for(int i = ret-1; i >= 0; i--){
 
316
        if(proc_id == 0){
 
317
          ret = sscanf(direntries[i]->d_name, "%" SCNuMAX, &proc_id);
 
318
          if(ret < 0){
 
319
            error_plus(0, errno, "sscanf");
 
320
          }
 
321
        }
 
322
        free(direntries[i]);
 
323
      }
 
324
    }
 
325
    /* scandir might preallocate for this variable (man page unclear).
 
326
       even if ret == 0, therefore we need to free it. */
 
327
    free(direntries);
220
328
  }
221
329
  pid_t pid;
222
 
  pid = (pid_t)maxvalue;
223
 
  if((uintmax_t)pid == maxvalue){
 
330
  pid = (pid_t)proc_id;
 
331
  if((uintmax_t)pid == proc_id){
224
332
    return pid;
225
333
  }
226
334
  
227
335
  return 0;
228
336
}
229
337
 
230
 
const char **getargv(pid_t pid){
 
338
char **getargv(pid_t pid){
231
339
  int cl_fd;
232
340
  char *cmdline_filename;
233
341
  ssize_t sret;
236
344
  ret = asprintf(&cmdline_filename, "/proc/%" PRIuMAX "/cmdline",
237
345
                 (uintmax_t)pid);
238
346
  if(ret == -1){
239
 
    error(0, errno, "asprintf");
 
347
    error_plus(0, errno, "asprintf");
240
348
    return NULL;
241
349
  }
242
350
  
244
352
  cl_fd = open(cmdline_filename, O_RDONLY);
245
353
  free(cmdline_filename);
246
354
  if(cl_fd == -1){
247
 
    error(0, errno, "open");
 
355
    error_plus(0, errno, "open");
248
356
    return NULL;
249
357
  }
250
358
  
258
366
    if(cmdline_len + blocksize > cmdline_allocated){
259
367
      tmp = realloc(cmdline, cmdline_allocated + blocksize);
260
368
      if(tmp == NULL){
261
 
        error(0, errno, "realloc");
 
369
        error_plus(0, errno, "realloc");
262
370
        free(cmdline);
263
371
        close(cl_fd);
264
372
        return NULL;
271
379
    sret = read(cl_fd, cmdline + cmdline_len,
272
380
                cmdline_allocated - cmdline_len);
273
381
    if(sret == -1){
274
 
      error(0, errno, "read");
 
382
      error_plus(0, errno, "read");
275
383
      free(cmdline);
276
384
      close(cl_fd);
277
385
      return NULL;
280
388
  } while(sret != 0);
281
389
  ret = close(cl_fd);
282
390
  if(ret == -1){
283
 
    error(0, errno, "close");
 
391
    error_plus(0, errno, "close");
284
392
    free(cmdline);
285
393
    return NULL;
286
394
  }
289
397
  char **argv = malloc((argz_count(cmdline, cmdline_len) + 1)
290
398
                       * sizeof(char *)); /* Get number of args */
291
399
  if(argv == NULL){
292
 
    error(0, errno, "argv = malloc()");
 
400
    error_plus(0, errno, "argv = malloc()");
293
401
    free(cmdline);
294
402
    return NULL;
295
403
  }
296
404
  argz_extract(cmdline, cmdline_len, argv); /* Create argv */
297
 
  return (const char **)argv;
 
405
  return argv;
298
406
}
299
407
 
300
408
int main(__attribute__((unused))int argc,
308
416
  /* test -x /bin/plymouth */
309
417
  ret = access(plymouth_path, X_OK);
310
418
  if(ret == -1){
311
 
    exit(EXIT_FAILURE);
 
419
    /* Plymouth is probably not installed.  Don't print an error
 
420
       message, just exit. */
 
421
    exit(EX_UNAVAILABLE);
312
422
  }
313
 
 
 
423
  
314
424
  { /* Add signal handlers */
315
425
    struct sigaction old_action,
316
426
      new_action = { .sa_handler = termination_handler,
317
427
                     .sa_flags = 0 };
318
428
    sigemptyset(&new_action.sa_mask);
319
 
    for(int *sig = (int[]){ SIGINT, SIGHUP, SIGTERM, 0 }; *sig != 0; sig++){
 
429
    for(int *sig = (int[]){ SIGINT, SIGHUP, SIGTERM, 0 };
 
430
        *sig != 0; sig++){
320
431
      ret = sigaddset(&new_action.sa_mask, *sig);
321
432
      if(ret == -1){
322
 
        error(0, errno, "sigaddset");
323
 
        exit(EX_OSERR);
 
433
        error_plus(EX_OSERR, errno, "sigaddset");
324
434
      }
325
435
      ret = sigaction(*sig, NULL, &old_action);
326
436
      if(ret == -1){
327
 
        error(0, errno, "sigaction");
328
 
        exit(EX_OSERR);
 
437
        error_plus(EX_OSERR, errno, "sigaction");
329
438
      }
330
439
      if(old_action.sa_handler != SIG_IGN){
331
440
        ret = sigaction(*sig, &new_action, NULL);
332
441
        if(ret == -1){
333
 
          error(0, errno, "sigaction");
334
 
          exit(EX_OSERR);
 
442
          error_plus(EX_OSERR, errno, "sigaction");
335
443
        }
336
444
      }
337
445
    }
338
446
  }
339
 
    
 
447
  
340
448
  /* plymouth --ping */
341
449
  bret = exec_and_wait(&plymouth_command_pid, plymouth_path,
342
 
                       (const char *[]){ (const char *)plymouth_path, (const char *)"--ping", (const char *)NULL},
 
450
                       (const char *[])
 
451
                       { plymouth_path, "--ping", NULL },
343
452
                       true, false);
344
453
  if(not bret){
345
454
    if(interrupted_by_signal){
346
455
      kill_and_wait(plymouth_command_pid);
 
456
      exit(EXIT_FAILURE);
347
457
    }
348
 
    exit(EXIT_FAILURE);
 
458
    /* Plymouth is probably not running.  Don't print an error
 
459
       message, just exit. */
 
460
    exit(EX_UNAVAILABLE);
349
461
  }
350
462
  
351
463
  prompt = makeprompt();
352
464
  ret = asprintf(&prompt_arg, "--prompt=%s", prompt);
353
465
  free(prompt);
354
466
  if(ret == -1){
355
 
    error(0, errno, "asprintf");
356
 
    exit(EXIT_FAILURE);
 
467
    error_plus(EX_OSERR, errno, "asprintf");
357
468
  }
358
469
  
359
470
  /* plymouth ask-for-password --prompt="$prompt" */
360
 
  bret = exec_and_wait(&plymouth_command_pid, plymouth_path,
361
 
                       (const char *[]){plymouth_path, "ask-for-password", prompt_arg, NULL},
 
471
  bret = exec_and_wait(&plymouth_command_pid,
 
472
                       plymouth_path, (const char *[])
 
473
                       { plymouth_path, "ask-for-password",
 
474
                           prompt_arg, NULL },
362
475
                       true, false);
363
476
  free(prompt_arg);
364
 
  if(not bret){
365
 
    if(interrupted_by_signal){
366
 
      kill_and_wait(plymouth_command_pid);
367
 
    } else {
368
 
      exit(EXIT_FAILURE);
369
 
    }
370
 
  }
371
 
  
372
477
  if(bret){
373
478
    exit(EXIT_SUCCESS);
374
479
  }
 
480
  if(not interrupted_by_signal){
 
481
    /* exec_and_wait failed for some other reason */
 
482
    exit(EXIT_FAILURE);
 
483
  }
 
484
  kill_and_wait(plymouth_command_pid);
375
485
  
376
 
  const char **plymouthd_argv = NULL;
 
486
  char **plymouthd_argv = NULL;
377
487
  pid_t pid = get_pid();
378
488
  if(pid == 0){
379
 
    error(0, 0, "plymouthd pid not found");
 
489
    error_plus(0, 0, "plymouthd pid not found");
380
490
  } else {
381
491
    plymouthd_argv = getargv(pid);
382
492
  }
383
 
  if(plymouthd_argv == NULL){
384
 
    plymouthd_argv = plymouthd_default_argv;
385
 
  }
386
493
  
387
 
  bret = exec_and_wait(NULL, plymouth_path,
388
 
                       (const char *[]){plymouth_path, "quit", NULL}, false, false);
389
 
  if(not bret){
390
 
    exit(EXIT_FAILURE);
391
 
  }
392
 
  bret = exec_and_wait(NULL, plymouthd_path, plymouthd_argv, false, true);
393
 
  if(not bret){
394
 
    exit(EXIT_FAILURE);
395
 
  }
396
 
  exec_and_wait(NULL, plymouth_path,
397
 
                (const char *[]){ plymouth_path, "show-splash", NULL }, false, false);
 
494
  bret = exec_and_wait(NULL, plymouth_path, (const char *[])
 
495
                       { plymouth_path, "quit", NULL },
 
496
                       false, false);
 
497
  if(not bret){
 
498
    if(plymouthd_argv != NULL){
 
499
      free(*plymouthd_argv);
 
500
      free(plymouthd_argv);
 
501
    }
 
502
    exit(EXIT_FAILURE);
 
503
  }
 
504
  bret = exec_and_wait(NULL, plymouthd_path,
 
505
                       (plymouthd_argv != NULL)
 
506
                       ? (const char * const *)plymouthd_argv
 
507
                       : plymouthd_default_argv,
 
508
                       false, true);
 
509
  if(plymouthd_argv != NULL){
 
510
    free(*plymouthd_argv);
 
511
    free(plymouthd_argv);
 
512
  }
 
513
  if(not bret){
 
514
    exit(EXIT_FAILURE);
 
515
  }
 
516
  exec_and_wait(NULL, plymouth_path, (const char *[])
 
517
                { plymouth_path, "show-splash", NULL },
 
518
                false, false);
398
519
  exit(EXIT_FAILURE);
399
520
}