mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
dns_name_values capability added
Added capability to transfer DNSName type between server and client Part of ticket: IPA should allow internationalized domain names https://fedorahosted.org/freeipa/ticket/3169i Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
committed by
Martin Kosek
parent
64d8da21c6
commit
7625c02844
1
API.txt
1
API.txt
@@ -4014,3 +4014,4 @@ capability: optional_uid_params 2.54
|
|||||||
capability: permissions2 2.69
|
capability: permissions2 2.69
|
||||||
capability: primary_key_types 2.83
|
capability: primary_key_types 2.83
|
||||||
capability: datetime_values 2.84
|
capability: datetime_values 2.84
|
||||||
|
capability: dns_name_values 2.88
|
||||||
|
|||||||
4
VERSION
4
VERSION
@@ -89,5 +89,5 @@ IPA_DATA_VERSION=20100614120000
|
|||||||
# #
|
# #
|
||||||
########################################################
|
########################################################
|
||||||
IPA_API_VERSION_MAJOR=2
|
IPA_API_VERSION_MAJOR=2
|
||||||
IPA_API_VERSION_MINOR=87
|
IPA_API_VERSION_MINOR=88
|
||||||
# Last change: pviktori - --dnssec option for dnszone
|
# Last change: mbasti - Added 'dns_name_values' capability
|
||||||
|
|||||||
@@ -50,7 +50,10 @@ capabilities = dict(
|
|||||||
primary_key_types=u'2.83',
|
primary_key_types=u'2.83',
|
||||||
|
|
||||||
# support for datetime values on the client
|
# support for datetime values on the client
|
||||||
datetime_values=u'2.84'
|
datetime_values=u'2.84',
|
||||||
|
|
||||||
|
# dns_name_values: dnsnames as objects
|
||||||
|
dns_name_values=u'2.88',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ from ipapython.ipa_log_manager import root_logger
|
|||||||
from ipapython import ipautil
|
from ipapython import ipautil
|
||||||
from ipapython import kernel_keyring
|
from ipapython import kernel_keyring
|
||||||
from ipapython.cookie import Cookie
|
from ipapython.cookie import Cookie
|
||||||
|
from ipapython.dnsutil import DNSName
|
||||||
from ipalib.text import _
|
from ipalib.text import _
|
||||||
from ipapython.nsslib import NSSHTTPS, NSSConnection
|
from ipapython.nsslib import NSSHTTPS, NSSConnection
|
||||||
from ipalib.krb_utils import KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN, KRB5KRB_AP_ERR_TKT_EXPIRED, \
|
from ipalib.krb_utils import KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN, KRB5KRB_AP_ERR_TKT_EXPIRED, \
|
||||||
@@ -173,6 +174,12 @@ def xml_wrap(value, version):
|
|||||||
else:
|
else:
|
||||||
return value.strftime(LDAP_GENERALIZED_TIME_FORMAT)
|
return value.strftime(LDAP_GENERALIZED_TIME_FORMAT)
|
||||||
|
|
||||||
|
if isinstance(value, DNSName):
|
||||||
|
if capabilities.client_has_capability(version, 'dns_name_values'):
|
||||||
|
return {'__dns_name__': unicode(value)}
|
||||||
|
else:
|
||||||
|
return unicode(value)
|
||||||
|
|
||||||
assert type(value) in (unicode, int, long, float, bool, NoneType)
|
assert type(value) in (unicode, int, long, float, bool, NoneType)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@@ -198,6 +205,9 @@ def xml_unwrap(value, encoding='UTF-8'):
|
|||||||
if type(value) in (list, tuple):
|
if type(value) in (list, tuple):
|
||||||
return tuple(xml_unwrap(v, encoding) for v in value)
|
return tuple(xml_unwrap(v, encoding) for v in value)
|
||||||
if type(value) is dict:
|
if type(value) is dict:
|
||||||
|
if '__dns_name__' in value:
|
||||||
|
return DNSName(value['__dns_name__'])
|
||||||
|
else:
|
||||||
return dict(
|
return dict(
|
||||||
(k, xml_unwrap(v, encoding)) for (k, v) in value.iteritems()
|
(k, xml_unwrap(v, encoding)) for (k, v) in value.iteritems()
|
||||||
)
|
)
|
||||||
@@ -284,6 +294,11 @@ def json_encode_binary(val, version):
|
|||||||
return {'__datetime__': val.strftime(LDAP_GENERALIZED_TIME_FORMAT)}
|
return {'__datetime__': val.strftime(LDAP_GENERALIZED_TIME_FORMAT)}
|
||||||
else:
|
else:
|
||||||
return val.strftime(LDAP_GENERALIZED_TIME_FORMAT)
|
return val.strftime(LDAP_GENERALIZED_TIME_FORMAT)
|
||||||
|
elif isinstance(val, DNSName):
|
||||||
|
if capabilities.client_has_capability(version, 'dns_name_values'):
|
||||||
|
return {'__dns_name__': unicode(val)}
|
||||||
|
else:
|
||||||
|
return unicode(val)
|
||||||
else:
|
else:
|
||||||
return val
|
return val
|
||||||
|
|
||||||
@@ -314,6 +329,8 @@ def json_decode_binary(val):
|
|||||||
elif '__datetime__' in val:
|
elif '__datetime__' in val:
|
||||||
return datetime.datetime.strptime(val['__datetime__'],
|
return datetime.datetime.strptime(val['__datetime__'],
|
||||||
LDAP_GENERALIZED_TIME_FORMAT)
|
LDAP_GENERALIZED_TIME_FORMAT)
|
||||||
|
elif '__dns_name__' in val:
|
||||||
|
return DNSName(val['__dns_name__'])
|
||||||
else:
|
else:
|
||||||
return dict((k, json_decode_binary(v)) for k, v in val.items())
|
return dict((k, json_decode_binary(v)) for k, v in val.items())
|
||||||
elif isinstance(val, list):
|
elif isinstance(val, list):
|
||||||
|
|||||||
Reference in New Issue
Block a user