OLD | NEW |
1 /* | 1 /* |
2 * vtables (and methods that call through them) for the 4 types of | 2 * vtables (and methods that call through them) for the 4 types of |
3 * SSLSockets supported. Only one type is still supported. | 3 * SSLSockets supported. Only one type is still supported. |
4 * Various other functions. | 4 * Various other functions. |
5 * | 5 * |
6 * ***** BEGIN LICENSE BLOCK ***** | 6 * ***** BEGIN LICENSE BLOCK ***** |
7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
8 * | 8 * |
9 * The contents of this file are subject to the Mozilla Public License Version | 9 * The contents of this file are subject to the Mozilla Public License Version |
10 * 1.1 (the "License"); you may not use this file except in compliance with | 10 * 1.1 (the "License"); you may not use this file except in compliance with |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 if (layer == NULL) { | 282 if (layer == NULL) { |
283 PORT_SetError(PR_BAD_DESCRIPTOR_ERROR); | 283 PORT_SetError(PR_BAD_DESCRIPTOR_ERROR); |
284 return NULL; | 284 return NULL; |
285 } | 285 } |
286 | 286 |
287 ss = (sslSocket *)layer->secret; | 287 ss = (sslSocket *)layer->secret; |
288 ss->fd = layer; | 288 ss->fd = layer; |
289 return ss; | 289 return ss; |
290 } | 290 } |
291 | 291 |
292 sslSocket * | 292 static sslSocket * |
293 ssl_DupSocket(sslSocket *os) | 293 ssl_DupSocket(sslSocket *os) |
294 { | 294 { |
295 sslSocket *ss; | 295 sslSocket *ss; |
296 SECStatus rv; | 296 SECStatus rv; |
297 | 297 |
298 ss = ssl_NewSocket((PRBool)(!os->opt.noLocks), os->protocolVariant); | 298 ss = ssl_NewSocket((PRBool)(!os->opt.noLocks), os->protocolVariant); |
299 if (ss) { | 299 if (ss) { |
300 ss->opt = os->opt; | 300 ss->opt = os->opt; |
301 ss->opt.useSocks = PR_FALSE; | 301 ss->opt.useSocks = PR_FALSE; |
302 ss->vrange = os->vrange; | 302 ss->vrange = os->vrange; |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 { | 1390 { |
1391 sslSocket * ns = NULL; | 1391 sslSocket * ns = NULL; |
1392 PRStatus rv; | 1392 PRStatus rv; |
1393 PRNetAddr addr; | 1393 PRNetAddr addr; |
1394 SECStatus status = ssl_Init(); | 1394 SECStatus status = ssl_Init(); |
1395 | 1395 |
1396 if (status != SECSuccess) { | 1396 if (status != SECSuccess) { |
1397 return NULL; | 1397 return NULL; |
1398 } | 1398 } |
1399 | 1399 |
| 1400 /* |
| 1401 * The session cache locks (cacheLock in sslnonce.c and symWrapKeysLock |
| 1402 * in ssl3con.c) are always used when there is an sslSocket 'ss', |
| 1403 * except for SSL_ClearSessionCache and SSL3_ShutdownServerCache. So |
| 1404 * we can lazily initialize the session cache locks right before we |
| 1405 * create an sslSocket. |
| 1406 */ |
| 1407 status = ssl_InitSessionCacheLocks(); |
| 1408 if (status != SECSuccess) { |
| 1409 return NULL; |
| 1410 } |
| 1411 |
1400 if (model == NULL) { | 1412 if (model == NULL) { |
1401 /* Just create a default socket if we're given NULL for the model */ | 1413 /* Just create a default socket if we're given NULL for the model */ |
1402 ns = ssl_NewSocket((PRBool)(!ssl_defaults.noLocks), variant); | 1414 ns = ssl_NewSocket((PRBool)(!ssl_defaults.noLocks), variant); |
1403 } else { | 1415 } else { |
1404 sslSocket * ss = ssl_FindSocket(model); | 1416 sslSocket * ss = ssl_FindSocket(model); |
1405 if (ss == NULL || ss->protocolVariant != variant) { | 1417 if (ss == NULL || ss->protocolVariant != variant) { |
1406 SSL_DBG(("%d: SSL[%d]: bad model socket in ssl_ImportFD", | 1418 SSL_DBG(("%d: SSL[%d]: bad model socket in ssl_ImportFD", |
1407 SSL_GETPID(), model)); | 1419 SSL_GETPID(), model)); |
1408 return NULL; | 1420 return NULL; |
1409 } | 1421 } |
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 ssl_DestroySocketContents(ss); | 3053 ssl_DestroySocketContents(ss); |
3042 ssl_DestroyLocks(ss); | 3054 ssl_DestroyLocks(ss); |
3043 PORT_Free(ss); | 3055 PORT_Free(ss); |
3044 ss = NULL; | 3056 ss = NULL; |
3045 } | 3057 } |
3046 ss->protocolVariant = protocolVariant; | 3058 ss->protocolVariant = protocolVariant; |
3047 } | 3059 } |
3048 return ss; | 3060 return ss; |
3049 } | 3061 } |
3050 | 3062 |
OLD | NEW |