80 char* temp_date = NULL;
81 char* temp_pre_date = NULL;
82 char* temp_repo = NULL;
83 int temp_backup_req = 0;
86 StrAppend(&sql,
"select distinct k.backup, s.name, k.pre_backup from keypairs k, securitymodules s ");
87 StrAppend(&sql,
"where s.id = k.securitymodule_id ");
101 if (verbose_flag == 1) {
102 printf(
"Pre Backup Date: Backup Date: Repository:\n");
104 printf(
"Date: Repository:\n");
106 while (status == 0) {
112 if (verbose_flag == 1) {
113 if (temp_date != NULL || temp_pre_date != NULL) {
114 printf(
"%-24s %-24s %s\n", temp_pre_date, temp_date, temp_repo);
117 if (temp_date != NULL) {
118 printf(
"%-24s %s\n", temp_date, temp_repo);
143 StrAppend(&sql2,
"select s.name, s.requirebackup from keypairs k, securitymodules s ");
144 StrAppend(&sql2,
"where s.id = k.securitymodule_id ");
150 StrAppend(&sql2,
" and k.backup is null");
151 StrAppend(&sql2,
" group by s.name order by s.name");
159 while (status == 0) {
162 DbInt(row2, 1, &temp_backup_req);
164 if (temp_backup_req == 0) {
165 printf(
"Repository %s has unbacked up keys (that can be used)\n", temp_repo);
167 printf(
"Repository %s has unbacked up keys (that will not be used)\n", temp_repo);
188 StrAppend(&sql3,
"select s.name from keypairs k, securitymodules s ");
189 StrAppend(&sql3,
"where s.id = k.securitymodule_id ");
195 StrAppend(&sql3,
" and k.backup is null");
196 StrAppend(&sql3,
" and k.pre_backup is not null");
197 StrAppend(&sql3,
" group by s.name order by s.name");
205 while (status == 0) {
209 printf(
"Repository %s has keys prepared for back up which have not been committed\n", temp_repo);
251 char* temp_name = NULL;
252 char* temp_cap = NULL;
256 StrAppend(&sql,
"select name, capacity, requirebackup from securitymodules ");
265 printf(
"Name: Capacity: RequireBackup:\n");
266 while (status == 0) {
270 DbInt(row, 2, &temp_back);
272 printf(
"%-32s %-12s %s\n", temp_name, (strlen(temp_cap) == 0) ?
"unset" : temp_cap, (temp_back == 0) ?
"No" :
"Yes");
315 char* temp_name = NULL;
316 char* temp_desc = NULL;
319 StrAppend(&sql,
"select name, description from policies ");
328 printf(
"Name: Description:\n");
329 while (status == 0) {
334 printf(
"%-32s %s\n", temp_name, (strlen(temp_desc) == 0) ?
"unset" : temp_desc);
379 char* temp_zone = NULL;
381 char* temp_date = NULL;
386 StrAppend(&sql,
"select z.name, k.keytype, k.retire, k.state from zones z, KEYDATA_VIEW k where z.id = k.zone_id and k.state in (3,4,7) ");
400 printf(
"Zone: Keytype: Rollover expected:\n");
401 while (status == 0) {
404 DbInt(row, 1, &temp_type);
406 DbInt(row, 3, &temp_state);
409 printf(
"%-31s %-13s %s\n", temp_zone, (temp_type ==
KSM_TYPE_KSK) ?
"KSK" :
"ZSK", (temp_date == NULL) ?
"(not scheduled)" : temp_date);
412 printf(
"%-31s %-13s %s\n", temp_zone,
"KSK",
"waiting for ds-seen");
433 *ds_count = local_count;
void DbFreeResult(DB_RESULT result)
int DbFetchRow(DB_RESULT result, DB_ROW *row)
char * DqsSpecifyInit(const char *table, const char *fields)
int KsmCheckNextRollover(int keytype, int zone_id, char **datetime)
int DbString(DB_ROW row, int field_index, char **result)
void DqsConditionInt(char **query, const char *field, DQS_COMPARISON compare, int value, int index)
int KsmListRollovers(int zone_id, int *ds_count)
void DbFreeRow(DB_ROW row)
int DbExecuteSql(DB_HANDLE handle, const char *stmt_str, DB_RESULT *result)
void StrAppend(char **str1, const char *str2)
int DbInt(DB_ROW row, int field_index, int *value)
int KsmListBackups(int repo_id, int verbose_flag)
void DqsEnd(char **query)
void DbStringFree(char *string)