|
|
ee2f06 |
diff -up authconfig-6.2.8/authconfig-gtk.py.ipav2join authconfig-6.2.8/authconfig-gtk.py
|
|
|
ee2f06 |
--- authconfig-6.2.8/authconfig-gtk.py.ipav2join 2014-09-29 15:18:58.252487444 +0200
|
|
|
ee2f06 |
+++ authconfig-6.2.8/authconfig-gtk.py 2014-09-29 15:19:15.077867285 +0200
|
|
|
ee2f06 |
@@ -2,12 +2,13 @@
|
|
|
ee2f06 |
# -*- coding: UTF-8 -*-
|
|
|
ee2f06 |
#
|
|
|
ee2f06 |
# Authconfig - client authentication configuration program
|
|
|
ee2f06 |
-# Copyright (c) 1999-2008 Red Hat, Inc.
|
|
|
ee2f06 |
+# Copyright (c) 1999-2014 Red Hat, Inc.
|
|
|
ee2f06 |
#
|
|
|
ee2f06 |
# Authors: Preston Brown <pbrown@redhat.com>
|
|
|
ee2f06 |
# Nalin Dahyabhai <nalin@redhat.com>
|
|
|
ee2f06 |
# Matt Wilson <msw@redhat.com>
|
|
|
ee2f06 |
# Tomas Mraz <tmraz@redhat.com>
|
|
|
ee2f06 |
+# Jan Lieskovsky <jlieskov@redhat.com>
|
|
|
ee2f06 |
#
|
|
|
ee2f06 |
# This is free software; you can redistribute it and/or modify it
|
|
|
ee2f06 |
# under the terms of the GNU General Public License as published by
|
|
|
ee2f06 |
@@ -236,6 +237,7 @@ class Authconfig:
|
|
|
ee2f06 |
self.oldrealm = ""
|
|
|
ee2f06 |
self.oldkdc = ""
|
|
|
ee2f06 |
self.oldadminserver = ""
|
|
|
ee2f06 |
+ self.messageParent = None
|
|
|
ee2f06 |
|
|
|
ee2f06 |
def destroy_widget(self, button, widget):
|
|
|
ee2f06 |
widget.destroy()
|
|
|
ee2f06 |
@@ -272,7 +274,9 @@ class Authconfig:
|
|
|
ee2f06 |
response = self.run_on_button(None, "joinwbdomain",
|
|
|
ee2f06 |
"winbindjoin_map", parent)
|
|
|
ee2f06 |
if (response == gtk.RESPONSE_OK):
|
|
|
ee2f06 |
- self.info.joinDomain(True)
|
|
|
ee2f06 |
+ self.messageParent = parent
|
|
|
ee2f06 |
+ self.info.joinDomain(False)
|
|
|
ee2f06 |
+ self.messageParent = None
|
|
|
ee2f06 |
self.info.joinUser = None
|
|
|
ee2f06 |
self.info.joinPassword = None
|
|
|
ee2f06 |
|
|
|
ee2f06 |
@@ -287,7 +291,9 @@ class Authconfig:
|
|
|
ee2f06 |
response = self.run_on_button(None, "joinipadomain",
|
|
|
ee2f06 |
"ipav2join_map", parent)
|
|
|
ee2f06 |
if (response == gtk.RESPONSE_OK):
|
|
|
ee2f06 |
- self.info.joinIPADomain(True)
|
|
|
ee2f06 |
+ self.messageParent = parent
|
|
|
ee2f06 |
+ self.info.joinIPADomain(False)
|
|
|
ee2f06 |
+ self.messageParent = None
|
|
|
ee2f06 |
|
|
|
ee2f06 |
def info_apply(self, map, xml):
|
|
|
ee2f06 |
for entry in map.keys():
|
|
|
ee2f06 |
@@ -796,10 +802,12 @@ class Authconfig:
|
|
|
ee2f06 |
response = self.run_on_button(None, "ldapcacertdownload",
|
|
|
ee2f06 |
"ldapcacert_map", parent)
|
|
|
ee2f06 |
if (response == gtk.RESPONSE_OK):
|
|
|
ee2f06 |
+ self.messageParent = parent
|
|
|
ee2f06 |
self.info.downloadLDAPCACert()
|
|
|
ee2f06 |
+ self.messageParent = None
|
|
|
ee2f06 |
|
|
|
ee2f06 |
def message_callback(self, text):
|
|
|
ee2f06 |
- msg = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, text)
|
|
|
ee2f06 |
+ msg = gtk.MessageDialog(self.messageParent, 0, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, text)
|
|
|
ee2f06 |
msg.set_title(_("Authentication Configuration"))
|
|
|
ee2f06 |
msg.run()
|
|
|
ee2f06 |
msg.destroy()
|
|
|
ee2f06 |
diff -up authconfig-6.2.8/authinfo.py.ipav2join authconfig-6.2.8/authinfo.py
|
|
|
ee2f06 |
--- authconfig-6.2.8/authinfo.py.ipav2join 2014-09-29 15:14:59.000000000 +0200
|
|
|
ee2f06 |
+++ authconfig-6.2.8/authinfo.py 2014-09-29 15:15:55.776367966 +0200
|
|
|
ee2f06 |
@@ -1,7 +1,7 @@
|
|
|
ee2f06 |
# -*- coding: UTF-8 -*-
|
|
|
ee2f06 |
#
|
|
|
ee2f06 |
# Authconfig - client authentication configuration program
|
|
|
ee2f06 |
-# Copyright (c) 1999-2011 Red Hat, Inc.
|
|
|
ee2f06 |
+# Copyright (c) 1999-2014 Red Hat, Inc.
|
|
|
ee2f06 |
#
|
|
|
ee2f06 |
# Authors: Preston Brown <pbrown@redhat.com>
|
|
|
ee2f06 |
# Nalin Dahyabhai <nalin@redhat.com>
|
|
|
ee2f06 |
@@ -10,6 +10,7 @@
|
|
|
ee2f06 |
# Ray Strode <rstrode@redhat.com>
|
|
|
ee2f06 |
# Paolo Bonzini <pbonzini@redhat.com>
|
|
|
ee2f06 |
# Miloslav Trmac <mitr@redhat.com>
|
|
|
ee2f06 |
+# Jan Lieskovsky <jlieskov@redhat.com>
|
|
|
ee2f06 |
#
|
|
|
ee2f06 |
# This is free software; you can redistribute it and/or modify it
|
|
|
ee2f06 |
# under the terms of the GNU General Public License as published by
|
|
|
ee2f06 |
@@ -879,9 +880,17 @@ def feedFork(command, echo, query, respo
|
|
|
ee2f06 |
return 255
|
|
|
ee2f06 |
if not pid:
|
|
|
ee2f06 |
# child
|
|
|
ee2f06 |
- status = os.system(command)
|
|
|
ee2f06 |
+ if query:
|
|
|
ee2f06 |
+ child = Popen([command], shell=True)
|
|
|
ee2f06 |
+ else:
|
|
|
ee2f06 |
+ child = Popen([command], stdin=PIPE, shell=True)
|
|
|
ee2f06 |
+ child.communicate(input=(response or '')+'\n')
|
|
|
ee2f06 |
+
|
|
|
ee2f06 |
+ # wait for the child to terminate & set the returncode
|
|
|
ee2f06 |
+ child.wait()
|
|
|
ee2f06 |
+ status = child.returncode
|
|
|
ee2f06 |
os._exit(status)
|
|
|
ee2f06 |
- output = ""
|
|
|
ee2f06 |
+ (output, error) = ("","")
|
|
|
ee2f06 |
try:
|
|
|
ee2f06 |
i = fcntl.fcntl(master, fcntl.F_GETFL)
|
|
|
ee2f06 |
fcntl.fcntl(master, fcntl.F_SETFL, i & ~os.O_NONBLOCK)
|
|
|
ee2f06 |
@@ -918,13 +927,24 @@ def feedFork(command, echo, query, respo
|
|
|
ee2f06 |
if c:
|
|
|
ee2f06 |
try:
|
|
|
ee2f06 |
output += c
|
|
|
ee2f06 |
+ error += c
|
|
|
ee2f06 |
if echo:
|
|
|
ee2f06 |
sys.stderr.write(c)
|
|
|
ee2f06 |
- if query in output:
|
|
|
ee2f06 |
- os.write(master, response)
|
|
|
ee2f06 |
+ if query and query in output:
|
|
|
ee2f06 |
+ # Search for password prompt start
|
|
|
ee2f06 |
+ index = error.rfind("\r\n")
|
|
|
ee2f06 |
+ os.write(master, response or '')
|
|
|
ee2f06 |
os.write(master, "\r\n")
|
|
|
ee2f06 |
+ if index != -1:
|
|
|
ee2f06 |
+ # Drop password prompt substring from error
|
|
|
ee2f06 |
+ error = "\n" + error[:index]
|
|
|
ee2f06 |
+ else:
|
|
|
ee2f06 |
+ # Drop whole error content, password prompt
|
|
|
ee2f06 |
+ # was the first line
|
|
|
ee2f06 |
+ error = ""
|
|
|
ee2f06 |
output = ""
|
|
|
ee2f06 |
- sys.stderr.write("<...>\n")
|
|
|
ee2f06 |
+ if echo:
|
|
|
ee2f06 |
+ sys.stderr.write("<...>\n")
|
|
|
ee2f06 |
except OSError, (err, text):
|
|
|
ee2f06 |
sys.stderr.write("write: " + text + "\n")
|
|
|
ee2f06 |
os.close(master)
|
|
|
ee2f06 |
@@ -941,7 +961,7 @@ def feedFork(command, echo, query, respo
|
|
|
ee2f06 |
(child, status) = os.waitpid(pid, 0)
|
|
|
ee2f06 |
except OSError, (err, text):
|
|
|
ee2f06 |
sys.stderr.write("waitpid: " + text + "\n")
|
|
|
ee2f06 |
- return status
|
|
|
ee2f06 |
+ return (status, error)
|
|
|
ee2f06 |
|
|
|
ee2f06 |
def isEmptyDir(path):
|
|
|
ee2f06 |
try:
|
|
|
ee2f06 |
@@ -4227,17 +4247,26 @@ class AuthInfo:
|
|
|
ee2f06 |
# Not needed -- "joining" is meaningless for other
|
|
|
ee2f06 |
# models.
|
|
|
ee2f06 |
return
|
|
|
ee2f06 |
- cmd = "/usr/bin/net join %s%s %s%s -U %s" % (
|
|
|
ee2f06 |
+ cmd = PATH_WINBIND_NET + " join %s%s %s%s -U %s" % (
|
|
|
ee2f06 |
domain and "-w " or "", domain,
|
|
|
ee2f06 |
server and "-S " or "", server,
|
|
|
ee2f06 |
self.joinUser)
|
|
|
ee2f06 |
|
|
|
ee2f06 |
if echo:
|
|
|
ee2f06 |
sys.stderr.write("[%s]\n" % cmd)
|
|
|
ee2f06 |
- if self.joinPassword:
|
|
|
ee2f06 |
- status = feedFork(cmd, echo, "sword:", self.joinPassword)
|
|
|
ee2f06 |
+ child = Popen([cmd], shell=True)
|
|
|
ee2f06 |
+ child.communicate()
|
|
|
ee2f06 |
+ status = child.returncode
|
|
|
ee2f06 |
+ else:
|
|
|
ee2f06 |
+ status, error = feedFork(cmd, echo, "sword:", self.joinPassword)
|
|
|
ee2f06 |
+ if echo:
|
|
|
ee2f06 |
+ if status != 0:
|
|
|
ee2f06 |
+ self.messageCB(_("Winbind domain join was not successful."))
|
|
|
ee2f06 |
else:
|
|
|
ee2f06 |
- status = os.system(cmd)
|
|
|
ee2f06 |
+ if status != 0:
|
|
|
ee2f06 |
+ errmsg = _("Winbind domain join was not successful. The net join command failed with the following error:")
|
|
|
ee2f06 |
+ errmsg += "\n" + error
|
|
|
ee2f06 |
+ self.messageCB(errmsg)
|
|
|
ee2f06 |
return status == 0
|
|
|
ee2f06 |
|
|
|
ee2f06 |
def joinIPADomain(self, echo):
|
|
|
ee2f06 |
@@ -4258,22 +4287,30 @@ class AuthInfo:
|
|
|
ee2f06 |
realm and "--realm=" or "", realm,
|
|
|
ee2f06 |
principal and "--principal=" or "", principal,
|
|
|
ee2f06 |
nontp,
|
|
|
ee2f06 |
- password and "-W" or "")
|
|
|
ee2f06 |
-
|
|
|
ee2f06 |
+ not echo and "--unattended" or "-W")
|
|
|
ee2f06 |
+
|
|
|
ee2f06 |
if echo:
|
|
|
ee2f06 |
sys.stderr.write("[%s]\n" % cmd)
|
|
|
ee2f06 |
- if self.joinPassword:
|
|
|
ee2f06 |
- status = feedFork(cmd, echo, "sword:", self.joinPassword)
|
|
|
ee2f06 |
+ child = Popen([cmd], shell=True)
|
|
|
ee2f06 |
+ child.communicate()
|
|
|
ee2f06 |
+ status = child.returncode
|
|
|
ee2f06 |
else:
|
|
|
ee2f06 |
- status = os.system(cmd)
|
|
|
ee2f06 |
+ status, error = feedFork(cmd, echo, '', password)
|
|
|
ee2f06 |
+
|
|
|
ee2f06 |
if status == 0:
|
|
|
ee2f06 |
self.ipaDomainJoined = True
|
|
|
ee2f06 |
+ if echo:
|
|
|
ee2f06 |
+ if status != 0:
|
|
|
ee2f06 |
+ self.messageCB(_("IPAv2 domain join was not successful."))
|
|
|
ee2f06 |
else:
|
|
|
ee2f06 |
- self.messageCB(_("IPAv2 domain join was not succesful. The ipa-client-install command failed."))
|
|
|
ee2f06 |
+ if status != 0:
|
|
|
ee2f06 |
+ errmsg = _("IPAv2 domain join was not successful. The ipa-client-install command failed with the following error:")
|
|
|
ee2f06 |
+ errmsg += "\n" + error
|
|
|
ee2f06 |
+ self.messageCB(errmsg)
|
|
|
ee2f06 |
return status == 0
|
|
|
ee2f06 |
|
|
|
ee2f06 |
def uninstallIPA(self):
|
|
|
ee2f06 |
- cmd = PATH_IPA_CLIENT_INSTALL + " --uninstall --noac"
|
|
|
ee2f06 |
+ cmd = PATH_IPA_CLIENT_INSTALL + " --uninstall --noac --unattended"
|
|
|
ee2f06 |
os.system(cmd)
|
|
|
ee2f06 |
|
|
|
ee2f06 |
def toggleCachingService(self, nostart):
|