OpenDNSSEC-enforcer
2.1.5
src
keystate
keystate_ds_submit_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"
33
#include "
daemon/enforcercommands.h
"
34
#include "
daemon/engine.h
"
35
#include "
enforcer/enforce_task.h
"
36
#include "log.h"
37
#include "str.h"
38
#include "clientpipe.h"
39
#include "
db/key_data.h
"
40
#include "
keystate/keystate_ds.h
"
41
#include "
keystate/keystate_ds_submit_task.h
"
42
43
#include "
keystate/keystate_ds_submit_cmd.h
"
44
45
static
void
46
usage(
int
sockfd)
47
{
48
client_printf(sockfd,
49
"key ds-submit\n"
50
" --zone <zone> aka -z\n"
51
" --keytag <keytag> | --cka_id <CKA_ID> aka -x | -k\n"
52
/* " [--force] (aka -f) force even if there is no configured\n"
53
" DelegationSignerSubmitCommand.\n" */
54
);
55
}
56
57
static
void
58
help(
int
sockfd)
59
{
60
client_printf(sockfd,
61
"Issue a ds-submit to the enforcer for a KSK.\n"
62
"(This command with no parameters lists eligible keys.)\n"
63
"\nOptions:\n"
64
"zone name of the zone\n"
65
"keytag|cka_id specify the key tag or the locator of the key\n\n"
);
66
}
67
68
static
int
69
run(
int
sockfd, cmdhandler_ctx_type* context,
const
char
*cmd)
70
{
71
int
error;
72
db_connection_t
* dbconn =
getconnectioncontext
(context);
73
engine_type
* engine =
getglobalcontext
(context);
74
/* TODO, this changes the state, but sbmt cmd is not exec. */
75
error =
run_ds_cmd
(sockfd, cmd, dbconn,
76
KEY_DATA_DS_AT_PARENT_SUBMIT
,
77
KEY_DATA_DS_AT_PARENT_SUBMITTED
, engine);
78
if
(error == 0) {
79
/* YBS: TODO only affected zones */
80
enforce_task_flush_all
(engine, dbconn);
81
}
82
return
error;
83
84
}
85
86
struct
cmd_func_block
key_ds_submit_funcblock
= {
87
"key ds-submit"
, &usage, &help, NULL, &run
88
};
run_ds_cmd
int run_ds_cmd(int sockfd, const char *cmd, db_connection_t *dbconn, key_data_ds_at_parent_t state_from, key_data_ds_at_parent_t state_to, engine_type *engine)
Definition:
keystate_ds.c:433
enforcercommands.h
KEY_DATA_DS_AT_PARENT_SUBMITTED
@ KEY_DATA_DS_AT_PARENT_SUBMITTED
Definition:
key_data.h:52
keystate_ds.h
key_ds_submit_funcblock
struct cmd_func_block key_ds_submit_funcblock
Definition:
keystate_ds_submit_cmd.c:86
enforce_task_flush_all
void enforce_task_flush_all(engine_type *engine, db_connection_t *dbconn)
Definition:
enforce_task.c:179
keystate_ds_submit_task.h
getconnectioncontext
db_connection_t * getconnectioncontext(cmdhandler_ctx_type *context)
Definition:
enforcercommands.c:108
engine_struct
Definition:
engine.h:47
KEY_DATA_DS_AT_PARENT_SUBMIT
@ KEY_DATA_DS_AT_PARENT_SUBMIT
Definition:
key_data.h:51
keystate_ds_submit_cmd.h
engine.h
db_connection
Definition:
db_connection.h:46
getglobalcontext
engine_type * getglobalcontext(cmdhandler_ctx_type *context)
Definition:
enforcercommands.c:102
enforce_task.h
key_data.h
Generated by
1.8.17