~ubuntu-branches/ubuntu/lucid/apf/lucid

« back to all changes in this revision

Viewing changes to src/afclient.c

  • Committer: Bazaar Package Importer
  • Author(s): Juan A. Diaz
  • Date: 2007-10-15 20:50:41 UTC
  • mfrom: (1.2.1 upstream) (3 feisty)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20071015205041-vhkhklncuq3bjq1s
* New upstream release.
* Added suport for certificate-based authentication (Closes: #440985).
  Thanks to Joshua Judson Rosen for making his whishes come true.
* Added dpatch in the build-depends to solve a minor bug in the afclient's
  manpages (lintian error: hyphen-used-as-minus-sign).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * active port forwarder - software for secure forwarding
3
 
 * Copyright (C) 2003-2006 jeremian <jeremian [at] poczta.fm>
 
3
 * Copyright (C) 2003-2007 jeremian <jeremian [at] poczta.fm>
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
6
6
 * it under the terms of the GNU General Public License as published by
32
32
  {"portnum", 1, 0, 'p'},
33
33
  {"verbose", 0, 0, 'v'},
34
34
  {"keyfile", 1, 0, 'k'},
 
35
  {"cerfile", 1, 0, 'c'},
35
36
  {"storefile", 1, 0, 's'},
36
37
  {"cfgfile", 1, 0, 'f'},
37
38
  {"log", 1, 0, 'o'},
107
108
  char* localPort = NULL;
108
109
  char* localDestinationName = NULL;
109
110
  char* keys = NULL;
 
111
  char* certif = NULL;
110
112
  char* store = NULL;
111
113
  char* dateformat = NULL;
112
114
  char* kaTimeout = NULL;
180
182
  
181
183
  while ((n = getopt_long(argc, argv,
182
184
          GETOPT_LONG_LIBDL(GETOPT_LONG_LIBPTHREAD(
183
 
              GETOPT_LONG_AF_INET6("huUn:m:d:p:vk:s:o:i:D:rP:X:VK:A:T:f:")))
 
185
              GETOPT_LONG_AF_INET6("huUn:m:d:p:vk:c:s:o:i:D:rP:X:VK:A:T:f:")))
184
186
          , long_options, 0)) != -1) {
185
187
    switch (n) {
186
188
      case 'h': {
250
252
        keys = optarg;
251
253
        break;
252
254
      }
 
255
      case 'c': {
 
256
        certif = optarg;
 
257
        break;
 
258
      }
253
259
      case 's': {
254
260
        store = optarg;
255
261
        break;
385
391
      else {
386
392
        ClientConfiguration_set_keysFile(cconfig, keys);
387
393
      }
 
394
      if (certif != NULL) {
 
395
        ClientConfiguration_set_certificateFile(cconfig, certif);
 
396
      }
388
397
      if (store == NULL) {
389
398
        if (ClientConfiguration_get_storeFile(cconfig) == NULL) {
390
399
          ClientConfiguration_set_storeFile(cconfig, "known_hosts");
486
495
      exit(1);
487
496
    }
488
497
    ClientConfiguration_set_keysFile(cconfig, keys);
 
498
    ClientConfiguration_set_certificateFile(cconfig, certif);
489
499
    ClientConfiguration_set_storeFile(cconfig, store);
490
500
    ClientConfiguration_set_dateFormat(cconfig, dateformat);
491
501
    ClientConfiguration_set_realmsNumber(cconfig, 1);
695
705
          "Setting rsa key failed (%s)... exiting", keys);
696
706
      exit(1);
697
707
    }
698
 
    
 
708
 
 
709
    certif = ClientConfiguration_get_certificateFile(cconfig);
 
710
    if (certif) {
 
711
      if (SSL_CTX_use_certificate_file(ctx, certif, SSL_FILETYPE_PEM) != 1) {
 
712
        aflog(LOG_T_INIT, LOG_I_CRIT,
 
713
            "Setting certificate failed (%s)... exiting", certif);
 
714
        exit(1);
 
715
      }
 
716
    }
 
717
 
699
718
    if ((ClientRealm_get_clientMode(pointer) != CLIENTREALM_MODE_REMOTE) &&
700
719
        (!verbose))
701
720
      daemon(0, 0);