Source for file poppassd.php
Documentation is available at poppassd.php
* Poppassd change password backend
* @author Seth Randall <sethr at missoulafcu.org>
* @copyright © 2004-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: poppassd.php,v 1.10 2006/07/15 12:01:09 tokul Exp $
* @subpackage change_password
* Set the address of the server your poppass daemon runs on.
* If it's the same as your imap server, you can leave it blank
/* get overrides from config.php */
if (isset
($cpw_poppassd['server'])) $poppassd_server=
$cpw_poppassd['server'];
* Define here the name of your password changing function.
global $squirrelmail_plugin_hooks;
$squirrelmail_plugin_hooks['change_password_dochange']['poppassd'] =
'cpw_poppassd_dochange';
* This is the function that is specific to your backend. It takes
* the current password (as supplied by the user) and the desired
* new password. It will return an array of messages. If everything
* was successful, the array will be empty. Else, it will contain
* Constants to be used for these messages:
* CPW_CURRENT_NOMATCH -> "Your current password is not correct."
* CPW_INVALID_PW -> "Your new password contains invalid characters."
* @param array data The username/currentpw/newpw data.
* @return array Array of error messages.
// unfortunately, we can only pass one parameter to a hook function,
// so we have to pass it as an array.
$username =
$data['username'];
// your code here to change the password for $username from
// $currentpw into $newpw.
fputs($pop_socket, "quit\r\n");
if (!feof($pop_socket)) {
$strResp =
fgets($pop_socket, 1024);
$result =
substr(trim($strResp), 0, 3); // 200, 500
if(!preg_match('/^[23]\d\d/', $result) ||
$debug) {
$messages[] =
"--> $strResp";
global $imapServerAddress;
/** sqimap_get_user_server() function */
include_once(SM_PATH .
'../functions/imap_general.php');
if($poppassd_server ==
'') {
// if poppassd address is not set, use imap server's address
// make sure that setting contains address and not mapping
$messages[] =
_("Connecting to Password Server");
$pop_socket =
fsockopen($poppassd_server, 106, $errno, $errstr);
$messages[] =
_("ERROR") .
': ' .
"$errstr ($errno)";
fputs($pop_socket, "user $username\r\n");
fputs($pop_socket, "pass $old_pw\r\n");
fputs($pop_socket, "newpass $new_pw\r\n");
Documentation generated on Sat, 07 Oct 2006 16:13:05 +0300 by phpDocumentor 1.3.0RC6