aboutsummaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 8396c40368d2..89c3ed287628 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.477 2024/12/04 14:24:20 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1008,7 +1008,7 @@ do_fingerprint(struct passwd *pw)
while (getline(&line, &linesize, f) != -1) {
lnum++;
cp = line;
- cp[strcspn(cp, "\n")] = '\0';
+ cp[strcspn(cp, "\r\n")] = '\0';
/* Trim leading space and comments */
cp = line + strspn(line, " \t");
if (*cp == '#' || *cp == '\0')
@@ -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));
}