#!/bin/bash
##########################################################
# (C) ZE CMS, Humboldt-Universitaet zu Berlin
# Written 2014 by Daniel Rohde <d.rohde@cms.hu-berlin.de>
##########################################################
# changes: 
#   LDAP user password

if [ $# = 0 ] ; then
        echo "Usage: $0 user [password]"
        exit 1
fi

. $(dirname $0)/config

user=$1
if [ "$#" = 1 ] ; then
	read -s -p "Password: " password
else
	password=$2
fi

ldapmodify -x -h $LDAP_HOST -D $LDAP_ADMIN -w $LDAP_ADMINPW <<EOF
dn: uid=$user,$LDAP_USERS
changetype: modify
replace: userPassword
userPassword: $password

EOF
