summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrcritten@redhat.com <rcritten@redhat.com>2007-08-27 13:45:28 -0400
committerrcritten@redhat.com <rcritten@redhat.com>2007-08-27 13:45:28 -0400
commita5b7e3f56b8a3bddfafa1811061cd146f7c818e1 (patch)
treec033d05a1fd0dcdf3e4417a6be567398b1a91c78
parentc7c8aa09269895a9cb9c02e87c5289a2461d647a (diff)
downloadfreeipa-a5b7e3f56b8a3bddfafa1811061cd146f7c818e1.tar.gz
freeipa-a5b7e3f56b8a3bddfafa1811061cd146f7c818e1.tar.xz
freeipa-a5b7e3f56b8a3bddfafa1811061cd146f7c818e1.zip
Include any LDAP error strings in XML-RPC Fault exceptions
Put a try/except around attempts to determine user uniqueness
-rw-r--r--ipa-server/xmlrpc-server/funcs.py7
-rw-r--r--ipa-server/xmlrpc-server/ipaxmlrpc.py8
2 files changed, 10 insertions, 5 deletions
diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py
index f388f3f4f..8994be915 100644
--- a/ipa-server/xmlrpc-server/funcs.py
+++ b/ipa-server/xmlrpc-server/funcs.py
@@ -192,11 +192,10 @@ class IPAServer:
uid = self.__safe_filter(uid)
filter = "(&(uid=%s)(objectclass=posixAccount))" % uid
- entry = self.__get_entry(self.basedn, filter, ['dn','uid'], opts)
-
- if entry is not None:
+ try:
+ entry = self.__get_entry(self.basedn, filter, ['dn','uid'], opts)
return 0
- else:
+ except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
return 1
def get_user_by_uid (self, uid, sattrs=None, opts=None):
diff --git a/ipa-server/xmlrpc-server/ipaxmlrpc.py b/ipa-server/xmlrpc-server/ipaxmlrpc.py
index 3f30f8fbd..32a7e8089 100644
--- a/ipa-server/xmlrpc-server/ipaxmlrpc.py
+++ b/ipa-server/xmlrpc-server/ipaxmlrpc.py
@@ -36,6 +36,7 @@ from mod_python import apache
import ipaserver
import funcs
from ipa import ipaerror
+import ldap
import string
import base64
@@ -150,7 +151,12 @@ class ModXMLRPCRequestHandler(object):
response = dumps(response, methodresponse=1, allow_none=1)
except ipaerror.IPAError, e:
self.traceback = True
- response = dumps(Fault(e.code, str(e)))
+
+ if (isinstance(e.detail, ldap.LDAPError)):
+u err = ": %s: %s" % (e.detail.args[0]['desc'], e.detail.args[0].get('info',''))
+ response = dumps(Fault(e.code, str(e) + err))
+ else:
+ response = dumps(Fault(e.code, str(e)))
except:
self.traceback = True
# report exception back to server