summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2005-03-02 12:33:04 +1100
committerDamien Miller <djm@mindrot.org>2005-03-02 12:33:04 +1100
commit89eac8010a80589bcd3abda8f253cd0cd3d2088c (patch)
treea7d2ad7e01871352959b6d1bf3ade6e386cd0222 /ssh-keygen.c
parent1227d4c93c44d09694e547b62b643afa2a321a17 (diff)
- djm@cvs.openbsd.org 2005/03/02 01:27:41
[ssh-keygen.c] ignore hostnames with metachars when hashing; ok deraadt@
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 00ddb90c8..a9931d4d8 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keygen.c,v 1.119 2005/03/01 10:42:49 djm Exp $");
+RCSID("$OpenBSD: ssh-keygen.c,v 1.120 2005/03/02 01:27:41 djm Exp $");
#include <openssl/evp.h>
#include <openssl/pem.h>
@@ -686,8 +686,15 @@ do_known_hosts(struct passwd *pw, const char *name)
} else if (hash_hosts) {
for(cp2 = strsep(&cp, ",");
cp2 != NULL && *cp2 != '\0';
- cp2 = strsep(&cp, ","))
- print_host(out, cp2, public, 1);
+ cp2 = strsep(&cp, ",")) {
+ if (strcspn(cp2, "*?!") != strlen(cp2))
+ fprintf(stderr, "Warning: "
+ "ignoring host name with "
+ "metacharacters: %.64s\n",
+ cp2);
+ else
+ print_host(out, cp2, public, 1);
+ }
has_unhashed = 1;
}
}