#!/bin/bash
#
# /usr/bin/mailpasswd
#
# Shell script wrapper for courierpasswd to change passwords
# for courier-imapd via authdaemon.
#
# Originally written for the Gentoo Linux distribution
#
# Copyright (c) 1999-2005 Gentoo Technologies, Inc
# Released under v2 of the GNU GPL
#
# Author(s) Christoph Probst <chris-sw-ccp@netzpunkt.org>
#
# Notes - to change passwords you need to emerge courierpasswd.
# - If you don't want the password-change dialog then rather use
# checkpasswd directly.
# - there is a plugin courierchang_pass available for squirrelmail
# that uses courierpasswd INSTEAD of courierpassd or poppassd.
#
# Todo - convert this script to python
#
# Version 0.1
#
# ========================================================================
if [ "${1}x" == "x" ] ; then
echo "mailpasswd - Interface to change the password for an e-mail user."
echo "Syntax: mailpasswd e-mail-username"
exit 2
fi
username=${1}
echo "Changing password for e-mail user ${username}"
echo -n "(current) E-Mail password: "
read -s oldpassword
echo
echo -n "New E-Mail password: "
read -s newpassword
echo
if [ "${newpassword}x" == "x" ] ; then
echo "New password is empty, that is not allowed! Password NOT changed."
exit 3