[SERVER-14822] fassert on _fd in Socket::doSSLHandshake should actually be on fd >= 0 Created: 07/Aug/14  Updated: 19/Jul/16  Resolved: 29/Jun/16

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: 3.3.10

Type: Bug Priority: Trivial - P5
Reporter: Gabriel Russell (Inactive) Assignee: Matt Cotter
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 16 (06/24/16), Platforms 17 (07/15/16)
Participants:

 Description   

I suspect that this fassert is incorrect. It seams that -1 is the invalid value and that 0 and higher are valid values.

diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index bdab735..b88747b 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -493,7 +493,7 @@ namespace mongo {
 
     std::string Socket::doSSLHandshake(const char* firstBytes, int len) {
         if (!_sslManager) return "";
-        fassert(16506, _fd);
+        fassert(16506, _fd >=0 );
         if (_sslConnection.get()) {
             throw SocketException(SocketException::RECV_ERROR, 
                                   "Attempt to call SSL_accept on already secure Socket from " +



 Comments   
Comment by Githook User [ 29/Jun/16 ]

Author:

{u'username': u'Machyne', u'name': u'Matt Cotter', u'email': u'matt.cotter@mongodb.com'}

Message: SERVER-14822 don't assert invalid on sock descriptor 0

Also switch usage of `-1` to `INVALID_SOCKET` to be explicit.
Branch: master
https://github.com/mongodb/mongo/commit/67afbdf8c8d97642b2b8ab639d9a55ccf51ffc39

Generated at Thu Feb 08 03:36:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.