mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 08:00:02 -06:00
Replace a new instance of IPAdmin use in ipa-server-install.
This commit is contained in:
parent
9dc7cf9338
commit
44c1844493
@ -483,15 +483,15 @@ def main():
|
|||||||
if user_input("Do you want to remove old SRV and NS records?", False):
|
if user_input("Do you want to remove old SRV and NS records?", False):
|
||||||
dm_password = read_password("Directory Manager", confirm=False, validate=False)
|
dm_password = read_password("Directory Manager", confirm=False, validate=False)
|
||||||
# Try out the password
|
# Try out the password
|
||||||
|
ldapuri = 'ldap://%s' % api.env.host
|
||||||
try:
|
try:
|
||||||
conn = ipaldap.IPAdmin(api.env.host)
|
conn = ldap2(shared_instance=False, ldap_uri=ldapuri)
|
||||||
conn.do_simple_bind(bindpw=dm_password)
|
conn.connect(bind_dn='cn=directory manager', bind_pw=dm_password)
|
||||||
conn.unbind()
|
except errors.ACIError:
|
||||||
except (ldap.CONNECT_ERROR, ldap.SERVER_DOWN), e:
|
|
||||||
sys.exit("\nUnable to connect to LDAP server %s" % api.env.host)
|
|
||||||
except ldap.INVALID_CREDENTIALS, e :
|
|
||||||
sys.exit("\nThe password provided is incorrect for LDAP server %s" % api.env.host)
|
sys.exit("\nThe password provided is incorrect for LDAP server %s" % api.env.host)
|
||||||
|
except errors.ExecutionError:
|
||||||
|
sys.exit("\nUnable to connect to LDAP server %s" % api.env.host)
|
||||||
|
conn.disconnect()
|
||||||
|
|
||||||
return uninstall(not certs.ipa_self_signed(), dm_password)
|
return uninstall(not certs.ipa_self_signed(), dm_password)
|
||||||
|
|
||||||
@ -846,6 +846,9 @@ try:
|
|||||||
except SystemExit, e:
|
except SystemExit, e:
|
||||||
sys.exit(e)
|
sys.exit(e)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
if options.uninstall:
|
||||||
|
message = "Unexpected error - see ipaserver-uninstall.log for details:\n %s" % str(e)
|
||||||
|
else
|
||||||
message = "Unexpected error - see ipaserver-install.log for details:\n %s" % str(e)
|
message = "Unexpected error - see ipaserver-install.log for details:\n %s" % str(e)
|
||||||
print message
|
print message
|
||||||
message = str(e)
|
message = str(e)
|
||||||
|
@ -262,19 +262,19 @@ class ldap2(CrudBackend, Encoder):
|
|||||||
if tls_keyfile is not None:
|
if tls_keyfile is not None:
|
||||||
_ldap.set_option(_ldap.OPT_X_TLS_KEYFILE, tls_keyfile)
|
_ldap.set_option(_ldap.OPT_X_TLS_KEYFILE, tls_keyfile)
|
||||||
|
|
||||||
|
try:
|
||||||
conn = _ldap.initialize(self.ldap_uri)
|
conn = _ldap.initialize(self.ldap_uri)
|
||||||
if ccache is not None:
|
if ccache is not None:
|
||||||
try:
|
|
||||||
os.environ['KRB5CCNAME'] = ccache
|
os.environ['KRB5CCNAME'] = ccache
|
||||||
conn.sasl_interactive_bind_s('', SASL_AUTH)
|
conn.sasl_interactive_bind_s('', SASL_AUTH)
|
||||||
principal = krbV.CCache(name=ccache,
|
principal = krbV.CCache(name=ccache,
|
||||||
context=krbV.default_context()).principal().name
|
context=krbV.default_context()).principal().name
|
||||||
setattr(context, 'principal', principal)
|
setattr(context, 'principal', principal)
|
||||||
except _ldap.LDAPError, e:
|
|
||||||
_handle_errors(e, **{})
|
|
||||||
else:
|
else:
|
||||||
# no kerberos ccache, use simple bind
|
# no kerberos ccache, use simple bind
|
||||||
conn.simple_bind_s(bind_dn, bind_pw)
|
conn.simple_bind_s(bind_dn, bind_pw)
|
||||||
|
except _ldap.LDAPError, e:
|
||||||
|
_handle_errors(e, **{})
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
def destroy_connection(self):
|
def destroy_connection(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user