/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/mandos-client.c

  • Committer: Teddy Hogeborn
  • Date: 2008-09-06 17:24:58 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080906172458-2x5wlfkn7oqckt1y
* legalnotice.xml: Copy DocBook 4.4-formatted text from
                   <http://www.gnu.org/licenses/gpl-3.0.dbk>.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 * "browse_callback", and parts of "main".
10
10
 * 
11
11
 * Everything else is
12
 
 * Copyright © 2008,2009 Teddy Hogeborn
13
 
 * Copyright © 2008,2009 Björn Påhlsson
 
12
 * Copyright © 2007-2008 Teddy Hogeborn & Björn Påhlsson
14
13
 * 
15
14
 * This program is free software: you can redistribute it and/or
16
15
 * modify it under the terms of the GNU General Public License as
102
101
 
103
102
#define BUFFER_SIZE 256
104
103
 
 
104
/*
 
105
  #define PATHDIR "/conf/conf.d/mandos"
 
106
*/
 
107
 
105
108
#define PATHDIR "/conf/conf.d/mandos"
106
109
#define SECKEY "seckey.txt"
107
110
#define PUBKEY "pubkey.txt"
108
111
 
109
112
bool debug = false;
110
113
static const char mandos_protocol_version[] = "1";
111
 
const char *argp_program_version = "mandos-client " VERSION;
 
114
const char *argp_program_version = "mandos-client 1.0";
112
115
const char *argp_program_bug_address = "<mandos@fukt.bsnet.se>";
113
116
 
114
117
/* Used for passing in values through the Avahi callback functions */
312
315
  
313
316
  /* Seek back to the beginning of the GPGME plaintext data buffer */
314
317
  if (gpgme_data_seek(dh_plain, (off_t) 0, SEEK_SET) == -1){
315
 
    perror("gpgme_data_seek");
 
318
    perror("pgpme_data_seek");
316
319
    plaintext_length = -1;
317
320
    goto decrypt_end;
318
321
  }
448
451
  
449
452
  gnutls_certificate_free_credentials(mc->cred);
450
453
  gnutls_global_deinit();
451
 
  gnutls_dh_params_deinit(mc->dh_params);
452
454
  return -1;
453
455
}
454
456
 
828
830
                          .dh_bits = 1024, .priority = "SECURE256"
829
831
                          ":!CTYPE-X.509:+CTYPE-OPENPGP" };
830
832
    bool gnutls_initalized = false;
831
 
    bool gpgme_initalized = false;
 
833
    bool pgpme_initalized = false;
832
834
    
833
835
    {
834
836
      struct argp_option options[] = {
975
977
    }
976
978
    
977
979
    if(not init_gpgme(&mc, pubkey, seckey, tempdir)){
978
 
      fprintf(stderr, "gpgme_initalized failed\n");
 
980
      fprintf(stderr, "pgpme_initalized failed\n");
979
981
      exitcode = EXIT_FAILURE;
980
982
      goto end;
981
983
    } else {
982
 
      gpgme_initalized = true;
 
984
      pgpme_initalized = true;
983
985
    }
984
986
    
985
987
    if_index = (AvahiIfIndex) if_nametoindex(interface);
1096
1098
    if (gnutls_initalized){
1097
1099
      gnutls_certificate_free_credentials(mc.cred);
1098
1100
      gnutls_global_deinit ();
1099
 
      gnutls_dh_params_deinit(mc.dh_params);
1100
1101
    }
1101
1102
    
1102
 
    if(gpgme_initalized){
 
1103
    if(pgpme_initalized){
1103
1104
      gpgme_release(mc.ctx);
1104
1105
    }
1105
1106
    
1132
1133
            free(fullname);
1133
1134
          }
1134
1135
        }
1135
 
        closedir(d);
1136
1136
      }
1137
1137
      ret = rmdir(tempdir);
1138
1138
      if(ret == -1){