/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

  • Committer: Teddy Hogeborn
  • Date: 2014-08-09 23:37:07 UTC
  • mto: (237.7.304 trunk)
  • mto: This revision was merged to the branch mainline in revision 323.
  • Revision ID: teddy@recompile.se-20140809233707-6c5qyievp78lnzf1
askpass-fifo: Lower privileges after opening FIFO.

* plugins.d/askpass-fifo.c (main): Lower privileges after opening FIFO.

Show diffs side-by-side

added added

removed removed

Lines of Context:
240
240
  ret = clock_gettime(CLOCK_MONOTONIC, &(new_server->last_seen));
241
241
  if(ret == -1){
242
242
    perror_plus("clock_gettime");
243
 
    free(new_server->ip);
 
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
244
251
    free(new_server);
245
252
    return false;
246
253
  }
1069
1076
     timed out */
1070
1077
  
1071
1078
  if(quit_now){
 
1079
    avahi_s_service_resolver_free(r);
1072
1080
    return;
1073
1081
  }
1074
1082
  
1645
1653
      int status;
1646
1654
      if(TEMP_FAILURE_RETRY(waitpid(hook_pid, &status, 0)) == -1){
1647
1655
        perror_plus("waitpid");
 
1656
        free(direntry);
1648
1657
        continue;
1649
1658
      }
1650
1659
      if(WIFEXITED(status)){
1652
1661
          fprintf_plus(stderr, "Warning: network hook \"%s\" exited"
1653
1662
                       " with status %d\n", direntry->d_name,
1654
1663
                       WEXITSTATUS(status));
 
1664
          free(direntry);
1655
1665
          continue;
1656
1666
        }
1657
1667
      } else if(WIFSIGNALED(status)){
1658
1668
        fprintf_plus(stderr, "Warning: network hook \"%s\" died by"
1659
1669
                     " signal %d\n", direntry->d_name,
1660
1670
                     WTERMSIG(status));
 
1671
        free(direntry);
1661
1672
        continue;
1662
1673
      } else {
1663
1674
        fprintf_plus(stderr, "Warning: network hook \"%s\""
1664
1675
                     " crashed\n", direntry->d_name);
 
1676
        free(direntry);
1665
1677
        continue;
1666
1678
      }
1667
1679
    }
1669
1681
      fprintf_plus(stderr, "Network hook \"%s\" ran successfully\n",
1670
1682
                   direntry->d_name);
1671
1683
    }
 
1684
    free(direntry);
1672
1685
  }
1673
1686
  free(direntries);
1674
1687
  if((int)TEMP_FAILURE_RETRY(close(hookdir_fd)) == -1){
2268
2281
        if(ret_errno != 0){
2269
2282
          errno = ret_errno;
2270
2283
          perror_plus("argz_add");
 
2284
          free(direntries[i]);
2271
2285
          continue;
2272
2286
        }
2273
2287
        if(debug){
2274
2288
          fprintf_plus(stderr, "Will use interface \"%s\"\n",
2275
2289
                       direntries[i]->d_name);
2276
2290
        }
 
2291
        free(direntries[i]);
2277
2292
      }
2278
2293
      free(direntries);
2279
2294
    } else {
2549
2564
    mc.current_server->prev->next = NULL;
2550
2565
    while(mc.current_server != NULL){
2551
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
2552
2575
      free(mc.current_server);
2553
2576
      mc.current_server = next;
2554
2577
    }
2623
2646
                         " \"%s\", 0): %s\n", tempdir,
2624
2647
                         direntries[i]->d_name, strerror(errno));
2625
2648
          }
 
2649
          free(direntries[i]);
2626
2650
        }
2627
2651
        
2628
2652
        /* need to clean even if 0 because man page doesn't specify */