/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: Björn Påhlsson
  • Date: 2008-01-18 21:18:26 UTC
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: belorn@legolas-20080118211826-5rbwo54l4bwim5x2
Client:
        [Working version in initrd for booting]
        Added #ifdef DEBUG statements through out the program
        Added support to keep bouth tcp and udp up at the same time
        Catching several more error return codes that was unchecked.
        Starts the Network interface during startup.
        Added support for entering password on console
        Added error handling, like looping until a password has been received.
        Added cleanup handling so console state is always restored
                
removed:
        Old server.cpp [see next version]
        Test certificates

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
 
 
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"
 
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"
31
27
 
32
28
gnutls_certificate_credentials_t x509_cred;
33
29
 
66
62
 
67
63
  struct termios t_old, t_new;
68
64
  int status = 0;
69
 
  
70
 
  if (tcgetattr (STDIN_FILENO, &t_old) != 0){
71
 
    return 1;
72
 
  }
73
 
  
 
65
 
74
66
  session = initgnutls ();
75
67
 
76
68
#ifdef DEBUG
114
106
  FD_ZERO(&rfds_orig);
115
107
  FD_SET(udp_sd, &rfds_orig);
116
108
  FD_SET(STDIN_FILENO, &rfds_orig);
117
 
  
 
109
 
 
110
 
 
111
  if (tcgetattr (STDIN_FILENO, &t_old) != 0){
 
112
    return 1;
 
113
  }
118
114
  t_new = t_old;
119
115
  t_new.c_lflag &= ~ECHO;
120
116
  if (tcsetattr (STDIN_FILENO, TCSAFLUSH, &t_new) != 0){