Check-in [8dd7366fcc]
Bounty program for improvements to Tcl and certain Tcl packages.
Overview
Comment: * tls.c (Tls_Clean, ImportObjCmd): Fix cleanup mem leak [Bug 1414045]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8dd7366fccb979d917f5ebd7adf554322f28a308
User & Date: hobbs2 on 2008-03-19 19:59:40
Other Links: manifest | tags
Context
2008-03-19
21:31
Use better Eval APIs, cleaner Tcl_Obj-handling. check-in: 5804017ad3 user: hobbs2 tags: trunk
19:59
* tls.c (Tls_Clean, ImportObjCmd): Fix cleanup mem leak [Bug 1414045] check-in: 8dd7366fcc user: hobbs2 tags: trunk
02:34
Updated the nmake build files with MSVC9 support and fixed to run the test-suite properly. Corrected namespace handling in tls::initlib on Windows. Applied #1890223 to fix handshake on non-blocking sockets check-in: 5fb2d63afa user: patthoyts tags: trunk
Changes

Modified ChangeLog from [c3dbe35daa] to [7fb55e6798].




1
2
3
4
5
6
7






8
9
10
11
12
13
14
15
16


17
18
19
20
21
22
23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
+
+
+
+







+
+
+
+
+
+









+
+







2008-03-19  Jeff Hobbs  <[email protected]>

	* tls.c (Tls_Clean, ImportObjCmd): Fix cleanup mem leak [Bug 1414045]

2008-03-19  Pat Thoyts  <[email protected]>

	* win/Makefile.vc  Updated the nmake build files with MSVC9 support
	* win/rules.vc:    and fixed to run the test-suite properly.
	* win/nmakehlp.c:
	* tls.tcl (tls::initlib): Corrected namespace handling.
	* tls.c: Applied #1890223 to fix handshake on non-blocking sockets

2008-03-17  Jeff Hobbs  <[email protected]>

	* tls.tcl (tls::initlib):     load tls.tcl first and call
	* Makefile.in (pkgIndex.tcl): tls::initlib to load library to
	handle cwd changes. [Bug 1888113]

2007-09-06  Pat Thoyts  <[email protected]>

	* tls.c:           Silence 64 bit integer conversion warnings
	* win/nmakehlp.c:  Update build system to support AMD64 target
	* win/makefile.vc: with MSVC8
	* win/rules.vc:

2007-06-22  Jeff Hobbs  <[email protected]>

	* configure.in, configure, win/makefile.vc (DOTVERSION): bump to 1.6

	* tlsIO.c (TlsInputProc, TlsOutputProc, TlsWatchProc): 
	* tls.c (VerifyCallback): add an state flag in the verify callback
	that prevents possibly recursion (on 'update'). [Bug 1652380]

	* tests/ciphers.test: reworked to make test output cleaner to
	understand missing ciphers (if any)

Modified tls.c from [531e26fa4b] to [ad0e17ca78].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15






-
+







/*
 * Copyright (C) 1997-1999 Matt Newman <[email protected]>
 * some modifications:
 *	Copyright (C) 2000 Ajuba Solutions
 *	Copyright (C) 2002 ActiveState Corporation
 *	Copyright (C) 2004 Starfish Systems 
 *
 * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tls.c,v 1.27 2008/03/19 02:34:21 patthoyts Exp $
 * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tls.c,v 1.28 2008/03/19 19:59:40 hobbs2 Exp $
 *
 * TLS (aka SSL) Channel - can be layered on any bi-directional
 * Tcl_Channel (Note: Requires Trf Core Patch)
 *
 * This was built (almost) from scratch based upon observation of
 * OpenSSL 0.9.2B
 *
859
860
861
862
863
864
865
866

867
868
869
870
871
872
873
859
860
861
862
863
864
865

866
867
868
869
870
871
872
873






-
+







    if (server) {
	statePtr->flags |= TLS_TCL_SERVER;
	SSL_set_accept_state(statePtr->ssl);
    } else {
	SSL_set_connect_state(statePtr->ssl);
    }
    SSL_set_bio(statePtr->ssl, statePtr->p_bio, statePtr->p_bio);
    BIO_set_ssl(statePtr->bio, statePtr->ssl, BIO_CLOSE);
    BIO_set_ssl(statePtr->bio, statePtr->ssl, BIO_NOCLOSE);

    /*
     * End of SSL Init
     */
    Tcl_SetResult(interp, (char *) Tcl_GetChannelName(statePtr->self),
	    TCL_VOLATILE);
    return TCL_OK;
1358
1359
1360
1361
1362
1363
1364
1365
1366








1367
1368
1369
1370
1371
1372
1373
1358
1359
1360
1361
1362
1363
1364


1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379






-
-
+
+
+
+
+
+
+
+







     */

    if (statePtr->timer != (Tcl_TimerToken) NULL) {
	Tcl_DeleteTimerHandler(statePtr->timer);
	statePtr->timer = NULL;
    }

    if (statePtr->ssl) {
	SSL_shutdown(statePtr->ssl);
    if (statePtr->bio) {
	/* This will call SSL_shutdown. Bug 1414045 */
	dprintf(stderr, "BIO_free_all(%p)\n", statePtr->bio);
	BIO_free_all(statePtr->bio);
	statePtr->bio = NULL;
    }
    if (statePtr->ssl) {
	dprintf(stderr, "SSL_free(%p)\n", statePtr->ssl);
	SSL_free(statePtr->ssl);
	statePtr->ssl = NULL;
    }
    if (statePtr->ctx) {
	SSL_CTX_free(statePtr->ctx);
	statePtr->ctx = NULL;
    }