summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2011-09-30 10:09:55 +0200
committerMartin Kosek <mkosek@redhat.com>2011-10-05 10:58:25 +0200
commit12bfed37d4d22319e2cfadb5d9b460da7e748432 (patch)
tree58deb5415d489ac25bad5df267a2df523ba142cc /install
parenta16b5b4c00ca9b82cd40a2c2be22c9e77e0ce64a (diff)
downloadfreeipa-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 'install')
-rwxr-xr-xinstall/tools/ipa-csreplica-manage8
-rwxr-xr-xinstall/tools/ipa-replica-conncheck4
-rwxr-xr-xinstall/tools/ipa-replica-install6
-rwxr-xr-xinstall/tools/ipa-server-install2
4 files changed, 10 insertions, 10 deletions
diff --git a/install/tools/ipa-csreplica-manage b/install/tools/ipa-csreplica-manage
index 39d505654..c33f3bc5f 100755
--- a/install/tools/ipa-csreplica-manage
+++ b/install/tools/ipa-csreplica-manage
@@ -111,7 +111,7 @@ class CSReplicationManager(replication.ReplicationManager):
dn = 'cn=%s,cn=mapping tree,cn=config' % esc1_suffix
# TODO: should we detect proto/port somehow ?
mod = [(ldap.MOD_DELETE, 'nsslapd-referral',
- 'ldap://%s:%s/%s' % (hostname, PORT, esc2_suffix))]
+ 'ldap://%s/%s' % (ipautil.format_netloc(hostname, PORT), esc2_suffix))]
try:
self.conn.modify_s(dn, mod)
@@ -226,7 +226,7 @@ def del_link(realm, replica1, replica2, dirman_passwd, force=False):
except errors.NotFound:
sys.exit("'%s' has no replication agreement for '%s'" % (replica1, replica2))
except ldap.SERVER_DOWN, e:
- sys.exit("Unable to connect to %s:%d: %s" % (replica1, PORT, convert_error(e)))
+ sys.exit("Unable to connect to %s: %s" % (ipautil.format_netloc(replica1, PORT), convert_error(e)))
except Exception, e:
sys.exit("Failed to get data from '%s': %s" % (replica1, convert_error(e)))
@@ -322,7 +322,7 @@ def add_link(realm, replica1, replica2, dirman_passwd, options):
except ldap.NO_SUCH_OBJECT:
sys.exit('%s does not have a CA configured.' % replica2)
except ldap.SERVER_DOWN, e:
- sys.exit("Unable to connect to %s:636: %s" % (replica2, convert_error(e)))
+ sys.exit("Unable to connect to %s: %s" % (ipautil.format_netloc(replica2, 636), convert_error(e)))
except Exception, e:
sys.exit("Failed to get data from '%s': %s" % (replica1, convert_error(e)))
@@ -337,7 +337,7 @@ def add_link(realm, replica1, replica2, dirman_passwd, options):
except ldap.NO_SUCH_OBJECT:
sys.exit("Cannot find replica '%s'" % replica1)
except ldap.SERVER_DOWN, e:
- sys.exit("Unable to connect to %s:%d %s" % (replica1, PORT, convert_error(e)))
+ sys.exit("Unable to connect to %s %s" % (ipautil.format_netloc(replica1, PORT), convert_error(e)))
except Exception, e:
sys.exit("Failed to get data from '%s': %s" % (replica1, convert_error(e)))
diff --git a/install/tools/ipa-replica-conncheck b/install/tools/ipa-replica-conncheck
index 48ff336ff..09567d6eb 100755
--- a/install/tools/ipa-replica-conncheck
+++ b/install/tools/ipa-replica-conncheck
@@ -201,8 +201,8 @@ def configure_krb5_conf(realm, kdc, filename):
#the following are necessary only if DNS discovery does not work
#[realms]
- realms_info =[{'name':'kdc', 'type':'option', 'value':kdc+':88'},
- {'name':'admin_server', 'type':'option', 'value':kdc+':749'}]
+ realms_info =[{'name':'kdc', 'type':'option', 'value':ipautil.format_netloc(kdc, 88)},
+ {'name':'admin_server', 'type':'option', 'value':ipautil.format_netloc(kdc, 749)}]
realms = [{'name':realm, 'type':'subsection', 'value':realms_info}]
opts.append({'name':'realms', 'type':'section', 'value':realms})
diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install
index af317cde5..624e6ea82 100755
--- a/install/tools/ipa-replica-install
+++ b/install/tools/ipa-replica-install
@@ -227,7 +227,7 @@ def install_dns_records(config, options):
# before our DS server is installed.
cur_uri = api.Backend.ldap2.ldap_uri
object.__setattr__(api.Backend.ldap2, 'ldap_uri',
- 'ldaps://%s' % config.master_host_name)
+ 'ldaps://%s' % ipautil.format_netloc(config.master_host_name))
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager",
bind_pw=config.dirman_password,
tls_cacertfile=CACERT)
@@ -355,7 +355,7 @@ def main():
fd.write("basedn=" + util.realm_to_suffix(config.realm_name) + "\n")
fd.write("realm=" + config.realm_name + "\n")
fd.write("domain=" + config.domain_name + "\n")
- fd.write("xmlrpc_uri=https://%s/ipa/xml\n" % config.host_name)
+ fd.write("xmlrpc_uri=https://%s/ipa/xml\n" % ipautil.format_netloc(config.host_name))
fd.write("ldap_uri=ldapi://%%2fvar%%2frun%%2fslapd-%s.socket\n" % dsinstance.realm_to_serverid(config.realm_name))
if ipautil.file_exists(config.dir + "/cacert.p12"):
fd.write("enable_ra=True\n")
@@ -392,7 +392,7 @@ def main():
install_ca_cert(config)
# Try out the password
- ldapuri = 'ldaps://%s' % config.master_host_name
+ ldapuri = 'ldaps://%s' % ipautil.format_netloc(config.master_host_name)
try:
conn = ldap2(shared_instance=False, ldap_uri=ldapuri, base_dn='')
conn.connect(bind_dn='cn=directory manager',
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index 7d961cb87..36efd2b82 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -830,7 +830,7 @@ def main():
fd.write("basedn=" + util.realm_to_suffix(realm_name) + "\n")
fd.write("realm=" + realm_name + "\n")
fd.write("domain=" + domain_name + "\n")
- fd.write("xmlrpc_uri=https://%s/ipa/xml\n" % host_name)
+ fd.write("xmlrpc_uri=https://%s/ipa/xml\n" % format_netloc(host_name))
fd.write("ldap_uri=ldapi://%%2fvar%%2frun%%2fslapd-%s.socket\n" % dsinstance.realm_to_serverid(realm_name))
fd.write("enable_ra=True\n")
if not options.selfsign: