Skip to content

Commit

Permalink
Merge pull request mkj#248 from stokito/fix_236
Browse files Browse the repository at this point in the history
dropbearkey.c Ignore unsupported command line options
  • Loading branch information
mkj authored Aug 29, 2023
2 parents d26bd77 + ec26975 commit 66abae8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/dropbearkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ int main(int argc, char ** argv) {
enum signkey_type keytype = DROPBEAR_SIGNKEY_NONE;
char * typetext = NULL;
char * sizetext = NULL;
char * passphrase = NULL;
unsigned int bits = 0, genbits;
int printpub = 0;

Expand Down Expand Up @@ -194,11 +195,16 @@ int main(int argc, char ** argv) {
printhelp(argv[0]);
exit(EXIT_SUCCESS);
break;
#if DEBUG_TRACE
case 'v':
#if DEBUG_TRACE
debug_trace = DROPBEAR_VERBOSE_LEVEL;
break;
#endif
break;
case 'q':
break; /* quiet is default */
case 'N':
next = &passphrase;
break;
default:
fprintf(stderr, "Unknown argument %s\n", argv[i]);
printhelp(argv[0]);
Expand Down Expand Up @@ -266,6 +272,11 @@ int main(int argc, char ** argv) {
check_signkey_bits(keytype, bits);;
}

if (passphrase && *passphrase != '\0') {
fprintf(stderr, "Only empty passphrase is supported\n");
exit(EXIT_FAILURE);
}

genbits = signkey_generate_get_bits(keytype, bits);
fprintf(stderr, "Generating %u bit %s key, this may take a while...\n", genbits, typetext);
if (signkey_generate(keytype, bits, filename, 0) == DROPBEAR_FAILURE)
Expand Down

0 comments on commit 66abae8

Please sign in to comment.