Bug 807250: Backout cset 4a1849df5e3e due to assertion failures NSS_3_15_5_BETA1
authorBrian Smith <brian@briansmith.org>
Sun, 12 Jan 2014 22:07:34 -0800
changeset 10998 ab1e7334bde60c4f2242348de71761c05689f421
parent 10997 ebe34884a3a06934ad85ce7b4dcae7d5c198a1b0
child 10999 63c3d536754643a7fd64e059b8e4a87b248bcb1f
push id272
push userbrian@briansmith.org
push dateMon, 13 Jan 2014 06:15:18 +0000
bugs807250
Bug 807250: Backout cset 4a1849df5e3e due to assertion failures
lib/ssl/sslsock.c
--- a/lib/ssl/sslsock.c
+++ b/lib/ssl/sslsock.c
@@ -147,17 +147,17 @@ ssl_GetPrivate(PRFileDesc *fd)
 
     if (fd->methods->file_type != PR_DESC_LAYERED ||
         fd->identity != ssl_layer_id) {
 	PORT_SetError(PR_BAD_DESCRIPTOR_ERROR);
 	return NULL;
     }
 
     ss = (sslSocket *)fd->secret;
-    PORT_Assert(ss->fd == fd);
+    ss->fd = fd;
     return ss;
 }
 
 /* This function tries to find the SSL layer in the stack. 
  * It searches for the first SSL layer at or below the argument fd,
  * and failing that, it searches for the nearest SSL layer above the 
  * argument fd.  It returns the private sslSocket from the found layer.
  */
@@ -172,17 +172,17 @@ ssl_FindSocket(PRFileDesc *fd)
 
     layer = PR_GetIdentitiesLayer(fd, ssl_layer_id);
     if (layer == NULL) {
 	PORT_SetError(PR_BAD_DESCRIPTOR_ERROR);
 	return NULL;
     }
 
     ss = (sslSocket *)layer->secret;
-    PORT_Assert(ss->fd == layer);
+    ss->fd = layer;
     return ss;
 }
 
 static sslSocket *
 ssl_DupSocket(sslSocket *os)
 {
     sslSocket *ss;
     SECStatus rv;
@@ -1311,23 +1311,20 @@ ssl_ImportFD(PRFileDesc *model, PRFileDe
     	return NULL;
 
     rv = ssl_PushIOLayer(ns, fd, PR_TOP_IO_LAYER);
     if (rv != PR_SUCCESS) {
 	ssl_FreeSocket(ns);
 	SET_ERROR_CODE
 	return NULL;
     }
-#if defined(DEBUG) || defined(FORCE_PR_ASSERT)
-    {
-	sslSocket * ss = ssl_FindSocket(fd);
-	PORT_Assert(ss == ns);
-    }
-#endif
-    ns->TCPconnected = (PR_SUCCESS == ssl_DefGetpeername(ns, &addr));
+    ns = ssl_FindSocket(fd);
+    PORT_Assert(ns);
+    if (ns)
+	ns->TCPconnected = (PR_SUCCESS == ssl_DefGetpeername(ns, &addr));
     return fd;
 }
 
 PRFileDesc *
 SSL_ImportFD(PRFileDesc *model, PRFileDesc *fd)
 {
     return ssl_ImportFD(model, fd, ssl_variant_stream);
 }