/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 plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2015-07-12 02:08:25 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 325.
  • Revision ID: teddy@recompile.se-20150712020825-ng26jprj9m8crbo8
Don't use absolute paths to commands in Debian configurations scripts.

* debian/mandos-client.postinst: Don't use absolute paths to commands.
* debian/mandos-client.postrm: - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Mandos plugin runner - Run Mandos plugins
4
4
 *
5
 
 * Copyright © 2008-2015 Teddy Hogeborn
6
 
 * Copyright © 2008-2015 Björn Påhlsson
 
5
 * Copyright © 2008-2014 Teddy Hogeborn
 
6
 * Copyright © 2008-2014 Björn Påhlsson
7
7
 * 
8
8
 * This program is free software: you can redistribute it and/or
9
9
 * modify it under the terms of the GNU General Public License as
827
827
          }
828
828
        }
829
829
      }
830
 
      close(plugindir_fd);
 
830
      TEMP_FAILURE_RETRY(close(plugindir_fd));
831
831
    }
832
832
  }
833
833
  
925
925
    ret = (int)TEMP_FAILURE_RETRY(fstat(plugin_fd, &st));
926
926
    if(ret == -1){
927
927
      error(0, errno, "stat");
928
 
      close(plugin_fd);
 
928
      TEMP_FAILURE_RETRY(close(plugin_fd));
929
929
      free(direntries[i]);
930
930
      continue;
931
931
    }
940
940
                plugindir != NULL ? plugindir : PDIR,
941
941
                direntries[i]->d_name);
942
942
      }
943
 
      close(plugin_fd);
 
943
      TEMP_FAILURE_RETRY(close(plugin_fd));
944
944
      free(direntries[i]);
945
945
      continue;
946
946
    }
948
948
    plugin *p = getplugin(direntries[i]->d_name);
949
949
    if(p == NULL){
950
950
      error(0, errno, "getplugin");
951
 
      close(plugin_fd);
 
951
      TEMP_FAILURE_RETRY(close(plugin_fd));
952
952
      free(direntries[i]);
953
953
      continue;
954
954
    }
957
957
        fprintf(stderr, "Ignoring disabled plugin \"%s\"\n",
958
958
                direntries[i]->d_name);
959
959
      }
960
 
      close(plugin_fd);
 
960
      TEMP_FAILURE_RETRY(close(plugin_fd));
961
961
      free(direntries[i]);
962
962
      continue;
963
963
    }
1003
1003
    if(pipefd[0] >= FD_SETSIZE){
1004
1004
      fprintf(stderr, "pipe()[0] (%d) >= FD_SETSIZE (%d)", pipefd[0],
1005
1005
              FD_SETSIZE);
1006
 
      close(pipefd[0]);
1007
 
      close(pipefd[1]);
 
1006
      TEMP_FAILURE_RETRY(close(pipefd[0]));
 
1007
      TEMP_FAILURE_RETRY(close(pipefd[1]));
1008
1008
      exitstatus = EX_OSERR;
1009
1009
      free(direntries[i]);
1010
1010
      goto fallback;
1014
1014
    ret = set_cloexec_flag(pipefd[0]);
1015
1015
    if(ret < 0){
1016
1016
      error(0, errno, "set_cloexec_flag");
1017
 
      close(pipefd[0]);
1018
 
      close(pipefd[1]);
 
1017
      TEMP_FAILURE_RETRY(close(pipefd[0]));
 
1018
      TEMP_FAILURE_RETRY(close(pipefd[1]));
1019
1019
      exitstatus = EX_OSERR;
1020
1020
      free(direntries[i]);
1021
1021
      goto fallback;
1023
1023
    ret = set_cloexec_flag(pipefd[1]);
1024
1024
    if(ret < 0){
1025
1025
      error(0, errno, "set_cloexec_flag");
1026
 
      close(pipefd[0]);
1027
 
      close(pipefd[1]);
 
1026
      TEMP_FAILURE_RETRY(close(pipefd[0]));
 
1027
      TEMP_FAILURE_RETRY(close(pipefd[1]));
1028
1028
      exitstatus = EX_OSERR;
1029
1029
      free(direntries[i]);
1030
1030
      goto fallback;
1049
1049
      error(0, errno, "fork");
1050
1050
      TEMP_FAILURE_RETRY(sigprocmask(SIG_UNBLOCK,
1051
1051
                                     &sigchld_action.sa_mask, NULL));
1052
 
      close(pipefd[0]);
1053
 
      close(pipefd[1]);
 
1052
      TEMP_FAILURE_RETRY(close(pipefd[0]));
 
1053
      TEMP_FAILURE_RETRY(close(pipefd[1]));
1054
1054
      exitstatus = EX_OSERR;
1055
1055
      free(direntries[i]);
1056
1056
      goto fallback;
1084
1084
      /* no return */
1085
1085
    }
1086
1086
    /* Parent process */
1087
 
    close(pipefd[1]);           /* Close unused write end of pipe */
1088
 
    close(plugin_fd);
 
1087
    TEMP_FAILURE_RETRY(close(pipefd[1])); /* Close unused write end of
 
1088
                                             pipe */
 
1089
    TEMP_FAILURE_RETRY(close(plugin_fd));
1089
1090
    plugin *new_plugin = getplugin(direntries[i]->d_name);
1090
1091
    if(new_plugin == NULL){
1091
1092
      error(0, errno, "getplugin");
1137
1138
  
1138
1139
  free(direntries);
1139
1140
  direntries = NULL;
1140
 
  close(dir_fd);
 
1141
  TEMP_FAILURE_RETRY(close(dir_fd));
1141
1142
  dir_fd = -1;
1142
1143
  free_plugin(getplugin(NULL));
1143
1144
  
1341
1342
  free(direntries);
1342
1343
  
1343
1344
  if(dir_fd != -1){
1344
 
    close(dir_fd);
 
1345
    TEMP_FAILURE_RETRY(close(dir_fd));
1345
1346
  }
1346
1347
  
1347
1348
  /* Kill the processes */