mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Fix enum-conflation in cmdgen.c.
I'd somehow managed to declare an enum in cmdgen.c with key types OPENSSH and SSHCOM, and use it interchangeably with the one in ssh.h with SSH_KEYTYPE_OPENSSH and SSH_KEYTYPE_SSHCOM. It so happened that the relevant two enum values matched up! So this hasn't caused a bug yet, but it's an accident waiting to happen. Fix it before it does.
This commit is contained in:
parent
38d1db194d
commit
78b8bde7af
12
cmdgen.c
12
cmdgen.c
@ -920,7 +920,7 @@ int main(int argc, char **argv)
|
|||||||
outfilename = filename_from_str(outfile ? outfile : "");
|
outfilename = filename_from_str(outfile ? outfile : "");
|
||||||
|
|
||||||
switch (outtype) {
|
switch (outtype) {
|
||||||
int ret;
|
int ret, real_outtype;
|
||||||
|
|
||||||
case PRIVATE:
|
case PRIVATE:
|
||||||
if (sshver == 1) {
|
if (sshver == 1) {
|
||||||
@ -1058,7 +1058,15 @@ int main(int argc, char **argv)
|
|||||||
assert(ssh2key);
|
assert(ssh2key);
|
||||||
random_ref(); /* both foreign key types require randomness,
|
random_ref(); /* both foreign key types require randomness,
|
||||||
* for IV or padding */
|
* for IV or padding */
|
||||||
ret = export_ssh2(outfilename, outtype, ssh2key, passphrase);
|
switch (outtype) {
|
||||||
|
case OPENSSH:
|
||||||
|
real_outtype = SSH_KEYTYPE_OPENSSH;
|
||||||
|
break;
|
||||||
|
case SSHCOM:
|
||||||
|
real_outtype = SSH_KEYTYPE_SSHCOM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ret = export_ssh2(outfilename, real_outtype, ssh2key, passphrase);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
fprintf(stderr, "puttygen: unable to export key\n");
|
fprintf(stderr, "puttygen: unable to export key\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user