a bash script that checks the password expiration from an active directory ldap tree getting its users from zimbra. It sends an email to the user when its password is about to expire, it depends on the sendEmail project
http://caspian.dotconf.net/menu/Software/SendEmail/
You can adapt it to read users directly from the directory.