/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 at bsnet
  • Date: 2011-03-21 19:22:27 UTC
  • Revision ID: teddy@fukt.bsnet.se-20110321192227-y74ngvvcy9eq6shi
* 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:
1032
1032
int good_interface(const struct dirent *if_entry){
1033
1033
  ssize_t ssret;
1034
1034
  char *flagname = NULL;
 
1035
  if(if_entry->d_name[0] == '.'){
 
1036
    return 0;
 
1037
  }
1035
1038
  int ret = asprintf(&flagname, "%s/%s/flags", sys_class_net,
1036
1039
                     if_entry->d_name);
1037
1040
  if(ret < 0){
1038
1041
    perror("asprintf");
1039
1042
    return 0;
1040
1043
  }
1041
 
  if(if_entry->d_name[0] == '.'){
1042
 
    return 0;
1043
 
  }
1044
1044
  int flags_fd = (int)TEMP_FAILURE_RETRY(open(flagname, O_RDONLY));
1045
1045
  if(flags_fd == -1){
1046
1046
    perror("open");
 
1047
    free(flagname);
1047
1048
    return 0;
1048
1049
  }
 
1050
  free(flagname);
1049
1051
  typedef short ifreq_flags;    /* ifreq.ifr_flags in netdevice(7) */
1050
1052
  /* read line from flags_fd */
1051
1053
  ssize_t to_read = (sizeof(ifreq_flags)*2)+3; /* "0x1003\n" */