summaryrefslogtreecommitdiffstats
path: root/install/tools/ipa-nis-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-nis-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-nis-manage')
-rwxr-xr-xinstall/tools/ipa-nis-manage15
1 files changed, 7 insertions, 8 deletions
diff --git a/install/tools/ipa-nis-manage b/install/tools/ipa-nis-manage
index 310ee149..d611134e 100755
--- a/install/tools/ipa-nis-manage
+++ b/install/tools/ipa-nis-manage
@@ -107,16 +107,15 @@ 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.ACIError:
- sys.exit("Incorrect password")
- except errors.LDAPError, lde:
+ except errors.ExecutionError, lde:
sys.exit("An error occurred while connecting to the server: %s" % str(lde))
+ except errors.AuthorizationError:
+ sys.exit("Incorrect password")
if args[0] == "enable":
compat = get_entry(compat_dn, conn)
@@ -125,7 +124,7 @@ def main():
entry = None
try:
entry = get_entry(nis_config_dn, conn)
- except errors.LDAPError, lde:
+ except errors.ExecutionError, lde:
print "An error occurred while talking to the server."
print lde
retval = 1
@@ -149,7 +148,7 @@ def main():
entry.get('nsslapd-pluginenabled', [''])[0].lower() == 'off'):
# Already configured, just enable the plugin
print "Enabling plugin"
- ld = LDAPUpdate(dm_password=dirman_password, sub_dict={})
+ ld = LDAPUpdate(dm_password=dirman_password, sub_dict={}, ldapi=True)
if ld.update(files) != True:
retval = 1
mod = {'nsslapd-pluginenabled': 'on'}
@@ -186,7 +185,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