/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-02-27 18:57:58 UTC
  • Revision ID: teddy@fukt.bsnet.se-20110227185758-vie4xhfaevhpqtr6
* plugins.d/password-prompt.c (conflict_detection): Check for both
                                                    "plymouth" and
                                                    "plymouthd".

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
#define _GNU_SOURCE             /* getline(), asprintf() */
26
26
 
27
 
#include <termios.h>            /* struct termios, tcsetattr(),
 
27
#include <termios.h>            /* struct termios, tcsetattr(),
28
28
                                   TCSAFLUSH, tcgetattr(), ECHO */
29
29
#include <unistd.h>             /* struct termios, tcsetattr(),
30
30
                                   STDIN_FILENO, TCSAFLUSH,
50
50
#include <iso646.h>             /* or, not */
51
51
#include <stdbool.h>            /* bool, false, true */
52
52
#include <inttypes.h>           /* strtoumax() */
53
 
#include <sys/stat.h>           /* struct stat, lstat(), open() */
54
 
#include <string.h>             /* strlen, rindex, memcmp */
 
53
#include <sys/stat.h>           /* struct stat, lstat(), open() */
 
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,
102
102
    }
103
103
    
104
104
    char *cmdline_filename;
105
 
    ret = asprintf(&cmdline_filename, "/proc/%s/cmdline",
106
 
                   proc_entry->d_name);
 
105
    ret = asprintf(&cmdline_filename, "/proc/%s/cmdline", proc_entry->d_name);
107
106
    if(ret == -1){
108
107
      error(0, errno, "asprintf");
109
108
      return 0;
110
109
    }
111
110
    
112
 
    /* Open /proc/<pid>/cmdline */
 
111
    /* Open /proc/<pid>/cmdline  */
113
112
    cl_fd = open(cmdline_filename, O_RDONLY);
114
113
    free(cmdline_filename);
115
114
    if(cl_fd == -1){
169
168
    
170
169
    if((strcmp(cmdline_base, plymouth_name) != 0)
171
170
       and (strcmp(cmdline_base, plymouth_alt_name) != 0)){
172
 
      if(debug){
173
 
        fprintf(stderr, "\"%s\" is not \"%s\" or \"%s\"\n",
174
 
                cmdline_base, plymouth_name, plymouth_alt_name);
175
 
      }
176
171
      free(cmdline);
177
172
      return 0;
178
173
    }
179
 
    fprintf(stderr, "\"%s\" equals \"%s\" or \"%s\"\n",
180
 
            cmdline_base, plymouth_name, plymouth_alt_name);
181
174
    free(cmdline);
182
175
    return 1;
183
176
  }
184
 
  
 
177
 
185
178
  struct dirent **direntries;
186
179
  int ret;
187
180
  ret = scandir("/proc", &direntries, is_plymouth, alphasort);
276
269
 
277
270
  if (conflict_detection()){
278
271
    if(debug){
279
 
      fprintf(stderr, "Stopping %s because of conflict\n", argv[0]);
 
272
      fprintf(stderr, "Stopping %s because of conflict", argv[0]);
280
273
    }
281
274
    return EXIT_FAILURE;
282
275
  }
484
477
        break;
485
478
      }
486
479
    }
487
 
    /* if(sret == 0), then the only sensible thing to do is to retry
488
 
       to read from stdin */
 
480
    /* if(sret == 0), then the only sensible thing to do is to retry to
 
481
       read from stdin */
489
482
    fputc('\n', stderr);
490
483
    if(debug and not quit_now){
491
484
      /* If quit_now is nonzero, we were interrupted by a signal, and