[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Thu Jan 14 13:36:55 UTC 2016


The branch master has been updated
       via  fbd03b0964329fa43f84b99a19b1ee98e8ad190c (commit)
       via  1cd5cc368f9c907b2d184b4643ddcac2a156f628 (commit)
       via  9b56815d5f91180e2092d3e578054b8099100a48 (commit)
      from  67949615d25ead969c12e0f39370fef866df1704 (commit)


- Log -----------------------------------------------------------------
commit fbd03b0964329fa43f84b99a19b1ee98e8ad190c
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Jan 14 14:08:49 2016 +0100

    VMS open() doesn't take O_BINARY, but takes a context description
    
    Tell open() O_BINARY on VMS doesn't make sense, as it's possible to
    use more precise file attributes.  However, if we're still going to
    fdopen() it in binary mode, we must set the fd in binary context.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 1cd5cc368f9c907b2d184b4643ddcac2a156f628
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Jan 14 14:07:57 2016 +0100

    Rename binmode into textmode and use it correctly
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 9b56815d5f91180e2092d3e578054b8099100a48
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Jan 14 13:15:45 2016 +0100

    Do not use redirection on binary files
    
    On some platforms, the shell will determine what attributes a file
    will have, so while the program might think it's safely outputting
    binary data, it's not always true.
    
    For the sake of the tests, it's therefore safer to use -out than to
    use redirection.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 apps/apps.c                 | 20 +++++++++++++++-----
 test/recipes/20-test_enc.t  |  6 ++----
 test/recipes/tconversion.pl | 10 ++++++----
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/apps/apps.c b/apps/apps.c
index 685536a..bb47039 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -2796,7 +2796,7 @@ BIO *bio_open_owner(const char *filename, int format, int private)
 {
     FILE *fp = NULL;
     BIO *b = NULL;
-    int fd = -1, bflags, mode, binmode;
+    int fd = -1, bflags, mode, textmode;
 
     if (!private || filename == NULL || strcmp(filename, "-") == 0)
         return bio_open_default(filename, 'w', format);
@@ -2808,8 +2808,8 @@ BIO *bio_open_owner(const char *filename, int format, int private)
 #ifdef O_TRUNC
     mode |= O_TRUNC;
 #endif
-    binmode = istext(format);
-    if (binmode) {
+    textmode = istext(format);
+    if (!textmode) {
 #ifdef O_BINARY
         mode |= O_BINARY;
 #elif defined(_O_BINARY)
@@ -2817,14 +2817,24 @@ BIO *bio_open_owner(const char *filename, int format, int private)
 #endif
     }
 
-    fd = open(filename, mode, 0600);
+#ifdef OPENSSL_SYS_VMS
+    /* VMS doesn't have O_BINARY, it just doesn't make sense.  But,
+     * it still needs to know that we're going binary, or fdopen()
+     * will fail with "invalid argument"...  so we tell VMS what the
+     * context is.
+     */
+    if (!textmode)
+        fd = open(filename, mode, 0600, "ctx=bin");
+    else
+#endif
+        fd = open(filename, mode, 0600);
     if (fd < 0)
         goto err;
     fp = fdopen(fd, modestr('w', format));
     if (fp == NULL)
         goto err;
     bflags = BIO_CLOSE;
-    if (!binmode)
+    if (textmode)
         bflags |= BIO_FP_TEXT;
     b = BIO_new_fp(fp, bflags);
     if (b)
diff --git a/test/recipes/20-test_enc.t b/test/recipes/20-test_enc.t
index 836d979..55f3942 100644
--- a/test/recipes/20-test_enc.t
+++ b/test/recipes/20-test_enc.t
@@ -51,10 +51,8 @@ if (!$init) {
 		 @d = ( "enc", @{$variant{$t}}, "-d" );
 	     }
 
-	     ok(run(app([$cmd, @e],
-			stdin => $test, stdout => $cipherfile))
-		&& run(app([$cmd, @d],
-			   stdin => $cipherfile, stdout => $clearfile))
+	     ok(run(app([$cmd, @e, "-in", $test, "-out", $cipherfile]))
+		&& run(app([$cmd, @d, "-in", $cipherfile, "-out", $clearfile]))
 		&& compare_text($test,$clearfile) == 0, $t);
 	     unlink $cipherfile, $clearfile;
 	 }
diff --git a/test/recipes/tconversion.pl b/test/recipes/tconversion.pl
index 07e3406..0f9b03b 100644
--- a/test/recipes/tconversion.pl
+++ b/test/recipes/tconversion.pl
@@ -53,8 +53,9 @@ sub tconversion {
 	  ok(run(app([@cmd,
 		      "-in", "$testtype-fff.p",
 		      "-inform", "p",
-		      "-outform", $to],
-		     stdout => "$testtype-f.$to")), "p -> $to");
+		      "-out", "$testtype-f.$to",
+		      "-outform", $to])),
+	     "p -> $to");
       }
 
       foreach my $to (@conversionforms) {
@@ -62,8 +63,9 @@ sub tconversion {
 	      ok(run(app([@cmd,
 			  "-in", "$testtype-f.$from",
 			  "-inform", $from,
-			  "-outform", $to],
-			 stdout => "$testtype-ff.$from$to")), "$from -> $to");
+			  "-out", "$testtype-ff.$from$to",
+			  "-outform", $to])),
+		 "$from -> $to");
 	  }
       }
 


More information about the openssl-commits mailing list