#!/bin/bash
# Samba-TNG                                      list_domgroup_members
# --------------------------------------------------------------------

# --------------------------------------------------------------------
# config here

. ./prefs

# --------------------------------------------------------------------
# print usage

if [ "$1" == "" ]; then 
	echo "Usage: $(basename $0) <group>"
	exit 0
fi

groupexist=`$ldapsearch -D $binddn -w $bindpassword -LLL -b $groupsuffix|grep -w "$1"`

if [ "$groupexist" = "" ]; then
        echo "Group does not exist!"
        exit 1
fi

# --------------------------------------------------------------------
# begin

$rpcclient -S . -U $rpcuser%$rpcpassword -c "samgroupmem \"$1\"" -d0|awk '{print $1" "$2}'|grep $")"|less

exit 0

# --------------------------------------------------------------------
