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

  • Committer: Teddy Hogeborn
  • Date: 2016-02-28 03:01:43 UTC
  • Revision ID: teddy@recompile.se-20160228030143-i6w90r7wzkvlx9kq
Stop using python-gnutls.  Use GnuTLS 3.3 or later directly.

* INSTALL: Document dependency on GnuTLS 3.3 and remove dependency on
          Python-GnuTLS.

* debian/control (Source: mandos/Build-Depends): Add (>= 3.3.0) to
                                                 "libgnutls28-dev" and
                                                 "gnutls-dev".
  (Source: mandos/Build-Depends-Indep): Remove "python2.7-gnutls".
  (Package: mandos/Depends): Remove "python-gnutls" and
                             "python2.7-gnutls", add "libgnutls28-dev
                             (>= 3.3.0) | libgnutls30 (>= 3.3.0)"
* mandos: Remove imports of "gnutls" and all submodules.
  (GnuTLS, gnutls): New; simulate a "gnutls" module.  Change all
                    callers to match new shorter names.

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-2013 Teddy Hogeborn
6
 
 * Copyright © 2008-2013 Björn Påhlsson
 
5
 * Copyright © 2008-2015 Teddy Hogeborn
 
6
 * Copyright © 2008-2015 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
23
23
 */
24
24
 
25
25
#define _GNU_SOURCE             /* TEMP_FAILURE_RETRY(), getline(),
26
 
                                   O_CLOEXEC */
 
26
                                   O_CLOEXEC, pipe2() */
27
27
#include <stddef.h>             /* size_t, NULL */
28
28
#include <stdlib.h>             /* malloc(), exit(), EXIT_SUCCESS,
29
29
                                   realloc() */
30
30
#include <stdbool.h>            /* bool, true, false */
31
31
#include <stdio.h>              /* fileno(), fprintf(),
32
32
                                   stderr, STDOUT_FILENO, fclose() */
33
 
#include <sys/types.h>          /* DIR, fdopendir(), fstat(), struct
34
 
                                   stat, waitpid(), WIFEXITED(),
35
 
                                   WEXITSTATUS(), wait(), pid_t,
36
 
                                   uid_t, gid_t, getuid(), getgid(),
37
 
                                   dirfd() */
 
33
#include <sys/types.h>          /* fstat(), struct stat, waitpid(),
 
34
                                   WIFEXITED(), WEXITSTATUS(), wait(),
 
35
                                   pid_t, uid_t, gid_t, getuid(),
 
36
                                   getgid() */
38
37
#include <sys/select.h>         /* fd_set, select(), FD_ZERO(),
39
38
                                   FD_SET(), FD_ISSET(), FD_CLR */
40
39
#include <sys/wait.h>           /* wait(), waitpid(), WIFEXITED(),
42
41
                                   WCOREDUMP() */
43
42
#include <sys/stat.h>           /* struct stat, fstat(), S_ISREG() */
44
43
#include <iso646.h>             /* and, or, not */
45
 
#include <dirent.h>             /* DIR, struct dirent, fdopendir(),
46
 
                                   readdir(), closedir(), dirfd() */
 
44
#include <dirent.h>             /* struct dirent, scandirat() */
47
45
#include <unistd.h>             /* fcntl(), F_GETFD, F_SETFD,
48
46
                                   FD_CLOEXEC, write(), STDOUT_FILENO,
49
47
                                   struct stat, fstat(), close(),
50
48
                                   setgid(), setuid(), S_ISREG(),
51
 
                                   faccessat() pipe(), fork(),
 
49
                                   faccessat() pipe2(), fork(),
52
50
                                   _exit(), dup2(), fexecve(), read()
53
51
                                */
54
52
#include <fcntl.h>              /* fcntl(), F_GETFD, F_SETFD,
55
 
                                   FD_CLOEXEC, openat() */
 
53
                                   FD_CLOEXEC, openat(), scandirat(),
 
54
                                   pipe2() */
56
55
#include <string.h>             /* strsep, strlen(), strsignal(),
57
56
                                   strcmp(), strncmp() */
58
57
#include <errno.h>              /* errno */
72
71
                                   EX_CONFIG, EX_UNAVAILABLE, EX_OK */
73
72
#include <errno.h>              /* errno */
74
73
#include <error.h>              /* error() */
 
74
#include <fnmatch.h>            /* fnmatch() */
75
75
 
76
76
#define BUFFER_SIZE 256
77
77
 
78
78
#define PDIR "/lib/mandos/plugins.d"
 
79
#define PHDIR "/lib/mandos/plugin-helpers"
79
80
#define AFILE "/conf/conf.d/mandos/plugin-runner.conf"
80
81
 
81
82
const char *argp_program_version = "plugin-runner " VERSION;
240
241
  return add_to_char_array(def, &(p->environ), &(p->envc));
241
242
}
242
243
 
 
244
#ifndef O_CLOEXEC
243
245
/*
244
246
 * Based on the example in the GNU LibC manual chapter 13.13 "File
245
247
 * Descriptor Flags".
256
258
  return (int)TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD,
257
259
                                       ret | FD_CLOEXEC));
258
260
}
 
261
#endif  /* not O_CLOEXEC */
259
262
 
260
263
 
261
264
/* Mark processes as completed when they exit, and save their exit
345
348
 
346
349
int main(int argc, char *argv[]){
347
350
  char *plugindir = NULL;
 
351
  char *pluginhelperdir = NULL;
348
352
  char *argfile = NULL;
349
353
  FILE *conffp;
350
 
  size_t d_name_len;
351
 
  DIR *dir = NULL;
352
 
  struct dirent *dirst;
 
354
  struct dirent **direntries = NULL;
353
355
  struct stat st;
354
356
  fd_set rfds_all;
355
357
  int ret, maxfd = 0;
363
365
                                      .sa_flags = SA_NOCLDSTOP };
364
366
  char **custom_argv = NULL;
365
367
  int custom_argc = 0;
366
 
  int dir_fd;
 
368
  int dir_fd = -1;
367
369
  
368
370
  /* Establish a signal handler */
369
371
  sigemptyset(&sigchld_action.sa_mask);
414
416
      .doc = "Group ID the plugins will run as", .group = 3 },
415
417
    { .name = "debug", .key = 132,
416
418
      .doc = "Debug mode", .group = 4 },
 
419
    { .name = "plugin-helper-dir", .key = 133,
 
420
      .arg = "DIRECTORY",
 
421
      .doc = "Specify a different plugin helper directory",
 
422
      .group = 2 },
417
423
    /*
418
424
     * These reproduce what we would get without ARGP_NO_HELP
419
425
     */
545
551
    case 132:                   /* --debug */
546
552
      debug = true;
547
553
      break;
 
554
    case 133:                   /* --plugin-helper-dir */
 
555
      free(pluginhelperdir);
 
556
      pluginhelperdir = strdup(arg);
 
557
      if(pluginhelperdir != NULL){
 
558
        errno = 0;
 
559
      }
 
560
      break;
548
561
      /*
549
562
       * These reproduce what we would get without ARGP_NO_HELP
550
563
       */
601
614
    case 130:                   /* --userid */
602
615
    case 131:                   /* --groupid */
603
616
    case 132:                   /* --debug */
 
617
    case 133:                   /* --plugin-helper-dir */
604
618
    case '?':                   /* --help */
605
619
    case -3:                    /* --usage */
606
620
    case 'V':                   /* --version */
687
701
        custom_argc += 1;
688
702
        {
689
703
          char **new_argv = realloc(custom_argv, sizeof(char *)
690
 
                                    * ((unsigned int)
691
 
                                       custom_argc + 1));
 
704
                                    * ((size_t)custom_argc + 1));
692
705
          if(new_argv == NULL){
693
706
            error(0, errno, "realloc");
694
707
            exitstatus = EX_OSERR;
761
774
    goto fallback;
762
775
  }
763
776
  
 
777
  {
 
778
    char *pluginhelperenv;
 
779
    bool bret = true;
 
780
    ret = asprintf(&pluginhelperenv, "MANDOSPLUGINHELPERDIR=%s",
 
781
                   pluginhelperdir != NULL ? pluginhelperdir : PHDIR);
 
782
    if(ret != -1){
 
783
      bret = add_environment(getplugin(NULL), pluginhelperenv, true);
 
784
    }
 
785
    if(ret == -1 or not bret){
 
786
      error(0, errno, "Failed to set MANDOSPLUGINHELPERDIR"
 
787
            " environment variable to \"%s\" for all plugins\n",
 
788
            pluginhelperdir != NULL ? pluginhelperdir : PHDIR);
 
789
    }
 
790
    if(ret != -1){
 
791
      free(pluginhelperenv);
 
792
    }
 
793
  }
 
794
  
764
795
  if(debug){
765
796
    for(plugin *p = plugin_list; p != NULL; p=p->next){
766
797
      fprintf(stderr, "Plugin: %s has %d arguments\n",
795
826
          }
796
827
        }
797
828
      }
798
 
      TEMP_FAILURE_RETRY(close(plugindir_fd));
 
829
      close(plugindir_fd);
799
830
    }
800
831
  }
801
832
  
829
860
    ret = set_cloexec_flag(dir_fd);
830
861
    if(ret < 0){
831
862
      error(0, errno, "set_cloexec_flag");
832
 
      TEMP_FAILURE_RETRY(close(dir_fd));
833
863
      exitstatus = EX_OSERR;
834
864
      goto fallback;
835
865
    }
836
866
#endif  /* O_CLOEXEC */
837
 
    
838
 
    dir = fdopendir(dir_fd);
839
 
    if(dir == NULL){
840
 
      error(0, errno, "Could not open plugin dir");
841
 
      TEMP_FAILURE_RETRY(close(dir_fd));
842
 
      exitstatus = EX_OSERR;
843
 
      goto fallback;
 
867
  }
 
868
  
 
869
  int good_name(const struct dirent * const dirent){
 
870
    const char * const patterns[] = { ".*", "#*#", "*~", "*.dpkg-new",
 
871
                                      "*.dpkg-old", "*.dpkg-bak",
 
872
                                      "*.dpkg-divert", NULL };
 
873
#ifdef __GNUC__
 
874
#pragma GCC diagnostic push
 
875
#pragma GCC diagnostic ignored "-Wcast-qual"
 
876
#endif
 
877
    for(const char **pat = (const char **)patterns;
 
878
        *pat != NULL; pat++){
 
879
#ifdef __GNUC__
 
880
#pragma GCC diagnostic pop
 
881
#endif
 
882
      if(fnmatch(*pat, dirent->d_name, FNM_FILE_NAME | FNM_PERIOD)
 
883
         != FNM_NOMATCH){
 
884
        if(debug){
 
885
            fprintf(stderr, "Ignoring plugin dir entry \"%s\""
 
886
                    " matching pattern %s\n", dirent->d_name, *pat);
 
887
        }
 
888
        return 0;
 
889
      }
844
890
    }
 
891
    return 1;
 
892
  }
 
893
  
 
894
#ifdef __GLIBC__
 
895
#if __GLIBC_PREREQ(2, 15)
 
896
  int numplugins = scandirat(dir_fd, ".", &direntries, good_name,
 
897
                             alphasort);
 
898
#else  /* not __GLIBC_PREREQ(2, 15) */
 
899
  int numplugins = scandir(plugindir != NULL ? plugindir : PDIR,
 
900
                           &direntries, good_name, alphasort);
 
901
#endif  /* not __GLIBC_PREREQ(2, 15) */
 
902
#else   /* not __GLIBC__ */
 
903
  int numplugins = scandir(plugindir != NULL ? plugindir : PDIR,
 
904
                           &direntries, good_name, alphasort);
 
905
#endif  /* not __GLIBC__ */
 
906
  if(numplugins == -1){
 
907
    error(0, errno, "Could not scan plugin dir");
 
908
    direntries = NULL;
 
909
    exitstatus = EX_OSERR;
 
910
    goto fallback;
845
911
  }
846
912
  
847
913
  FD_ZERO(&rfds_all);
848
914
  
849
915
  /* Read and execute any executable in the plugin directory*/
850
 
  while(true){
851
 
    do {
852
 
      dirst = readdir(dir);
853
 
    } while(dirst == NULL and errno == EINTR);
854
 
    
855
 
    /* All directory entries have been processed */
856
 
    if(dirst == NULL){
857
 
      if(errno == EBADF){
858
 
        error(0, errno, "readdir");
859
 
        exitstatus = EX_IOERR;
860
 
        goto fallback;
861
 
      }
862
 
      break;
863
 
    }
864
 
    
865
 
    d_name_len = strlen(dirst->d_name);
866
 
    
867
 
    /* Ignore dotfiles, backup files and other junk */
868
 
    {
869
 
      bool bad_name = false;
870
 
      
871
 
      const char * const bad_prefixes[] = { ".", "#", NULL };
872
 
      
873
 
      const char * const bad_suffixes[] = { "~", "#", ".dpkg-new",
874
 
                                           ".dpkg-old",
875
 
                                           ".dpkg-bak",
876
 
                                           ".dpkg-divert", NULL };
877
 
#ifdef __GNUC__
878
 
#pragma GCC diagnostic push
879
 
#pragma GCC diagnostic ignored "-Wcast-qual"
880
 
#endif
881
 
      for(const char **pre = (const char **)bad_prefixes;
882
 
          *pre != NULL; pre++){
883
 
#ifdef __GNUC__
884
 
#pragma GCC diagnostic pop
885
 
#endif
886
 
        size_t pre_len = strlen(*pre);
887
 
        if((d_name_len >= pre_len)
888
 
           and strncmp((dirst->d_name), *pre, pre_len) == 0){
889
 
          if(debug){
890
 
            fprintf(stderr, "Ignoring plugin dir entry \"%s\""
891
 
                    " with bad prefix %s\n", dirst->d_name, *pre);
892
 
          }
893
 
          bad_name = true;
894
 
          break;
895
 
        }
896
 
      }
897
 
      if(bad_name){
898
 
        continue;
899
 
      }
900
 
#ifdef __GNUC__
901
 
#pragma GCC diagnostic push
902
 
#pragma GCC diagnostic ignored "-Wcast-qual"
903
 
#endif
904
 
      for(const char **suf = (const char **)bad_suffixes;
905
 
          *suf != NULL; suf++){
906
 
#ifdef __GNUC__
907
 
#pragma GCC diagnostic pop
908
 
#endif
909
 
        size_t suf_len = strlen(*suf);
910
 
        if((d_name_len >= suf_len)
911
 
           and (strcmp((dirst->d_name) + d_name_len-suf_len, *suf)
912
 
                == 0)){
913
 
          if(debug){
914
 
            fprintf(stderr, "Ignoring plugin dir entry \"%s\""
915
 
                    " with bad suffix %s\n", dirst->d_name, *suf);
916
 
          }
917
 
          bad_name = true;
918
 
          break;
919
 
        }
920
 
      }
921
 
      
922
 
      if(bad_name){
923
 
        continue;
924
 
      }
925
 
    }
926
 
    
927
 
    int plugin_fd = openat(dir_fd, dirst->d_name, O_RDONLY |
928
 
#ifdef O_CLOEXEC
929
 
                            O_CLOEXEC
930
 
#else  /* not O_CLOEXEC */
931
 
                            0
932
 
#endif  /* not O_CLOEXEC */
933
 
                            );
 
916
  for(int i = 0; i < numplugins; i++){
 
917
    
 
918
    int plugin_fd = openat(dir_fd, direntries[i]->d_name, O_RDONLY);
934
919
    if(plugin_fd == -1){
935
920
      error(0, errno, "Could not open plugin");
936
 
      continue;
937
 
    }
938
 
#ifndef O_CLOEXEC
939
 
  /* Set the FD_CLOEXEC flag on the plugin FD */
940
 
    ret = set_cloexec_flag(plugin_fd);
941
 
    if(ret < 0){
942
 
      error(0, errno, "set_cloexec_flag");
943
 
      TEMP_FAILURE_RETRY(close(plugin_fd));
944
 
      continue;
945
 
    }
946
 
#endif  /* O_CLOEXEC */
 
921
      free(direntries[i]);
 
922
      continue;
 
923
    }
947
924
    ret = (int)TEMP_FAILURE_RETRY(fstat(plugin_fd, &st));
948
925
    if(ret == -1){
949
926
      error(0, errno, "stat");
950
 
      TEMP_FAILURE_RETRY(close(plugin_fd));
 
927
      close(plugin_fd);
 
928
      free(direntries[i]);
951
929
      continue;
952
930
    }
953
931
    
954
932
    /* Ignore non-executable files */
955
933
    if(not S_ISREG(st.st_mode)
956
 
       or (TEMP_FAILURE_RETRY(faccessat(dir_fd, dirst->d_name, X_OK,
957
 
                                        0)) != 0)){
 
934
       or (TEMP_FAILURE_RETRY(faccessat(dir_fd, direntries[i]->d_name,
 
935
                                        X_OK, 0)) != 0)){
958
936
      if(debug){
959
937
        fprintf(stderr, "Ignoring plugin dir entry \"%s/%s\""
960
938
                " with bad type or mode\n",
961
 
                plugindir != NULL ? plugindir : PDIR, dirst->d_name);
 
939
                plugindir != NULL ? plugindir : PDIR,
 
940
                direntries[i]->d_name);
962
941
      }
963
 
      TEMP_FAILURE_RETRY(close(plugin_fd));
 
942
      close(plugin_fd);
 
943
      free(direntries[i]);
964
944
      continue;
965
945
    }
966
946
    
967
 
    plugin *p = getplugin(dirst->d_name);
 
947
    plugin *p = getplugin(direntries[i]->d_name);
968
948
    if(p == NULL){
969
949
      error(0, errno, "getplugin");
970
 
      TEMP_FAILURE_RETRY(close(plugin_fd));
 
950
      close(plugin_fd);
 
951
      free(direntries[i]);
971
952
      continue;
972
953
    }
973
954
    if(p->disabled){
974
955
      if(debug){
975
956
        fprintf(stderr, "Ignoring disabled plugin \"%s\"\n",
976
 
                dirst->d_name);
 
957
                direntries[i]->d_name);
977
958
      }
978
 
      TEMP_FAILURE_RETRY(close(plugin_fd));
 
959
      close(plugin_fd);
 
960
      free(direntries[i]);
979
961
      continue;
980
962
    }
981
963
    {
1006
988
    }
1007
989
    
1008
990
    int pipefd[2];
 
991
#ifndef O_CLOEXEC
1009
992
    ret = (int)TEMP_FAILURE_RETRY(pipe(pipefd));
 
993
#else  /* O_CLOEXEC */
 
994
    ret = (int)TEMP_FAILURE_RETRY(pipe2(pipefd, O_CLOEXEC));
 
995
#endif  /* O_CLOEXEC */
1010
996
    if(ret == -1){
1011
997
      error(0, errno, "pipe");
1012
998
      exitstatus = EX_OSERR;
1013
 
      goto fallback;
1014
 
    }
 
999
      free(direntries[i]);
 
1000
      goto fallback;
 
1001
    }
 
1002
    if(pipefd[0] >= FD_SETSIZE){
 
1003
      fprintf(stderr, "pipe()[0] (%d) >= FD_SETSIZE (%d)", pipefd[0],
 
1004
              FD_SETSIZE);
 
1005
      close(pipefd[0]);
 
1006
      close(pipefd[1]);
 
1007
      exitstatus = EX_OSERR;
 
1008
      free(direntries[i]);
 
1009
      goto fallback;
 
1010
    }
 
1011
#ifndef O_CLOEXEC
1015
1012
    /* Ask OS to automatic close the pipe on exec */
1016
1013
    ret = set_cloexec_flag(pipefd[0]);
1017
1014
    if(ret < 0){
1018
1015
      error(0, errno, "set_cloexec_flag");
 
1016
      close(pipefd[0]);
 
1017
      close(pipefd[1]);
1019
1018
      exitstatus = EX_OSERR;
 
1019
      free(direntries[i]);
1020
1020
      goto fallback;
1021
1021
    }
1022
1022
    ret = set_cloexec_flag(pipefd[1]);
1023
1023
    if(ret < 0){
1024
1024
      error(0, errno, "set_cloexec_flag");
 
1025
      close(pipefd[0]);
 
1026
      close(pipefd[1]);
1025
1027
      exitstatus = EX_OSERR;
 
1028
      free(direntries[i]);
1026
1029
      goto fallback;
1027
1030
    }
 
1031
#endif  /* not O_CLOEXEC */
1028
1032
    /* Block SIGCHLD until process is safely in process list */
1029
1033
    ret = (int)TEMP_FAILURE_RETRY(sigprocmask(SIG_BLOCK,
1030
1034
                                              &sigchld_action.sa_mask,
1032
1036
    if(ret < 0){
1033
1037
      error(0, errno, "sigprocmask");
1034
1038
      exitstatus = EX_OSERR;
 
1039
      free(direntries[i]);
1035
1040
      goto fallback;
1036
1041
    }
1037
1042
    /* Starting a new process to be watched */
1041
1046
    } while(pid == -1 and errno == EINTR);
1042
1047
    if(pid == -1){
1043
1048
      error(0, errno, "fork");
 
1049
      TEMP_FAILURE_RETRY(sigprocmask(SIG_UNBLOCK,
 
1050
                                     &sigchld_action.sa_mask, NULL));
 
1051
      close(pipefd[0]);
 
1052
      close(pipefd[1]);
1044
1053
      exitstatus = EX_OSERR;
 
1054
      free(direntries[i]);
1045
1055
      goto fallback;
1046
1056
    }
1047
1057
    if(pid == 0){
1063
1073
        _exit(EX_OSERR);
1064
1074
      }
1065
1075
      
1066
 
      if(dirfd(dir) < 0){
1067
 
        /* If dir has no file descriptor, we could not set FD_CLOEXEC
1068
 
           above and must now close it manually here. */
1069
 
        closedir(dir);
1070
 
      }
1071
1076
      if(fexecve(plugin_fd, p->argv,
1072
1077
                (p->environ[0] != NULL) ? p->environ : environ) < 0){
1073
1078
        error(0, errno, "fexecve for %s/%s",
1074
 
              plugindir != NULL ? plugindir : PDIR, dirst->d_name);
 
1079
              plugindir != NULL ? plugindir : PDIR,
 
1080
              direntries[i]->d_name);
1075
1081
        _exit(EX_OSERR);
1076
1082
      }
1077
1083
      /* no return */
1078
1084
    }
1079
1085
    /* Parent process */
1080
 
    TEMP_FAILURE_RETRY(close(pipefd[1])); /* Close unused write end of
1081
 
                                             pipe */
1082
 
    TEMP_FAILURE_RETRY(close(plugin_fd));
1083
 
    plugin *new_plugin = getplugin(dirst->d_name);
 
1086
    close(pipefd[1]);           /* Close unused write end of pipe */
 
1087
    close(plugin_fd);
 
1088
    plugin *new_plugin = getplugin(direntries[i]->d_name);
1084
1089
    if(new_plugin == NULL){
1085
1090
      error(0, errno, "getplugin");
1086
1091
      ret = (int)(TEMP_FAILURE_RETRY
1090
1095
        error(0, errno, "sigprocmask");
1091
1096
      }
1092
1097
      exitstatus = EX_OSERR;
 
1098
      free(direntries[i]);
1093
1099
      goto fallback;
1094
1100
    }
 
1101
    free(direntries[i]);
1095
1102
    
1096
1103
    new_plugin->pid = pid;
1097
1104
    new_plugin->fd = pipefd[0];
1127
1134
    }
1128
1135
  }
1129
1136
  
1130
 
  TEMP_FAILURE_RETRY(closedir(dir));
1131
 
  dir = NULL;
 
1137
  free(direntries);
 
1138
  direntries = NULL;
 
1139
  close(dir_fd);
 
1140
  dir_fd = -1;
1132
1141
  free_plugin(getplugin(NULL));
1133
1142
  
1134
1143
  for(plugin *p = plugin_list; p != NULL; p = p->next){
1328
1337
    free(custom_argv);
1329
1338
  }
1330
1339
  
1331
 
  if(dir != NULL){
1332
 
    closedir(dir);
 
1340
  free(direntries);
 
1341
  
 
1342
  if(dir_fd != -1){
 
1343
    close(dir_fd);
1333
1344
  }
1334
1345
  
1335
1346
  /* Kill the processes */
1355
1366
  free_plugin_list();
1356
1367
  
1357
1368
  free(plugindir);
 
1369
  free(pluginhelperdir);
1358
1370
  free(argfile);
1359
1371
  
1360
1372
  return exitstatus;