summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-05-15 11:06:10 +0000
committertrasz <trasz@FreeBSD.org>2015-05-15 11:06:10 +0000
commit907ca38653efe628f91bb6e0b2bcc572bb6972b9 (patch)
tree4172638db943d4f653966e83ead60cce83923cb4 /etc
parent56a7f3d096923d52b89f52c23c808a5739a4a925 (diff)
downloadFreeBSD-src-907ca38653efe628f91bb6e0b2bcc572bb6972b9.zip
FreeBSD-src-907ca38653efe628f91bb6e0b2bcc572bb6972b9.tar.gz
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
Diffstat (limited to 'etc')
-rw-r--r--etc/autofs/include_ldap43
1 files changed, 30 insertions, 13 deletions
diff --git a/etc/autofs/include_ldap b/etc/autofs/include_ldap
index 58970c0..4cf70bf 100644
--- a/etc/autofs/include_ldap
+++ b/etc/autofs/include_ldap
@@ -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
}
'
OpenPOWER on IntegriCloud