public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce•org>
To: Marek Zawirski <marek.zawirski@gmail•com>
Cc: Robin Rosenberg <robin.rosenberg@dewire•com>, git@vger•kernel.org
Subject: Re: [JGIT PATCH 1/2] Ignore unreadable SSH private keys when autoloading identities
Date: Wed, 27 Aug 2008 16:29:46 -0700	[thread overview]
Message-ID: <20080827232946.GS26523@spearce.org> (raw)
In-Reply-To: <48B5E2A1.3030007@gmail.com>

Marek Zawirski <marek.zawirski@gmail•com> wrote:
> Shawn O. Pearce wrote:
>> diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/DefaultSshSessionFactory.java b/org.spearce.jgit/src/org/spearce/jgit/transport/DefaultSshSessionFactory.java
> (...)
>> +			try {
>> +				addIdentity(k);
>> +			} catch (JSchException e) {
>> +				if (e.getMessage().startsWith("invalid privatekey: "))
>> +					continue;
>> +				throw e;
>> +			}
>
> That's extreme error handling with JSch;) Do you really think it's  
> better to rely on internal error message instead of continuing in any  
> case? Which other exceptions we would like to pass level up?

Oh, that's a good question.  In this particular code we're just
trying to prime the list of known keys so there's a chance we could
later prompt you for a passphrase during the handshaking.  So we
probably could get away with just ignoring all JSchExceptions at
this stage and treat the key as though it wasn't present...

I can't imagine what else we'd get back.  A FileNotFoundException
just means the user deleted the key before we could actually read
it (no big deal); an IOException because the key isn't readable
isn't an issue either.

I guess I can just change this to ignore everything.

-- 
Shawn.

  reply	other threads:[~2008-08-27 23:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-27 23:02 [JGIT PATCH 1/2] Ignore unreadable SSH private keys when autoloading identities Shawn O. Pearce
2008-08-27 23:02 ` [JGIT PATCH 2/2] pgm.push: Ensure SSH connections are closed Shawn O. Pearce
2008-08-27 23:26 ` [JGIT PATCH 1/2] Ignore unreadable SSH private keys when autoloading identities Marek Zawirski
2008-08-27 23:29   ` Shawn O. Pearce [this message]
2008-08-28  0:24     ` [JGIT PATCH 1/2 v2] " Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080827232946.GS26523@spearce.org \
    --to=spearce@spearce$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=marek.zawirski@gmail$(echo .)com \
    --cc=robin.rosenberg@dewire$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox