/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: 2009-05-23 05:59:52 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090523055952-wvnp7le0io6ttqni
Merge from release branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 */
31
31
 
32
32
/* Needed by GPGME, specifically gpgme_data_seek() */
 
33
#ifndef _LARGEFILE_SOURCE
33
34
#define _LARGEFILE_SOURCE
 
35
#endif
 
36
#ifndef _FILE_OFFSET_BITS
34
37
#define _FILE_OFFSET_BITS 64
 
38
#endif
35
39
 
36
40
#define _GNU_SOURCE             /* TEMP_FAILURE_RETRY(), asprintf() */
37
41
 
562
566
  
563
567
  memset(&to, 0, sizeof(to));
564
568
  if(af == AF_INET6){
565
 
    to.in6.sin6_family = (uint16_t)af;
 
569
    to.in6.sin6_family = (sa_family_t)af;
566
570
    ret = inet_pton(af, ip, &to.in6.sin6_addr);
567
571
  } else {                      /* IPv4 */
568
572
    to.in.sin_family = (sa_family_t)af;
854
858
       the callback function is called the Avahi server will free the
855
859
       resolver for us. */
856
860
    
857
 
    if(!(avahi_s_service_resolver_new(mc.server, interface,
858
 
                                       protocol, name, type, domain,
859
 
                                       AVAHI_PROTO_INET6, 0,
860
 
                                       resolve_callback, NULL)))
 
861
    if(avahi_s_service_resolver_new(mc.server, interface, protocol,
 
862
                                    name, type, domain, protocol, 0,
 
863
                                    resolve_callback, NULL) == NULL)
861
864
      fprintf(stderr, "Avahi: Failed to resolve service '%s': %s\n",
862
865
              name, avahi_strerror(avahi_server_errno(mc.server)));
863
866
    break;
908
911
  const char *seckey = PATHDIR "/" SECKEY;
909
912
  const char *pubkey = PATHDIR "/" PUBKEY;
910
913
  
911
 
  /* Initialize Mandos context */
912
 
  mc = (mandos_context){ .simple_poll = NULL, .server = NULL,
913
 
                         .dh_bits = 1024, .priority = "SECURE256"
914
 
                         ":!CTYPE-X.509:+CTYPE-OPENPGP" };
915
914
  bool gnutls_initialized = false;
916
915
  bool gpgme_initialized = false;
917
916
  float delay = 2.5f;
1257
1256
  
1258
1257
  /* Create the Avahi service browser */
1259
1258
  sb = avahi_s_service_browser_new(mc.server, if_index,
1260
 
                                   AVAHI_PROTO_INET6, "_mandos._tcp",
 
1259
                                   AVAHI_PROTO_UNSPEC, "_mandos._tcp",
1261
1260
                                   NULL, 0, browse_callback, NULL);
1262
1261
  if(sb == NULL){
1263
1262
    fprintf(stderr, "Failed to create service browser: %s\n",