From a600c3dd8801e8d77a033cbb2c425bff8ff11c70 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Sat, 21 Mar 2015 09:42:37 +0000 Subject: [PATCH] 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 MFC after: 1 month Sponsored by: The FreeBSD Foundation --- etc/autofs/include_ldap | 45 ++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/etc/autofs/include_ldap b/etc/autofs/include_ldap index 58970c06a449..4cf70bfeef81 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 0 { + printf "%s%s", key, 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 + } +} + +NF == 0 { + key = "" + nvalues = 0 + delete value } '