[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Querying session parameters
[Thread Prev] | [Thread Next]
- Subject: Re: Querying session parameters
- From: Pierre Lewis <leware@xxxxxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 09 Dec 2010 17:12:11 -0500
- To: libssh@xxxxxxxxxx
On Mon, Dec 06, 2010 at 04:25:53PM +0100, Aris Adamantiadis wrote: > This is a good question. The data exists but there is no accessors for it. > > I don't have so much time right now, so a patch would be welcome of > course :) This would not be very complicated to implement. Got it working, not too painful indeed. I tried to stick to the dominant style. IN libssh.h, I added one line: LIBSSH_API char *ssh_get_encryption_algo(ssh_session session); IN client.c after ssh_get_issue_banner(), but it could go anywhere there, I added following function. I went overboard with all the NULL checks because I had a silly error, the checks could be summarized in a single statement. Also, we could also return the 'in_cipher->name', and maybe I'll add that (it could be different, right?). /** * @brief Get info on currently used encryption algo * * Get info on currently used encryption algo * * @param session The SSH session to use. * * @return A pointer to a string with the info (do NOT free it!) */ const char *ssh_get_encryption_algo(ssh_session session) { if (session == NULL) { return "no session"; } if (session->current_crypto == NULL) { return "no current_crypto"; } if (session->current_crypto->out_cipher == NULL) { return "no out_cipher"; } if (session->current_crypto->out_cipher->name == NULL) { return "no out_cipher->name"; } return session->current_crypto->out_cipher->name; } And that gave me the current encryption algo ("aes256-ctr" on all hosts I've tried so far). I haven't yet bothered with the authentication stuff (I'm less curious about that). I might have trouble finding a host that returns something else! I won't provide this as a patch because I just don't understand the source management stuff well enough, but it's simple enough that you could just include it as part of your work at some point. Cheers, Pierre
libssh sftp download performance | "Mark Riordan" <mriordan@xxxxxxxxxxxx> |
Re: libssh sftp download performance | Andreas Schneider <asn@xxxxxxxxxxxx> |
Querying session parameters | Pierre Lewis <leware@xxxxxxxxxxxxxxxx> |
Re: Querying session parameters | Aris Adamantiadis <aris@xxxxxxxxxxxx> |