/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2008-11-08 17:26:35 UTC
  • Revision ID: teddy@fukt.bsnet.se-20081108172635-6eexzbysvsk4bu1z
* mandos: Also import "with_statement" and "absolute_import" from
          "__future__.  Import "closing" from "contextlib".
  (Client.__init__): Use "with closing" on "secfile".
  (Client.checker_callback): Call "self.bump_timeout()" instead of
                             doing it directly.
  (Client.bump_timeout): New method to bump up the timeout.
  (TCP_handler.handle): Simplify code to provide fallback default for
                        GnuTLS priority string.
  (IPv6_TCPServer): Do not inherit from
                    "SocketServer.ForkingTCPServer", since that is
                    undocumented - instead, follow the example code
                    from the documentation.
  (if_nametoindex): Use "with closing" on the socket.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Mandos plugin runner - Run Mandos plugins
4
4
 *
5
 
 * Copyright © 2008,2009 Teddy Hogeborn
6
 
 * Copyright © 2008,2009 Björn Påhlsson
 
5
 * Copyright © 2008 Teddy Hogeborn & Björn Påhlsson
7
6
 * 
8
7
 * This program is free software: you can redistribute it and/or
9
8
 * modify it under the terms of the GNU General Public License as
309
308
  struct stat st;
310
309
  fd_set rfds_all;
311
310
  int ret, maxfd = 0;
312
 
  ssize_t sret;
313
311
  uid_t uid = 65534;
314
312
  gid_t gid = 65534;
315
313
  bool debug = false;
547
545
    char *org_line = NULL;
548
546
    char *p, *arg, *new_arg, *line;
549
547
    size_t size = 0;
 
548
    ssize_t sret;
550
549
    const char whitespace_delims[] = " \r\t\f\v\n";
551
550
    const char comment_delim[] = "#";
552
551
 
1019
1018
        proc->buffer_size += BUFFER_SIZE;
1020
1019
      }
1021
1020
      /* Read from the process */
1022
 
      sret = read(proc->fd, proc->buffer + proc->buffer_length,
1023
 
                  BUFFER_SIZE);
1024
 
      if(sret < 0){
 
1021
      ret = read(proc->fd, proc->buffer + proc->buffer_length,
 
1022
                 BUFFER_SIZE);
 
1023
      if(ret < 0){
1025
1024
        /* Read error from this process; ignore the error */
1026
1025
        proc = proc->next;
1027
1026
        continue;
1028
1027
      }
1029
 
      if(sret == 0){
 
1028
      if(ret == 0){
1030
1029
        /* got EOF */
1031
1030
        proc->eof = true;
1032
1031
      } else {
1033
 
        proc->buffer_length += (size_t) sret;
 
1032
        proc->buffer_length += (size_t) ret;
1034
1033
      }
1035
1034
    }
1036
1035
  }