Suppress warnings about parsing Ed25519 keys when they are not present.
This commit is contained in:
parent
833a8a048b
commit
cffcaf966b
2 changed files with 11 additions and 3 deletions
|
@ -84,11 +84,13 @@ static bool read_pem(FILE *fp, const char *type, void *buf, size_t size) {
|
|||
size_t len = b64decode(line, line, linelen);
|
||||
if(!len) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Invalid base64 data in PEM file\n");
|
||||
errno = EINVAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(len > size) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Too much base64 data in PEM file\n");
|
||||
errno = EINVAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -98,7 +100,12 @@ static bool read_pem(FILE *fp, const char *type, void *buf, size_t size) {
|
|||
}
|
||||
|
||||
if(size) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Too little base64 data in PEM file\n");
|
||||
if(data) {
|
||||
errno = EINVAL;
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Too little base64 data in PEM file\n");
|
||||
} else {
|
||||
errno = ENOENT;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -137,10 +137,11 @@ bool read_ecdsa_public_key(connection_t *c) {
|
|||
}
|
||||
|
||||
c->ecdsa = ecdsa_read_pem_public_key(fp);
|
||||
fclose(fp);
|
||||
|
||||
if(!c->ecdsa)
|
||||
if(!c->ecdsa && errno != ENOENT)
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Parsing Ed25519 public key file `%s' failed.", fname);
|
||||
|
||||
fclose(fp);
|
||||
free(fname);
|
||||
return c->ecdsa;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue