/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: 2010-09-26 17:36:30 UTC
  • Revision ID: teddy@fukt.bsnet.se-20100926173630-zk7pe17fp2bv6zr7
* DBUS-API: Document new "LastApprovalRequest" client property.

* mandos (Client.last_approval_request): New attribute.
  (Client.need_approval): New method.
  (ClientDBus.need_approval): - '' -
  (ClientDBus.NeedApproval): Call self.need_approval().
  (ClientDBus.LastApprovalRequest_dbus_property): New D-Bus property.

* mandos-monitor: Show timeout counter during approval delay.
  (MandosClientWidget._update_timer_callback_lock): New.
  (MandosClientWidget.property_changed): Override to also call
                                         using_timer if
                                         ApprovalPending property is
                                         changed.
  (MandosClientWidget.using_timer): New method.
  (MandosClientWidget.checker_completed): Use "using_timer".
  (MandosClientWidget.need_approval): - '' -
  (MandosClientWidget.update): Show approval delay timer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
                                   ENOENT, EEXIST, EFAULT, EMFILE,
32
32
                                   ENFILE, ENOMEM, EBADF, EINVAL, EIO,
33
33
                                   EISDIR, EFBIG */
34
 
#include <stdio.h>              /* perror() */
 
34
#include <error.h>              /* error() */
35
35
#include <stdlib.h>             /* EXIT_FAILURE, NULL, size_t, free(),
36
36
                                   realloc(), EXIT_SUCCESS */
37
37
#include <fcntl.h>              /* open(), O_RDONLY */
51
51
  ret = mkfifo(passfifo, S_IRUSR | S_IWUSR);
52
52
  if(ret == -1){
53
53
    int e = errno;
54
 
    perror("mkfifo");
 
54
    error(0, errno, "mkfifo");
55
55
    switch(e){
56
56
    case EACCES:
57
57
    case ENOTDIR:
73
73
  int fifo_fd = open(passfifo, O_RDONLY);
74
74
  if(fifo_fd == -1){
75
75
    int e = errno;
76
 
    perror("open");
 
76
    error(0, errno, "open");
77
77
    switch(e){
78
78
    case EACCES:
79
79
    case ENOENT:
101
101
      if(buf_len + blocksize > buf_allocated){
102
102
        char *tmp = realloc(buf, buf_allocated + blocksize);
103
103
        if(tmp == NULL){
104
 
          perror("realloc");
 
104
          error(0, errno, "realloc");
105
105
          free(buf);
106
106
          return EX_OSERR;
107
107
        }
113
113
        int e = errno;
114
114
        free(buf);
115
115
        errno = e;
116
 
        perror("read");
 
116
        error(0, errno, "read");
117
117
        switch(e){
118
118
        case EBADF:
119
119
        case EFAULT:
141
141
      int e = errno;
142
142
      free(buf);
143
143
      errno = e;
144
 
      perror("write");
 
144
      error(0, errno, "write");
145
145
      switch(e){
146
146
      case EBADF:
147
147
      case EFAULT:
161
161
  ret = close(STDOUT_FILENO);
162
162
  if(ret == -1){
163
163
    int e = errno;
164
 
    perror("close");
 
164
    error(0, errno, "close");
165
165
    switch(e){
166
166
    case EBADF:
167
167
      return EX_OSFILE;