##  Copyright (c) 2004  Code Fusion cc
##
##  This  program is free  software; you can redistribute  it and/or
##  modify it  under the terms of the GNU  General Public License as
##  published by the  Free Software Foundation; either version 2, or
##  (at your option) any later version.
##
##  This program is  distributed in the hope that it will be useful,
##  but WITHOUT  ANY WARRANTY; without even the  implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
##  General Public License for more details.
##
##  You can view the  GNU General Public License, online, at the GNU
##  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
##

prefix=@l_prefix@

if [ ".$1" = ".--showhelp" ]; then
	echo "Display information on a user"
	exit 0
	HASHELP
fi

server=127.0.0.1
binddn=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_dn :" | sed -e "s;bind_dn : ;;"`
bindpw=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_pw :" | sed -e "s;bind_pw : ;;"`
basedn=`cat ${prefix}/etc/kolab/kolab.conf | grep "base_dn :" | sed -e "s;base_dn : ;;"`


if [ ".$1" = "." ]; then
	echo "Please specify an email address"
	exit 2
fi

${prefix}/bin/ldapsearch -x -LLL -b "$basedn" -D "$binddn" -w $bindpw -h $server "(&(objectClass=kolabInetOrgPerson)(mail=$1))"
