~ubuntu-branches/ubuntu/feisty/firefox/feisty-updates

« back to all changes in this revision

Viewing changes to security/nss/lib/ssl/sslsock.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack, Alexander Sack
  • Date: 2008-06-23 15:08:12 UTC
  • mfrom: (1.1.24 upstream)
  • Revision ID: james.westby@ubuntu.com-20080623150812-sxdwhn3dz9pmapvf
Tags: 2.0.0.15+0nobinonly-0ubuntu0.7.4
[ Alexander Sack ]
* New security/stability upstream release (v2.0.0.15)
  - see USN-619-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 * the terms of any one of the MPL, the GPL or the LGPL.
41
41
 *
42
42
 * ***** END LICENSE BLOCK ***** */
43
 
/* $Id: sslsock.c,v 1.44.2.6 2006/10/02 21:17:59 julien.pierre.bugs%sun.com Exp $ */
 
43
/* $Id: sslsock.c,v 1.44.2.9 2007/09/01 04:29:23 nelson%bolyard.com Exp $ */
44
44
#include "seccomon.h"
45
45
#include "cert.h"
46
46
#include "keyhi.h"
186
186
int                     ssl_lock_readers        = 1;    /* default true. */
187
187
char                    ssl_debug;
188
188
char                    ssl_trace;
 
189
FILE *                  ssl_trace_iob;
189
190
char lockStatus[] = "Locks are ENABLED.  ";
190
191
#define LOCKSTATUS_OFFSET 10 /* offset of ENABLED */
191
192
 
211
212
    PORT_Assert(fd->methods->file_type == PR_DESC_LAYERED);
212
213
    PORT_Assert(fd->identity == ssl_layer_id);
213
214
 
 
215
    if (fd->methods->file_type != PR_DESC_LAYERED ||
 
216
        fd->identity != ssl_layer_id) {
 
217
        PORT_SetError(PR_BAD_DESCRIPTOR_ERROR);
 
218
        return NULL;
 
219
    }
 
220
 
214
221
    ss = (sslSocket *)fd->secret;
215
222
    ss->fd = fd;
216
223
    return ss;
217
224
}
218
225
 
 
226
/* This function tries to find the SSL layer in the stack. 
 
227
 * It searches for the first SSL layer at or below the argument fd,
 
228
 * and failing that, it searches for the nearest SSL layer above the 
 
229
 * argument fd.  It returns the private sslSocket from the found layer.
 
230
 */
219
231
sslSocket *
220
232
ssl_FindSocket(PRFileDesc *fd)
221
233
{
1528
1540
    return SECSuccess;
1529
1541
}
1530
1542
 
1531
 
SECStatus PR_CALLBACK
1532
 
ssl_SetTimeout(PRFileDesc *fd, PRIntervalTime timeout)
1533
 
{
1534
 
    sslSocket *ss;
1535
 
 
1536
 
    ss = ssl_GetPrivate(fd);
1537
 
    if (!ss) {
1538
 
        SSL_DBG(("%d: SSL[%d]: bad socket in SetTimeout", SSL_GETPID(), fd));
1539
 
        return SECFailure;
1540
 
    }
1541
 
    SSL_LOCK_READER(ss);
1542
 
    ss->rTimeout = timeout;
1543
 
    if (ss->opt.fdx) {
1544
 
        SSL_LOCK_WRITER(ss);
1545
 
    }
1546
 
    ss->wTimeout = timeout;
1547
 
    if (ss->opt.fdx) {
1548
 
        SSL_UNLOCK_WRITER(ss);
1549
 
    }
1550
 
    SSL_UNLOCK_READER(ss);
1551
 
    return SECSuccess;
1552
 
}
1553
 
 
1554
1543
#define PR_POLL_RW (PR_POLL_WRITE | PR_POLL_READ)
1555
1544
 
1556
1545
static PRInt16 PR_CALLBACK
2080
2069
        char * ev;
2081
2070
        firsttime = 0;
2082
2071
#ifdef DEBUG
 
2072
        ev = getenv("SSLDEBUGFILE");
 
2073
        if (ev && ev[0]) {
 
2074
            ssl_trace_iob = fopen(ev, "w");
 
2075
        }
 
2076
        if (!ssl_trace_iob) {
 
2077
            ssl_trace_iob = stderr;
 
2078
        }
2083
2079
#ifdef TRACE
2084
2080
        ev = getenv("SSLTRACE");
2085
2081
        if (ev && ev[0]) {