rsGetHostByName doesn't support IPv6 addresses.
Before this commit when
an hostname had both AAAA and A record rsGetHostByName retrurned success
but with 0.0.0.0 invalid address. As rsGetHostByName is not capable of
handling IPv6 (fixing it would require API change and a bunch of
refactors around) just avoid to receive IPv6 addresses on resolition, so
the correct IPv4 address is returned if present, otherwise fail
gracefully (A record not found).
Forging of BIO_METHOD may be the cause of the stack overflow as the
internal structure in openssl changed so the methods get assigned to
wrong pointer.
Kudos Cyril to notice newer openssl internal struct had one new pointer
inserted as second member
Caused by unneeded pointer usages + not enough careful IPv6 porting
I haven't managed to reproduce the crash nor to test the fix due it
happening only when UDP relayed connection happens (apparently never on
my nodes.
I have managed to discover where the bug comes from thanks to multiple
user reports, specially to Ilario report which documented 3 crashes
happening on 0.6.4 with complete log.
/retroshare-gui/src/gui/settings/MessagePage.cpp:62:19: warning:
deleting object of polymorphic class type 'Rs::Msgs::MsgTagType' which
has non-virtual destructor might cause undefined behavior [-Wdelete-non-
virtual-dtor]
/retroshare-gui/src/gui/settings/MessagePage.cpp:62: warning: delete
called on non-final 'Rs::Msgs::MsgTagType' that has virtual functions
but non-virtual destructor
/retroshare-gui/src/gui/settings/MessagePage.cpp:86: warning: use of
old-style cast
/retroshare-gui/src/gui/settings/MessagePage.cpp:172: warning: zero as
null pointer constant
/retroshare-gui/src/gui/settings/MessagePage.cpp:176: warning: implicit
conversion changes signedness: 'int' to 'uint32_t' (aka 'unsigned int')
/retroshare-gui/src/gui/settings/MessagePage.cpp:203: warning: zero as
null pointer constant
/retroshare-gui/src/gui/settings/MessagePage.cpp:207: warning: implicit
conversion changes signedness: 'int' to 'uint32_t' (aka 'unsigned int')
/retroshare-gui/src/gui/settings/MessagePage.cpp:261: warning: implicit
conversion changes signedness: 'int' to 'uint32_t' (aka 'unsigned int')
/libretroshare/src/retroshare/rsmsgs.h:168: warning:
'Rs::Msgs::MessageInfo' has virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:168: warning: 'MessageInfo' has
no out-of-line virtual method definitions; its vtable will be emitted in
every translation unit
/libretroshare/src/retroshare/rsmsgs.h:234: warning:
'Rs::Msgs::MsgInfoSummary' has virtual functions but non-virtual
destructor
/libretroshare/src/retroshare/rsmsgs.h:234: warning: 'MsgInfoSummary'
has no out-of-line virtual method definitions; its vtable will be
emitted in every translation unit
/libretroshare/src/retroshare/rsmsgs.h:261: warning:
'Rs::Msgs::MsgTagInfo' has virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:328: warning: 'ChatId' has
virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:400: warning: 'ChatLobbyInvite'
has virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:420: warning:
'VisibleChatLobbyRecord' has virtual functions but non-virtual
destructor
/libretroshare/src/retroshare/rsmsgs.h:420: warning:
'VisibleChatLobbyRecord' has no out-of-line virtual method definitions;
its vtable will be emitted in every translation unit
/libretroshare/src/retroshare/rsmsgs.h:449: warning: 'ChatLobbyInfo' has
virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:486: warning: 'RsMsgs' has no
out-of-line virtual method definitions; its vtable will be emitted in
every translation unit
About vtable:
https://stackoverflow.com/questions/23746941/what-is-the-meaning-of-
clangs-wweak-vtables
https://stackoverflow.com/questions/50463374/avoid-weak-vtable-warnings-
for-classes-only-defined-in-a-source-file
/libretroshare/src/rsserver/rsloginhandler.cc:122:2: warning: missing
initializer for member 'SecretSchema::reserved' [-Wmissing-field-
initializers]
/libretroshare/src/rsserver/rsloginhandler.cc:122:2: warning: missing
initializer for member 'SecretSchema::reserved1' [-Wmissing-field-
initializers]
/libretroshare/src/rsserver/rsloginhandler.cc:122:2: warning: missing
initializer for member 'SecretSchema::reserved2' [-Wmissing-field-
initializers]
/libretroshare/src/rsserver/rsloginhandler.cc:122:2: warning: missing
initializer for member 'SecretSchema::reserved3' [-Wmissing-field-
initializers]
/libretroshare/src/rsserver/rsloginhandler.cc:122:2: warning: missing
initializer for member 'SecretSchema::reserved4' [-Wmissing-field-
initializers]
/libretroshare/src/rsserver/rsloginhandler.cc:122:2: warning: missing
initializer for member 'SecretSchema::reserved5' [-Wmissing-field-
initializers]
/libretroshare/src/rsserver/rsloginhandler.cc:122:2: warning: missing
initializer for member 'SecretSchema::reserved6' [-Wmissing-field-
initializers]
/libretroshare/src/rsserver/rsloginhandler.cc:122:2: warning: missing
initializer for member 'SecretSchema::reserved7' [-Wmissing-field-
initializers]
/libretroshare/src/rsserver/rsloginhandler.cc:34: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:55: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:120: warning: use of old-
style cast
/libretroshare/src/rsserver/rsloginhandler.cc:122: warning: missing
field 'reserved' initializer
/libretroshare/src/rsserver/rsloginhandler.cc:243: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:244: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:248: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:254: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:443: warning: 'return'
will never be executed
/libretroshare/src/rsserver/rsloginhandler.cc:270: warning: 'return'
will never be executed
/libretroshare/src/rsserver/rsloginhandler.cc:468: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:470: warning: use of old-
style cast
/libretroshare/src/rsserver/rsloginhandler.cc:470: warning: cast from
'const char *' to 'char *' drops const qualifier
/libretroshare/src/rsserver/rsloginhandler.cc:471: warning: use of old-
style cast
/libretroshare/src/rsserver/rsloginhandler.cc:471: warning: cast from
'const char *' to 'char *' drops const qualifier
/libretroshare/src/rsserver/rsloginhandler.cc:472: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:476: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:630: warning: 'return'
will never be executed
/libretroshare/src/rsserver/rsloginhandler.cc:650: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:651: warning: zero as null
pointer constant
/libretroshare/src/rsserver/rsloginhandler.cc:655: warning: zero as null
pointer constant
This function is part of the public API so it must be safe to call with
any input, before this commit if would crash if feeded with a broken or
empty certificate radix string.