New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libssh: #ifdef include files accordingly #8511
Conversation
S_IFLNK and S_IFMT will be undefined variable without including unistd.h. Could it work as expecting if we define them manually. |
We can define them manually, sure. But isn't there a header file you can include that has them defined? Like maybe |
This fix seems to build on Windows now, at least with mingw |
I tried this diff and it works fine on MSVC + clang-cl too;
Except the typical problem with the peer certificate. |
Reported-by: 梦终无痕 Bug: https://curl.se/mail/lib-2022-02/0131.html Closes #8511
e2060f6
to
134d9b7
Compare
But I noted that
Any way to avoid that? |
It seems tricky because libssh has no apparent way to inhibit that. |
134d9b7
to
59ba485
Compare
that's fine as long as there's a corresponding cleanup call. multiple startup calls increment an internal counter and it works the same as curl_global_init/cleanup. |
The 'oldlibssh' feature indicates that the error code returned by libssh for a broken known_hosts file should be 67 rather than 60 (test1459). This feature was added as part of curl#8444 with 'oldlibssh' mapping to libssh versions prior to 0.9.6, and then refined as part of curl#8511 to map to versions prior to 0.9.5. In Red Hat Enterprise Linux 8.5 there is a patched version of libssh version 0.9.4 (https://git.centos.org/rpms/libssh/blob/c8/f/SOURCES) in which test1459 fails because it returns the "new" value rather than the "old" one. It's plausible that one of the patches is responsible for this rather than the underlying code but I don't think so. This change therefore drops the 'oldlibssh' version check to map to libssh versions older than 0.9.4, which fixes builds on RHEL-8.
The 'oldlibssh' feature indicates that the error code returned by libssh for a broken known_hosts file should be 67 rather than 60 (test1459). This feature was added as part of #8444 with 'oldlibssh' mapping to libssh versions prior to 0.9.6, and then refined as part of #8511 to map to versions prior to 0.9.5. In Red Hat Enterprise Linux 8.5 there is a patched version of libssh version 0.9.4 (https://git.centos.org/rpms/libssh/blob/c8/f/SOURCES) in which test1459 fails because it returns the "new" value rather than the "old" one. It's plausible that one of the patches is responsible for this rather than the underlying code but I don't think so. This change therefore drops the 'oldlibssh' version check to map to libssh versions older than 0.9.4, which fixes builds on RHEL-8. Closes #8548
- If building libcurl against an old libssh version missing SSH_S_IFMT and SSH_S_IFLNK then use the values from a supported version. Prior to this change if libssh did not define SSH_S_IFMT and SSH_S_IFLNK then S_IFMT and S_IFLNK, respectively, were used instead. The problem with that is the user's S_ stat macros don't have the same values across platforms. For example Windows has values different from Linux. Follow-up to 7b0fd39. Ref: curl#8511 (comment) Ref: curl#8574 Closes #xxxx
- If building libcurl against an old libssh version missing SSH_S_IFMT and SSH_S_IFLNK then use the values from a supported version. Prior to this change if libssh did not define SSH_S_IFMT and SSH_S_IFLNK then S_IFMT and S_IFLNK, respectively, were used instead. The problem with that is the user's S_ stat macros don't have the same values across platforms. For example Windows has values different from Linux. Follow-up to 7b0fd39. Ref: #8511 (comment) Ref: #8574 Closes #8588
Reported-by: 梦终无痕
Bug: https://curl.se/mail/lib-2022-02/0131.html