Skip to content

Commit 9e66b37

Browse files
chronolawdndx
authored andcommitted
check cert/pkey more carefully
1 parent ba65f5a commit 9e66b37

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/resty/core/socket/tcp.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,17 @@ local server_name_str = ffi.new("ngx_str_t[1]")
4848
local openssl_error_code = ffi.new("int[1]")
4949

5050
local function setclientcert(self, cert, pkey)
51-
if not cert or not pkey then
51+
if not cert and not pkey then
5252
self.client_cert = nil
5353
self.client_pkey = nil
5454
return
5555
end
5656

57+
if not cert or not pkey then
58+
error("client certificate must be supplied with corresponding " ..
59+
"private key", 2)
60+
end
61+
5762
if type(cert) ~= "cdata" then
5863
error("bad client cert type", 2)
5964
end

0 commit comments

Comments
 (0)