Check-in [af42842c6e]
Overview
Comment:Fixed PasswordCallback when using default tls::password callback to pass all parameters
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | main
Files: files | file ages | folders
SHA3-256: af42842c6ee8493004da37e473ac4ee6c608fc638e00c6063c474a1deab5fe87
User & Date: bohagan on 2024-12-08 22:20:24
Other Links: branch diff | manifest | tags
Context
2024-12-09
00:17
Fixed issue where some non-error conditions triggered a call to Tls_Error check-in: 08e1cd7d4f user: bohagan tags: trunk, main
2024-12-08
22:20
Fixed PasswordCallback when using default tls::password callback to pass all parameters check-in: af42842c6e user: bohagan tags: trunk, main
19:24
Documentation cleanup check-in: ef8cbe9bbf user: bohagan tags: trunk, main
Changes
538
539
540
541
542
543
544

545

546
547
548
549
550
551
552
553

554
555
556



557
558
559
560
561
562
563
564
565
566
567
568
538
539
540
541
542
543
544
545

546








547



548
549
550



551

552
553
554
555
556
557
558







+
-
+
-
-
-
-
-
-
-
-
+
-
-
-
+
+
+
-
-
-

-







    int code;
    Tcl_Size len;

    dprintf("Called");

    /* If no callback, use default callback */
    if (statePtr->password == NULL) {
	cmdPtr = Tcl_NewListObj(0, NULL);
	if (Tcl_EvalEx(interp, "tls::password", -1, TCL_EVAL_GLOBAL) == TCL_OK) {
	Tcl_ListObjAppendElement(interp, cmdPtr, Tcl_NewStringObj("tls::password", -1));
	    char *ret = (char *) Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &len);
	    if (len > (Tcl_Size) size-1) {
		len = (Tcl_Size) size-1;
	    }
	    strncpy(buf, ret, (size_t) len);
	    buf[len] = '\0';
	    return (int) len;
	} else {
    } else {
	    return -1;
	}
    }
	cmdPtr = Tcl_DuplicateObj(statePtr->password);
    }


    dprintf("PasswordCallback: create callback command");

    /* Create command to eval with fn, rwflag, and size args */
    cmdPtr = Tcl_DuplicateObj(statePtr->password);
    Tcl_ListObjAppendElement(interp, cmdPtr, Tcl_NewStringObj("password", -1));
    Tcl_ListObjAppendElement(interp, cmdPtr, Tcl_NewIntObj(rwflag));
    Tcl_ListObjAppendElement(interp, cmdPtr, Tcl_NewIntObj(size));

    dprintf("PasswordCallback: eval callback");

    Tcl_Preserve((void *) interp);