Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 May 2015 11:06:10 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r282961 - stable/10/etc/autofs
Message-ID:  <201505151106.t4FB6AXG072576@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Fri May 15 11:06:10 2015
New Revision: 282961
URL: https://svnweb.freebsd.org/changeset/base/282961

Log:
  MFC r280321:
  
  Make the autofs LDAP script cope with server returning entries with
  ENTRY_ATTRIBUTE (eg cn) after the VALUE_ATTRIBUTE (eg automountInformation),
  instead of before.
  
  PR:		198557
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/10/etc/autofs/include_ldap
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/autofs/include_ldap
==============================================================================
--- stable/10/etc/autofs/include_ldap	Fri May 15 11:03:19 2015	(r282960)
+++ stable/10/etc/autofs/include_ldap	Fri May 15 11:06:10 2015	(r282961)
@@ -15,24 +15,41 @@ $1 == "'$ENTRY_ATTRIBUTE':" {
 	key = $2
 }
 
-$1 == "'$VALUE_ATTRIBUTE':" && key {
-	printf "%s%s", key, OFS
-	key = ""
-	for (i=2; i<NF; i++) {
-		printf "%s%s", $(i), OFS
+$1 == "'$VALUE_ATTRIBUTE':" {
+	for (i = 2; i <= NF; i++) {
+		value[i] = $(i)
 	}
-	printf "%s%s", $NF, ORS
+	nvalues = NF
+	b64 = 0
 }
 
 # Double colon after attribute name means the value is in Base64.
-$1 == "'$VALUE_ATTRIBUTE'::" && key {
+$1 == "'$VALUE_ATTRIBUTE'::" {
+	for (i = 2; i <= NF; i++) {
+		value[i] = $(i)
+	}
+	nvalues = NF
+	b64 = 1
+}
+
+# Empty line - end of record.
+NF == 0 && key != "" && nvalues > 0 {
 	printf "%s%s", key, OFS
-	key = ""
-	for (i=2; i<NF; i++) {
-		printf "%s%s", $(i), OFS
+	for (i = 2; i < nvalues; i++) {
+		printf "%s%s", value[i], OFS
+	}
+	if (b64 == 1) {
+		printf "%s", value[nvalues] | "b64decode -rp"
+		close("b64decode -rp")
+		printf "%s", ORS
+	} else {
+		printf "%s%s", value[nvalues], ORS
 	}
-	printf "%s", $NF | "b64decode -rp"
-	close("b64decode -rp")
-	printf "%s", ORS
+}
+
+NF == 0 {
+	key = ""
+	nvalues = 0
+	delete value
 }
 '



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505151106.t4FB6AXG072576>