Bugzilla – Attachment 2136 Details for
Bug 1981
Trying to use ssh with a missing identity file gives no warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
warn for missing user-provided IdentityFiles
ssh-identityfile-warning.patch (text/plain), 2.90 KB, created by
Darren Tucker
on 2012-03-09 11:06:58 AEDT
(
hide
)
Description:
warn for missing user-provided IdentityFiles
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2012-03-09 11:06:58 AEDT
Size:
2.90 KB
patch
obsolete
>Index: sshconnect2.c >=================================================================== >RCS file: /home/dtucker/openssh/cvs/openssh/sshconnect2.c,v >retrieving revision 1.180 >diff -u -p -r1.180 sshconnect2.c >--- sshconnect2.c 29 May 2011 11:42:34 -0000 1.180 >+++ sshconnect2.c 9 Mar 2012 00:02:06 -0000 >@@ -248,6 +248,7 @@ struct identity { > char *filename; /* comment for agent-only keys */ > int tried; > int isprivate; /* key points to the private key */ >+ int userprovided; > }; > TAILQ_HEAD(idlist, identity); > >@@ -312,7 +313,7 @@ void userauth(Authctxt *, char *); > static int sign_and_send_pubkey(Authctxt *, Identity *); > static void pubkey_prepare(Authctxt *); > static void pubkey_cleanup(Authctxt *); >-static Key *load_identity_file(char *); >+static Key *load_identity_file(char *, int); > > static Authmethod *authmethod_get(char *authlist); > static Authmethod *authmethod_lookup(const char *name); >@@ -1186,7 +1187,7 @@ identity_sign(Identity *id, u_char **sig > if (id->isprivate || (id->key->flags & KEY_FLAG_EXT)) > return (key_sign(id->key, sigp, lenp, data, datalen)); > /* load the private key from the file */ >- if ((prv = load_identity_file(id->filename)) == NULL) >+ if ((prv = load_identity_file(id->filename, id->userprovided)) == NULL) > return (-1); > ret = key_sign(prv, sigp, lenp, data, datalen); > key_free(prv); >@@ -1311,7 +1312,7 @@ send_pubkey_test(Authctxt *authctxt, Ide > } > > static Key * >-load_identity_file(char *filename) >+load_identity_file(char *filename, int userprovided) > { > Key *private; > char prompt[300], *passphrase; >@@ -1319,7 +1320,12 @@ load_identity_file(char *filename) > struct stat st; > > if (stat(filename, &st) < 0) { >- debug3("no such identity: %s", filename); >+ if (userprovided) >+ logit("no such identity: %s: %s", filename, >+ strerror(errno)); >+ else >+ debug3("no such identity: %s: %s", filename, >+ strerror(errno)); > return NULL; > } > private = key_load_private_type(KEY_UNSPEC, filename, "", NULL, &perm_ok); >@@ -1382,6 +1388,7 @@ pubkey_prepare(Authctxt *authctxt) > id = xcalloc(1, sizeof(*id)); > id->key = key; > id->filename = xstrdup(options.identity_files[i]); >+ id->userprovided = 1; > TAILQ_INSERT_TAIL(&files, id, next); > } > /* list of keys supported by the agent */ >@@ -1423,7 +1430,8 @@ pubkey_prepare(Authctxt *authctxt) > TAILQ_INSERT_TAIL(preferred, id, next); > } > TAILQ_FOREACH(id, preferred, next) { >- debug2("key: %s (%p)", id->filename, id->key); >+ debug2("key: %s (%p), userprovided %d", id->filename, id->key, >+ id->userprovided); > } > } > >@@ -1468,7 +1476,8 @@ userauth_pubkey(Authctxt *authctxt) > sent = send_pubkey_test(authctxt, id); > } else if (id->key == NULL) { > debug("Trying private key: %s", id->filename); >- id->key = load_identity_file(id->filename); >+ id->key = load_identity_file(id->filename, >+ id->userprovided); > if (id->key != NULL) { > id->isprivate = 1; > sent = sign_and_send_pubkey(authctxt, id);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
djm
:
ok+
Actions:
View
|
Diff
Attachments on
bug 1981
:
2136
|
2219