/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

* plugins.d/mandos-client.c (good_interface): Check if the interface
                                              name starts with "."
                                              before anything else.
                                              Bug fix: Fix memory
                                              leak.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
#include <unistd.h>             /* close(), SEEK_SET, off_t, write(),
74
74
                                   getuid(), getgid(), seteuid(),
75
75
                                   setgid(), pause() */
76
 
#include <arpa/inet.h>          /* inet_pton(), htons, inet_ntop() */
 
76
#include <arpa/inet.h>          /* inet_pton(), htons */
77
77
#include <iso646.h>             /* not, or, and */
78
78
#include <argp.h>               /* struct argp_option, error_t, struct
79
79
                                   argp_state, struct argp,
423
423
  }
424
424
  
425
425
  /* OpenPGP credentials */
426
 
  ret = gnutls_certificate_allocate_credentials(&mc.cred);
 
426
  gnutls_certificate_allocate_credentials(&mc.cred);
427
427
  if(ret != GNUTLS_E_SUCCESS){
428
 
    fprintf(stderr, "GnuTLS memory error: %s\n",
 
428
    fprintf(stderr, "GnuTLS memory error: %s\n", /* Spurious warning
 
429
                                                    from
 
430
                                                    -Wunreachable-code
 
431
                                                 */
429
432
            safer_gnutls_strerror(ret));
430
433
    gnutls_global_deinit();
431
434
    return -1;
1047
1050
  free(flagname);
1048
1051
  typedef short ifreq_flags;    /* ifreq.ifr_flags in netdevice(7) */
1049
1052
  /* read line from flags_fd */
1050
 
  ssize_t to_read = 2+(sizeof(ifreq_flags)*2)+1; /* "0x1003\n" */
 
1053
  ssize_t to_read = (sizeof(ifreq_flags)*2)+3; /* "0x1003\n" */
1051
1054
  char *flagstring = malloc((size_t)to_read+1); /* +1 for final \0 */
1052
1055
  flagstring[(size_t)to_read] = '\0';
1053
1056
  if(flagstring == NULL){
1110
1113
    }
1111
1114
    return 0;
1112
1115
  }
1113
 
  /* Reject non-ARP interfaces (including dummy interfaces) */
1114
 
  if(flags & IFF_NOARP){
1115
 
    if(debug){
1116
 
      fprintf(stderr, "Rejecting non-ARP interface \"%s\"\n",
1117
 
              if_entry->d_name);
1118
 
    }
1119
 
    return 0;
1120
 
  }
1121
1116
  /* Accept this device */
1122
1117
  if(debug){
1123
1118
    fprintf(stderr, "Interface \"%s\" is acceptable\n",