[openssh-commits] [openssh] 01/02: upstream: allow "-" as output file for moduli screening

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Oct 18 16:46:19 AEDT 2024


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit d9cd208e89a471a3ff8adfcec68d6210af9e9fd5
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Fri Oct 18 05:37:24 2024 +0000

    upstream: allow "-" as output file for moduli screening
    
    based on GHPR393
    
    OpenBSD-Commit-ID: 1517763764eb55d03a6092dd120d2909c6fef0e1
---
 ssh-keygen.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ssh-keygen.c b/ssh-keygen.c
index 8396c403..f7ea0696 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.475 2024/09/15 00:47:01 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.476 2024/10/18 05:37:24 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1994 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -3028,7 +3028,9 @@ do_moduli_gen(const char *out_file, char **opts, size_t nopts)
 		}
 	}
 
-	if ((out = fopen(out_file, "w")) == NULL) {
+	if (strcmp(out_file, "-") == 0)
+		out = stdout;
+	else if ((out = fopen(out_file, "w")) == NULL) {
 		fatal("Couldn't open modulus candidate file \"%s\": %s",
 		    out_file, strerror(errno));
 	}
@@ -3093,7 +3095,9 @@ do_moduli_screen(const char *out_file, char **opts, size_t nopts)
 		}
 	}
 
-	if ((out = fopen(out_file, "a")) == NULL) {
+	if (strcmp(out_file, "-") == 0)
+		out = stdout;
+	else if ((out = fopen(out_file, "a")) == NULL) {
 		fatal("Couldn't open moduli file \"%s\": %s",
 		    out_file, strerror(errno));
 	}

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list