Check-in [a288c8e1e1]
Overview
Comment:Merge trunk
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bohagan
Files: files | file ages | folders
SHA3-256: a288c8e1e1001e85f52b9562285c1d1c67120673102a8e61880a3549e43869c7
User & Date: jan.nijtmans on 2024-02-23 09:39:52
Other Links: branch diff | manifest | tags
Context
2024-02-23
10:26
Merge trunk check-in: e6d7dec8c0 user: jan.nijtmans tags: bohagan
09:39
Merge trunk check-in: a288c8e1e1 user: jan.nijtmans tags: bohagan
09:13
Code formatting. TlsCloseProc is no longer needed in Tcl 9. check-in: 2382e3457d user: jan.nijtmans tags: trunk, main
2024-02-22
20:48
Merge trunk check-in: e514e3a5e3 user: jan.nijtmans tags: bohagan
Changes

Modified Makefile.in from [25417b55a9] to [581d650545].

212
213
214
215
216
217
218
219

220
221
222
223
224
225
226
212
213
214
215
216
217
218

219
220
221
222
223
224
225
226







-
+








doc:
	@echo "If you have documentation to create, place the commands to"
	@echo "build the docs in the 'doc:' target.  For example:"
	@echo "        xml2nroff sample.xml > sample.n"
	@echo "        xml2html sample.xml > sample.html"

install: all install-binaries install-libraries install-doc
install: all install-binaries install-libraries

install-binaries: binaries install-lib-binaries install-bin-binaries

#========================================================================
# This rule installs platform-independent files, such as header files.
# The list=...; for p in $$list handles the empty list case x-platform.
#========================================================================

Modified generic/tlsIO.c from [41f450ae51] to [9c5382b06f].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
14
15
16
17
18
19
20

21
22
23
24
25
26
27







-







 * Also work done by the follow people provided the impetus to do this "right":
 *    tclSSL (Colin McCormack, Shared Technology)
 *    SSLtcl (Peter Antman)
 *
 */

#include "tlsInt.h"
#include <errno.h>

/*
 * Forward declarations
 */
static void TlsChannelHandlerTimer(void *clientData);

/*
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73



74
75
76
77
78
79
80
81
82
83
84
85

86
87
88
89
90
91


92

93
94
95


96


97

98
99
100
101
102
103
104
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

97
98


99
100
101
102
103

104
105
106
107
108
109
110
111







-
+















+
+
+












+






+
+
-
+

-
-
+
+

+
+
-
+







    }
    return(0);
}

/*
 *-------------------------------------------------------------------
 *
 * TlsCloseProc --
 * TlsClose2Proc --
 *
 *    This procedure is invoked by the generic IO level to perform
 *    channel-type-specific cleanup when a SSL socket based channel
 *    is closed.
 *
 *    Note: we leave the underlying socket alone, is this right?
 *
 * Results:
 *    0 if successful or POSIX error code if failed.
 *
 * Side effects:
 *    Closes the socket of the channel.
 *
 *-------------------------------------------------------------------
 */
#if TCL_MAJOR_VERSION > 8
#   define TlsCloseProc NULL /* No longer neccessary in Tcl 9 */
#else
static int TlsCloseProc(
    void *instanceData,
    TCL_UNUSED(Tcl_Interp *))
{
    State *statePtr = (State *)instanceData;

    dprintf("TlsCloseProc(%p)", statePtr);

    Tls_Clean(statePtr);
    Tcl_EventuallyFree(statePtr, Tls_Free);
    return TCL_OK;
}
#endif

static int TlsClose2Proc(
    void *instanceData,    /* The socket state. */
    Tcl_Interp *interp,		/* For errors - can be NULL. */
    int flags)			/* Flags to close read and/or write side of channel */
{
    State *statePtr = (State *)instanceData;

    dprintf("TlsClose2Proc(%p)", instanceData);
    dprintf("TlsClose2Proc(%p)", statePtr);

    if (!(flags & (TCL_CLOSE_READ|TCL_CLOSE_WRITE))) {
	return TlsCloseProc(instanceData, interp);
    if ((flags&(TCL_CLOSE_READ|TCL_CLOSE_WRITE))) {
	return EINVAL;
    }
    Tls_Clean(statePtr);
    Tcl_EventuallyFree(statePtr, Tls_Free);
    return EINVAL;
    return TCL_OK;
}

/*
 *------------------------------------------------------*
 *
 * Tls_WaitForConnect --
 *
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
765
766
767
768
769
770
771

772
773
774
775
776
777
778







-







     * to. But this transformation has no such interest. It just passes
     * the request down, unchanged.
     */
    dprintf("Registering our interest in the lower channel (chan=%p)", (void *) downChan);
    watchProc = Tcl_ChannelWatchProc(Tcl_GetChannelType(downChan));
    watchProc(Tcl_GetChannelInstanceData(downChan), mask);


    /*
     * Management of the internal timer.
     */
    if (statePtr->timer != (Tcl_TimerToken) NULL) {
	dprintf("A timer was found, deleting it");
	Tcl_DeleteTimerHandler(statePtr->timer);
	statePtr->timer = (Tcl_TimerToken) NULL;
889
890
891
892
893
894
895
896

897
898
899
900
901
902
903
895
896
897
898
899
900
901

902
903
904
905
906
907
908
909







-
+







 *
 *    Result:
 *        None.
 *
 *------------------------------------------------------*
 */
static void TlsChannelHandlerTimer(void *clientData) {
    State *statePtr = (State *) clientData;
    State *statePtr = (State *)clientData;
    int mask = 0;

    dprintf("Called");

    statePtr->timer = (Tcl_TimerToken) NULL;

    if (BIO_wpending(statePtr->bio)) {
923
924
925
926
927
928
929
930

931
932
933
934
935
936
937
929
930
931
932
933
934
935

936
937
938
939
940
941
942
943







-
+







Tcl_Channel Tls_GetParent(State *statePtr, int maskFlags) {
    dprintf("Requested to get parent of channel %p", statePtr->self);

    if ((statePtr->flags & ~maskFlags) & TLS_TCL_FASTPATH) {
	dprintf("Asked to get the parent channel while we are using FastPath -- returning NULL");
	return(NULL);
    }
    return(Tcl_GetStackedChannel(statePtr->self));
    return Tcl_GetStackedChannel(statePtr->self);
}

/*
 *-------------------------------------------------------------------
 *
 * Tls_ChannelType --
 *