/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: 2014-07-16 23:44:54 UTC
  • Revision ID: teddy@recompile.se-20140716234454-6erpylmbf5qzndf3
mandos-client: Fix bug with GPGME 1.5.0.

* initramfs-tools-hook: If GPGME is 1.5.0 or later, copy "gpgconfig"
                        to RAM file system and do what GPGME does:
                        run "gpgconfig" to find GnuPG binary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
234
234
                          .af = af };
235
235
  if(new_server->ip == NULL){
236
236
    perror_plus("strdup");
 
237
    free(new_server);
237
238
    return false;
238
239
  }
239
240
  ret = clock_gettime(CLOCK_MONOTONIC, &(new_server->last_seen));
240
241
  if(ret == -1){
241
242
    perror_plus("clock_gettime");
 
243
#ifdef __GNUC__
 
244
#pragma GCC diagnostic push
 
245
#pragma GCC diagnostic ignored "-Wcast-qual"
 
246
#endif
 
247
    free((char *)(new_server->ip));
 
248
#ifdef __GNUC__
 
249
#pragma GCC diagnostic pop
 
250
#endif
 
251
    free(new_server);
242
252
    return false;
243
253
  }
244
254
  /* Special case of first server */
1066
1076
     timed out */
1067
1077
  
1068
1078
  if(quit_now){
 
1079
    avahi_s_service_resolver_free(r);
1069
1080
    return;
1070
1081
  }
1071
1082
  
1642
1653
      int status;
1643
1654
      if(TEMP_FAILURE_RETRY(waitpid(hook_pid, &status, 0)) == -1){
1644
1655
        perror_plus("waitpid");
 
1656
        free(direntry);
1645
1657
        continue;
1646
1658
      }
1647
1659
      if(WIFEXITED(status)){
1649
1661
          fprintf_plus(stderr, "Warning: network hook \"%s\" exited"
1650
1662
                       " with status %d\n", direntry->d_name,
1651
1663
                       WEXITSTATUS(status));
 
1664
          free(direntry);
1652
1665
          continue;
1653
1666
        }
1654
1667
      } else if(WIFSIGNALED(status)){
1655
1668
        fprintf_plus(stderr, "Warning: network hook \"%s\" died by"
1656
1669
                     " signal %d\n", direntry->d_name,
1657
1670
                     WTERMSIG(status));
 
1671
        free(direntry);
1658
1672
        continue;
1659
1673
      } else {
1660
1674
        fprintf_plus(stderr, "Warning: network hook \"%s\""
1661
1675
                     " crashed\n", direntry->d_name);
 
1676
        free(direntry);
1662
1677
        continue;
1663
1678
      }
1664
1679
    }
1666
1681
      fprintf_plus(stderr, "Network hook \"%s\" ran successfully\n",
1667
1682
                   direntry->d_name);
1668
1683
    }
 
1684
    free(direntry);
1669
1685
  }
1670
1686
  free(direntries);
1671
1687
  if((int)TEMP_FAILURE_RETRY(close(hookdir_fd)) == -1){
2265
2281
        if(ret_errno != 0){
2266
2282
          errno = ret_errno;
2267
2283
          perror_plus("argz_add");
 
2284
          free(direntries[i]);
2268
2285
          continue;
2269
2286
        }
2270
2287
        if(debug){
2271
2288
          fprintf_plus(stderr, "Will use interface \"%s\"\n",
2272
2289
                       direntries[i]->d_name);
2273
2290
        }
 
2291
        free(direntries[i]);
2274
2292
      }
2275
2293
      free(direntries);
2276
2294
    } else {
2546
2564
    mc.current_server->prev->next = NULL;
2547
2565
    while(mc.current_server != NULL){
2548
2566
      server *next = mc.current_server->next;
 
2567
#ifdef __GNUC__
 
2568
#pragma GCC diagnostic push
 
2569
#pragma GCC diagnostic ignored "-Wcast-qual"
 
2570
#endif
 
2571
      free((char *)(mc.current_server->ip));
 
2572
#ifdef __GNUC__
 
2573
#pragma GCC diagnostic pop
 
2574
#endif
2549
2575
      free(mc.current_server);
2550
2576
      mc.current_server = next;
2551
2577
    }
2620
2646
                         " \"%s\", 0): %s\n", tempdir,
2621
2647
                         direntries[i]->d_name, strerror(errno));
2622
2648
          }
 
2649
          free(direntries[i]);
2623
2650
        }
2624
2651
        
2625
2652
        /* need to clean even if 0 because man page doesn't specify */