Imported Debian patch 4.0.5-6~numeezy

This commit is contained in:
Alexandre Ellert
2016-02-17 15:07:45 +01:00
committed by Mario Fetka
parent c44de33144
commit 10dfc9587b
1203 changed files with 53869 additions and 241462 deletions

View File

@@ -17,20 +17,18 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import ConfigParser
from optparse import Option, Values, OptionParser, IndentedHelpFormatter, OptionValueError
from copy import copy
from dns import resolver, rdatatype
from dns.exception import DNSException
from six.moves.configparser import SafeConfigParser
from ipapython.dn import DN
from ipaplatform.paths import paths
import dns.name
from six.moves.urllib.parse import urlsplit
import socket
import re
import urlparse
class IPAConfigError(Exception):
def __init__(self, msg=''):
@@ -66,7 +64,7 @@ def check_ip_option(option, opt, value):
def check_dn_option(option, opt, value):
try:
return DN(value)
except Exception as e:
except Exception, e:
raise OptionValueError("option %s: invalid DN: %s" % (opt, e))
class IPAOption(Option):
@@ -107,7 +105,7 @@ class IPAOptionParser(OptionParser):
all_opts_dict = dict([ (o.dest, o) for o in self._get_all_options() if hasattr(o, 'sensitive') ])
safe_opts_dict = {}
for option, value in opts.__dict__.items():
for option, value in opts.__dict__.iteritems():
if all_opts_dict[option].sensitive != True:
safe_opts_dict[option] = value
@@ -154,7 +152,7 @@ class IPAConfig:
config = IPAConfig()
def __parse_config(discover_server = True):
p = SafeConfigParser()
p = ConfigParser.SafeConfigParser()
p.read(paths.IPA_DEFAULT_CONF)
try:
@@ -165,7 +163,7 @@ def __parse_config(discover_server = True):
if discover_server:
try:
s = p.get("global", "xmlrpc_uri")
server = urlsplit(s)
server = urlparse.urlsplit(s)
config.default_server.append(server.netloc)
except:
pass
@@ -178,6 +176,17 @@ def __parse_config(discover_server = True):
def __discover_config(discover_server = True):
servers = []
try:
if not config.default_realm:
try:
# only import krbV when we need it
import krbV
krbctx = krbV.default_context()
config.default_realm = krbctx.default_realm
except ImportError:
pass
if not config.default_realm:
return False
if not config.default_domain:
# try once with REALM -> domain
domain = str(config.default_realm).lower()