#!/bin/bash
##  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>.
##
PATH=/usr/bin:$PATH

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

SERVER=127.0.0.1
BINDDN=`sed -n "s;bind_dn : ;;p" /etc/kolab/kolab.conf`
BINDPW=`sed -n "s;bind_pw : ;;p" /etc/kolab/kolab.conf`
BASEDN=`sed -n "s;base_dn : ;;p" /etc/kolab/kolab.conf`


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

ldapsearch -x -LLL -b "$BASEDN" -D "$BINDDN" -w $BINDPW -h $SERVER "(&(objectClass=kolabInetOrgPerson)(mail=$1))"

