Re: [Freeipa-devel] [PATCH] 600 fix ipa-nis-manage

2010-11-09 Thread Jakub Hrozek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/04/2010 08:28 PM, Rob Crittenden wrote:
 ipa-nis-manage was broken because of a signature change to
 ldap2.getentry(). Two new arguments were added before normalize and a
 call to this in ipa-nis-manage was relying on positional arguments. This
 caused ldap2 to add the basedn to what we were trying to get, which was
 something in cn=config, so it failed.
 
 ticket https://fedorahosted.org/freeipa/ticket/414
 
 rob
 

ipa-nis-manage does not throw an exception with this patch anymore

- - Ack

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkzZTWwACgkQHsardTLnvCUuiQCfV4A+vTsMxC7NywfgkLS3PJdB
W9EAn3KmQf2Aqj24BU3eE/0bdZmVX8Tc
=gWc8
-END PGP SIGNATURE-

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 600 fix ipa-nis-manage

2010-11-04 Thread Rob Crittenden
ipa-nis-manage was broken because of a signature change to 
ldap2.getentry(). Two new arguments were added before normalize and a 
call to this in ipa-nis-manage was relying on positional arguments. This 
caused ldap2 to add the basedn to what we were trying to get, which was 
something in cn=config, so it failed.


ticket https://fedorahosted.org/freeipa/ticket/414

rob
From 98c033712ec27c5692246cb6f2d1d91087b98fa5 Mon Sep 17 00:00:00 2001
From: Rob Crittenden rcrit...@redhat.com
Date: Thu, 4 Nov 2010 15:23:25 -0400
Subject: [PATCH] Fix NotFound exception in ipa-nis-manage.

The signature of ldap2.get_entry() changed so normalize wasn't being
handled properly so the basedn was always being appended causing our
entry in cn=config to be not found.

ticket 414
---
 install/tools/ipa-nis-manage |6 --
 ipaserver/plugins/ldap2.py   |2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/install/tools/ipa-nis-manage b/install/tools/ipa-nis-manage
index 706b0e6..6448d17 100755
--- a/install/tools/ipa-nis-manage
+++ b/install/tools/ipa-nis-manage
@@ -37,7 +37,7 @@ error was:
  % sys.exc_value
 sys.exit(1)
 
-nis_config_dn = cn=NIS Server, cn=plugins, cn=config
+nis_config_dn = cn=NIS Server,cn=plugins,cn=config
 compat_dn = cn=Schema Compatibility,cn=plugins,cn=config
 
 def parse_options():
@@ -115,6 +115,8 @@ def main():
 conn.connect(
 bind_dn='cn=directory manager', bind_pw=dirman_password
 )
+except errors.ACIError:
+sys.exit(Incorrect password)
 except errors.LDAPError, lde:
 print An error occurred while connecting to the server.
 print lde
@@ -205,7 +207,7 @@ def main():
 print The %s service may need to be started. % servicemsg
 
 finally:
-if conn:
+if conn and conn.isconnected():
 conn.disconnect()
 
 return retval
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index b5efc42..cbb8ddb 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -702,7 +702,7 @@ class ldap2(CrudBackend, Encoder):
 
 def _generate_modlist(self, dn, entry_attrs, normalize):
 # get original entry
-(dn, entry_attrs_old) = self.get_entry(dn, entry_attrs.keys(), normalize)
+(dn, entry_attrs_old) = self.get_entry(dn, entry_attrs.keys(), normalize=normalize)
 # get_entry returns a decoded entry, encode it back
 # we could call search_s directly, but this saves a lot of code at
 # the expense of a little bit of performace
-- 
1.7.2.1

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel