/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/password-prompt.c

  • Committer: Teddy Hogeborn
  • Date: 2011-12-31 20:07:11 UTC
  • mfrom: (535.1.9 wireless-network-hook)
  • Revision ID: teddy@recompile.se-20111231200711-6dli3r8drftem57r
Merge new wireless network hook.  Fix bridge network hook to use
hardware addresses instead of interface names.  Implement and document
new "CONNECT" environment variable for network hooks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Password-prompt - Read a password from the terminal and print 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
72
72
/* Needed for conflict resolution */
73
73
const char plymouth_name[] = "plymouthd";
74
74
 
 
75
__attribute__((format (gnu_printf, 2, 3), nonnull(1)))
 
76
int fprintf_plus(FILE *stream, const char *format, ...){
 
77
  va_list ap;
 
78
  va_start (ap, format);
 
79
  
 
80
  TEMP_FAILURE_RETRY(fprintf(stream, "Mandos plugin %s: ",
 
81
                             program_invocation_short_name));
 
82
  return TEMP_FAILURE_RETRY(vfprintf(stream, format, ap));
 
83
}
 
84
 
75
85
/* Function to use when printing errors */
76
86
__attribute__((format (gnu_printf, 3, 4)))
77
87
void error_plus(int status, int errnum, const char *formatstring,
82
92
  
83
93
  va_start(ap, formatstring);
84
94
  ret = vasprintf(&text, formatstring, ap);
85
 
  if(ret == -1){
 
95
  if (ret == -1){
86
96
    fprintf(stderr, "Mandos plugin %s: ",
87
97
            program_invocation_short_name);
88
98
    vfprintf(stderr, formatstring, ap);
212
222
  struct dirent **direntries = NULL;
213
223
  int ret;
214
224
  ret = scandir("/proc", &direntries, is_plymouth, alphasort);
215
 
  if(ret == -1){
 
225
  if (ret == -1){
216
226
    error_plus(1, errno, "scandir");
217
227
  }
218
 
  {
219
 
    int i = ret;
220
 
    while(i--){
221
 
      free(direntries[i]);
222
 
    }
223
 
  }
224
228
  free(direntries);
225
229
  return ret > 0;
226
230
}
309
313
    fprintf(stderr, "Starting %s\n", argv[0]);
310
314
  }
311
315
 
312
 
  if(conflict_detection()){
 
316
  if (conflict_detection()){
313
317
    if(debug){
314
318
      fprintf(stderr, "Stopping %s because of conflict\n", argv[0]);
315
319
    }