version 1.10, 1999/11/15 20:53:24 |
version 1.11, 1999/11/16 22:49:28 |
|
|
#include "ssh.h" |
#include "ssh.h" |
#include "xmalloc.h" |
#include "xmalloc.h" |
#include "authfd.h" |
#include "authfd.h" |
|
#include "fingerprint.h" |
|
|
void |
void |
delete_file(AuthenticationConnection *ac, const char *filename) |
delete_file(AuthenticationConnection *ac, const char *filename) |
|
|
} |
} |
|
|
void |
void |
list_identities(AuthenticationConnection *ac) |
list_identities(AuthenticationConnection *ac, int fp) |
{ |
{ |
BIGNUM *e, *n; |
BIGNUM *e, *n; |
int status; |
int status; |
|
|
status; |
status; |
status = ssh_get_next_identity(ac, e, n, &comment)) |
status = ssh_get_next_identity(ac, e, n, &comment)) |
{ |
{ |
char *ebuf, *nbuf; |
unsigned int bits = BN_num_bits(n); |
had_identities = 1; |
had_identities = 1; |
ebuf = BN_bn2dec(e); |
if (fp) { |
if (ebuf == NULL) { |
printf("%d %s %s\n", bits, fingerprint(e, n), comment); |
error("list_identities: BN_bn2dec(e) failed."); |
} else { |
}else{ |
char *ebuf, *nbuf; |
nbuf = BN_bn2dec(n); |
ebuf = BN_bn2dec(e); |
if (nbuf == NULL) { |
if (ebuf == NULL) { |
error("list_identities: BN_bn2dec(n) failed."); |
error("list_identities: BN_bn2dec(e) failed."); |
}else{ |
}else{ |
unsigned int bits = BN_num_bits(n); |
nbuf = BN_bn2dec(n); |
printf("%d %s %s %s\n", bits, ebuf, nbuf, comment); |
if (nbuf == NULL) { |
free(nbuf); |
error("list_identities: BN_bn2dec(n) failed."); |
} |
}else{ |
free(ebuf); |
printf("%d %s %s %s\n", bits, ebuf, nbuf, comment); |
|
free(nbuf); |
|
} |
|
free(ebuf); |
|
} |
} |
} |
xfree(comment); |
xfree(comment); |
} |
} |
|
|
|
|
for (i = 1; i < argc; i++) |
for (i = 1; i < argc; i++) |
{ |
{ |
if (strcmp(argv[i], "-l") == 0) |
if ((strcmp(argv[i], "-l") == 0) || |
|
(strcmp(argv[i], "-L") == 0)) |
{ |
{ |
list_identities(ac); |
list_identities(ac, argv[i][1] == 'l' ? 1 : 0); |
no_files = 0; /* Don't default-add/delete if -l. */ |
no_files = 0; /* Don't default-add/delete if -l. */ |
continue; |
continue; |
} |
} |