summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/bindinstance.py6
-rw-r--r--ipaserver/install/cainstance.py4
-rw-r--r--ipaserver/install/dsinstance.py6
-rw-r--r--ipaserver/install/httpinstance.py2
-rw-r--r--ipaserver/install/krbinstance.py2
-rw-r--r--ipaserver/install/ldapupdate.py2
-rw-r--r--ipaserver/install/replication.py2
-rw-r--r--ipaserver/ipaldap.py2
-rw-r--r--ipaserver/ipautil.py141
-rw-r--r--ipaserver/plugins/join.py6
-rw-r--r--ipaserver/rpcserver.py2
11 files changed, 18 insertions, 157 deletions
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index ce3166122..fa3864a22 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -395,7 +395,7 @@ class BindInstance(service.Service):
self.domain = domain_name
self.forwarders = forwarders
self.host = fqdn.split(".")[0]
- self.suffix = util.realm_to_suffix(self.realm)
+ self.suffix = ipautil.realm_to_suffix(self.realm)
self.ntp = ntp
self.reverse_zone = reverse_zone
self.zone_refresh = zone_refresh
@@ -614,7 +614,7 @@ class BindInstance(service.Service):
self.realm = realm_name
self.domain = domain_name
self.host = fqdn.split(".")[0]
- self.suffix = util.realm_to_suffix(self.realm)
+ self.suffix = ipautil.realm_to_suffix(self.realm)
self.ntp = ntp
self.reverse_zone = reverse_zone
@@ -622,7 +622,7 @@ class BindInstance(service.Service):
def remove_master_dns_records(self, fqdn, realm_name, domain_name):
host = fqdn.split(".")[0]
- suffix = util.realm_to_suffix(realm_name)
+ suffix = ipautil.realm_to_suffix(realm_name)
zone = domain_name
resource_records = (
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index 56b84fcd8..af8d39aa5 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -240,7 +240,7 @@ class CADSInstance(service.Service):
if host_name and realm_name:
self.principal = "dogtagldap/%s@%s" % (self.fqdn, self.realm_name)
if realm_name:
- self.suffix = util.realm_to_suffix(self.realm_name)
+ self.suffix = ipautil.realm_to_suffix(self.realm_name)
self.__setup_sub_dict()
else:
self.suffix = None
@@ -250,7 +250,7 @@ class CADSInstance(service.Service):
subject_base=None):
self.ds_port = ds_port
self.realm_name = realm_name.upper()
- self.suffix = util.realm_to_suffix(self.realm_name)
+ self.suffix = ipautil.realm_to_suffix(self.realm_name)
self.fqdn = host_name
self.dm_password = dm_password
self.domain = domain_name
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 827f69136..359d76664 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -167,7 +167,7 @@ class DsInstance(service.Service):
self.open_ports = []
self.run_init_memberof = True
if realm_name:
- self.suffix = util.realm_to_suffix(self.realm_name)
+ self.suffix = ipautil.realm_to_suffix(self.realm_name)
self.__setup_sub_dict()
else:
self.suffix = None
@@ -218,7 +218,7 @@ class DsInstance(service.Service):
hbac_allow=True):
self.realm_name = realm_name.upper()
self.serverid = realm_to_serverid(self.realm_name)
- self.suffix = util.realm_to_suffix(self.realm_name)
+ self.suffix = ipautil.realm_to_suffix(self.realm_name)
self.fqdn = fqdn
self.dm_password = dm_password
self.domain = domain_name
@@ -251,7 +251,7 @@ class DsInstance(service.Service):
domain_name, dm_password, pkcs12_info=None):
self.realm_name = realm_name.upper()
self.serverid = realm_to_serverid(self.realm_name)
- self.suffix = util.realm_to_suffix(self.realm_name)
+ self.suffix = ipautil.realm_to_suffix(self.realm_name)
self.master_fqdn = master_fqdn
self.fqdn = fqdn
self.dm_password = dm_password
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index e1bbc30a1..a14115115 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -62,7 +62,7 @@ class HTTPInstance(service.Service):
self.realm = realm
self.domain = domain_name
self.dm_password = dm_password
- self.suffix = util.realm_to_suffix(self.realm)
+ self.suffix = ipautil.realm_to_suffix(self.realm)
self.pkcs12_info = pkcs12_info
self.self_signed_ca = self_signed_ca
self.principal = "HTTP/%s@%s" % (self.fqdn, self.realm)
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index f38ae9b42..2faf8e196 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -132,7 +132,7 @@ class KrbInstance(service.Service):
self.host = host_name.split(".")[0]
self.ip = socket.getaddrinfo(host_name, None, socket.AF_UNSPEC, socket.SOCK_STREAM)[0][4][0]
self.domain = domain_name
- self.suffix = util.realm_to_suffix(self.realm)
+ self.suffix = ipautil.realm_to_suffix(self.realm)
self.kdc_password = ipautil.ipa_generate_password()
self.admin_password = admin_password
self.dm_password = admin_password
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index 90b3691a8..e803df8a2 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -79,7 +79,7 @@ class LDAPUpdate:
krbctx = krbV.default_context()
try:
self.realm = krbctx.default_realm
- suffix = util.realm_to_suffix(self.realm)
+ suffix = ipautil.realm_to_suffix(self.realm)
except krbV.Krb5Error:
self.realm = None
suffix = None
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index c8c5bc139..ed4caeb7b 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -105,7 +105,7 @@ class ReplicationManager(object):
self.dirman_passwd = dirman_passwd
self.realm = realm
self.starttls = starttls
- tmp = util.realm_to_suffix(realm)
+ tmp = ipautil.realm_to_suffix(realm)
self.suffix = str(DN(tmp)).lower()
self.need_memberof_fixup = False
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index 7174072a6..23279aa0b 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -34,7 +34,7 @@ import ldap.sasl
import ldapurl
from ldap.controls import LDAPControl
from ldap.ldapobject import SimpleLDAPObject
-from ipaserver import ipautil
+from ipapython import ipautil
from ipalib import errors
from ipapython.ipautil import format_netloc
from ipapython.entity import Entity
diff --git a/ipaserver/ipautil.py b/ipaserver/ipautil.py
deleted file mode 100644
index 311f50ec3..000000000
--- a/ipaserver/ipautil.py
+++ /dev/null
@@ -1,141 +0,0 @@
-# Authors: Simo Sorce <ssorce@redhat.com>
-#
-# Copyright (C) 2007 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-import xmlrpclib
-import re
-
-def realm_to_suffix(realm_name):
- """
- Convert a kerberos realm into the IPA suffix.
- """
- s = realm_name.split(".")
- terms = ["dc=" + x.lower() for x in s]
- return ",".join(terms)
-
-class CIDict(dict):
- """
- Case-insensitive but case-respecting dictionary.
-
- This code is derived from python-ldap's cidict.py module,
- written by stroeder: http://python-ldap.sourceforge.net/
-
- This version extends 'dict' so it works properly with TurboGears.
- If you extend UserDict, isinstance(foo, dict) returns false.
- """
-
- def __init__(self, default=None):
- super(CIDict, self).__init__()
- self._keys = {}
- self.update(default or {})
-
- def __getitem__(self, key):
- return super(CIDict, self).__getitem__(key.lower())
-
- def __setitem__(self, key, value):
- lower_key = key.lower()
- self._keys[lower_key] = key
- return super(CIDict, self).__setitem__(lower_key, value)
-
- def __delitem__(self, key):
- lower_key = key.lower()
- del self._keys[lower_key]
- return super(CIDict, self).__delitem__(key.lower())
-
- def update(self, dict):
- for key in dict.keys():
- self[key] = dict[key]
-
- def has_key(self, key):
- return super(CIDict, self).has_key(key.lower())
-
- def get(self, key, failobj=None):
- try:
- return self[key]
- except KeyError:
- return failobj
-
- def keys(self):
- return self._keys.values()
-
- def items(self):
- result = []
- for k in self._keys.values():
- result.append((k, self[k]))
- return result
-
- def copy(self):
- copy = {}
- for k in self._keys.values():
- copy[k] = self[k]
- return copy
-
- def iteritems(self):
- return self.copy().iteritems()
-
- def iterkeys(self):
- return self.copy().iterkeys()
-
- def setdefault(self, key, value=None):
- try:
- return self[key]
- except KeyError:
- self[key] = value
- return value
-
- def pop(self, key, *args):
- try:
- value = self[key]
- del self[key]
- return value
- except KeyError:
- if len(args) == 1:
- return args[0]
- raise
-
- def popitem(self):
- (lower_key, value) = super(CIDict, self).popitem()
- key = self._keys[lower_key]
- del self._keys[lower_key]
-
- return (key, value)
-
-
-def get_gsserror(e):
- """A GSSError exception looks differently in python 2.4 than it does
- in python 2.5, deal with it."""
-
- try:
- primary = e[0]
- secondary = e[1]
- except Exception:
- primary = e[0][0]
- secondary = e[0][1]
-
- return (primary[0], secondary[0])
-
-def utf8_encode_value(value):
- if isinstance(value, unicode):
- return value.encode('utf-8')
- return value
-
-def utf8_encode_values(values):
- if isinstance(values, list) or isinstance(values, tuple):
- return map(utf8_encode_value, values)
- else:
- return utf8_encode_value(values)
diff --git a/ipaserver/plugins/join.py b/ipaserver/plugins/join.py
index 007336387..e7713dc06 100644
--- a/ipaserver/plugins/join.py
+++ b/ipaserver/plugins/join.py
@@ -21,11 +21,13 @@
Joining an IPA domain
"""
+import krbV
+
from ipalib import api, util
from ipalib import Command, Str
from ipalib import errors
-import krbV
from ipalib import _
+from ipaserver.install import installutils
def get_realm():
"""
@@ -52,7 +54,7 @@ class join(Command):
validate_host,
cli_name='hostname',
doc=_("The hostname to register as"),
- default_from=lambda: unicode(util.get_fqdn()),
+ default_from=lambda: unicode(installutils.get_fqdn()),
autofill=True,
#normalizer=lamda value: value.lower(),
),
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index 83c5c2d67..f9a549f4e 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -31,7 +31,7 @@ from ipalib.backend import Executioner
from ipalib.errors import PublicError, InternalError, CommandError, JSONError, ConversionError, CCacheError, RefererError, InvalidSessionPassword
from ipalib.request import context, Connection, destroy_context
from ipalib.rpc import xml_dumps, xml_loads
-from ipalib.util import make_repr, parse_time_duration
+from ipalib.util import parse_time_duration
from ipalib.dn import DN
from ipaserver.plugins.ldap2 import ldap2
from ipapython.compat import json