Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
paramiko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
Modules
paramiko
Commits
c77b97fba5fa
Commit
c77b97fba5fa
authored
11 years ago
by
Jeff Forcier
Browse files
Options
Downloads
Plain Diff
Merge branch '1.10' into 1.11
Conflicts: NEWS
parents
ff495824b0b0
f5fde44762c2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
NEWS
+7
-0
7 additions, 0 deletions
NEWS
paramiko/config.py
+24
-15
24 additions, 15 deletions
paramiko/config.py
tests/test_util.py
+11
-0
11 additions, 0 deletions
tests/test_util.py
with
42 additions
and
15 deletions
NEWS
+
7
−
0
View file @
c77b97fb
...
@@ -12,6 +12,13 @@
...
@@ -12,6 +12,13 @@
Releases
Releases
========
========
v1.10.4 (27th Sep 2013)
-----------------------
* #179: Fix a missing variable causing errors when an ssh_config file has a
non-default AddressFamily set. Thanks to Ed Marshall & Tomaz Muraus for catch
& patch.
v1.11.1 (20th Sep 2013)
v1.11.1 (20th Sep 2013)
-----------------------
-----------------------
...
...
This diff is collapsed.
Click to expand it.
paramiko/config.py
+
24
−
15
View file @
c77b97fb
...
@@ -35,6 +35,6 @@
...
@@ -35,6 +35,6 @@
Returns the host
'
s fqdn on request as string.
Returns the host
'
s fqdn on request as string.
"""
"""
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
,
host
=
None
):
self
.
fqdn
=
None
self
.
fqdn
=
None
self
.
config
=
config
self
.
config
=
config
...
@@ -39,5 +39,6 @@
...
@@ -39,5 +39,6 @@
self
.
fqdn
=
None
self
.
fqdn
=
None
self
.
config
=
config
self
.
config
=
config
self
.
host
=
host
def
__str__
(
self
):
def
__str__
(
self
):
if
self
.
fqdn
is
None
:
if
self
.
fqdn
is
None
:
...
@@ -54,5 +55,6 @@
...
@@ -54,5 +55,6 @@
fqdn
=
None
fqdn
=
None
address_family
=
self
.
config
.
get
(
'
addressfamily
'
,
'
any
'
).
lower
()
address_family
=
self
.
config
.
get
(
'
addressfamily
'
,
'
any
'
).
lower
()
if
address_family
!=
'
any
'
:
if
address_family
!=
'
any
'
:
try
:
family
=
socket
.
AF_INET
if
address_family
==
'
inet
'
\
family
=
socket
.
AF_INET
if
address_family
==
'
inet
'
\
else
socket
.
AF_INET6
else
socket
.
AF_INET6
...
@@ -57,7 +59,8 @@
...
@@ -57,7 +59,8 @@
family
=
socket
.
AF_INET
if
address_family
==
'
inet
'
\
family
=
socket
.
AF_INET
if
address_family
==
'
inet
'
\
else
socket
.
AF_INET6
else
socket
.
AF_INET6
results
=
socket
.
getaddrinfo
(
host
,
results
=
socket
.
getaddrinfo
(
self
.
host
,
None
,
None
,
family
,
family
,
socket
.
SOCK_DGRAM
,
socket
.
SOCK_DGRAM
,
socket
.
IPPROTO_IP
,
socket
.
IPPROTO_IP
,
...
@@ -60,10 +63,11 @@
...
@@ -60,10 +63,11 @@
None
,
None
,
family
,
family
,
socket
.
SOCK_DGRAM
,
socket
.
SOCK_DGRAM
,
socket
.
IPPROTO_IP
,
socket
.
IPPROTO_IP
,
socket
.
AI_CANONNAME
)
socket
.
AI_CANONNAME
)
for
res
in
results
:
for
res
in
results
:
af
,
socktype
,
proto
,
canonname
,
sa
=
res
af
,
socktype
,
proto
,
canonname
,
sa
=
res
if
canonname
and
'
.
'
in
canonname
:
if
canonname
and
'
.
'
in
canonname
:
fqdn
=
canonname
fqdn
=
canonname
break
break
...
@@ -65,8 +69,13 @@
...
@@ -65,8 +69,13 @@
for
res
in
results
:
for
res
in
results
:
af
,
socktype
,
proto
,
canonname
,
sa
=
res
af
,
socktype
,
proto
,
canonname
,
sa
=
res
if
canonname
and
'
.
'
in
canonname
:
if
canonname
and
'
.
'
in
canonname
:
fqdn
=
canonname
fqdn
=
canonname
break
break
# giaerror -> socket.getaddrinfo() can't resolve self.host
# (which is from socket.gethostname()). Fall back to the
# getfqdn() call below.
except
socket
.
gaierror
:
pass
# Handle 'any' / unspecified
# Handle 'any' / unspecified
if
fqdn
is
None
:
if
fqdn
is
None
:
fqdn
=
socket
.
getfqdn
()
fqdn
=
socket
.
getfqdn
()
...
@@ -216,7 +225,7 @@
...
@@ -216,7 +225,7 @@
remoteuser
=
user
remoteuser
=
user
host
=
socket
.
gethostname
().
split
(
'
.
'
)[
0
]
host
=
socket
.
gethostname
().
split
(
'
.
'
)[
0
]
fqdn
=
LazyFqdn
(
config
)
fqdn
=
LazyFqdn
(
config
,
host
)
homedir
=
os
.
path
.
expanduser
(
'
~
'
)
homedir
=
os
.
path
.
expanduser
(
'
~
'
)
replacements
=
{
'
controlpath
'
:
replacements
=
{
'
controlpath
'
:
[
[
...
...
This diff is collapsed.
Click to expand it.
tests/test_util.py
+
11
−
0
View file @
c77b97fb
...
@@ -329,3 +329,14 @@
...
@@ -329,3 +329,14 @@
paramiko
.
util
.
lookup_ssh_host_config
(
host
,
config
),
paramiko
.
util
.
lookup_ssh_host_config
(
host
,
config
),
values
values
)
)
def
test_12_config_addressfamily_and_lazy_fqdn
(
self
):
"""
Ensure the code path honoring non-
'
all
'
AddressFamily doesn
'
t asplode
"""
test_config
=
"""
AddressFamily inet
IdentityFile something_%l_using_fqdn
"""
config
=
paramiko
.
util
.
parse_ssh_config
(
cStringIO
.
StringIO
(
test_config
))
assert
config
.
lookup
(
'
meh
'
)
# will die during lookup() if bug regresses
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment