12 messages in net.sourceforge.lists.courier-usersRE: [courier-users] Howto enable cryp...
FromSent OnAttachments
Daniel BachlerMay 16, 2003 7:28 am 
Stefan HornburgMay 16, 2003 7:58 am 
Joe LaffeyMay 16, 2003 9:01 am 
Joe LaffeyMay 16, 2003 9:13 am 
Joe LaffeyMay 16, 2003 9:52 am 
tibykeMay 17, 2003 12:15 am 
Daniel BachlerMay 18, 2003 7:01 am 
Joe LaffeyMay 18, 2003 9:27 am 
James A BakerMay 18, 2003 10:55 am 
cour...@interfacelounge.netMay 18, 2003 8:04 pm 
Joshua E WarcholMay 20, 2003 11:54 am 
RandyMay 20, 2003 12:13 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:RE: [courier-users] Howto enable crypted pwds for authmysql with php?Actions...
From:cour...@interfacelounge.net (cour@interfacelounge.net)
Date:May 18, 2003 8:04:46 pm
List:net.sourceforge.lists.courier-users

This is a bit of code I wrote a while ago to change courier mysql passwords, it takes an existing password from the DB, checks it and changes it to a new password. I haven't used it for a while so can't remember just how well it works but should be fine as a starting point.

<?php // $db_passwd is pulled from the DB ;)

if ($db_passwd == "" OR $_POST['newpassword'] != $_POST['newpassword2']) { echo "Error with Username or password<br />\n"; die; }

$old_passwd = crypt($_POST['password']); $passwd = crypt($passwd,$db_passwd);

$salt = substr($passwd, 0, 12); $salted_passwd = crypt($_POST['password'], $salt); $new_passwd = crypt($_POST['newpassword']);

// debug stuff echo ("Email: \"" . $_POST['username'] . "\"<br />\n"); echo ("Old passwd: \"" . $old_passwd . "\"<br />\n"); echo ("DB passwd: \"" . $db_passwd . "\"<br />\n"); echo ("DB passwd Length: \"" . strlen($db_passwd) . "\"<br />\n"); echo ("Crypted DB passwd: \"" . $passwd . "\"<br />\n"); echo ("Salted Old DB passwd: \"" . $salted_passwd . "\"<br />\n"); echo ("Salted Old DB passwd Length: \"" . strlen($salted_passwd) . "\"<br />\n");

if (trim($db_passwd) == trim($salted_passwd)) { echo "Password verified!<br />\n"; } else { echo "Error with Username or password<br />\n"; die; }

// do the rest.. add to db etc ?>

Hope it helps,

hunter

-----Original Message----- From: cour@lists.sourceforge.net [mailto:cour@lists.sourceforge.net] On Behalf Of James A Baker Sent: Monday, 19 May 2003 3:54 AM To: cour@lists.sourceforge.net Subject: Re: [courier-users] Howto enable crypted pwds for authmysql with php?

On Sunday, May 18, 2003, at 09:06 US/Central, Daniel Bachler wrote:

On Sat, 17 May 2003 00:04:57 -0500, James A Baker <jaba@mac.com> wrote:

Courier's "userdbpw" will create both crypted and md5 passwords that work fine in postgres. Does it not work for you? -- Or did I miss something here?

I'm afraid I did not find it. Could you tell me where to look for it? I did a find on userdbpw in the courier directory but it did not turn up with anything. Is this tool optional?

Thanks for your patience, Daniel

Well, not precisely... not without knowing your install paths anyway. But I can tell you that on my system, it was installed as: /usr/lib/courier/sbin/userdbpw

AFAIK, it is installed by default. But I don't know that for sure. If you perhaps didn't install the authuserdb module at all (i.e. used the --without-authuserdb option to configure), then maybe it doesn't get installed either. I'm just not sure.

HTH.

-jab