Repair ssl_key_log_file handling

Set ssl_key_log_file to null in ssl_decode_ctx_create if no
file name was supplied.

Only seek ssl_key_log_file in ssl_read_key_log_file if it
is non null.

Repair order of fseek parameters.
This commit is contained in:
Ulrik Haugen 2019-05-22 12:51:17 +02:00
parent 3a96262c3a
commit d3a18bfb2d

View file

@ -172,9 +172,13 @@ int ssl_decode_ctx_create(dp,keyfile,pass,keylogfile)
if(r_assoc_create(&d->session_cache))
ABORT(R_NO_MEMORY);
if(keylogfile && !(d->ssl_key_log_file=fopen(keylogfile, "r"))){
fprintf(stderr,"Failed to open ssl key log file");
ABORT(R_INTERNAL);
if (keylogfile) {
if(!(d->ssl_key_log_file=fopen(keylogfile, "r"))){
fprintf(stderr,"Failed to open ssl key log file");
ABORT(R_INTERNAL);
}
} else {
d->ssl_key_log_file = NULL;
}
X509V3_add_standard_extensions();
@ -1106,7 +1110,8 @@ static int ssl_read_key_log_file(d)
}
_status=0;
abort:
fseek(d->ctx->ssl_key_log_file, SEEK_SET, 0);
if (d->ctx->ssl_key_log_file != NULL)
fseek(d->ctx->ssl_key_log_file, 0, SEEK_SET);
return(_status);
}
#endif