2 * add.c - CGI to add keys.
4 * Jonathan McDowell <noodles@earth.li>
6 * Copyright 2002 Project Purple
8 * $Id: add.c,v 1.13 2004/05/26 18:53:14 noodles Exp $
17 #include "charfuncs.h"
20 #include "keystructs.h"
24 #include "onak-conf.h"
28 int main(int argc, char *argv[])
30 struct openpgp_packet_list *packets = NULL;
31 struct openpgp_publickey *keys = NULL;
33 struct buffer_ctx ctx;
37 memset(&ctx, 0, sizeof(ctx));
39 params = getcgivars(argc, argv);
40 for (i = 0; params != NULL && params[i] != NULL; i += 2) {
41 if (!strcmp(params[i], "keytext")) {
42 ctx.buffer = params[i+1];
43 ctx.size = strlen(ctx.buffer);
56 start_html("onak : Add");
57 if (ctx.buffer == NULL) {
58 puts("Error: No keytext to add supplied.");
61 initlogthing("add", config.logfile);
62 dearmor_openpgp_stream(buffer_fetchchar,
65 if (packets != NULL) {
66 parse_keys(packets, &keys);
68 count = update_keys(&keys);
69 printf("Got %d new keys.\n", count);
70 logthing(LOGTHING_NOTICE, "Got %d new keys.",
79 puts("No OpenPGP packets found in input.");
85 return (EXIT_SUCCESS);