2000-05-16 00:31:59 +08:00
|
|
|
#! /bin/sh
|
|
|
|
# $OpenLDAP$
|
2003-01-04 04:20:47 +08:00
|
|
|
## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
2000-05-16 00:31:59 +08:00
|
|
|
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
1998-08-09 08:43:13 +08:00
|
|
|
|
|
|
|
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`
|
|
|
|
|
2002-05-15 13:17:08 +08:00
|
|
|
#sleep 60
|
1998-08-09 08:43:13 +08:00
|
|
|
# if we found an entry that matches
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
echo $PWLINE | awk -F: '{
|
|
|
|
printf("dn: cn=%s,%s\n", $1, base);
|
2000-05-16 00:31:59 +08:00
|
|
|
printf("objectclass: top\n");
|
|
|
|
printf("objectclass: person\n");
|
1998-08-09 08:43:13 +08:00
|
|
|
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
|