version 1.46, 2019/11/25 00:51:37 |
version 1.47, 2020/01/25 23:02:13 |
|
|
{ |
{ |
struct sshbuf *krlbuf = NULL; |
struct sshbuf *krlbuf = NULL; |
struct ssh_krl *krl = NULL; |
struct ssh_krl *krl = NULL; |
int oerrno = 0, r, fd; |
int oerrno = 0, r; |
|
|
if (path == NULL) |
if (path == NULL) |
return 0; |
return 0; |
|
if ((r = sshbuf_load_file(path, &krlbuf)) != 0) { |
if ((krlbuf = sshbuf_new()) == NULL) |
|
return SSH_ERR_ALLOC_FAIL; |
|
if ((fd = open(path, O_RDONLY)) == -1) { |
|
r = SSH_ERR_SYSTEM_ERROR; |
|
oerrno = errno; |
oerrno = errno; |
goto out; |
goto out; |
} |
} |
if ((r = sshkey_load_file(fd, krlbuf)) != 0) { |
|
oerrno = errno; |
|
goto out; |
|
} |
|
if ((r = ssh_krl_from_blob(krlbuf, &krl, NULL, 0)) != 0) |
if ((r = ssh_krl_from_blob(krlbuf, &krl, NULL, 0)) != 0) |
goto out; |
goto out; |
debug2("%s: checking KRL %s", __func__, path); |
debug2("%s: checking KRL %s", __func__, path); |
r = ssh_krl_check_key(krl, key); |
r = ssh_krl_check_key(krl, key); |
out: |
out: |
if (fd != -1) |
|
close(fd); |
|
sshbuf_free(krlbuf); |
sshbuf_free(krlbuf); |
ssh_krl_free(krl); |
ssh_krl_free(krl); |
if (r != 0) |
if (r != 0) |