<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>crypt-md5 password with show_encryption doesn&#039;t work</title> 
  <pubDate>Fri, 10 Apr 2026 20:05:34 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/9275</link> 
  <atom:link rel="self" type="application/rss+xml" title="crypt-md5 password with show_encryption doesn&#039;t work" href="https://bugs.horde.org/ticket/9275/rss" /> 
  <description>crypt-md5 password with show_encryption doesn&#039;t work</description> 
 
   
   
  <item> 
   <title>when using show_encryption parameter, if the stored encrypti</title> 
   <description>when using show_encryption parameter, if the stored encryption is crypt, it cannot work with crypt-md5 as it will use the crypt method to compare password instead of crypt-md5

(it will not work with crypt-blowfish also)
</description> 
   <pubDate>Wed, 29 Sep 2010 22:01:31 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9275#t60213</link> 
  </item> 
   
  <item> 
   <title>Here is a fix that works:

diff -urb passwd.old/lib/Driver</title> 
   <description>Here is a fix that works:

diff -urb passwd.old/lib/Driver.php passwd/lib/Driver.php
--- passwd.old/lib/Driver.php   2010-09-30 00:00:35.000000000 +0200
+++ passwd/lib/Driver.php       2010-09-29 23:39:17.000000000 +0200
@@ -3,7 +3,7 @@
  * Passwd_Driver:: defines an API for implementing password change systems for
  * Passwd.
  *
- * $Horde: passwd/lib/Driver.php,v 1.44.2.9 2008/10/24 16:48:50 jan Exp $
+ * $Horde: passwd/lib/Driver.php,v 1.44.2.10 2009-01-06 15:25:15 jan Exp $
  *
  * Copyright 2000-2009 The Horde Project (http://www.horde.org/)
  *
@@ -54,6 +54,9 @@
             if ($this-&gt;_params[&#039;driver&#039;] == &#039;ldap&#039; &amp;&amp; $encryption == &#039;md5&#039;) {
                 $encryption = &#039;md5-base64&#039;;
             }
+           if ($encryption == &#039;crypt&#039; &amp;&amp; substr($encrypted, 0, 3) == &#039;$1$&#039;) {
+               $encryption = &#039;crypt-md5&#039;;
+           }
         } else {
             $encryption = $this-&gt;_params[&#039;encryption&#039;];
         }
</description> 
   <pubDate>Wed, 29 Sep 2010 22:02:14 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9275#t60214</link> 
  </item> 
   
  <item> 
   <title>This is not how crypt() works: http://php.net/crypt
crypt()</title> 
   <description>This is not how crypt() works: http://php.net/crypt
crypt() should figure out itself from the salt which crypt algorithm to choose. If it doesn&#039;t, then PHP is broken, or the crypt method you are using is not supported by the system.</description> 
   <pubDate>Thu, 21 Oct 2010 16:06:16 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9275#t60555</link> 
  </item> 
   
  <item> 
   <title>Indeed there is a bug as you cannot use crypt-md5 encryption</title> 
   <description>Indeed there is a bug as you cannot use crypt-md5 encryption even if the password was saved with passwd as the matching of the old password doesn&#039;t work.

But the correction has maybe to be done elsewhere, I check that.</description> 
   <pubDate>Thu, 21 Oct 2010 18:03:36 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9275#t60573</link> 
  </item> 
   
  <item> 
   <title>So the problem of not passing the right encryption to Auth::</title> 
   <description>So the problem of not passing the right encryption to Auth::getCryptedPassword is the Auth::getSalt function not the crypt one. The salt generated is not the same for crypt-md5 and crypt, so the old password given is encrypted with the crypt method and it cannot match the one previously stored that is a crypt-md5 one.

Maybe the Auth::getSalt shouldn&#039;t be called at all in the compare password case.</description> 
   <pubDate>Thu, 21 Oct 2010 18:23:40 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9275#t60575</link> 
  </item> 
   
  <item> 
   <title>Sorry, I lost you. Can you explain again, which strings/salt</title> 
   <description>Sorry, I lost you. Can you explain again, which strings/salts/passwords are passed where, and where you think this is a bug?</description> 
   <pubDate>Thu, 21 Oct 2010 20:07:01 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9275#t60581</link> 
  </item> 
   
  <item> 
   <title>Ok, let&#039;s try to be clear.

I want password to be stored w</title> 
   <description>Ok, let&#039;s try to be clear.

I want password to be stored with crypt-md5 method, so it&#039;s already the case in the database, and the format is {crypt}$1$xxxxxxxxxxxxxxx (but it can be another method also, that&#039;s why it&#039;s prefixed)

Then I want to provide user a way to change their password and keep storing them with crypt-md5 method.

I&#039;ve set encryption to crypt-md5 in passwd and show_encryption to true (I can have put encryption to any other method I think I&#039;ll get the same result as my password are already crypt-md5)

So to change the password the old one is reqested from the user, and the problem lie here:

In passwd/lib/Driver.php, in function comparePasswords
there is a call to Auth::getCryptedPassword to get the encrypted version of the old password given by the user that need to match the stored version.
As the method is stored with the password, &#039;crypt&#039; is use as encryption for the old password, so the params given to Auth::getCryptedPassword are (&#039;password&#039;, &#039;{crypt}$1$1a9668b1$5uJT0BQW24EEtrVj/c4R2/&#039;, &#039;crypt&#039;, false)

And in lib/Horde/Auth.php in getCryptedPassword, the first task done is to recompute $salt, and if &#039;crypt&#039; is used instead of &#039;crypt-md5&#039; it reduce it to 3 chars instead of 13 (see the getSalt function).
If the salt is not recomputed, it works (I&#039;ve tested).
So the call to crypt have to be done with the encrypted old password as second paremeter (or it&#039;s first 13 chars as it&#039;s done when &#039;crypt-md5&#039; is used as parameter in this function).

Hope this is clearer.</description> 
   <pubDate>Thu, 21 Oct 2010 20:40:44 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9275#t60584</link> 
  </item> 
   
  <item> 
   <title>If passwords are encrypted with crypt-md5, then they should </title> 
   <description>If passwords are encrypted with crypt-md5, then they should be prefixed with {crypt-md5} not {crypt}.</description> 
   <pubDate>Wed, 26 Mar 2014 12:58:35 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9275#t83023</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
