/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 client.cpp

  • Committer: Teddy Hogeborn
  • Date: 2008-06-21 00:53:32 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080621005332-s4scjdpevuso4lsd
* server.py: Bug fix: Do "from __future__ import division".
  (Client.__init__): Bug fix: parse interval string from config file.
  (Client.check_action): Take no arguments.  Print some debugging
  output.  Reset "checker" to None.
  (Client.start_checker): Sleep 10 seconds before pinging to alleviate
  debugging.
  (Client.next_stop): Bug fix: check if "last_seen" and/or "checker"
  is None.
  (Client.still_valid): Bug fix: check if "last_seen" is None.
  (Client.handle): When finding the right password to send, use a list
  comprehension and an index lookup instead of a generator expression to
  a dict.
  (IPv6_TCPServer.request_queue_size): Removed.
  (in6addr_any): Moved inside "main".
  (main): Changed "clients" to be a Set instead of a list.  Bug fix:
  Exit when/if all clients are removed.  Call "select" with all client
  checkers and a suitable timeout.  Add some debugging output.  Start
  new checkers when needed and delete clients which have timed out.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#define SOCKET_ERR(err,s) if(err<0) {perror(s); status = 1; goto quit;}
23
23
#define PORT 49001
24
 
#define CERTFILE "/conf/conf.d/cryptkeyreq/client-cert.pem"
25
 
#define KEYFILE "/conf/conf.d/cryptkeyreq/client-key.pem"
26
 
#define CAFILE "/conf/conf.d/cryptkeyreq/ca.pem"
 
24
 
 
25
#ifndef CERT_ROOT
 
26
#define CERT_ROOT "/conf/conf.d/cryptkeyreq/"
 
27
#endif
 
28
#define CERTFILE CERT_ROOT "client-cert.pem"
 
29
#define KEYFILE CERT_ROOT "client-key.pem"
 
30
#define CAFILE CERT_ROOT "ca.pem"
27
31
 
28
32
gnutls_certificate_credentials_t x509_cred;
29
33
 
62
66
 
63
67
  struct termios t_old, t_new;
64
68
  int status = 0;
65
 
 
 
69
  
 
70
  if (tcgetattr (STDIN_FILENO, &t_old) != 0){
 
71
    return 1;
 
72
  }
 
73
  
66
74
  session = initgnutls ();
67
75
 
68
76
#ifdef DEBUG
106
114
  FD_ZERO(&rfds_orig);
107
115
  FD_SET(udp_sd, &rfds_orig);
108
116
  FD_SET(STDIN_FILENO, &rfds_orig);
109
 
 
110
 
 
111
 
  if (tcgetattr (STDIN_FILENO, &t_old) != 0){
112
 
    return 1;
113
 
  }
 
117
  
114
118
  t_new = t_old;
115
119
  t_new.c_lflag &= ~ECHO;
116
120
  if (tcsetattr (STDIN_FILENO, TCSAFLUSH, &t_new) != 0){