2 * sendsync.c - Routines to send a key sync mail.
4 * Jonathan McDowell <noodles@earth.li>
6 * Copyright 1999, 2002 Project Purple
11 #include <sys/types.h>
15 #include "keystructs.h"
18 #include "onak-conf.h"
22 int fd_putchar(void *ctx, size_t count, void *c)
24 fwrite(c, sizeof(char), count, ctx);
30 * sendkeysync - Send a key sync mail to our peers.
31 * keys: The list of keys to send.
33 * Takes a list of keys and sends out a keysync mail to all our peers.
35 int sendkeysync(struct openpgp_publickey *keys)
38 struct ll *cursite = NULL;
39 struct openpgp_packet_list *packets = NULL;
40 struct openpgp_packet_list *list_end = NULL;
42 if (config.syncsites != NULL &&
43 (fd=popen(config.mta, "w")) != NULL) {
44 fprintf(fd, "From: %s\n", config.adminemail);
47 for (cursite = config.syncsites; cursite != NULL;
48 cursite = cursite->next) {
49 fprintf(fd, "%s", (char *) cursite->object);
50 if (cursite->next != NULL) {
56 fprintf(fd, "Subject: incremental\n");
57 fprintf(fd, "X-Keyserver-Sent: %s\n", config.thissite);
58 fprintf(fd, "Precedence: list\n");
59 fprintf(fd, "MIME-Version: 1.0\n");
60 fprintf(fd, "Content-Type: application/pgp-keys\n\n");
62 flatten_publickey(keys,
65 armor_openpgp_stream(fd_putchar,
68 free_packet_list(packets);