diff options
author | Jan Cholasta <jcholast@redhat.com> | 2011-09-30 10:09:55 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-10-05 10:58:25 +0200 |
commit | 12bfed37d4d22319e2cfadb5d9b460da7e748432 (patch) | |
tree | 58deb5415d489ac25bad5df267a2df523ba142cc /ipa-client/ipaclient | |
parent | a16b5b4c00ca9b82cd40a2c2be22c9e77e0ce64a (diff) | |
download | freeipa-12bfed37d4d22319e2cfadb5d9b460da7e748432.tar.gz freeipa-12bfed37d4d22319e2cfadb5d9b460da7e748432.tar.xz freeipa-12bfed37d4d22319e2cfadb5d9b460da7e748432.zip |
Add a function for formatting network locations of the form host:port for use in URLs.
If the host part is a literal IPv6 address, it must be enclosed in square
brackets (RFC 2732).
ticket 1869
Diffstat (limited to 'ipa-client/ipaclient')
-rw-r--r-- | ipa-client/ipaclient/ipadiscovery.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ipa-client/ipaclient/ipadiscovery.py b/ipa-client/ipaclient/ipadiscovery.py index f6c13fb67..3e31cad37 100644 --- a/ipa-client/ipaclient/ipadiscovery.py +++ b/ipa-client/ipaclient/ipadiscovery.py @@ -25,7 +25,7 @@ import tempfile import ldap from ldap import LDAPError from ipapython.ipautil import run, CalledProcessError, valid_ip, get_ipa_basedn, \ - realm_to_suffix + realm_to_suffix, format_netloc NOT_FQDN = -1 @@ -220,15 +220,15 @@ class IPADiscovery: raise RuntimeError("Creating temporary directory failed: %s" % str(e)) try: - run(["/usr/bin/wget", "-O", "%s/ca.crt" % temp_ca_dir, "http://%s/ipa/config/ca.crt" % thost]) + run(["/usr/bin/wget", "-O", "%s/ca.crt" % temp_ca_dir, "http://%s/ipa/config/ca.crt" % format_netloc(thost)]) except CalledProcessError, e: logging.debug('Retrieving CA from %s failed.\n%s' % (thost, str(e))) return [NOT_IPA_SERVER] #now verify the server is really an IPA server try: - logging.debug("Init ldap with: ldap://"+thost+":389") - lh = ldap.initialize("ldap://"+thost+":389") + logging.debug("Init ldap with: ldap://"+format_netloc(thost, 389)) + lh = ldap.initialize("ldap://"+format_netloc(thost, 389)) ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, True) ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, "%s/ca.crt" % temp_ca_dir) lh.set_option(ldap.OPT_PROTOCOL_VERSION, 3) |