diff options
author | trasz <trasz@FreeBSD.org> | 2014-08-31 21:18:23 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2014-08-31 21:18:23 +0000 |
commit | e8d76f86d25e64bdb4a9ab0b15c509c07491724a (patch) | |
tree | 3eebe0ef20c0ab7543612cca9aa64d87a222a4ed /etc/autofs/include_ldap | |
parent | 0ca40bff6c5041cdf647ca146893c61a26796c76 (diff) | |
download | FreeBSD-src-e8d76f86d25e64bdb4a9ab0b15c509c07491724a.zip FreeBSD-src-e8d76f86d25e64bdb4a9ab0b15c509c07491724a.tar.gz |
MFC r270096:
Bring in the new automounter, similar to what's provided in most other
UNIX systems, eg. MacOS X and Solaris. It uses Sun-compatible map format,
has proper kernel support, and LDAP integration.
There are still a few outstanding problems; they will be fixed shortly.
Reviewed by: allanjude@, emaste@, kib@, wblock@ (earlier versions)
Phabric: D523
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'etc/autofs/include_ldap')
-rw-r--r-- | etc/autofs/include_ldap | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/etc/autofs/include_ldap b/etc/autofs/include_ldap new file mode 100644 index 0000000..58970c0 --- /dev/null +++ b/etc/autofs/include_ldap @@ -0,0 +1,38 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# Modify this to suit your needs. The "$1" is the map name, eg. "auto_master". +# To debug, simply run this script with map name as the only parameter. It's +# supposed to output map contents ("key location" pairs) to standard output. +SEARCHBASE="ou=$1,dc=example,dc=com" +ENTRY_ATTRIBUTE="cn" +VALUE_ATTRIBUTE="automountInformation" + +/usr/local/bin/ldapsearch -LLL -x -o ldif-wrap=no -b "$SEARCHBASE" "$ENTRY_ATTRIBUTE" "$VALUE_ATTRIBUTE" | awk ' +$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 + } + printf "%s%s", $NF, ORS +} + +# Double colon after attribute name means the value is in Base64. +$1 == "'$VALUE_ATTRIBUTE'::" && key { + printf "%s%s", key, OFS + key = "" + for (i=2; i<NF; i++) { + printf "%s%s", $(i), OFS + } + printf "%s", $NF | "b64decode -rp" + close("b64decode -rp") + printf "%s", ORS +} +' |