summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2000-09-20 13:55:50 +0000
committerRichard Levitte <levitte@openssl.org>2000-09-20 13:55:50 +0000
commit645749ef98612340b11c4bf2ba856e1fa469912b (patch)
tree3a93d71b7f63b5b01f085c38211ce82af0778125 /apps
parent9a0c0d3f7441515452caff3380b235bb15d33a5e (diff)
On VMS, stdout may very well lead to a file that is written to in a
record-oriented fashion. That means that every write() will write a separate record, which will be read separately by the programs trying to read from it. This can be very confusing. The solution is to put a BIO filter in the way that will buffer text until a linefeed is reached, and then write everything a line at a time, so every record written will be an actual line, not chunks of lines and not (usually doesn't happen, but I've seen it once) several lines in one record. Voila, BIO_f_linebuffer() is born. Since we're so close to release time, I'm making this VMS-only for now, just to make sure no code is needlessly broken by this. After the release, this BIO method will be enabled on all other platforms as well.
Diffstat (limited to 'apps')
-rw-r--r--apps/asn1pars.c8
-rw-r--r--apps/ca.c24
-rw-r--r--apps/ciphers.c8
-rw-r--r--apps/crl.c20
-rw-r--r--apps/crl2p7.c10
-rw-r--r--apps/dgst.c12
-rw-r--r--apps/dh.c10
-rw-r--r--apps/dhparam.c10
-rw-r--r--apps/dsa.c10
-rw-r--r--apps/dsaparam.c10
-rw-r--r--apps/enc.c10
-rw-r--r--apps/errstr.c8
-rw-r--r--apps/gendh.c10
-rw-r--r--apps/gendsa.c10
-rw-r--r--apps/genrsa.c10
-rw-r--r--apps/nseq.c13
-rw-r--r--apps/openssl.c16
-rw-r--r--apps/passwd.c8
-rw-r--r--apps/pkcs12.c13
-rw-r--r--apps/pkcs7.c10
-rw-r--r--apps/pkcs8.c15
-rw-r--r--apps/rand.c8
-rw-r--r--apps/req.c16
-rw-r--r--apps/rsa.c10
-rw-r--r--apps/rsautl.c12
-rw-r--r--apps/sess_id.c10
-rw-r--r--apps/smime.c12
-rw-r--r--apps/spkac.c22
-rw-r--r--apps/x509.c18
29 files changed, 306 insertions, 47 deletions
diff --git a/apps/asn1pars.c b/apps/asn1pars.c
index 30e1da443a..f25c9f84e8 100644
--- a/apps/asn1pars.c
+++ b/apps/asn1pars.c
@@ -206,6 +206,12 @@ bad:
goto end;
}
BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
if (oidfile != NULL)
{
@@ -315,7 +321,7 @@ bad:
end:
BIO_free(derout);
if (in != NULL) BIO_free(in);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (b64 != NULL) BIO_free(b64);
if (ret != 0)
ERR_print_errors(bio_err);
diff --git a/apps/ca.c b/apps/ca.c
index 0931401992..2d71104745 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -690,6 +690,12 @@ bad:
if (verbose)
{
BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); /* cannot fail */
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
TXT_DB_write(out,db);
BIO_printf(bio_err,"%d entries loaded from the database\n",
db->data->num);
@@ -724,7 +730,15 @@ bad:
}
}
else
+ {
BIO_set_fp(Sout,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ Sout = BIO_push(tmpbio, Sout);
+ }
+#endif
+ }
}
if (req)
@@ -1020,7 +1034,7 @@ bad:
#endif
BIO_free(in);
- BIO_free(out);
+ BIO_free_all(out);
in=NULL;
out=NULL;
if (rename(serialfile,buf[2]) < 0)
@@ -1237,9 +1251,9 @@ bad:
ret=0;
err:
BIO_free(hex);
- BIO_free(Cout);
- BIO_free(Sout);
- BIO_free(out);
+ BIO_free_all(Cout);
+ BIO_free_all(Sout);
+ BIO_free_all(out);
BIO_free(in);
sk_X509_pop_free(cert_sk,X509_free);
@@ -1354,7 +1368,7 @@ static int save_serial(char *serialfile, BIGNUM *serial)
BIO_puts(out,"\n");
ret=1;
err:
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (ai != NULL) ASN1_INTEGER_free(ai);
return(ret);
}
diff --git a/apps/ciphers.c b/apps/ciphers.c
index 72b2009e18..b6e2f966d8 100644
--- a/apps/ciphers.c
+++ b/apps/ciphers.c
@@ -108,6 +108,12 @@ int MAIN(int argc, char **argv)
if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ STDout = BIO_push(tmpbio, STDout);
+ }
+#endif
argc--;
argv++;
@@ -195,7 +201,7 @@ err:
end:
if (ctx != NULL) SSL_CTX_free(ctx);
if (ssl != NULL) SSL_free(ssl);
- if (STDout != NULL) BIO_free(STDout);
+ if (STDout != NULL) BIO_free_all(STDout);
EXIT(ret);
}
diff --git a/apps/crl.c b/apps/crl.c
index b1c3325f21..3b5725f23f 100644
--- a/apps/crl.c
+++ b/apps/crl.c
@@ -122,7 +122,15 @@ int MAIN(int argc, char **argv)
if (bio_out == NULL)
if ((bio_out=BIO_new(BIO_s_file())) != NULL)
+ {
BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ bio_out = BIO_push(tmpbio, bio_out);
+ }
+#endif
+ }
informat=FORMAT_PEM;
outformat=FORMAT_PEM;
@@ -314,7 +322,15 @@ bad:
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -340,8 +356,8 @@ bad:
if (!i) { BIO_printf(bio_err,"unable to write CRL\n"); goto end; }
ret=0;
end:
- BIO_free(out);
- BIO_free(bio_out);
+ BIO_free_all(out);
+ BIO_free_all(bio_out);
bio_out=NULL;
X509_CRL_free(x);
if(store) {
diff --git a/apps/crl2p7.c b/apps/crl2p7.c
index d02862710d..7f853b65ab 100644
--- a/apps/crl2p7.c
+++ b/apps/crl2p7.c
@@ -239,7 +239,15 @@ bad:
sk_free(certflst);
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -266,7 +274,7 @@ bad:
ret=0;
end:
if (in != NULL) BIO_free(in);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (p7 != NULL) PKCS7_free(p7);
if (crl != NULL) X509_CRL_free(crl);
diff --git a/apps/dgst.c b/apps/dgst.c
index d7e524a883..0e93c97ca5 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -236,7 +236,15 @@ int MAIN(int argc, char **argv)
if(out_bin)
out = BIO_new_file(outfile, "wb");
else out = BIO_new_file(outfile, "w");
- } else out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ } else {
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
if(!out) {
BIO_printf(bio_err, "Error opening output file %s\n",
@@ -323,7 +331,7 @@ end:
OPENSSL_free(buf);
}
if (in != NULL) BIO_free(in);
- BIO_free(out);
+ BIO_free_all(out);
EVP_PKEY_free(sigkey);
if(sigbuf) OPENSSL_free(sigbuf);
if (bmd != NULL) BIO_free(bmd);
diff --git a/apps/dh.c b/apps/dh.c
index ee71d95f0c..7465442e49 100644
--- a/apps/dh.c
+++ b/apps/dh.c
@@ -184,7 +184,15 @@ bad:
}
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -309,7 +317,7 @@ bad:
ret=0;
end:
if (in != NULL) BIO_free(in);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh);
EXIT(ret);
}
diff --git a/apps/dhparam.c b/apps/dhparam.c
index a738c5af67..5f9b60148d 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -391,7 +391,15 @@ bad:
goto end;
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -496,7 +504,7 @@ bad:
ret=0;
end:
if (in != NULL) BIO_free(in);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh);
EXIT(ret);
}
diff --git a/apps/dsa.c b/apps/dsa.c
index 842e0c0d15..7c4a46f78e 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -233,7 +233,15 @@ bad:
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -281,7 +289,7 @@ bad:
ret=0;
end:
if(in != NULL) BIO_free(in);
- if(out != NULL) BIO_free(out);
+ if(out != NULL) BIO_free_all(out);
if(dsa != NULL) DSA_free(dsa);
if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout);
diff --git a/apps/dsaparam.c b/apps/dsaparam.c
index a15d6ea309..f861ec7b1a 100644
--- a/apps/dsaparam.c
+++ b/apps/dsaparam.c
@@ -205,7 +205,15 @@ bad:
}
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -347,7 +355,7 @@ bad:
ret=0;
end:
if (in != NULL) BIO_free(in);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (dsa != NULL) DSA_free(dsa);
EXIT(ret);
}
diff --git a/apps/enc.c b/apps/enc.c
index 49338aca0f..2101b4cc64 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -416,7 +416,15 @@ bad:
if (outf == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outf) <= 0)
@@ -584,7 +592,7 @@ end:
if (strbuf != NULL) OPENSSL_free(strbuf);
if (buff != NULL) OPENSSL_free(buff);
if (in != NULL) BIO_free(in);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (benc != NULL) BIO_free(benc);
if (b64 != NULL) BIO_free(b64);
if(pass) OPENSSL_free(pass);
diff --git a/apps/errstr.c b/apps/errstr.c
index 2c62046476..e392328f93 100644
--- a/apps/errstr.c
+++ b/apps/errstr.c
@@ -91,12 +91,18 @@ int MAIN(int argc, char **argv)
out=BIO_new(BIO_s_file());
if ((out != NULL) && BIO_set_fp(out,stdout,BIO_NOCLOSE))
{
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
lh_node_stats_bio((LHASH *)ERR_get_string_table(),out);
lh_stats_bio((LHASH *)ERR_get_string_table(),out);
lh_node_usage_stats_bio((LHASH *)
ERR_get_string_table(),out);
}
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
argc--;
argv++;
}
diff --git a/apps/gendh.c b/apps/gendh.c
index caf5e8d736..e0c7889a31 100644
--- a/apps/gendh.c
+++ b/apps/gendh.c
@@ -142,7 +142,15 @@ bad:
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -174,7 +182,7 @@ bad:
end:
if (ret != 0)
ERR_print_errors(bio_err);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh);
EXIT(ret);
}
diff --git a/apps/gendsa.c b/apps/gendsa.c
index 1937613849..6022d8f142 100644
--- a/apps/gendsa.c
+++ b/apps/gendsa.c
@@ -178,7 +178,15 @@ bad:
if (out == NULL) goto end;
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -209,7 +217,7 @@ end:
if (ret != 0)
ERR_print_errors(bio_err);
if (in != NULL) BIO_free(in);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (dsa != NULL) DSA_free(dsa);
if(passout) OPENSSL_free(passout);
EXIT(ret);
diff --git a/apps/genrsa.c b/apps/genrsa.c
index 5cf47e6921..ac0b709e7a 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -168,7 +168,15 @@ bad:
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -212,7 +220,7 @@ bad:
ret=0;
err:
if (rsa != NULL) RSA_free(rsa);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if(passout) OPENSSL_free(passout);
if (ret != 0)
ERR_print_errors(bio_err);
diff --git a/apps/nseq.c b/apps/nseq.c
index 7210fbdb5e..1d73d1ad52 100644
--- a/apps/nseq.c
+++ b/apps/nseq.c
@@ -119,8 +119,15 @@ int MAIN(int argc, char **argv)
"Can't open output file %s\n", outfile);
goto end;
}
- } else out = BIO_new_fp(stdout, BIO_NOCLOSE);
-
+ } else {
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
if (toseq) {
seq = NETSCAPE_CERT_SEQUENCE_new();
seq->certs = sk_X509_new_null();
@@ -152,7 +159,7 @@ int MAIN(int argc, char **argv)
ret = 0;
end:
BIO_free(in);
- BIO_free(out);
+ BIO_free_all(out);
NETSCAPE_CERT_SEQUENCE_free(seq);
EXIT(ret);
diff --git a/apps/openssl.c b/apps/openssl.c
index c3680c5e71..4f61006b73 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -238,13 +238,19 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
else if ((strncmp(argv[0],"no-",3)) == 0)
{
BIO *bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ bio_stdout = BIO_push(tmpbio, bio_stdout);
+ }
+#endif
f.name=argv[0]+3;
ret = (lh_retrieve(prog,&f) != NULL);
if (!ret)
BIO_printf(bio_stdout, "%s\n", argv[0]);
else
BIO_printf(bio_stdout, "%s\n", argv[0]+3);
- BIO_free(bio_stdout);
+ BIO_free_all(bio_stdout);
goto end;
}
else if ((strcmp(argv[0],"quit") == 0) ||
@@ -269,11 +275,17 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
else /* strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0 */
list_type = FUNC_TYPE_CIPHER;
bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ bio_stdout = BIO_push(tmpbio, bio_stdout);
+ }
+#endif
for (fp=functions; fp->name != NULL; fp++)
if (fp->type == list_type)
BIO_printf(bio_stdout, "%s\n", fp->name);
- BIO_free(bio_stdout);
+ BIO_free_all(bio_stdout);
ret=0;
goto end;
}
diff --git a/apps/passwd.c b/apps/passwd.c
index 6c1aed0f0b..6851a9927d 100644
--- a/apps/passwd.c
+++ b/apps/passwd.c
@@ -81,6 +81,12 @@ int MAIN(int argc, char **argv)
if (out == NULL)
goto err;
BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
badopt = 0, opt_done = 0;
i = 0;
@@ -276,7 +282,7 @@ err:
if (in)
BIO_free(in);
if (out)
- BIO_free(out);
+ BIO_free_all(out);
EXIT(ret);
}
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index 070993de30..6789169bdb 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -350,8 +350,15 @@ int MAIN(int argc, char **argv)
CRYPTO_push_info("write files");
#endif
- if (!outfile) out = BIO_new_fp(stdout, BIO_NOCLOSE);
- else out = BIO_new_file(outfile, "wb");
+ if (!outfile) {
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ } else out = BIO_new_file(outfile, "wb");
if (!out) {
BIO_printf(bio_err, "Error opening output file %s\n",
outfile ? outfile : "<stdout>");
@@ -657,7 +664,7 @@ int MAIN(int argc, char **argv)
CRYPTO_remove_all_info();
#endif
BIO_free(in);
- BIO_free(out);
+ BIO_free_all(out);
if (canames) sk_free(canames);
if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout);
diff --git a/apps/pkcs7.c b/apps/pkcs7.c
index f471cc77fd..0af269007a 100644
--- a/apps/pkcs7.c
+++ b/apps/pkcs7.c
@@ -196,7 +196,15 @@ bad:
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -280,6 +288,6 @@ bad:
end:
if (p7 != NULL) PKCS7_free(p7);
if (in != NULL) BIO_free(in);
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
EXIT(ret);
}
diff --git a/apps/pkcs8.c b/apps/pkcs8.c
index b0914cd453..7b588e4337 100644
--- a/apps/pkcs8.c
+++ b/apps/pkcs8.c
@@ -194,8 +194,15 @@ int MAIN(int argc, char **argv)
"Can't open output file %s\n", outfile);
return (1);
}
- } else out = BIO_new_fp (stdout, BIO_NOCLOSE);
-
+ } else {
+ out = BIO_new_fp (stdout, BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
if (topk8) {
if(informat == FORMAT_PEM)
pkey = PEM_read_bio_PrivateKey(in, NULL, NULL, passin);
@@ -253,7 +260,7 @@ int MAIN(int argc, char **argv)
}
PKCS8_PRIV_KEY_INFO_free (p8inf);
EVP_PKEY_free(pkey);
- BIO_free(out);
+ BIO_free_all(out);
if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout);
return (0);
@@ -336,7 +343,7 @@ int MAIN(int argc, char **argv)
}
EVP_PKEY_free(pkey);
- BIO_free(out);
+ BIO_free_all(out);
BIO_free(in);
if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout);
diff --git a/apps/rand.c b/apps/rand.c
index fa9bc023f4..04764d7ffb 100644
--- a/apps/rand.c
+++ b/apps/rand.c
@@ -101,7 +101,15 @@ int MAIN(int argc, char **argv)
if (outfile != NULL)
r = BIO_write_filename(out, outfile);
else
+ {
r = BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
if (r <= 0)
goto err;
diff --git a/apps/req.c b/apps/req.c
index 2c1b9ee876..1aab38d9d7 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -609,6 +609,12 @@ bad:
{
BIO_printf(bio_err,"writing new private key to stdout\n");
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
}
else
{
@@ -804,7 +810,15 @@ loop:
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if ((keyout != NULL) && (strcmp(outfile,keyout) == 0))
@@ -890,7 +904,7 @@ end:
}
if ((req_conf != NULL) && (req_conf != config)) CONF_free(req_conf);
BIO_free(in);
- BIO_free(out);
+ BIO_free_all(out);
EVP_PKEY_free(pkey);
X509_REQ_free(req);
X509_free(x509ss);
diff --git a/apps/rsa.c b/apps/rsa.c
index fc8fa54941..b4b0651a94 100644
--- a/apps/rsa.c
+++ b/apps/rsa.c
@@ -278,7 +278,15 @@ bad:
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -377,7 +385,7 @@ bad:
ret=0;
end:
if(in != NULL) BIO_free(in);
- if(out != NULL) BIO_free(out);
+ if(out != NULL) BIO_free_all(out);
if(rsa != NULL) RSA_free(rsa);
if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout);
diff --git a/apps/rsautl.c b/apps/rsautl.c
index ba95229e1a..bcb94c3d81 100644
--- a/apps/rsautl.c
+++ b/apps/rsautl.c
@@ -198,7 +198,15 @@ int MAIN(int argc, char **argv)
ERR_print_errors(bio_err);
goto end;
}
- } else out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ } else {
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
keysize = RSA_size(rsa);
@@ -255,7 +263,7 @@ int MAIN(int argc, char **argv)
end:
RSA_free(rsa);
BIO_free(in);
- BIO_free(out);
+ BIO_free_all(out);
if(rsa_in) OPENSSL_free(rsa_in);
if(rsa_out) OPENSSL_free(rsa_out);
return ret;
diff --git a/apps/sess_id.c b/apps/sess_id.c
index 71d5aa0b7c..60cc3f1e49 100644
--- a/apps/sess_id.c
+++ b/apps/sess_id.c
@@ -206,7 +206,15 @@ bad:
}
if (outfile == NULL)
+ {
BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
else
{
if (BIO_write_filename(out,outfile) <= 0)
@@ -262,7 +270,7 @@ bad:
}
ret=0;
end:
- if (out != NULL) BIO_free(out);
+ if (out != NULL) BIO_free_all(out);
if (x != NULL) SSL_SESSION_free(x);
EXIT(ret);
}
diff --git a/apps/smime.c b/apps/smime.c
index 25997feb6d..9467b59bef 100644
--- a/apps/smime.c
+++ b/apps/smime.c
@@ -393,7 +393,15 @@ int MAIN(int argc, char **argv)
"Can't open output file %s\n", outfile);
goto end;
}
- } else out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ } else {
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
if(operation == SMIME_VERIFY) {
if(!(store = setup_verify(CAfile, CApath))) goto end;
@@ -490,7 +498,7 @@ end:
PKCS7_free(p7);
BIO_free(in);
BIO_free(indata);
- BIO_free(out);
+ BIO_free_all(out);
if(passin) OPENSSL_free(passin);
return (ret);
}
diff --git a/apps/spkac.c b/apps/spkac.c
index ad45c2ddb7..459d730a70 100644
--- a/apps/spkac.c
+++ b/apps/spkac.c
@@ -192,7 +192,15 @@ bad:
spkstr = NETSCAPE_SPKI_b64_encode(spki);
if (outfile) out = BIO_new_file(outfile, "w");
- else out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ else {
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
if(!out) {
BIO_printf(bio_err, "Error opening output file\n");
@@ -241,7 +249,15 @@ bad:
}
if (outfile) out = BIO_new_file(outfile, "w");
- else out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ else {
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }