simon-git: putty (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Fri Apr 29 12:07:31 BST 2022


TL;DR:
  f9bb1f49 ssh/verstring.c: fix use of '\r' and '\n'.
  03cfda89 Windows: make SockAddr's error field const char *.
  67204ffd Windows: stop trying to use gai_strerror.
  e22df745 Reorganise sk_namelookup (on both platforms).

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2022-04-29 12:07:31

commit f9bb1f49970eb9a41c517f387f46783c4c9f8b4c
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=f9bb1f49970eb9a41c517f387f46783c4c9f8b4c;hp=e6df50ea6b1476d04caad64fc919974684a4a091
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Apr 29 10:31:24 2022 +0100

    ssh/verstring.c: fix use of '\r' and '\n'.
    
    It's a thoroughly pedantic point, but I just spotted that the
    comparison of wire data against theoretically platform-dependent char
    escapes is a violation of \k{udp-portability}.

 ssh/verstring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

commit 03cfda89d135576ba458e6da0b337aea198d00c7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=03cfda89d135576ba458e6da0b337aea198d00c7;hp=f9bb1f49970eb9a41c517f387f46783c4c9f8b4c
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Apr 29 11:54:36 2022 +0100

    Windows: make SockAddr's error field const char *.
    
    We're assigning string literals into it all over the place, so it
    should have been const char * all along. No thanks to any of the
    compilers that didn't point that out!

 windows/network.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 67204ffd0b46b277fb6c848cd1a4b17771996eb5
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=67204ffd0b46b277fb6c848cd1a4b17771996eb5;hp=03cfda89d135576ba458e6da0b337aea198d00c7
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Apr 29 11:55:56 2022 +0100

    Windows: stop trying to use gai_strerror.
    
    To begin with, Windows's own API documentation doesn't recommend using
    it (for thread-safety reasons), and promises that the error codes
    returned from getaddrinfo are aliases for the normal Windows error
    code enumeration. So it's safe, and quite likely preferable, to just
    use ordinary win_strerror instead.
    
    But more embarrassingly, my attempt to acquire and use gai_strerror
    from one or other Winsock DLL didn't even *work*! Because of course
    it's a function that handles strings, which means it comes in two
    variants, gai_strerrorA and gai_strerrorW, so in order to look it up
    using GetProcAddress, I should have specified which I wanted. And I
    didn't, so the lookup always failed.
    
    This should improve error reporting in cases of interesting kinds of
    DNS failure.

 windows/network.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

commit e22df7454511140b332b9ba4f9ce5d539e6d9717
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=e22df7454511140b332b9ba4f9ce5d539e6d9717;hp=67204ffd0b46b277fb6c848cd1a4b17771996eb5
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Apr 29 08:05:39 2022 +0100

    Reorganise sk_namelookup (on both platforms).
    
    I just tried to trace through the Windows version's control flow in
    response to a confusing bug report, and found that the control flow
    itself was so confusing I couldn't make sense of it. Why are we
    choosing between getaddrinfo and gethostbyname via #ifndef NO_IPV6,
    then re-converging control flow and diverging a second time to report
    the error?
    
    So I rewrote the whole thing to have completely separate sections of
    code dealing with the three resolution strategies, each with its own
    dedicated error reporting system. And then I checked the Unix version
    and found it was about as confusing, so I rewrote that too in the same
    style. Now the two are mostly the same, except for details: Unix has
    an override at the top for a Unix socket pathname, Windows has to cope
    with getaddrinfo maybe not being found at run time (so the other cases
    aren't in the #else clause), and Windows uses the same error reporting
    for both lookup functions whereas Unix has to use the appropriate
    gai_strerror or hstrerror.

 unix/network.c    | 142 ++++++++++++++++++++------------------------
 windows/network.c | 175 ++++++++++++++++++++++++------------------------------
 2 files changed, 140 insertions(+), 177 deletions(-)



More information about the tartarus-commits mailing list