mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-27 03:20:22 +08:00
10a3a1b9c9
================ Written by Hallvard B. Furuseth and placed into the public domain. This software is not subject to any license of the University of Oslo. ================ searchexample.conf needs core.schema, otherwise it fails on the suffix DN. searchexample.sh has a spurious 'sleep', probably from testing. Also, I suggest 'chmod +x searchexample.sh'. Hallvard B. Furuseth <h.b.furuseth@usit.uio.no>, May 2002.
46 lines
802 B
Bash
46 lines
802 B
Bash
#! /bin/sh
|
|
# $OpenLDAP$
|
|
## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
|
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
while [ 1 ]; do
|
|
read TAG VALUE
|
|
if [ $? -ne 0 ]; then
|
|
break
|
|
fi
|
|
case "$TAG" in
|
|
base:)
|
|
BASE=$VALUE
|
|
;;
|
|
filter:)
|
|
FILTER=$VALUE
|
|
;;
|
|
# include other parameters here
|
|
esac
|
|
done
|
|
|
|
LOGIN=`echo $FILTER | sed -e 's/.*=\(.*\))/\1/'`
|
|
|
|
PWLINE=`grep -i "^$LOGIN" /etc/passwd`
|
|
|
|
#sleep 60
|
|
# if we found an entry that matches
|
|
if [ $? = 0 ]; then
|
|
echo $PWLINE | awk -F: '{
|
|
printf("dn: cn=%s,%s\n", $1, base);
|
|
printf("objectclass: top\n");
|
|
printf("objectclass: person\n");
|
|
printf("cn: %s\n", $1);
|
|
printf("cn: %s\n", $5);
|
|
printf("sn: %s\n", $1);
|
|
printf("uid: %s\n", $1);
|
|
}' base="$BASE"
|
|
echo ""
|
|
fi
|
|
|
|
# result
|
|
echo "RESULT"
|
|
echo "code: 0"
|
|
|
|
exit 0
|