2 * sendsync.c - Routines to send a key sync mail.
4 * Jonathan McDowell <noodles@earth.li>
6 * Copyright 1999, 2002 Project Purple
8 * $Id: sendsync.c,v 1.2 2003/06/04 20:57:12 noodles Exp $
13 #include <sys/types.h>
17 #include "keystructs.h"
20 #include "onak-conf.h"
24 int fd_putchar(void *ctx, size_t count, unsigned char *c)
28 for (i = 0; i < count; i++) {
35 * sendkeysync - Send a key sync mail to our peers.
36 * keys: The list of keys to send.
38 * Takes a list of keys and sends out a keysync mail to all our peers.
40 int sendkeysync(struct openpgp_publickey *keys)
43 struct ll *cursite = NULL;
44 struct openpgp_packet_list *packets = NULL;
45 struct openpgp_packet_list *list_end = NULL;
47 if (config.syncsites != NULL &&
48 (fd=popen("sendmail -t", "w")) != NULL) {
49 fprintf(fd, "From: %s\n", config.adminemail);
52 for (cursite = config.syncsites; cursite != NULL;
53 cursite = cursite->next) {
54 fprintf(fd, "%s", (char *) cursite->object);
55 if (cursite->next != NULL) {
61 fprintf(fd, "Subject: incremental\n");
62 fprintf(fd, "X-Keyserver-Sent: %s\n", config.thissite);
63 fprintf(fd, "Precedence: list\n");
64 fprintf(fd, "MIME-Version: 1.0\n");
65 fprintf(fd, "Content-Type: application/pgp-keys\n\n");
67 flatten_publickey(keys,
70 armor_openpgp_stream(fd_putchar,
73 free_packet_list(packets);