#!/bin/sh
#
# show-attributetypes
#
# Lists the attributetypes supported by the DSA
#
# andrew.findlay@skills-1st.co.uk
#
# $Id$

PROG=`basename "$0"`

# Find the vars file for this example
# The working directory must be in the example subtree

if test -f ../vars
then
	. ../vars
elif test -f vars
then
	. ./vars
else
	echo "$PROG: no vars file in . or .." 1>&2
	exit 1
fi

if test -z "${servername}" -o -z "${serverport}" -o -z "${basedn}"
then
	echo "$PROG: must define servername, serverport and basedn in the vars file" 1>&2
	exit 1
fi

SCHEMA=`ldapsearch -LLL \
	-H "ldap://${servername}:${serverport}/" \
	-s base \
	-b '' \
	-x '(objectclass=*)' subschemasubentry | sed -n -e 's/^subschemasubentry: //ip'`

ldapsearch -LLL \
	-H "ldap://${servername}:${serverport}/" \
	-s base \
	-b "$SCHEMA" \
	-x '(objectclass=*)' attributetypes
