Jim Tcl
Check-in [1952b26edf]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:aio: Prefer TLS_method() over TLSv1_2_method()

To avoid a deprecation warning

Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1952b26edfcfe14473996c0edc40624d4ccd0cb5
User & Date: steveb@workware.net.au 2018-11-24 01:24:44
Context
2018-11-25
22:51
appveyor.yml: update OpenSSL DLL paths check-in: 8d046c71be user: steveb@workware.net.au tags: trunk
2018-11-24
01:24
aio: Prefer TLS_method() over TLSv1_2_method()

To avoid a deprecation warning

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 1952b26edf user: steveb@workware.net.au tags: trunk

2018-11-23
12:20
aio: Don't use FD_CLOEXEC with JIM_ANSIC

Bootstrap jimsh sets JIM_ANSIC but FD_CLOEXEC is enabled. This causes FD_CLOEXEC to be set on fd 0 (stdin), thus closing the default fd 0 in the child process during exec.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 0f89f3d934 user: steveb@workware.net.au tags: trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to auto.def.

279
280
281
282
283
284
285




286
287
288
289
290
291
292
        if {[cc-check-includes openssl/ssl.h] && [cc-check-function-in-lib ERR_error_string crypto] && [cc-check-function-in-lib TLSv1_2_method ssl]} {
            msg-result "Enabling SSL"
            define JIM_SSL
            define-append LDLIBS [get-define lib_ERR_error_string] [get-define lib_TLSv1_2_method]
        } elseif {[opt-bool ssl]} {
            user-error "SSL support requires OpenSSL"
        }




    }
}
if {[opt-bool-or-full lineedit]} {
    if {([cc-check-includes termios.h] && [have-feature isatty]) || [have-feature winconsole]} {
        msg-result "Enabling line editing"
        define USE_LINENOISE
        define-append PARSE_UNIDATA_FLAGS -width







>
>
>
>







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
        if {[cc-check-includes openssl/ssl.h] && [cc-check-function-in-lib ERR_error_string crypto] && [cc-check-function-in-lib TLSv1_2_method ssl]} {
            msg-result "Enabling SSL"
            define JIM_SSL
            define-append LDLIBS [get-define lib_ERR_error_string] [get-define lib_TLSv1_2_method]
        } elseif {[opt-bool ssl]} {
            user-error "SSL support requires OpenSSL"
        }
    }
    # Later versions deprecate TLSv1_2_method, but older versions don't have TLS_method
    if {![cc-check-function-in-lib TLS_method ssl]} {
        define-append CCOPTS -DUSE_TLSv1_2_method
    }
}
if {[opt-bool-or-full lineedit]} {
    if {([cc-check-includes termios.h] && [have-feature isatty]) || [have-feature winconsole]} {
        msg-result "Enabling line editing"
        define USE_LINENOISE
        define-append PARSE_UNIDATA_FLAGS -width

Changes to jim-aio.c.

1631
1632
1633
1634
1635
1636
1637




1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652

#if defined(JIM_SSL) && !defined(JIM_BOOTSTRAP)
static void JimAioSslContextDelProc(struct Jim_Interp *interp, void *privData)
{
    SSL_CTX_free((SSL_CTX *)privData);
    ERR_free_strings();
}





static SSL_CTX *JimAioSslCtx(Jim_Interp *interp)
{
    SSL_CTX *ssl_ctx = (SSL_CTX *)Jim_GetAssocData(interp, "ssl_ctx");
    if (ssl_ctx == NULL) {
        SSL_load_error_strings();
        SSL_library_init();
        ssl_ctx = SSL_CTX_new(TLSv1_2_method());
        if (ssl_ctx && SSL_CTX_set_default_verify_paths(ssl_ctx)) {
            SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_NONE, NULL);
            Jim_SetAssocData(interp, "ssl_ctx", JimAioSslContextDelProc, ssl_ctx);
        } else {
            Jim_SetResultString(interp, ERR_error_string(ERR_get_error(), NULL), -1);
        }
    }







>
>
>
>







|







1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656

#if defined(JIM_SSL) && !defined(JIM_BOOTSTRAP)
static void JimAioSslContextDelProc(struct Jim_Interp *interp, void *privData)
{
    SSL_CTX_free((SSL_CTX *)privData);
    ERR_free_strings();
}

#ifdef USE_TLSv1_2_method
#define TLS_method TLSv1_2_method
#endif

static SSL_CTX *JimAioSslCtx(Jim_Interp *interp)
{
    SSL_CTX *ssl_ctx = (SSL_CTX *)Jim_GetAssocData(interp, "ssl_ctx");
    if (ssl_ctx == NULL) {
        SSL_load_error_strings();
        SSL_library_init();
        ssl_ctx = SSL_CTX_new(TLS_method());
        if (ssl_ctx && SSL_CTX_set_default_verify_paths(ssl_ctx)) {
            SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_NONE, NULL);
            Jim_SetAssocData(interp, "ssl_ctx", JimAioSslContextDelProc, ssl_ctx);
        } else {
            Jim_SetResultString(interp, ERR_error_string(ERR_get_error(), NULL), -1);
        }
    }