Fix sttring overrun issue
parent
646d2a19da
commit
700f1a41b5
|
@ -72,7 +72,7 @@ concurrency.promises byte-arrays ;
|
|||
"resource:extra/openssl/test/server.pem" >>key-file
|
||||
"resource:extra/openssl/test/root.pem" >>ca-file
|
||||
"resource:extra/openssl/test/dh1024.pem" >>dh-file
|
||||
"password" >byte-array >>password
|
||||
"password" >>password
|
||||
[
|
||||
"127.0.0.1" 0 <inet4> <secure> ascii <server> [
|
||||
dup addr>> addrspec>> port>> "port" get fulfill
|
||||
|
|
|
@ -7,7 +7,7 @@ openssl secure-socket-backend [
|
|||
"resource:extra/openssl/test/server.pem" >>key-file
|
||||
"resource:extra/openssl/test/root.pem" >>ca-file
|
||||
"resource:extra/openssl/test/dh1024.pem" >>dh-file
|
||||
"password" ascii string>alien >>password
|
||||
"password" >>password
|
||||
[ ] with-secure-context
|
||||
] unit-test
|
||||
|
||||
|
@ -15,7 +15,7 @@ openssl secure-socket-backend [
|
|||
<secure-config>
|
||||
"resource:extra/openssl/test/server.pem" >>key-file
|
||||
"resource:extra/openssl/test/root.pem" >>ca-file
|
||||
"wrong password" ascii string>alien >>password
|
||||
"wrong password" >>password
|
||||
[ ] with-secure-context
|
||||
] must-fail
|
||||
] with-variable
|
||||
|
|
|
@ -5,7 +5,7 @@ math.order combinators init alien alien.c-types alien.strings libc
|
|||
continuations destructors debugger inspector
|
||||
locals unicode.case
|
||||
openssl.libcrypto openssl.libssl
|
||||
io.backend io.ports io.files io.encodings.ascii io.sockets.secure ;
|
||||
io.backend io.ports io.files io.encodings.8-bit io.sockets.secure ;
|
||||
IN: openssl
|
||||
|
||||
! This code is based on http://www.rtfm.com/openssl-examples/
|
||||
|
@ -68,7 +68,7 @@ TUPLE: openssl-context < secure-context aliens ;
|
|||
] alien-callback ;
|
||||
|
||||
: default-pasword ( ctx -- alien )
|
||||
[ config>> password>> malloc-byte-array ] [ aliens>> ] bi
|
||||
[ config>> password>> latin1 malloc-string ] [ aliens>> ] bi
|
||||
[ push ] [ drop ] 2bi ;
|
||||
|
||||
: set-default-password ( ctx -- )
|
||||
|
@ -181,7 +181,7 @@ M: ssl-handle dispose*
|
|||
X509_get_subject_name
|
||||
NID_commonName 256 <byte-array>
|
||||
[ 256 X509_NAME_get_text_by_NID ] keep
|
||||
swap -1 = [ drop f ] [ ascii alien>string ] if ;
|
||||
swap -1 = [ drop f ] [ latin1 alien>string ] if ;
|
||||
|
||||
: check-common-name ( host ssl-handle -- )
|
||||
SSL_get_peer_certificate common-name 2dup [ >lower ] bi@ =
|
||||
|
|
Loading…
Reference in New Issue