/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

  • Committer: Björn Påhlsson
  • Date: 2011-06-23 22:27:15 UTC
  • mto: (237.7.33 trunk)
  • mto: This revision was merged to the branch mainline in revision 284.
  • Revision ID: belorn@fukt.bsnet.se-20110623222715-q5wro9ma9iyjl367
* Makefile (CFLAGS): Added "-lrt" to include real time library.
* plugins.d/mandos-client.c: use scandir(3) instead of readdir(3)
                             Prefix all debug output with "Mandos plugin " + program_invocation_short_name
                             Retry servers that failed to provide password.
                             New option --retry SECONDS that sets the interval between rechecking.
                             --retry also controls how often it retries a server when using --connect.
* plugins.d/splashy.c:  Prefix all debug output with "Mandos plugin " + program_invocation_short_name
* plugins.d/usplash.c: --||--
* plugins.d/askpass-fifo.c: --||--
* plugins.d/password-prompt.c: --||--
* plugins.d/plymouth.c: --||--
* mandos: Lower logger level from warning to info on failed client requests because client was disabled or unknown fingerprint.
* plugins.d/plymouth.c (get_pid): bug fix. Was not calling free on direntries. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
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             /* getline(), asprintf() */
41
41
                                   getenv(), free() */
42
42
#include <dirent.h>             /* scandir(), alphasort() */
43
43
#include <stdio.h>              /* fprintf(), stderr, getline(),
44
 
                                   stdin, feof(), fputc(), vfprintf(),
45
 
                                   vasprintf() */
 
44
                                   stdin, feof(), fputc(), vfprintf(), vasprintf()
 
45
                                */
46
46
#include <errno.h>              /* errno, EBADF, ENOTTY, EINVAL,
47
47
                                   EFAULT, EFBIG, EIO, ENOSPC, EINTR
48
48
                                */
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()
55
 
                                 */
 
54
#include <string.h>             /* strlen, rindex, memcmp, strerror() */
56
55
#include <argp.h>               /* struct argp_option, struct
57
56
                                   argp_state, struct argp,
58
57
                                   argp_parse(), error_t,
67
66
int signal_received;
68
67
bool debug = false;
69
68
const char *argp_program_version = "password-prompt " VERSION;
70
 
const char *argp_program_bug_address = "<mandos@recompile.se>";
 
69
const char *argp_program_bug_address = "<mandos@fukt.bsnet.se>";
71
70
 
72
71
/* Needed for conflict resolution */
73
72
const char plymouth_name[] = "plymouthd";
74
73
 
75
74
/* Function to use when printing errors */
76
 
void error_plus(int status, int errnum, const char *formatstring,
77
 
                ...){
 
75
void error_plus(int status, int errnum, const char *formatstring, ...){
78
76
  va_list ap;
79
77
  char *text;
80
78
  int ret;
82
80
  va_start(ap, formatstring);
83
81
  ret = vasprintf(&text, formatstring, ap);
84
82
  if (ret == -1){
85
 
    fprintf(stderr, "Mandos plugin %s: ",
86
 
            program_invocation_short_name);
 
83
    fprintf(stderr, "Mandos plugin %s: ", program_invocation_short_name);
87
84
    vfprintf(stderr, formatstring, ap);
88
85
    fprintf(stderr, ": ");
89
86
    fprintf(stderr, "%s\n", strerror(errnum));
208
205
    return 1;
209
206
  }
210
207
  
211
 
  struct dirent **direntries = NULL;
 
208
  struct dirent **direntries;
212
209
  int ret;
213
210
  ret = scandir("/proc", &direntries, is_plymouth, alphasort);
214
211
  if (ret == -1){
215
212
    error(1, errno, "scandir");
216
213
  }
217
 
  free(direntries);
218
214
  return ret > 0;
219
215
}
220
216