summaryrefslogtreecommitdiffstats
path: root/install/tools/ipa-host-net-manage
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2011-02-15 14:11:27 -0500
committerRob Crittenden <rcritten@redhat.com>2011-03-03 14:04:34 -0500
commit64575a411b27dde7919406fdaf5bdec07c6645f3 (patch)
treeab0870adf6181f4457959f44fb936ec705f741d2 /install/tools/ipa-host-net-manage
parenteb6b3c7afc4065f12960f09791f2a5b645abef8b (diff)
downloadfreeipa-64575a411b27dde7919406fdaf5bdec07c6645f3.tar.gz
freeipa-64575a411b27dde7919406fdaf5bdec07c6645f3.tar.xz
freeipa-64575a411b27dde7919406fdaf5bdec07c6645f3.zip
Use ldapi: instead of unsecured ldap: in ipa core tools.
The patch also corrects exception handling in some of the tools. Fix #874
Diffstat (limited to 'install/tools/ipa-host-net-manage')
-rwxr-xr-xinstall/tools/ipa-host-net-manage13
1 files changed, 6 insertions, 7 deletions
diff --git a/install/tools/ipa-host-net-manage b/install/tools/ipa-host-net-manage
index ae8a224aa..5da7b9222 100755
--- a/install/tools/ipa-host-net-manage
+++ b/install/tools/ipa-host-net-manage
@@ -96,13 +96,12 @@ def main():
conn = None
try:
- ldapuri = 'ldap://%s' % installutils.get_fqdn()
try:
- conn = ldap2(shared_instance=False, ldap_uri=ldapuri, base_dn='')
+ conn = ldap2(shared_instance=False, base_dn='')
conn.connect(
bind_dn='cn=directory manager', bind_pw=dirman_password
)
- except errors.LDAPError, lde:
+ except errors.ExecutionError, lde:
sys.exit("An error occurred while connecting to the server.\n%s\n" %
str(lde))
except errors.ACIError, e:
@@ -118,7 +117,7 @@ def main():
print "Plugin Disabled"
except errors.NotFound:
print "Plugin Disabled"
- except errors.LDAPError, lde:
+ except errors.ExecutionError, lde:
print "An error occurred while talking to the server."
print lde
return 0
@@ -136,7 +135,7 @@ def main():
retval = 2
except errors.NotFound:
print "Enabling Plugin"
- except errors.LDAPError, lde:
+ except errors.ExecutionError, lde:
print "An error occurred while talking to the server."
print lde
retval = 1
@@ -184,7 +183,7 @@ def main():
print "An error occurred while talking to the server."
print dbe
retval = 1
- except errors.LDAPError, lde:
+ except errors.ExecutionError, lde:
print "An error occurred while talking to the server."
print lde
retval = 1
@@ -193,7 +192,7 @@ def main():
retval = 1
finally:
- if conn.isconnected():
+ if conn and conn.isconnected():
conn.disconnect()
return retval