Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-bareos: use socket.create_connection() to allow AF_INET6 #1646

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- pkglists: update SUSE to have vmware packages [PR #1632]
- backup report: show negative compression [PR #1598]
- core: add build patch for `sprintf` in macos builds [PR #1636]
- python-bareos: use socket.create_connection() to allow AF_INET6 [PR #1646]

### Removed
- plugins: remove old deprecated postgres plugin [PR #1606]
Expand Down Expand Up @@ -51,4 +52,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[PR #1632]: https://github.com/bareos/bareos/pull/1632
[PR #1636]: https://github.com/bareos/bareos/pull/1636
[PR #1637]: https://github.com/bareos/bareos/pull/1637
[PR #1646]: https://github.com/bareos/bareos/pull/1646
[unreleased]: https://github.com/bareos/bareos/tree/master
12 changes: 6 additions & 6 deletions python-bareos/bareos/bsock/lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self):
self.logger.debug("init")
self.status = None
self.address = None
self.timeout = None
self.timeout = 30
self.password = None
self.pam_username = None
self.pam_password = None
Expand Down Expand Up @@ -162,7 +162,8 @@ def connect(
self.dirname = dirname
else:
self.dirname = address
self.timeout = timeout
if timeout:
self.timeout = timeout
self.connection_type = connection_type
self.name = name
if password is None:
Expand Down Expand Up @@ -236,12 +237,11 @@ def __connect(self):
return auth

def __connect_plain(self):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# initialize
try:
if self.timeout:
self.socket.settimeout(self.timeout)
self.socket.connect((self.address, self.port))
self.socket = socket.create_connection(
(self.address, self.port), timeout=self.timeout
)
except (socket.error, socket.gaierror) as e:
self._handleSocketError(e)
raise bareos.exceptions.ConnectionError(
Expand Down