Wireshark mailing list archives

Re: Patch for empty SSH env variables


From: Jakub Zawadzki <darkjames () darkjames ath cx>
Date: Tue, 6 Oct 2009 10:59:17 +0200

Hi,

On Mon, Oct 05, 2009 at 05:37:00PM -0400, Charles Rumford wrote:
A friend of mine had been having the same issue, and we decided to dive into
the code and figure out what was going one. It turns out that ssh-agent set
the SSH_CONNECTION and SSH_CLIENT environment variables to the empty string
when on the local machine.  Because of this in util.c, in *get_conn_cfilter(),
tokens[0] is null and there is no check to get around this.

I have attached patch to fix this problem. Does this seem like a reasonable
fix for this problem?

-             if (tokens[3]) {
+             if (tokens[3] && tokens[0]) {

I'd prefer to use if (g_strv_length(tokens) == 4) in SSH_CONNECTION,
and if (g_strv_length(tokens) == 3) in SSH_CLIENT

And there are missing g_strfreev(tokens) call.

I rewritten get_conn_cfilter() to use g_strdup_printf() instead of static g_string.
(I removed const from declaration, and make it return NULL when it fail to create filter instad of "")

And when it fail to obtain filter from one source, it will try with another one.
(in DISPLAY block there was lot of returns, so I moved SESSIONNAME above)

Later we can try to create filter from multiple sources:
  like SSH && DISPLAY.

I think it should work, but I don't have time to test it :)

Regards.

Attachment: get_conn_cfilter.patch
Description:

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: