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, unsigned char *c)
26 for (i = 0; i < count; i++) {
33 * sendkeysync - Send a key sync mail to our peers.
34 * keys: The list of keys to send.
36 * Takes a list of keys and sends out a keysync mail to all our peers.
38 int sendkeysync(struct openpgp_publickey *keys)
41 struct ll *cursite = NULL;
42 struct openpgp_packet_list *packets = NULL;
43 struct openpgp_packet_list *list_end = NULL;
45 if (config.syncsites != NULL &&
46 (fd=popen(config.mta, "w")) != NULL) {
47 fprintf(fd, "From: %s\n", config.adminemail);
50 for (cursite = config.syncsites; cursite != NULL;
51 cursite = cursite->next) {
52 fprintf(fd, "%s", (char *) cursite->object);
53 if (cursite->next != NULL) {
59 fprintf(fd, "Subject: incremental\n");
60 fprintf(fd, "X-Keyserver-Sent: %s\n", config.thissite);
61 fprintf(fd, "Precedence: list\n");
62 fprintf(fd, "MIME-Version: 1.0\n");
63 fprintf(fd, "Content-Type: application/pgp-keys\n\n");
65 flatten_publickey(keys,
68 armor_openpgp_stream(fd_putchar,
71 free_packet_list(packets);