X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=apps%2Fsess_id.c;h=2be2692f087484c42aa7d23cf99c183aa3816d5d;hb=6a78ae2821e89a8838714496524fd39d9d21fb1b;hp=681654335ab1dde43dcec996965f4a272c35563b;hpb=25aaa98aa249d26391c1994d2de449562c8b8b99;p=openssl.git diff --git a/apps/sess_id.c b/apps/sess_id.c index 681654335a..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; } @@ -220,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)