SSLSocket#syswrite no longer raises IOError after IO#close

Đang mở
#1,156 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c, ruby
Lĩnh vực
backend, security

Hướng nghiên cứu

Start by tracing how SSLSocket#syswrite reaches SSL_write() and how the underlying socket's close is handled, using the reported regression from #1105 as context. Reproduce the supplied UNIXSocket pair example, then add or locate a regression test that checks writing after close raises IOError; the issue names no source or test files, so expect to read around the socket implementation first.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Since bf1a41904e051d31dbb1648019787fe336cec1c8 (#1105), SSLSocket#syswrite no longer raises IOError after IO#close on the underlying socket. SSL_write() still uses the old file descriptor number, so if a new socket gets the same number, the TLS record goes to the new socket.

require "openssl"
require "socket"

key = OpenSSL::PKey::EC.generate("prime256v1")
cert = OpenSSL::X509::Certificate.new
cert.public_key = key
cert.not_before = cert.not_after = Time.now
cert.sign(key, "SHA256")
ctx = OpenSSL::SSL::SSLContext.new
ctx.add_certificate(cert, key)

s1, s2 = UNIXSocket.pair
Thread.new { OpenSSL::SSL::SSLSocket.new(s1, ctx).accept }
ssl = OpenSSL::SSL::SSLSocket.new(s2)
ssl.connect

fd = s2.fileno
s2.close
a, b = UNIXSocket.pair
a.fileno == fd #=> true
ssl.syswrite("hello") #=> 5
b.read_nonblock(100) #=> "\x17\x03\x03\x00\x16..."

I checked the open PRs, but none of them corrects the issue.

Ngôn ngữ chính
C
Star
276
Fork
205
Merge trung bình
21 giờ 17 phút
Pull request đã merge (30 ngày)
17

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ruby/openssl

Tất cả issue của ruby/openssl

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.