gcc80: Adjust search paths for base compiler layout.
[dragonfly.git] / etc / autofs / include_ldap
blob4cf70bfeef81df849a6927799e38299ae71d409a
1 #!/bin/sh
3 # $FreeBSD$
6 # Modify this to suit your needs. The "$1" is the map name, eg. "auto_master".
7 # To debug, simply run this script with map name as the only parameter. It's
8 # supposed to output map contents ("key location" pairs) to standard output.
9 SEARCHBASE="ou=$1,dc=example,dc=com"
10 ENTRY_ATTRIBUTE="cn"
11 VALUE_ATTRIBUTE="automountInformation"
13 /usr/local/bin/ldapsearch -LLL -x -o ldif-wrap=no -b "$SEARCHBASE" "$ENTRY_ATTRIBUTE" "$VALUE_ATTRIBUTE" | awk '
14 $1 == "'$ENTRY_ATTRIBUTE':" {
15 key = $2
18 $1 == "'$VALUE_ATTRIBUTE':" {
19 for (i = 2; i <= NF; i++) {
20 value[i] = $(i)
22 nvalues = NF
23 b64 = 0
26 # Double colon after attribute name means the value is in Base64.
27 $1 == "'$VALUE_ATTRIBUTE'::" {
28 for (i = 2; i <= NF; i++) {
29 value[i] = $(i)
31 nvalues = NF
32 b64 = 1
35 # Empty line - end of record.
36 NF == 0 && key != "" && nvalues > 0 {
37 printf "%s%s", key, OFS
38 for (i = 2; i < nvalues; i++) {
39 printf "%s%s", value[i], OFS
41 if (b64 == 1) {
42 printf "%s", value[nvalues] | "b64decode -rp"
43 close("b64decode -rp")
44 printf "%s", ORS
45 } else {
46 printf "%s%s", value[nvalues], ORS
50 NF == 0 {
51 key = ""
52 nvalues = 0
53 delete value