Line data Source code
1 : /* ks-engine-kdns.c - KDNS OpenPGP key access
2 : * Copyright (C) 2011 Free Software Foundation, Inc.
3 : *
4 : * This file is part of GnuPG.
5 : *
6 : * GnuPG is free software; you can redistribute it and/or modify
7 : * it under the terms of the GNU General Public License as published by
8 : * the Free Software Foundation; either version 3 of the License, or
9 : * (at your option) any later version.
10 : *
11 : * GnuPG is distributed in the hope that it will be useful,
12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : * GNU General Public License for more details.
15 : *
16 : * You should have received a copy of the GNU General Public License
17 : * along with this program; if not, see <https://www.gnu.org/licenses/>.
18 : */
19 :
20 : #include <config.h>
21 :
22 : #include <stdio.h>
23 : #include <stdlib.h>
24 : #include <string.h>
25 : #include <assert.h>
26 :
27 : #include "dirmngr.h"
28 : #include "misc.h"
29 : #include "userids.h"
30 : #include "ks-engine.h"
31 :
32 : /* Print a help output for the schemata supported by this module. */
33 : gpg_error_t
34 0 : ks_kdns_help (ctrl_t ctrl, parsed_uri_t uri)
35 : {
36 0 : const char const data[] =
37 : "This keyserver engine accepts URLs of the form:\n"
38 : " kdns://[NAMESERVER]/[ROOT][?at=STRING]\n"
39 : "with\n"
40 : " NAMESERVER used for queries (default: system standard)\n"
41 : " ROOT a DNS name appended to the query (default: none)\n"
42 : " STRING a string to replace the '@' (default: \".\")\n"
43 : "If a long answer is expected add the parameter \"usevc=1\".\n"
44 : "Supported methods: fetch\n"
45 : "Example:\n"
46 : "A query for \"hacker@gnupg.org\" with\n"
47 : " kdns://10.0.0.1/example.net?at=_key_&usevc=1\n"
48 : "setup as --auto-key-lookup in gpg does a CERT record query\n"
49 : "with type PGP on the nameserver 10.0.0.1 for\n"
50 : " hacker._key_.gnupg.org.example.net";
51 : gpg_error_t err;
52 :
53 0 : if (!uri)
54 0 : err = ks_print_help (ctrl, " kdns");
55 0 : else if (!strcmp (uri->scheme, "kdns"))
56 0 : err = ks_print_help (ctrl, data);
57 : else
58 0 : err = 0;
59 :
60 0 : return err;
61 : }
62 :
63 :
64 : /* Get the key from URI which is expected to specify a kdns scheme.
65 : On success R_FP has an open stream to read the data. */
66 : gpg_error_t
67 0 : ks_kdns_fetch (ctrl_t ctrl, parsed_uri_t uri, estream_t *r_fp)
68 : {
69 : gpg_error_t err;
70 :
71 : (void)ctrl;
72 0 : *r_fp = NULL;
73 :
74 0 : if (strcmp (uri->scheme, "kdns"))
75 0 : return gpg_error (GPG_ERR_INV_ARG);
76 :
77 0 : err = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
78 0 : return err;
79 : }
|