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
This commit is contained in:
parent
771df80a72
commit
a600c3dd88
@ -15,24 +15,41 @@ $1 == "'$ENTRY_ATTRIBUTE':" {
|
|||||||
key = $2
|
key = $2
|
||||||
}
|
}
|
||||||
|
|
||||||
$1 == "'$VALUE_ATTRIBUTE':" && key {
|
$1 == "'$VALUE_ATTRIBUTE':" {
|
||||||
printf "%s%s", key, OFS
|
for (i = 2; i <= NF; i++) {
|
||||||
key = ""
|
value[i] = $(i)
|
||||||
for (i=2; i<NF; i++) {
|
|
||||||
printf "%s%s", $(i), OFS
|
|
||||||
}
|
}
|
||||||
printf "%s%s", $NF, ORS
|
nvalues = NF
|
||||||
|
b64 = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Double colon after attribute name means the value is in Base64.
|
# Double colon after attribute name means the value is in Base64.
|
||||||
$1 == "'$VALUE_ATTRIBUTE'::" && key {
|
$1 == "'$VALUE_ATTRIBUTE'::" {
|
||||||
printf "%s%s", key, OFS
|
for (i = 2; i <= NF; i++) {
|
||||||
key = ""
|
value[i] = $(i)
|
||||||
for (i=2; i<NF; i++) {
|
|
||||||
printf "%s%s", $(i), OFS
|
|
||||||
}
|
}
|
||||||
printf "%s", $NF | "b64decode -rp"
|
nvalues = NF
|
||||||
close("b64decode -rp")
|
b64 = 1
|
||||||
printf "%s", ORS
|
}
|
||||||
|
|
||||||
|
# Empty line - end of record.
|
||||||
|
NF == 0 && key != "" && nvalues > 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
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user