@@ -785,7 +785,7 @@ bool secureZone(DNSSECKeeper& dk, const std::string& zone)
785
785
}
786
786
787
787
for (vector<string>::iterator i = k_algos.begin ()+1 ; i != k_algos.end (); i++)
788
- dk.addKey (zone, true , shorthand2algorithm (*i), k_size, true );
788
+ dk.addKey (zone, true , shorthand2algorithm (*i), k_size, true ); // obvious errors will have been caught above
789
789
790
790
BOOST_FOREACH (string z_algo, z_algos)
791
791
{
@@ -1147,13 +1147,18 @@ try
1147
1147
bits = atoi (cmds[n].c_str ());
1148
1148
} else {
1149
1149
cerr<<" Unknown algorithm, key flag or size '" <<cmds[n]<<" '" <<endl;
1150
- return 0 ;
1150
+ exit (EXIT_FAILURE); ;
1151
1151
}
1152
1152
}
1153
- cerr<<" Adding a " << (keyOrZone ? " KSK" : " ZSK" )<<" with algorithm = " <<algorithm<<" , active=" <<active<<endl;
1154
- if (bits)
1155
- cerr<<" Requesting specific key size of " <<bits<<" bits" <<endl;
1156
- dk.addKey (zone, keyOrZone, algorithm, bits, active);
1153
+ if (!dk.addKey (zone, keyOrZone, algorithm, bits, active)) {
1154
+ cerr<<" Adding key failed, perhaps DNSSEC not enabled in configuration?" <<endl;
1155
+ exit (1 );
1156
+ }
1157
+ else {
1158
+ cerr<<" Added a " << (keyOrZone ? " KSK" : " ZSK" )<<" with algorithm = " <<algorithm<<" , active=" <<active<<endl;
1159
+ if (bits)
1160
+ cerr<<" Requested specific key size of " <<bits<<" bits" <<endl;
1161
+ }
1157
1162
}
1158
1163
else if (cmds[0 ] == " remove-zone-key" ) {
1159
1164
if (cmds.size () < 3 ) {
@@ -1317,7 +1322,10 @@ try
1317
1322
else
1318
1323
dpk.d_flags = 257 ; // ksk
1319
1324
1320
- dk.addKey (zone, dpk);
1325
+ if (!dk.addKey (zone, dpk)) {
1326
+ cerr<<" Adding key failed, perhaps DNSSEC not enabled in configuration?" <<endl;
1327
+ exit (1 );
1328
+ }
1321
1329
1322
1330
}
1323
1331
else if (cmds[0 ]==" import-zone-key" ) {
@@ -1353,7 +1361,10 @@ try
1353
1361
exit (1 );
1354
1362
}
1355
1363
}
1356
- dk.addKey (zone, dpk, active);
1364
+ if (!dk.addKey (zone, dpk, active)) {
1365
+ cerr<<" Adding key failed, perhaps DNSSEC not enabled in configuration?" <<endl;
1366
+ exit (1 );
1367
+ }
1357
1368
}
1358
1369
else if (cmds[0 ]==" export-zone-dnskey" ) {
1359
1370
if (cmds.size () < 3 ) {
0 commit comments