summaryrefslogtreecommitdiffstats
path: root/ipalib/rpc.py
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-09-04 15:49:26 +0200
committerMartin Kosek <mkosek@redhat.com>2012-09-06 14:57:07 +0200
commitcfbea2a99e53dea54aaa0a1670c2bed194c4dc2c (patch)
treef719d2b5f4076ff2b7c39a0a9bab7e48442307fa /ipalib/rpc.py
parent71f900890695dc342480664b5ec7068d2e7f230d (diff)
downloadfreeipa-cfbea2a99e53dea54aaa0a1670c2bed194c4dc2c.tar.gz
freeipa-cfbea2a99e53dea54aaa0a1670c2bed194c4dc2c.tar.xz
freeipa-cfbea2a99e53dea54aaa0a1670c2bed194c4dc2c.zip
Transfer long numbers over XMLRPC
Numeric parameters in ipalib were limited by XMLRPC boundaries for integer (2^31-1) which is too low for some LDAP attributes like DNS SOA serial field. Transfer numbers which are not in XMLRPC boundary as a string and not as a number to workaround this limitation. Int parameter had to be updated to also accept Python's long type as valid int type. https://fedorahosted.org/freeipa/ticket/2568
Diffstat (limited to 'ipalib/rpc.py')
-rw-r--r--ipalib/rpc.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ipalib/rpc.py b/ipalib/rpc.py
index d1764e3e3..fc135f4f6 100644
--- a/ipalib/rpc.py
+++ b/ipalib/rpc.py
@@ -37,7 +37,8 @@ import sys
import os
import errno
import locale
-from xmlrpclib import Binary, Fault, dumps, loads, ServerProxy, Transport, ProtocolError
+from xmlrpclib import (Binary, Fault, dumps, loads, ServerProxy, Transport,
+ ProtocolError, MININT, MAXINT)
import kerberos
from dns import resolver, rdatatype
from dns.exception import DNSException
@@ -94,9 +95,11 @@ def xml_wrap(value):
if type(value) is Decimal:
# transfer Decimal as a string
return unicode(value)
+ if isinstance(value, (int, long)) and (value < MININT or value > MAXINT):
+ return unicode(value)
if isinstance(value, DN):
return str(value)
- assert type(value) in (unicode, int, float, bool, NoneType)
+ assert type(value) in (unicode, int, long, float, bool, NoneType)
return value