/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugins.d/mandos-client.c

Overflows are not detected by sscanf(), so stop using it:

* plugin-runner.c (main/parse_opt): Change from using "sscanf()" to
                                    "strtoimax()".
* plugins.d/mandos-client.c (main/parse_opt, main): Change from using
                                                    "sscanf()" to
                                                    "strtoimax()" and
                                                    "strtof()".
* splashy.c (main): Change from using "sscanf()" to "strtoimax()".
* usplash.c (main): - '' -

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