You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by sanhex <gi...@git.apache.org> on 2017/09/26 00:04:30 UTC

[GitHub] incubator-guacamole-server pull request #113: GUACAMOLE-396: Fixing ssh sock...

GitHub user sanhex opened a pull request:

    https://github.com/apache/incubator-guacamole-server/pull/113

    GUACAMOLE-396: Fixing ssh socket for IPv6 address

    GUACAMOLE-396: guacd cannot connect to ssh servers with IPv6 addresses
    
    Root Cause:
    In the ssh library of guacd, the TCP socket for connecting to ssh server is created with AF_INET. So it does not support IPv6 address.
    
    Solution:
    When guacd creates the socket for ssh in guac_common_ssh_create_session(), stop using hard coded AF_INET for socket() call, use the address family which is returned from getaddrinfo().
    
    Test:
    - Connected successfully via ssh connections with IPv4 and IPv6 hosts.
    - No connection error in guacd logs.
    - Simulated a connection failure with specifying a ssh server which does not exist. guacd worked well in this case.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sanhex/incubator-guacamole-server patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-guacamole-server/pull/113.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #113
    
----
commit f33467801bdff22bfd3dac00e09092c115f71604
Author: James <10...@users.noreply.github.com>
Date:   2017-09-25T23:57:33Z

    Fixing ssh socket for IPv6 address
    
    GUACAMOLE-396: guacd cannot connect to ssh servers with IPv6 addresses
    
    Root Cause:
    In the ssh library of guacd, the TCP socket for connecting to ssh server is created with AF_INET. So it does not support IPv6 address.
    
    Solution:
    When guacd creates the socket for ssh in guac_common_ssh_create_session(), stop using hard coded AF_INET for socket() call, use the address family which is returned from getaddrinfo().
    
    Test:
    - Connected successfully via ssh connections with IPv4 and IPv6 hosts.
    - No connection error in guacd logs.
    - Simulated a connection failure with specifying a ssh server which does not exist. guacd worked well in this case.

----


---

[GitHub] incubator-guacamole-server pull request #113: GUACAMOLE-396: Fixing ssh sock...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/incubator-guacamole-server/pull/113#discussion_r140930812
  
    --- Diff: src/common-ssh/ssh.c ---
    @@ -418,7 +418,7 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
     
         int retval;
     
    -    int fd;
    +    int fd = -1;
    --- End diff --
    
    Please do not initialize variables unnecessarily.


---

[GitHub] incubator-guacamole-server pull request #113: GUACAMOLE-396: Fixing ssh sock...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-guacamole-server/pull/113


---

[GitHub] incubator-guacamole-server pull request #113: GUACAMOLE-396: Fixing ssh sock...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/incubator-guacamole-server/pull/113#discussion_r140931760
  
    --- Diff: src/common-ssh/ssh.c ---
    @@ -479,7 +478,7 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
                 guac_client_log(client, GUAC_LOG_DEBUG, "Unable to connect to "
                         "host %s, port %s: %s",
                         connected_address, connected_port, strerror(errno));
    -
    +        close(fd);
    --- End diff --
    
    Previously, there was a blank line after this single-line `else` block, visually separating that block from the code that followed. For the sake of readability, that blank line should remain.
    
    I would suggest either restoring the blank line, adding this `close()` call to the `else` block itself, or getting rid of the `else` entirely and rely on the fact that the `if` will `break` out of the loop (and thus the `else` is superfluous anyway).


---