2 * add.c - CGI to add keys.
4 * Jonathan McDowell <noodles@earth.li>
6 * Copyright 2002 Project Purple
8 * $Id: add.c,v 1.10 2003/06/04 20:57:06 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;
36 memset(&ctx, 0, sizeof(ctx));
38 params = getcgivars(argc, argv);
39 for (i = 0; params != NULL && params[i] != NULL; i += 2) {
40 if (!strcmp(params[i], "keytext")) {
41 ctx.buffer = params[i+1];
42 ctx.size = strlen(ctx.buffer);
55 start_html("onak : Add");
56 if (ctx.buffer == NULL) {
57 puts("Error: No keytext to add supplied.");
60 initlogthing("add", config.logfile);
61 dearmor_openpgp_stream(buffer_fetchchar,
64 if (packets != NULL) {
65 parse_keys(packets, &keys);
67 printf("Got %d new keys.\n",
76 puts("No OpenPGP packets found in input.");
82 return (EXIT_SUCCESS);