Browse code

timeout for keyserver operations

Bernd Wurst authored on 24/04/2019 06:40:10
Showing 1 changed files
... ...
@@ -329,7 +329,7 @@ function search_pgp_key($search)
329 329
         return null;
330 330
     }
331 331
     $output = array();
332
-    $command = 'LC_ALL=C /usr/bin/gpg --batch --with-colons --keyserver hkps://hkps.pool.sks-keyservers.net --search-key '.escapeshellarg($search);
332
+    $command = 'LC_ALL=C /usr/bin/timeout 10 /usr/bin/gpg --batch --with-colons --keyserver hkps://hkps.pool.sks-keyservers.net --search-key '.escapeshellarg($search);
333 333
     DEBUG($command);
334 334
     exec($command, $output);
335 335
     DEBUG($output);
... ...
@@ -360,7 +360,7 @@ function fetch_pgp_key($pgp_id)
360 360
 {
361 361
     $output = array();
362 362
     $ret = null;
363
-    $command = '/usr/bin/gpg --batch --keyserver hkps://hkps.pool.sks-keyservers.net --no-auto-check-trustdb --trust-model=always --recv-key '.escapeshellarg($pgp_id);
363
+    $command = '/usr/bin/timeout 10 /usr/bin/gpg --batch --keyserver hkps://hkps.pool.sks-keyservers.net --no-auto-check-trustdb --trust-model=always --recv-key '.escapeshellarg($pgp_id);
364 364
     DEBUG($command);
365 365
     exec($command, $output, $ret);
366 366
     DEBUG($output);