Blame SOURCES/authconfig-6.2.8-multiple-ldap-uris.patch

977b74
diff -up authconfig-6.2.8/authconfig-gtk.py.ldap-uris authconfig-6.2.8/authconfig-gtk.py
977b74
--- authconfig-6.2.8/authconfig-gtk.py.ldap-uris	2014-09-29 15:41:20.000000000 +0200
977b74
+++ authconfig-6.2.8/authconfig-gtk.py	2014-09-29 15:49:09.277372121 +0200
977b74
@@ -526,6 +526,7 @@ class Authconfig:
977b74
 		if not ldapserver:
977b74
 			return True
977b74
 		uritovalidate = ldapserver.get_text()
977b74
+		uritovalidate = self.info.ldapHostsToURIs(uritovalidate, False)
977b74
 		return self.info.validateLDAPURI(uritovalidate)
977b74
 
977b74
 	def enable_cacert_download(self, active, xml):
977b74
diff -up authconfig-6.2.8/authinfo.py.ldap-uris authconfig-6.2.8/authinfo.py
977b74
--- authconfig-6.2.8/authinfo.py.ldap-uris	2014-09-29 15:44:28.000000000 +0200
977b74
+++ authconfig-6.2.8/authinfo.py	2014-09-29 15:49:48.156249829 +0200
977b74
@@ -1588,20 +1588,24 @@ class AuthInfo:
977b74
 
977b74
 	def validateLDAPURI(self, s):
977b74
 		"""
977b74
-		Check LDAP URI provided in the form of literal IPv6 address
977b74
-		for correctness.
977b74
-
977b74
-		Return False if IPv6 valid is invalid or urlparse failed to
977b74
-		obtain integer port value, True otherwise.
977b74
+		Check whether LDAP URI is valid.
977b74
 		"""
977b74
-		try:
977b74
-			p = urlparse.urlparse(s).port
977b74
-			return True
977b74
-		except ValueError:
977b74
-			return False
977b74
+		if ',' in s:
977b74
+			uris = s.split(',')
977b74
+		else:
977b74
+			uris = s.split()
977b74
+		for uri in uris:
977b74
+			try:
977b74
+				p = urlparse.urlparse(uri).port
977b74
+			except (ValueError, socket.error):
977b74
+				return False
977b74
+		return True
977b74
 
977b74
-	def ldapHostsToURIs(self, s):
977b74
-		l = s.split(",")
977b74
+	def ldapHostsToURIs(self, s, validate):
977b74
+		if ',' in s:
977b74
+			l = s.split(',')
977b74
+		else:
977b74
+			l = s.split()
977b74
 		ret = ""
977b74
 		for item in l:
977b74
 			if item:
977b74
@@ -1611,9 +1615,8 @@ class AuthInfo:
977b74
 					ret += item
977b74
 				else:
977b74
 					ret += "ldap://" + item + "/"
977b74
-		if not self.validateLDAPURI(ret):
977b74
+		if validate and not self.validateLDAPURI(ret):
977b74
 			self.messageCB(_("Invalid LDAP URI."))
977b74
-			return ""
977b74
 		return ret
977b74
 
977b74
 	# Read LDAP setup from /etc/ldap.conf.
977b74
@@ -1669,7 +1672,7 @@ class AuthInfo:
977b74
 			# We'll pull MD5/DES crypt ("pam_password") from the config
977b74
 			# file, or from the pam_unix PAM config lines.
977b74
 
977b74
-		self.ldapServer = self.ldapHostsToURIs(cleanList(self.ldapServer))
977b74
+		self.ldapServer = self.ldapHostsToURIs(cleanList(self.ldapServer), False)
977b74
 		f.close()
977b74
 		return True
977b74
 
977b74
@@ -2456,12 +2459,12 @@ class AuthInfo:
977b74
 	# suggestions we "know".  The second case is when the user has just made a
977b74
 	# change to one field and we need to update another field to somehow
977b74
 	# compensate for the change.
977b74
-	def update(self):
977b74
+	def update(self, validate=False):
977b74
 		self.smbServers = cleanList(self.smbServers)
977b74
 		self.ipav2Server = cleanList(self.ipav2Server)
977b74
 		self.kerberosKDC = cleanList(self.kerberosKDC)
977b74
 		self.kerberosAdminServer = cleanList(self.kerberosAdminServer)
977b74
-		self.ldapServer = self.ldapHostsToURIs(self.ldapServer)
977b74
+		self.ldapServer = self.ldapHostsToURIs(self.ldapServer, validate)
977b74
 		if self.smbSecurity == "ads":
977b74
 			# As of this writing, an ADS implementation always
977b74
 			# upper-cases the realm name, even if only internally,
977b74
@@ -4024,7 +4027,7 @@ class AuthInfo:
977b74
 			self.ipaUninstall = True
977b74
 
977b74
 	def write(self):
977b74
-		self.update()
977b74
+		self.update(True)
977b74
 		self.prewriteUpdate()
977b74
 		self.setupBackup(PATH_CONFIG_BACKUPS + "/last")
977b74
 		try:
977b74
@@ -4064,7 +4067,7 @@ class AuthInfo:
977b74
 
977b74
 	def writeChanged(self, ref):
977b74
 		self.checkPAMLinked()
977b74
-		self.update()
977b74
+		self.update(True)
977b74
 		self.prewriteUpdate()
977b74
 		self.setupBackup(PATH_CONFIG_BACKUPS + "/last")
977b74
 		ret = True