summaryrefslogtreecommitdiffstats
path: root/ipapython/ipautil.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2016-02-29 13:55:07 +0100
committerJan Cholasta <jcholast@redhat.com>2016-03-03 10:31:55 +0100
commit8df86d5bffdccd4f9e4d16fbd439f23903ec25af (patch)
tree45dd47275fe1fd8b2859b4124f54feaef5c9ecd7 /ipapython/ipautil.py
parent3c57c305add17b95d4fb962efd9e5dfc9bd35efe (diff)
downloadfreeipa-8df86d5bffdccd4f9e4d16fbd439f23903ec25af.tar.gz
freeipa-8df86d5bffdccd4f9e4d16fbd439f23903ec25af.tar.xz
freeipa-8df86d5bffdccd4f9e4d16fbd439f23903ec25af.zip
Move get_ipa_basedn from ipautil to ipadiscovery
The function wasn't used anywhere else. Part of the work for https://fedorahosted.org/freeipa/ticket/5638 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipapython/ipautil.py')
-rw-r--r--ipapython/ipautil.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index 336693c3f..95357fa54 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -57,8 +57,6 @@ PLUGINS_SHARE_DIR = paths.IPA_PLUGINS
GEN_PWD_LEN = 12
-IPA_BASEDN_INFO = 'ipa v2.0'
-
# Having this in krb_utils would cause circular import
KRB5_KDC_UNREACH = 2529639068 # Cannot contact any KDC for requested realm
KRB5KDC_ERR_SVC_UNAVAILABLE = 2529638941 # A service is not available that is
@@ -1134,45 +1132,6 @@ def is_auto_empty_zone(zone):
]]
return zone in automatic_empty_zones
-def get_ipa_basedn(conn):
- """
- Get base DN of IPA suffix in given LDAP server.
-
- None is returned if the suffix is not found
-
- :param conn: Bound LDAPClient that will be used for searching
- """
- entry = conn.get_entry(
- DN(), attrs_list=['defaultnamingcontext', 'namingcontexts'])
-
- # FIXME: import ipalib here to prevent import loops
- from ipalib import errors
-
- contexts = entry['namingcontexts']
- if 'defaultnamingcontext' in entry:
- # If there is a defaultNamingContext examine that one first
- default = entry.single_value['defaultnamingcontext']
- if default in contexts:
- contexts.remove(default)
- contexts.insert(0, default)
- for context in contexts:
- root_logger.debug("Check if naming context '%s' is for IPA" % context)
- try:
- [entry] = conn.get_entries(
- DN(context), conn.SCOPE_BASE, "(info=IPA*)")
- except errors.NotFound:
- root_logger.debug("LDAP server did not return info attribute to "
- "check for IPA version")
- continue
- info = entry.single_value['info'].lower()
- if info != IPA_BASEDN_INFO:
- root_logger.debug("Detected IPA server version (%s) did not match the client (%s)" \
- % (info, IPA_BASEDN_INFO))
- continue
- root_logger.debug("Naming context '%s' is a valid IPA context" % context)
- return DN(context)
-
- return None
def config_replace_variables(filepath, replacevars=dict(), appendvars=dict()):
"""