summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/authfile.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2011-05-23 07:24:57 +0000
committerdjm <djm@openbsd.org>2011-05-23 07:24:57 +0000
commit44c7fac79757640d95fd2b700640c1566b272fd1 (patch)
tree1190e7e01e2a3155f0b82d3e69448c71ff9b1a98 /usr.bin/ssh/authfile.c
parentmention ranges; prodding and feedback jmc@ (diff)
downloadwireguard-openbsd-44c7fac79757640d95fd2b700640c1566b272fd1.tar.xz
wireguard-openbsd-44c7fac79757640d95fd2b700640c1566b272fd1.zip
read in key comments for v.2 keys (though note that these are not
passed over the agent protocol); bz#439, based on patch from binder AT arago.de; ok markus@
Diffstat (limited to 'usr.bin/ssh/authfile.c')
-rw-r--r--usr.bin/ssh/authfile.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/ssh/authfile.c b/usr.bin/ssh/authfile.c
index be7efd4d5a4..325a8e25005 100644
--- a/usr.bin/ssh/authfile.c
+++ b/usr.bin/ssh/authfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authfile.c,v 1.90 2011/05/13 00:05:36 djm Exp $ */
+/* $OpenBSD: authfile.c,v 1.91 2011/05/23 07:24:57 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -758,8 +758,11 @@ key_try_load_public(Key *k, const char *filename, char **commentp)
;
if (*cp) {
if (key_read(k, &cp) == 1) {
- if (commentp)
- *commentp=xstrdup(filename);
+ cp[strcspn(cp, "\r\n")] = '\0';
+ if (commentp) {
+ *commentp = xstrdup(*cp ?
+ cp : filename);
+ }
fclose(f);
return 1;
}