/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-12-25 23:13:47 UTC
  • Revision ID: teddy@fukt.bsnet.se-20091225231347-gg9u9ru0wj0f24hh
More consistent terminology: Clients are no longer "invalid" - they
are "disabled".  All code and documentation changed to reflect this.

D=Bus API change: The "properties" argument was removed from the
"ClientAdded" signal on interface "se.bsnet.fukt.Mandos".  All code in
both "mandos" and "mandos-monitor" changed to reflect this.

* mandos: Replaced "with closing(F)" with simply "with F" in all
          places where F is a file object.
  (Client.still_valid): Removed.  All callers changed to look at
                        "Client.enabled" instead.
  (dbus_service_property): Check for unsupported signatures with the
                           "byte_arrays" option.
  (DBusObjectWithProperties.Set): - '' -
  (ClientHandler.handle): Use the reverse pipe to receive the
                          "Client.enabled" attribute instead of the
                          now-removed "Client.still_valid()" method.
  (ForkingMixInWithPipe): Renamed to "ForkingMixInWithPipes" (all
                          users changed).  Now also create a reverse
                          pipe for sending data to the child process.
  (ForkingMixInWithPipes.add_pipe): Now takes two pipe fd's as
                                    arguments.  All callers changed.
  (IPv6_TCPServer.handle_ipc): Take an additional "reply_fd" argument
                               (all callers changed).  Close the reply
                               pipe when the child data pipe is
                               closed.  New "GETATTR" IPC method; will
                               pickle client attribute and send it
                               over the reply pipe FD.
  (MandosDBusService.ClientAdded): Removed "properties" argument.  All
                                   emitters changed.
* mandos-clients.conf.xml (DESCRIPTION, OPTIONS): Use
                                                  "enabled/disabled"
                                                  terminology.
* mandos-ctl: Option "--is-valid" renamed to "--is-enabled".
* mandos-monitor: Enable user locale.  Try to log exceptions.
  (MandosClientPropertyCache.__init__): Removed "properties" argument.
                                        All callers changed.
  (UserInterface.add_new_client): Remove "properties" argument.  All
                                  callers changed.  Supply "logger"
                                  argument to MandosClientWidget().
  (UserInterface.add_client): New "logger" argument.  All callers
                              changed.
* mandos.xml (BUGS, SECURITY/CLIENTS): Use "enabled/disabled"
                                       terminology.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Askpass-FIFO - Read a password from a FIFO and output it
4
4
 * 
5
 
 * Copyright © 2008-2010 Teddy Hogeborn
6
 
 * Copyright © 2008-2010 Björn Påhlsson
 
5
 * Copyright © 2008,2009 Teddy Hogeborn
 
6
 * Copyright © 2008,2009 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
31
31
                                   ENOENT, EEXIST, EFAULT, EMFILE,
32
32
                                   ENFILE, ENOMEM, EBADF, EINVAL, EIO,
33
33
                                   EISDIR, EFBIG */
34
 
#include <error.h>              /* error() */
 
34
#include <stdio.h>              /* perror() */
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
 
    error(0, errno, "mkfifo");
 
54
    perror("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
 
    error(0, errno, "open");
 
76
    perror("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
 
          error(0, errno, "realloc");
 
104
          perror("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
 
        error(0, errno, "read");
 
116
        perror("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
 
      error(0, errno, "write");
 
144
      perror("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
 
    error(0, errno, "close");
 
164
    perror("close");
165
165
    switch(e){
166
166
    case EBADF:
167
167
      return EX_OSFILE;