summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-07-15 13:43:16 +0200
committerErich Eckner <git@eckner.net>2019-07-15 13:43:16 +0200
commit1b78e8e868b4bb0a7e766b356d893b4caada71a9 (patch)
tree9c124d15b52259ecba78ece96733e62d99779f35
parenta3e28233b6827fdac52b434ac9d1fc89a34813cb (diff)
downloadarchweb32-1b78e8e868b4bb0a7e766b356d893b4caada71a9.tar.xz
buildmaster/gpg-keys.php: hand out gpg keys from the database
-rw-r--r--buildmaster/gpg-keys.php33
1 files changed, 31 insertions, 2 deletions
diff --git a/buildmaster/gpg-keys.php b/buildmaster/gpg-keys.php
index db990c2..ed33418 100644
--- a/buildmaster/gpg-keys.php
+++ b/buildmaster/gpg-keys.php
@@ -1,6 +1,35 @@
<?php
require_once "../init.php";
require_once BASE . "/lib/mysql.php";
+require_once BASE . "/lib/http.php";
+
+ if (array_key_exists('fp', $_GET)) {
+ $result = mysql_run_query(
+ "SELECT" .
+ " `gpg_keys`.`fingerprint`," .
+ "`gpg_keys`.`public_key`" .
+ " FROM `gpg_keys`" .
+ " WHERE `gpg_keys`.`fingerprint`=from_base64(\"" . base64_encode(strtoupper($_GET['fp'])) . "\")"
+ );
+ if ($result -> num_rows == 0)
+ throw_http_error(400, 'Key not found');
+ $result = $result -> fetch_assoc();
+ print "<html>\n";
+ print " <head>\n";
+ print " <title>\n";
+ print " Archlinux 32 Key Server -- Get \"" . $result['fingerprint'] . "\"\n";
+ print " </title>\n";
+ print " <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n";
+ print " </head>\n";
+ print " <body>\n";
+ print " <h1>Archlinux 32 Key Server -- Get \"" . $result['fingerprint'] . "\"</h1>\n";
+ print " <pre>\n";
+ print $result['public_key'] . "\n";
+ print " </pre>\n";
+ print " </body>\n";
+ print "</html>\n";
+ die();
+ };
$result = mysql_run_query(
"SELECT" .
@@ -36,8 +65,8 @@ show_warning_on_offline_slave();
print "<tr>";
print "<td>" . $row["person"] . "</td>";
print "<td>" . $row["action"] . "</td>";
- print "<td><a href=\"http://pgp.mit.edu/pks/lookup?op=get&search=0x" .
- substr($row["fingerprint"],-16) .
+ print "<td><a href=\"?fp=" .
+ $row["fingerprint"] .
"\">" . $row["fingerprint"] . "</a></td>";
print "</tr>\n";
}