version 1.316, 2018/06/01 04:21:29 |
version 1.317, 2018/06/06 18:29:18 |
|
|
{ |
{ |
FILE *f; |
FILE *f; |
struct sshkey *public = NULL; |
struct sshkey *public = NULL; |
char *comment = NULL, *cp, *ep, line[SSH_MAX_PUBKEY_BYTES]; |
char *comment = NULL, *cp, *ep, *line = NULL; |
|
size_t linesize = 0; |
int i, invalid = 1; |
int i, invalid = 1; |
const char *path; |
const char *path; |
u_long lnum = 0; |
u_long lnum = 0; |
|
|
} else if ((f = fopen(path, "r")) == NULL) |
} else if ((f = fopen(path, "r")) == NULL) |
fatal("%s: %s: %s", __progname, path, strerror(errno)); |
fatal("%s: %s: %s", __progname, path, strerror(errno)); |
|
|
while (read_keyfile_line(f, path, line, sizeof(line), &lnum) == 0) { |
while (getline(&line, &linesize, f) != -1) { |
|
lnum++; |
cp = line; |
cp = line; |
cp[strcspn(cp, "\n")] = '\0'; |
cp[strcspn(cp, "\n")] = '\0'; |
/* Trim leading space and comments */ |
/* Trim leading space and comments */ |
|
|
*/ |
*/ |
if (lnum == 1 && strcmp(identity_file, "-") != 0 && |
if (lnum == 1 && strcmp(identity_file, "-") != 0 && |
strstr(cp, "PRIVATE KEY") != NULL) { |
strstr(cp, "PRIVATE KEY") != NULL) { |
|
free(line); |
fclose(f); |
fclose(f); |
fingerprint_private(path); |
fingerprint_private(path); |
exit(0); |
exit(0); |
|
|
invalid = 0; /* One good key in the file is sufficient */ |
invalid = 0; /* One good key in the file is sufficient */ |
} |
} |
fclose(f); |
fclose(f); |
|
free(line); |
|
|
if (invalid) |
if (invalid) |
fatal("%s is not a public key file.", path); |
fatal("%s is not a public key file.", path); |
|
|
struct stat st; |
struct stat st; |
int r, is_stdin = 0, ok = 0; |
int r, is_stdin = 0, ok = 0; |
FILE *f; |
FILE *f; |
char *cp, line[SSH_MAX_PUBKEY_BYTES]; |
char *cp, *line = NULL; |
const char *path; |
const char *path; |
|
size_t linesize = 0; |
u_long lnum = 0; |
u_long lnum = 0; |
|
|
if (!have_identity) |
if (!have_identity) |
|
|
} else if ((f = fopen(identity_file, "r")) == NULL) |
} else if ((f = fopen(identity_file, "r")) == NULL) |
fatal("fopen %s: %s", identity_file, strerror(errno)); |
fatal("fopen %s: %s", identity_file, strerror(errno)); |
|
|
while (read_keyfile_line(f, path, line, sizeof(line), &lnum) == 0) { |
while (getline(&line, &linesize, f) != -1) { |
|
lnum++; |
sshkey_free(key); |
sshkey_free(key); |
key = NULL; |
key = NULL; |
/* Trim leading space and comments */ |
/* Trim leading space and comments */ |
|
|
printf("%s:%lu:\n", path, lnum); |
printf("%s:%lu:\n", path, lnum); |
print_cert(key); |
print_cert(key); |
} |
} |
|
free(line); |
sshkey_free(key); |
sshkey_free(key); |
fclose(f); |
fclose(f); |
exit(ok ? 0 : 1); |
exit(ok ? 0 : 1); |
|
|
{ |
{ |
struct sshkey *key = NULL; |
struct sshkey *key = NULL; |
u_long lnum = 0; |
u_long lnum = 0; |
char *path, *cp, *ep, line[SSH_MAX_PUBKEY_BYTES]; |
char *path, *cp, *ep, *line = NULL; |
|
size_t linesize = 0; |
unsigned long long serial, serial2; |
unsigned long long serial, serial2; |
int i, was_explicit_key, was_sha1, r; |
int i, was_explicit_key, was_sha1, r; |
FILE *krl_spec; |
FILE *krl_spec; |
|
|
|
|
if (!quiet) |
if (!quiet) |
printf("Revoking from %s\n", path); |
printf("Revoking from %s\n", path); |
while (read_keyfile_line(krl_spec, path, line, sizeof(line), |
while (getline(&line, &linesize, krl_spec) != -1) { |
&lnum) == 0) { |
lnum++; |
was_explicit_key = was_sha1 = 0; |
was_explicit_key = was_sha1 = 0; |
cp = line + strspn(line, " \t"); |
cp = line + strspn(line, " \t"); |
/* Trim trailing space, comments and strip \n */ |
/* Trim trailing space, comments and strip \n */ |
|
|
} |
} |
if (strcmp(path, "-") != 0) |
if (strcmp(path, "-") != 0) |
fclose(krl_spec); |
fclose(krl_spec); |
|
free(line); |
free(path); |
free(path); |
} |
} |
|
|