/mandos/release

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

« back to all changes in this revision

Viewing changes to plugins.d/password-prompt.c

* debian/control (mandos-client): Conflict with correct version of
                                  dropbear.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
                                   getenv(), free() */
42
42
#include <dirent.h>             /* scandir(), alphasort() */
43
43
#include <stdio.h>              /* fprintf(), stderr, getline(),
44
 
                                   stdin, feof(), fputc(), vfprintf(), vasprintf()
 
44
                                   stdin, feof(), fputc()
45
45
                                */
46
46
#include <errno.h>              /* errno, EBADF, ENOTTY, EINVAL,
47
47
                                   EFAULT, EFBIG, EIO, ENOSPC, EINTR
51
51
#include <stdbool.h>            /* bool, false, true */
52
52
#include <inttypes.h>           /* strtoumax() */
53
53
#include <sys/stat.h>           /* struct stat, lstat(), open() */
54
 
#include <string.h>             /* strlen, rindex, memcmp, strerror() */
 
54
#include <string.h>             /* strlen, rindex, memcmp */
55
55
#include <argp.h>               /* struct argp_option, struct
56
56
                                   argp_state, struct argp,
57
57
                                   argp_parse(), error_t,
60
60
#include <sysexits.h>           /* EX_SOFTWARE, EX_OSERR,
61
61
                                   EX_UNAVAILABLE, EX_IOERR, EX_OK */
62
62
#include <fcntl.h>              /* open() */
63
 
#include <stdarg.h>             /* va_list, va_start(), ... */
64
63
 
65
64
volatile sig_atomic_t quit_now = 0;
66
65
int signal_received;
71
70
/* Needed for conflict resolution */
72
71
const char plymouth_name[] = "plymouthd";
73
72
 
74
 
/* Function to use when printing errors */
75
 
void error_plus(int status, int errnum, const char *formatstring, ...){
76
 
  va_list ap;
77
 
  char *text;
78
 
  int ret;
79
 
  
80
 
  va_start(ap, formatstring);
81
 
  ret = vasprintf(&text, formatstring, ap);
82
 
  if (ret == -1){
83
 
    fprintf(stderr, "Mandos plugin %s: ", program_invocation_short_name);
84
 
    vfprintf(stderr, formatstring, ap);
85
 
    fprintf(stderr, ": ");
86
 
    fprintf(stderr, "%s\n", strerror(errnum));
87
 
    error(status, errno, "vasprintf while printing error");
88
 
    return;
89
 
  }
90
 
  fprintf(stderr, "Mandos plugin ");
91
 
  error(status, errnum, "%s", text);
92
 
  free(text);
93
 
}
94
 
 
95
73
static void termination_handler(int signum){
96
74
  if(quit_now){
97
75
    return;
133
111
    cl_fd = open(cmdline_filename, O_RDONLY);
134
112
    free(cmdline_filename);
135
113
    if(cl_fd == -1){
136
 
      if(errno != ENOENT){
137
 
        error(0, errno, "open");
138
 
      }
 
114
      error(0, errno, "open");
139
115
      return 0;
140
116
    }
141
117