X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=apps%2Fsess_id.c;h=2be2692f087484c42aa7d23cf99c183aa3816d5d;hb=6b9686e694d602640a565e8cbbe80857db832571;hp=cfecd86a50030f3a3377944297d8f273ffa195a0;hpb=7e1b7485706c2b11091b5fa897fe496a2faa56cc;p=oweals%2Fopenssl.git diff --git a/apps/sess_id.c b/apps/sess_id.c index cfecd86a50..2be2692f08 100644 --- a/apps/sess_id.c +++ b/apps/sess_id.c @@ -74,7 +74,7 @@ typedef enum OPTION_choice { OPTIONS sess_id_options[] = { {"help", OPT_HELP, '-', "Display this summary"}, {"inform", OPT_INFORM, 'F', "Input format - default PEM (DER or PEM)"}, - {"outform", OPT_OUTFORM, 'F', + {"outform", OPT_OUTFORM, 'f', "Output format - default PEM (PEM, DER or NSS)"}, {"in", OPT_IN, 's', "Input file - default stdin"}, {"out", OPT_OUT, 's', "Output file - default stdout"}, @@ -114,7 +114,8 @@ int sess_id_main(int argc, char **argv) goto opthelp; break; case OPT_OUTFORM: - if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &outformat)) + if (!opt_format(opt_arg(), OPT_FMT_PEMDER | OPT_FMT_NSS, + &outformat)) goto opthelp; break; case OPT_IN: @@ -160,10 +161,7 @@ int sess_id_main(int argc, char **argv) } if (!noout || text) { - const char* modeflag = "w"; - if (outformat == FORMAT_ASN1 || outformat == FORMAT_NSS) - modeflag = "wb"; - out = bio_open_default(outfile, modeflag); + out = bio_open_default(outfile, 'w', outformat); if (out == NULL) goto end; } @@ -211,8 +209,7 @@ int sess_id_main(int argc, char **argv) ret = 0; end: BIO_free_all(out); - if (x != NULL) - SSL_SESSION_free(x); + SSL_SESSION_free(x); return (ret); } @@ -221,7 +218,7 @@ static SSL_SESSION *load_sess_id(char *infile, int format) SSL_SESSION *x = NULL; BIO *in = NULL; - in = bio_open_default(infile, RB(format)); + in = bio_open_default(infile, 'r', format); if (in == NULL) goto end; if (format == FORMAT_ASN1)