Re: SSH error messages not shown

From: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Jacek Wielemborek <d33tah(at)gmail(dot)com>, "pgadmin-hackers(at)postgresql(dot)org" <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: SSH error messages not shown
Date: 2015-06-15 05:10:15
Message-ID: CANxoLDfKViMr4tdjMC0L9V2fFCRtHjHEtDeMNccWHBZk5zcQKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Sure.

On Sun, Jun 14, 2015 at 3:13 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> Akshay, can you look into this please?
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK:http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On 13 Jun 2015, at 16:22, Jacek Wielemborek <d33tah(at)gmail(dot)com> wrote:
>
> Hi,
>
> When an libssh2 call fails, pgAdmin III just shows the error code and
> nothing else. Consider the following patch - this is what I created
> while wondering why my hostkeys don't work:
>
> diff --git a/pgadmin/utils/sshTunnel.cpp b/pgadmin/utils/sshTunnel.cpp
> index fd80214..e15f764 100644
> --- a/pgadmin/utils/sshTunnel.cpp
> +++ b/pgadmin/utils/sshTunnel.cpp
> @@ -201,8 +201,13 @@ bool CSSHTunnelThread::Initialize()
> #endif
> if (rc)
> {
> -
> LogSSHTunnelErrors(wxString::Format(_("SSH error: Authentication by
> identity file failed with error code %d"), rc), GetId());
> + char* errmsg;
> + int errmsg_len;
> + libssh2_session_last_error(m_session,
> &errmsg, &errmsg_len, 0);
> + wxString errmsg_s(errmsg, wxConvLibc);
> +
> LogSSHTunnelErrors(wxString::Format(_("SSH error: Authentication by
> identity file failed with error code %d [%s]"), rc, errmsg_s.c_str()),
> GetId());
> Cleanup();
> + free(errmsg);
> return false;
> }
> }
>
> Perhaps we could use this kind of routines wherever rc is being checked?
>
> Cheers,
> d33tah
>
>

--
*Akshay Joshi*
*Principal Software Engineer *

*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Akshay Joshi 2015-06-15 05:10:52 Re: valgrind complains a lot when trying to establish an SSH tunnel while giving wrong key
Previous Message Ashesh Vashi 2015-06-14 16:44:44 Re: [PATCH] Fix crash when disabling auto commit