OpenDNSSEC-enforcer 2.1.13
keystate_ds_gone_cmd.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Surfnet
3 * Copyright (c) 2011 .SE (The Internet Infrastructure Foundation).
4 * Copyright (c) 2011 OpenDNSSEC AB (svb)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30#include "config.h"
31
32#include "cmdhandler.h"
34#include "daemon/engine.h"
36#include "log.h"
37#include "str.h"
38#include "clientpipe.h"
39#include "longgetopt.h"
40#include "db/key_data.h"
42
44
45/* static const char *module_str = "keystate_ds_gone_cmd"; */
46
51static void
52usage(int sockfd)
53{
54 client_printf(sockfd,
55 "key ds-gone\n"
56 " --zone <zone> aka -z\n"
57 " --keytag <keytag> | --cka_id <CKA_ID> aka -x | -k\n"
58 );
59}
60
61static void
62help(int sockfd)
63{
64 client_printf(sockfd,
65 "Issue a ds-gone to the enforcer for a KSK. \n"
66 "(This command with no parameters lists eligible keys.)\n"
67 "\nOptions:\n"
68 "zone name of the zone\n"
69 "keytag|cka_id specify the keytag or the locator of the key\n\n");
70}
71
72static int
73run(cmdhandler_ctx_type* context, int argc, char* argv[])
74{
75 int error;
76 db_connection_t* dbconn = getconnectioncontext(context);
77 engine_type* engine = getglobalcontext(context);
78 error = run_ds_cmd(context, argc, argv, dbconn,
81 if (error == 0) {
82 /* YBS: TODO only affected zones */
83 enforce_task_flush_all(engine, dbconn);
84 }
85 return error;
86}
87
88struct cmd_func_block key_ds_gone_funcblock = {
89 "key ds-gone", &usage, &help, NULL, NULL, &run, NULL
90};
void enforce_task_flush_all(engine_type *engine, db_connection_t *dbconn)
db_connection_t * getconnectioncontext(cmdhandler_ctx_type *context)
engine_type * getglobalcontext(cmdhandler_ctx_type *context)
@ KEY_DATA_DS_AT_PARENT_UNSUBMITTED
Definition key_data.h:52
@ KEY_DATA_DS_AT_PARENT_RETRACTED
Definition key_data.h:57
int run_ds_cmd(cmdhandler_ctx_type *context, int argc, char *argv[], db_connection_t *dbconn, key_data_ds_at_parent_t state_from, key_data_ds_at_parent_t state_to, engine_type *engine)
struct cmd_func_block key_ds_gone_funcblock