bpo-37363: Add audit events for a range of modules (GH-14301)

This commit is contained in:
Steve Dower 2019-06-24 08:42:54 -07:00 committed by GitHub
parent 9bbf4d7083
commit 60419a7e96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 165 additions and 18 deletions

View file

@ -68,6 +68,7 @@ import socket
import collections
import datetime
import warnings
import sys
try:
import ssl
@ -413,6 +414,7 @@ class _NNTPBase:
def _putline(self, line):
"""Internal: send one line to the server, appending CRLF.
The `line` must be a bytes-like object."""
sys.audit("nntplib.NNTP.putline", self, line)
line = line + _CRLF
if self.debugging > 1: print('*put*', repr(line))
self.file.write(line)
@ -1040,6 +1042,7 @@ class NNTP(_NNTPBase):
"""
self.host = host
self.port = port
sys.audit("nntplib.NNTP", self, host, port)
self.sock = socket.create_connection((host, port), timeout)
file = None
try:
@ -1071,6 +1074,7 @@ if _have_ssl:
"""This works identically to NNTP.__init__, except for the change
in default port and the `ssl_context` argument for SSL connections.
"""
sys.audit("nntplib.NNTP", self, host, port)
self.sock = socket.create_connection((host, port), timeout)
file = None
try: