2016-06-29 12:00:22 +02:00
|
|
|
/* gpg-wks.h - Common definitions for wks server and client.
|
|
|
|
* Copyright (C) 2016 g10 Code GmbH
|
2017-06-19 12:37:52 +02:00
|
|
|
* Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
|
2016-06-29 12:00:22 +02:00
|
|
|
*
|
|
|
|
* This file is part of GnuPG.
|
|
|
|
*
|
2017-06-19 12:37:52 +02:00
|
|
|
* This file is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2.1 of
|
|
|
|
* the License, or (at your option) any later version.
|
2016-06-29 12:00:22 +02:00
|
|
|
*
|
2017-06-19 12:37:52 +02:00
|
|
|
* This file is distributed in the hope that it will be useful,
|
2016-06-29 12:00:22 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2017-06-19 12:37:52 +02:00
|
|
|
* GNU Lesser General Public License for more details.
|
2016-06-29 12:00:22 +02:00
|
|
|
*
|
2017-06-19 12:37:52 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2016-11-05 12:02:19 +01:00
|
|
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
2016-06-29 12:00:22 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNUPG_GPG_WKS_H
|
|
|
|
#define GNUPG_GPG_WKS_H
|
|
|
|
|
|
|
|
#include "../common/util.h"
|
|
|
|
#include "../common/strlist.h"
|
2016-07-03 00:41:30 +02:00
|
|
|
#include "mime-maker.h"
|
2016-06-29 12:00:22 +02:00
|
|
|
|
2017-02-23 20:10:59 +01:00
|
|
|
/* The draft version we implement. */
|
|
|
|
#define WKS_DRAFT_VERSION 3
|
|
|
|
|
|
|
|
|
2016-06-29 12:00:22 +02:00
|
|
|
/* We keep all global options in the structure OPT. */
|
2020-02-10 16:37:34 +01:00
|
|
|
EXTERN_UNLESS_MAIN_MODULE
|
2016-06-29 12:00:22 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int verbose;
|
|
|
|
unsigned int debug;
|
|
|
|
int quiet;
|
2016-07-03 00:41:30 +02:00
|
|
|
int use_sendmail;
|
2018-11-05 20:58:27 +01:00
|
|
|
int with_colons;
|
2022-10-06 18:38:29 +02:00
|
|
|
int no_autostart;
|
2022-11-29 16:47:44 +01:00
|
|
|
int add_revocs;
|
2016-07-03 00:41:30 +02:00
|
|
|
const char *output;
|
2016-06-29 12:00:22 +02:00
|
|
|
const char *gpg_program;
|
|
|
|
const char *directory;
|
2016-07-02 18:59:22 +02:00
|
|
|
const char *default_from;
|
|
|
|
strlist_t extra_headers;
|
2016-06-29 12:00:22 +02:00
|
|
|
} opt;
|
|
|
|
|
|
|
|
/* Debug values and macros. */
|
2016-09-29 17:55:32 +02:00
|
|
|
#define DBG_MIME_VALUE 1 /* Debug the MIME structure. */
|
|
|
|
#define DBG_PARSER_VALUE 2 /* Debug the Mail parser. */
|
2016-06-29 12:00:22 +02:00
|
|
|
#define DBG_CRYPTO_VALUE 4 /* Debug low level crypto. */
|
|
|
|
#define DBG_MEMORY_VALUE 32 /* Debug memory allocation stuff. */
|
|
|
|
#define DBG_MEMSTAT_VALUE 128 /* Show memory statistics. */
|
|
|
|
#define DBG_IPC_VALUE 1024 /* Debug assuan communication. */
|
|
|
|
#define DBG_EXTPROG_VALUE 16384 /* debug external program calls */
|
|
|
|
|
2016-09-29 17:55:32 +02:00
|
|
|
#define DBG_MIME (opt.debug & DBG_MIME_VALUE)
|
|
|
|
#define DBG_PARSER (opt.debug & DBG_PARSER_VALUE)
|
|
|
|
#define DBG_CRYPTO (opt.debug & DBG_CRYPTO_VALUE)
|
|
|
|
|
2016-06-29 12:00:22 +02:00
|
|
|
|
2016-09-02 16:54:42 +02:00
|
|
|
/* The parsed policy flags. */
|
|
|
|
struct policy_flags_s
|
|
|
|
{
|
2018-02-20 09:00:00 +01:00
|
|
|
char *submission_address;
|
2016-09-02 16:54:42 +02:00
|
|
|
unsigned int mailbox_only : 1;
|
|
|
|
unsigned int dane_only : 1;
|
|
|
|
unsigned int auth_submit : 1;
|
2017-09-12 18:05:00 +02:00
|
|
|
unsigned int protocol_version; /* The supported WKS_DRAFT_VERION or 0 */
|
2016-09-02 16:54:42 +02:00
|
|
|
unsigned int max_pending; /* Seconds to wait for a confirmation. */
|
|
|
|
};
|
|
|
|
typedef struct policy_flags_s *policy_flags_t;
|
|
|
|
|
|
|
|
|
2017-09-18 11:16:07 +02:00
|
|
|
/* An object to convey user ids of a key. */
|
|
|
|
struct uidinfo_list_s
|
|
|
|
{
|
|
|
|
struct uidinfo_list_s *next;
|
2017-09-18 11:31:36 +02:00
|
|
|
time_t created; /* Time the userid was created. */
|
2017-09-18 11:16:07 +02:00
|
|
|
char *mbox; /* NULL or the malloced mailbox from UID. */
|
2022-10-06 18:38:29 +02:00
|
|
|
unsigned int flags; /* These flags are cleared on creation. */
|
2022-12-06 09:23:16 +01:00
|
|
|
unsigned int expired:1;
|
|
|
|
unsigned int revoked:1;
|
2017-09-18 11:16:07 +02:00
|
|
|
char uid[1];
|
|
|
|
};
|
|
|
|
typedef struct uidinfo_list_s *uidinfo_list_t;
|
|
|
|
|
|
|
|
|
2016-09-02 16:54:42 +02:00
|
|
|
|
2016-07-03 00:41:30 +02:00
|
|
|
/*-- wks-util.c --*/
|
2016-12-08 17:55:36 +01:00
|
|
|
void wks_set_status_fd (int fd);
|
|
|
|
void wks_write_status (int no, const char *format, ...) GPGRT_ATTR_PRINTF(2,3);
|
2017-09-18 11:16:07 +02:00
|
|
|
void free_uidinfo_list (uidinfo_list_t list);
|
2018-02-20 15:23:19 +01:00
|
|
|
gpg_error_t wks_get_key (estream_t *r_key, const char *fingerprint,
|
2022-11-29 16:47:44 +01:00
|
|
|
const char *addrspec, int exact, int binary);
|
2017-09-18 11:16:07 +02:00
|
|
|
gpg_error_t wks_list_key (estream_t key, char **r_fpr,
|
|
|
|
uidinfo_list_t *r_mboxes);
|
2017-09-18 12:52:20 +02:00
|
|
|
gpg_error_t wks_filter_uid (estream_t *r_newkey, estream_t key,
|
2018-02-20 11:45:58 +01:00
|
|
|
const char *uid, int binary);
|
2022-11-29 16:47:44 +01:00
|
|
|
gpg_error_t wks_armor_key (estream_t *r_newkey, estream_t key,
|
|
|
|
const char *prefix);
|
|
|
|
gpg_error_t wks_find_add_revocs (estream_t key, const char *addrspec);
|
2016-07-03 00:41:30 +02:00
|
|
|
gpg_error_t wks_send_mime (mime_maker_t mime);
|
2016-09-02 16:54:42 +02:00
|
|
|
gpg_error_t wks_parse_policy (policy_flags_t flags, estream_t stream,
|
|
|
|
int ignore_unknown);
|
2018-02-20 09:00:00 +01:00
|
|
|
void wks_free_policy (policy_flags_t policy);
|
2023-01-20 09:00:31 +01:00
|
|
|
gpg_error_t wks_write_to_file (estream_t src, const char *fname);
|
2016-07-03 00:41:30 +02:00
|
|
|
|
2019-03-22 11:40:01 +01:00
|
|
|
gpg_error_t wks_fname_from_userid (const char *userid, int hash_only,
|
2018-12-04 09:45:42 +01:00
|
|
|
char **r_fname, char **r_addrspec);
|
|
|
|
gpg_error_t wks_compute_hu_fname (char **r_fname, const char *addrspec);
|
2022-10-06 18:38:29 +02:00
|
|
|
gpg_error_t wks_install_key_core (estream_t key, const char *addrspec);
|
2018-12-04 09:45:42 +01:00
|
|
|
gpg_error_t wks_cmd_install_key (const char *fname, const char *userid);
|
|
|
|
gpg_error_t wks_cmd_remove_key (const char *userid);
|
2019-03-22 11:40:01 +01:00
|
|
|
gpg_error_t wks_cmd_print_wkd_hash (const char *userid);
|
2019-03-25 15:13:59 +01:00
|
|
|
gpg_error_t wks_cmd_print_wkd_url (const char *userid);
|
2018-12-04 09:45:42 +01:00
|
|
|
|
|
|
|
|
2016-06-29 12:00:22 +02:00
|
|
|
/*-- wks-receive.c --*/
|
2016-09-29 17:55:32 +02:00
|
|
|
|
|
|
|
/* Flag values for the receive callback. */
|
|
|
|
#define WKS_RECEIVE_DRAFT2 1
|
|
|
|
|
2016-06-29 12:00:22 +02:00
|
|
|
gpg_error_t wks_receive (estream_t fp,
|
|
|
|
gpg_error_t (*result_cb)(void *opaque,
|
|
|
|
const char *mediatype,
|
2016-09-29 17:55:32 +02:00
|
|
|
estream_t data,
|
|
|
|
unsigned int flags),
|
2016-06-29 12:00:22 +02:00
|
|
|
void *cb_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /*GNUPG_GPG_WKS_H*/
|