]> git.sur5r.net Git - openldap/blob - servers/slapd/back-shell/searchexample.sh
Filled in Cyrus SASL authz/storage callbacks for all backends
[openldap] / servers / slapd / back-shell / searchexample.sh
1 #!/bin/sh
2
3 while [ 1 ]; do
4         read TAG VALUE
5         if [ $? -ne 0 ]; then
6                 break
7         fi
8         case "$TAG" in
9                 base:)
10                 BASE=$VALUE
11                 ;;
12                 filter:)
13                 FILTER=$VALUE
14                 ;;
15                 # include other parameters here
16         esac
17 done
18
19 LOGIN=`echo $FILTER | sed -e 's/.*=\(.*\))/\1/'`
20
21 PWLINE=`grep -i "^$LOGIN" /etc/passwd`
22
23 sleep 60
24 # if we found an entry that matches
25 if [ $? = 0 ]; then
26         echo $PWLINE | awk -F: '{
27                 printf("dn: cn=%s,%s\n", $1, base);
28                 printf("cn: %s\n", $1);
29                 printf("cn: %s\n", $5);
30                 printf("sn: %s\n", $1);
31                 printf("uid: %s\n", $1);
32         }' base="$BASE"
33         echo ""
34 fi
35
36 # result
37 echo "RESULT"
38 echo "code: 0"
39
40 exit 0