Commit cefa787
fix(NetSSLeay): avoid double-invoking passwd callback in CTX_use_PrivateKey_file
CTX_use_PrivateKey_file previously called loadPrivateKeyFile (which
invokes the password callback) and then re-opened the PEM and
re-invoked the callback to populate ctxState.loadedPrivateKey for
buildSslContext. This broke t/local/05_passwd_cb.t, which counts
callback invocations:
not ok 17 - different cbs per ctx work # each cb called 2x, expected 1
not ok 21 - callback1 called 2 times # got: '3' expected: '2'
Plus spurious "Bad plan: planned 36 tests but ran 40" because the
extra callback calls ran their own is()/ok() assertions.
Fix: loadPrivateKeyFile now takes an optional SslCtxState and
populates loadedPrivateKey + clears the cached SSLContext in a single
pass. The callback runs exactly once per load. use_PrivateKey_file
(SSL-level) benefits too — it now also populates the underlying
CTX's key so the KeyManager sees it.
Test results on t/local/05_passwd_cb.t:
before: Tests: 40 Failed: 6 Parse errors: planned 36 ran 40
after: Tests: 36 Failed: 0 All tests successful.
Full Net-SSLeay bundled suite: 47 files, 2326 tests, all pass.
./jcpan -t Digest::SHA3: 33/33 still green. make: green.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent dc78c62 commit cefa787
2 files changed
Lines changed: 25 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
Lines changed: 23 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4876 | 4876 | | |
4877 | 4877 | | |
4878 | 4878 | | |
4879 | | - | |
4880 | | - | |
4881 | | - | |
4882 | | - | |
4883 | | - | |
4884 | | - | |
4885 | | - | |
4886 | | - | |
4887 | | - | |
4888 | | - | |
4889 | | - | |
4890 | | - | |
4891 | | - | |
4892 | | - | |
4893 | | - | |
4894 | | - | |
4895 | | - | |
4896 | | - | |
4897 | | - | |
4898 | | - | |
4899 | | - | |
4900 | | - | |
4901 | | - | |
4902 | | - | |
4903 | | - | |
4904 | | - | |
4905 | | - | |
| 4879 | + | |
| 4880 | + | |
| 4881 | + | |
| 4882 | + | |
4906 | 4883 | | |
4907 | 4884 | | |
4908 | 4885 | | |
| |||
4933 | 4910 | | |
4934 | 4911 | | |
4935 | 4912 | | |
| 4913 | + | |
4936 | 4914 | | |
4937 | 4915 | | |
4938 | | - | |
4939 | | - | |
4940 | | - | |
4941 | | - | |
| 4916 | + | |
| 4917 | + | |
| 4918 | + | |
4942 | 4919 | | |
4943 | 4920 | | |
4944 | | - | |
| 4921 | + | |
4945 | 4922 | | |
4946 | 4923 | | |
4947 | | - | |
| 4924 | + | |
| 4925 | + | |
| 4926 | + | |
| 4927 | + | |
| 4928 | + | |
| 4929 | + | |
| 4930 | + | |
| 4931 | + | |
4948 | 4932 | | |
4949 | 4933 | | |
4950 | 4934 | | |
4951 | 4935 | | |
4952 | | - | |
| 4936 | + | |
4953 | 4937 | | |
4954 | 4938 | | |
4955 | 4939 | | |
| |||
4969 | 4953 | | |
4970 | 4954 | | |
4971 | 4955 | | |
| 4956 | + | |
| 4957 | + | |
| 4958 | + | |
| 4959 | + | |
| 4960 | + | |
4972 | 4961 | | |
4973 | 4962 | | |
4974 | 4963 | | |
| |||
0 commit comments