/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/askpass-fifo.c

  • Committer: Teddy Hogeborn
  • Date: 2009-09-17 01:21:27 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090917012127-4kwzquwuvudwucuv
* debian/control (Standards-Version): Updated to "2.8.3".

* mandos-client.conf.xml (OPTIONS/timeout): Add that a successful
                                            client request will also
                                            reset the timeout.
* mandos.xml (CHECKING): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
  
43
43
  /* Create FIFO */
44
44
  const char passfifo[] = "/lib/cryptsetup/passfifo";
45
 
  ret = (int)TEMP_FAILURE_RETRY(mkfifo(passfifo, S_IRUSR | S_IWUSR));
 
45
  ret = mkfifo(passfifo, S_IRUSR | S_IWUSR);
46
46
  if(ret == -1 and errno != EEXIST){
47
47
    perror("mkfifo");
48
48
    return EXIT_FAILURE;
49
49
  }
50
50
  
51
51
  /* Open FIFO */
52
 
  int fifo_fd = (int)TEMP_FAILURE_RETRY(open(passfifo, O_RDONLY));
 
52
  int fifo_fd = open(passfifo, O_RDONLY);
53
53
  if(fifo_fd == -1){
54
54
    perror("open");
55
55
    return EXIT_FAILURE;
72
72
        buf = tmp;
73
73
        buf_allocated += blocksize;
74
74
      }
75
 
      sret = TEMP_FAILURE_RETRY(read(fifo_fd, buf + buf_len,
76
 
                                     buf_allocated - buf_len));
 
75
      sret = read(fifo_fd, buf + buf_len, buf_allocated - buf_len);
77
76
      if(sret == -1){
78
77
        perror("read");
79
78
        free(buf);
84
83
  }
85
84
  
86
85
  /* Close FIFO */
87
 
  TEMP_FAILURE_RETRY(close(fifo_fd));
 
86
  close(fifo_fd);
88
87
  
89
88
  /* Print password to stdout */
90
89
  size_t written = 0;
91
90
  while(written < buf_len){
92
 
    sret = TEMP_FAILURE_RETRY(write(STDOUT_FILENO, buf + written,
93
 
                                    buf_len - written));
 
91
    sret = write(STDOUT_FILENO, buf + written, buf_len - written);
94
92
    if(sret == -1){
95
93
      perror("write");
96
94
      free(buf);