/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 13:09:43 UTC
  • Revision ID: teddy@recompile.se-20160228130943-6ofi0xgek1xd7qmy
Use GnuPG 2 if available

* debian/control (Package: mandos/Depends): Change "gnupg (<< 2)" to
                                            "gnupg".
  (Package: mandos-client/Depends): Remove "gnupg (<< 2)"; it will be
                                    depended on by libgpgme11, which
                                    will be added automatically by
                                    ${shlibs:Depends}.
* mandos (PGPEngine.__init__): Try to run "gpgconf" and set 'self.gpg'
                               to any binary found.  Also change
                               "--home" to "--homedir".
  (PGPEngine.encrypt, PGPEngine.decrypt): Use the 'self.gpg' attribute
                                          instead of "gpg".

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-2016 Teddy Hogeborn
6
 
 * Copyright © 2008-2016 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
891
891
    return 1;
892
892
  }
893
893
  
 
894
#ifdef __GLIBC__
 
895
#if __GLIBC_PREREQ(2, 15)
894
896
  int numplugins = scandirat(dir_fd, ".", &direntries, good_name,
895
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__ */
896
906
  if(numplugins == -1){
897
907
    error(0, errno, "Could not scan plugin dir");
898
908
    direntries = NULL;
1104
1114
      goto fallback;
1105
1115
    }
1106
1116
    
1107
 
    FD_SET(new_plugin->fd, &rfds_all);
 
1117
#if defined (__GNUC__) and defined (__GLIBC__)
 
1118
#if not __GLIBC_PREREQ(2, 16)
 
1119
#pragma GCC diagnostic push
 
1120
#pragma GCC diagnostic ignored "-Wsign-conversion"
 
1121
#endif
 
1122
#endif
 
1123
    FD_SET(new_plugin->fd, &rfds_all); /* Spurious warning from
 
1124
                                          -Wconversion in GNU libc
 
1125
                                          before 2.16 */
 
1126
#if defined (__GNUC__) and defined (__GLIBC__)
 
1127
#if not __GLIBC_PREREQ(2, 16)
 
1128
#pragma GCC diagnostic pop
 
1129
#endif
 
1130
#endif
1108
1131
    
1109
1132
    if(maxfd < new_plugin->fd){
1110
1133
      maxfd = new_plugin->fd;
1166
1189
          }
1167
1190
          
1168
1191
          /* Remove the plugin */
1169
 
          FD_CLR(proc->fd, &rfds_all);
 
1192
#if defined (__GNUC__) and defined (__GLIBC__)
 
1193
#if not __GLIBC_PREREQ(2, 16)
 
1194
#pragma GCC diagnostic push
 
1195
#pragma GCC diagnostic ignored "-Wsign-conversion"
 
1196
#endif
 
1197
#endif
 
1198
          FD_CLR(proc->fd, &rfds_all); /* Spurious warning from
 
1199
                                          -Wconversion in GNU libc
 
1200
                                          before 2.16 */
 
1201
#if defined (__GNUC__) and defined (__GLIBC__)
 
1202
#if not __GLIBC_PREREQ(2, 16)
 
1203
#pragma GCC diagnostic pop
 
1204
#endif
 
1205
#endif
1170
1206
          
1171
1207
          /* Block signal while modifying process_list */
1172
1208
          ret = (int)TEMP_FAILURE_RETRY(sigprocmask
1212
1248
      }
1213
1249
      
1214
1250
      /* This process has not completed.  Does it have any output? */
1215
 
      if(proc->eof or not FD_ISSET(proc->fd, &rfds)){
 
1251
#if defined (__GNUC__) and defined (__GLIBC__)
 
1252
#if not __GLIBC_PREREQ(2, 16)
 
1253
#pragma GCC diagnostic push
 
1254
#pragma GCC diagnostic ignored "-Wsign-conversion"
 
1255
#endif
 
1256
#endif
 
1257
      if(proc->eof or not FD_ISSET(proc->fd, &rfds)){ /* Spurious
 
1258
                                                         warning from
 
1259
                                                         -Wconversion
 
1260
                                                         in GNU libc
 
1261
                                                         before
 
1262
                                                         2.16 */
 
1263
#if defined (__GNUC__) and defined (__GLIBC__)
 
1264
#if not __GLIBC_PREREQ(2, 16)
 
1265
#pragma GCC diagnostic pop
 
1266
#endif
 
1267
#endif
1216
1268
        /* This process had nothing to say at this time */
1217
1269
        proc = proc->next;
1218
1270
        continue;