[PATCH] kio_sftp error detection

Michael Leupold lemma at confuego.org
Sun Dec 28 22:28:40 GMT 2008

On Sunday 28 December 2008 19:55:37 Thiago Macieira wrote:
> Michael Leupold wrote:
> >Hi there,
> >
> >for quite a while kio_sftp has been a little poor detecting errors. The
> > result of it was (is) usually an empty KDialog with some "unknown
> > error" caption. Those errors get especially annoying when they happen
> > during KUrlCompletion.
> >
> >I just figured that the sftp kioslave didn't know about some errors. So
> > I implemented:
> >- "Name or service not known" (eg. server name is not resolvable)
> >- "Connection refused" (eg. no ssh server running on the port specified)
> >- "Bad port" (displayed by OpenSSH if the port number is outside the
> > allowed TCP port range)
> >
> >Additionally I removed the modal dialog boxes because I think a kioslave
> >shouldn't show dialogboxes for those known errors (as I understand it
> >SlaveBase::error() is meant for that, right?). I didn't introduce any
> > new strings so far but used the ssh command's output (which might look
> > strange sometimes). I also tried to keep interoperability with plink
> > and non-free ssh (not sure if I succeeded - I can't test).
> >
> >Pretty please someone review and tell me if I may commit.
> Two things I didn't like about this patch:
> 1) file-global arrays of QRegExp. Don't do that. Just don't. Either put
> them in a class (non-static) or inside a function. And why are the first
> two entries always alike? What's that about "unused"?

I agree. I just decided to stick it in not modifying the original too much. 
I'll try to improve the code and submit another patch.
The first entries are alike due to the same reasons. I just added the extra 
version string for OpenSSH_4 and sticked to what was there. Entries I marked 
"unused" must never match.

> 2) "if the user entered an invalid port". That's not possible. If the port
> is not valid, it cannot be entered in the first place, since QUrl/KUrl
> will not accept ports beyond the valid range.

That I did not know. That means that "invalid port" can be stripped.

Thanks and regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081228/46b0fbf3/attachment.sig>

More information about the kde-core-devel mailing list