You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RANDOM_PADDING in transport.c gets accidentally(?) triggered by Windows wincrypt.h #921
I am filing this in relation to tracker issue 793 -- #793
That issue (in my case) deals with a remote server that does not handle the ssh-userauth packet correctly if random padding is enabled. That is probably a bug of that server.
However, as far as I can tell, is that RANDOM_PADDING isn't set in the libssh2 itself (not in my source at least). But in a windows build, in my case instead the source picked up the definition from a windows header (WinCrypt.h) where there is a macro of the same name.
So, although it's not quite a bug, I'd recommend to change the name of that ifdef to something like LIBSSH2_RANDOM_PADDING in transport.c because it's my impression (also from the fixme comment there) that it was not intended to be on.
We're using our own Visual Studio 2010 project with toolset 140 for the build.
I believe it was imported/made from a visual studio project that came with LIBSSH2 in the old days initially. Like I think around version 1.4 it came with a VisualStudio .dsp project file and we took that project, imported into into ours and are now carrying the VS2010 project file forward ever since by just adding the files that are added to LIBSSH2.
I know this sounds a bit vague and smells of a home made problem, but a quick test with just an winsock2.h include in an empty source indicates, that the RANDOM_PADDING comes with <winsock2.h>. The following source errors out on complilation in VS2010:
#include <winsock2.h>
#ifdef RANDOM_PADDING
#error RANDOM_PADDING set
#endif
@Markus-Schmidt: Thanks for the info! Could not reproduce this in #922 (with VS 2008, 2010, 2013 added). But the small example did reproduce. It happens when WIN32_LEAN_AND_MEAN is not set. I agree it's best to rename this to avoid potential mixups.
Activity
vszakats commentedon Apr 2, 2023
@Markus-Schmidt Do you know what toolchain/env/config was used for building libssh2 where this Windows macro spilled into
transfer.c?zocterminal commentedon Apr 2, 2023
We're using our own Visual Studio 2010 project with toolset 140 for the build.
I believe it was imported/made from a visual studio project that came with LIBSSH2 in the old days initially. Like I think around version 1.4 it came with a VisualStudio .dsp project file and we took that project, imported into into ours and are now carrying the VS2010 project file forward ever since by just adding the files that are added to LIBSSH2.
I know this sounds a bit vague and smells of a home made problem, but a quick test with just an winsock2.h include in an empty source indicates, that the RANDOM_PADDING comes with <winsock2.h>. The following source errors out on complilation in VS2010:
vszakats commentedon Apr 2, 2023
@Markus-Schmidt: Thanks for the info! Could not reproduce this in #922 (with VS 2008, 2010, 2013 added). But the small example did reproduce. It happens when
WIN32_LEAN_AND_MEANis not set. I agree it's best to rename this to avoid potential mixups.transport: rename local `RANDOM_PADDING` macro
zocterminal commentedon Apr 2, 2023
Excellent. Glad to have been of help.
transport: rename local `RANDOM_PADDING` macro
transport: rename local `RANDOM_PADDING` macro