/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: 2012-06-14 17:03:12 UTC
  • Revision ID: teddy@recompile.se-20120614170312-pl62gn832v09z4bi
* plugins.d/mandos-client.c: Don't use assert().  Use in_port_t for
                             port numbers everywhere except the
                             "resolve_callback" function; its
                             signature is forced by the signature of
                             the avahi_s_service_resolver_new
                             function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1450
1450
  int numhooks = scandir(hookdir, &direntries, runnable_hook,
1451
1451
                         alphasort);
1452
1452
  if(numhooks == -1){
1453
 
    if(errno == ENOENT){
1454
 
      if(debug){
1455
 
        fprintf_plus(stderr, "Network hook directory \"%s\" not"
1456
 
                     " found\n", hookdir);
1457
 
      }
1458
 
    } else {
1459
 
      perror_plus("scandir");
1460
 
    }
 
1453
    perror_plus("scandir");
1461
1454
  } else {
1462
1455
    int devnull = open("/dev/null", O_RDONLY);
1463
1456
    for(int i = 0; i < numhooks; i++){
2021
2014
  
2022
2015
  /* Run network hooks */
2023
2016
  {
2024
 
    
2025
 
    if(interfaces != NULL){
2026
 
      interfaces_hooks = malloc(interfaces_size);
2027
 
      if(interfaces_hooks == NULL){
2028
 
        perror_plus("malloc");
2029
 
        goto end;
2030
 
      }
2031
 
      memcpy(interfaces_hooks, interfaces, interfaces_size);
2032
 
      interfaces_hooks_size = interfaces_size;
2033
 
      argz_stringify(interfaces_hooks, interfaces_hooks_size,
2034
 
                     (int)',');
 
2017
    ret_errno = argz_append(&interfaces_hooks, &interfaces_hooks_size,
 
2018
                            interfaces, interfaces_size);
 
2019
    if(ret_errno != 0){
 
2020
      errno = ret_errno;
 
2021
      perror_plus("argz_append");
 
2022
      goto end;
2035
2023
    }
2036
 
    if(not run_network_hooks("start", interfaces_hooks != NULL ?
2037
 
                             interfaces_hooks : "", delay)){
 
2024
    argz_stringify(interfaces_hooks, interfaces_hooks_size, (int)',');
 
2025
    if(not run_network_hooks("start", interfaces_hooks, delay)){
2038
2026
      goto end;
2039
2027
    }
2040
2028
  }
2395
2383
    raise_privileges();
2396
2384
    
2397
2385
    /* Run network hooks */
2398
 
    run_network_hooks("stop", interfaces_hooks != NULL ?
2399
 
                      interfaces_hooks : "", delay);
 
2386
    run_network_hooks("stop", interfaces_hooks, delay);
2400
2387
    
2401
2388
    /* Take down the network interfaces which were brought up */
2402
2389
    {