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

  • Committer: Teddy Hogeborn
  • Date: 2011-09-18 15:59:05 UTC
  • mfrom: (24.1.179 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20110918155905-ngj2ig0yheralj1s
* DBUS-API: Document new "Expires" and "ExtendedTimeout" properties.
* README: Refer to the installed manual page more simply.
* mandos (Client.extended_timeout, Client.expires): New attributes.
  (Client.extended_timeout_milliseconds): New.
  (Client.__init__, Client.enable, Client.disable): Set new attributes.
  (Client.checked_ok): Take new "timeout" argument.
  (ClientDBus.expires): Transform into a property which sends a D-Bus
                        signal when changed.
  (ClientDBus._datetime_to_dbus): Return empty D-Bus string on None.
                                  All callers changed to use this.

  (ClientDBus.ApprovedByDefault_dbus_property,
  ClientDBus.ApprovalDelay_dbus_property,
  ClientDBus.ApprovalDuration_dbus_property,
  ClientDBus.Host_dbus_property, ClientDBus.Timeout_dbus_property,
  ClientDBus.Interval_dbus_property,
  ClientDBus.Checker_dbus_property): Bug fix: Only send D-Bus signal
                                     if new value is different.
  (ClientDBus.Timeout_dbus_property): Use new "expires" attribute.
  (ClientDBus.Expires_dbus_property,
  ClientDBus.ExtendedTimeout_dbus_property): New D-Bus properties.
  (ClientHandler.handle): Bump time using extended_timeout value.
  (main.client_defaults): Change default values of "timeout" and
                          "interval", added new default value for
                          "extended_timeout".
* mandos-clients.conf.xml (OPTIONS): Changed default values of
                                     "interval" and "timeout".  Add
                                     new "extended_timeout" option.
  (EXAMPLE): Updated default values.
* mandos-ctl: Show new "ExtendedTimeout" D-Bus property and change it
              using new "--extended-timeout" option.
* mandos-ctl.xml (SYNOPSIS, OPTIONS): Document new
                                      "--extended-timeout" option.
* mandos-monitor (MandosClientWidget.update): Use new "Expires" D-Bus
                                              property.
* mandos.xml (DESCRIPTION): Add reference to intro(8mandos) manual
                            page.
  (CHECKING): Refer to the new "extended_timeout" option in
  clients.conf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Usplash - Read a password from usplash and output it
4
4
 * 
5
 
 * Copyright © 2008-2017 Teddy Hogeborn
6
 
 * Copyright © 2008-2017 Björn Påhlsson
 
5
 * Copyright © 2008-2011 Teddy Hogeborn
 
6
 * Copyright © 2008-2011 Björn Påhlsson
7
7
 * 
8
8
 * This program is free software: you can redistribute it and/or
9
9
 * modify it under the terms of the GNU General Public License as
19
19
 * along with this program.  If not, see
20
20
 * <http://www.gnu.org/licenses/>.
21
21
 * 
22
 
 * Contact the authors at <mandos@recompile.se>.
 
22
 * Contact the authors at <mandos@fukt.bsnet.se>.
23
23
 */
24
24
 
25
25
#define _GNU_SOURCE             /* asprintf(), TEMP_FAILURE_RETRY() */
58
58
const char usplash_name[] = "/sbin/usplash";
59
59
 
60
60
/* Function to use when printing errors */
61
 
__attribute__((format (gnu_printf, 3, 4)))
62
61
void error_plus(int status, int errnum, const char *formatstring,
63
62
                ...){
64
63
  va_list ap;
67
66
  
68
67
  va_start(ap, formatstring);
69
68
  ret = vasprintf(&text, formatstring, ap);
70
 
  if(ret == -1){
 
69
  if (ret == -1){
71
70
    fprintf(stderr, "Mandos plugin %s: ",
72
71
            program_invocation_short_name);
73
72
    vfprintf(stderr, formatstring, ap);
117
116
      ret = asprintf(&cmd_line_alloc, "%s %s", cmd, arg);
118
117
      if(ret == -1){
119
118
        int e = errno;
120
 
        close(*fifo_fd_r);
 
119
        TEMP_FAILURE_RETRY(close(*fifo_fd_r));
121
120
        errno = e;
122
121
        return false;
123
122
      }
133
132
                 cmd_line_len - written);
134
133
    if(sret == -1){
135
134
      int e = errno;
136
 
      close(*fifo_fd_r);
 
135
      TEMP_FAILURE_RETRY(close(*fifo_fd_r));
137
136
      free(cmd_line_alloc);
138
137
      errno = e;
139
138
      return false;
491
490
        error_plus(0, errno, "read");
492
491
        status = EX_OSERR;
493
492
      }
494
 
      close(outfifo_fd);
 
493
      TEMP_FAILURE_RETRY(close(outfifo_fd));
495
494
      goto failure;
496
495
    }
497
496
    if(interrupted_by_signal){
578
577
  
579
578
  /* Close FIFO */
580
579
  if(fifo_fd != -1){
581
 
    ret = close(fifo_fd);
 
580
    ret = (int)TEMP_FAILURE_RETRY(close(fifo_fd));
582
581
    if(ret == -1 and errno != EINTR){
583
582
      error_plus(0, errno, "close");
584
583
    }
587
586
  
588
587
  /* Close output FIFO */
589
588
  if(outfifo_fd != -1){
590
 
    ret = close(outfifo_fd);
 
589
    ret = (int)TEMP_FAILURE_RETRY(close(outfifo_fd));
591
590
    if(ret == -1){
592
591
      error_plus(0, errno, "close");
593
592
    }
655
654
  
656
655
  /* Close FIFO (again) */
657
656
  if(fifo_fd != -1){
658
 
    ret = close(fifo_fd);
 
657
    ret = (int)TEMP_FAILURE_RETRY(close(fifo_fd));
659
658
    if(ret == -1 and errno != EINTR){
660
659
      error_plus(0, errno, "close");
661
660
    }