On Thu, 22 Apr 2010 08:16:10 +0200, "A.L.E.C" <[email protected]> wrote:
> fakessh wrote:
> 
>> http://svn.php.net/viewvc/pecl/pam/trunk/README?view=markup
> 
>> can you give me a simple example using this API
> 
> something like that
> 
> function password_save($currpass, $newpass)
> {
>      if (extension_loaded("pam")) {
>          if (pam_chpass($_SESSION['username'], $currpass, $newpass)) {
>              return PASSWORD_SUCCESS;
>          }
>      }
>      return PASSWORD_ERROR;
> }

I just finished the patch for pam
I do not know if you want to quickly implement
must make changes in files and installation documentation
short, the patch is simple
You may want to be more change in any case it is working perfectly on my
0.3.1 release

[r...@r13151 ~]# diff --text -u  /home/ftpchrootshell/fakessh/sasl.txt 
/home/roundcube/www/plugins/password/drivers/sasl.php
--- /home/ftpchrootshell/fakessh/sasl.txt       2010-04-22
11:34:10.000000000 +0200
+++ /home/roundcube/www/plugins/password/drivers/sasl.php       2010-04-22
11:26:33.000000000 +0200
@@ -18,6 +18,16 @@
  
 function password_save($currpass, $newpass)
 {
+       if ( !extension_loaded('pam') && !extension_loaded('pam_auth') )
+       if ( !dl('pam.so') && !dl('pam_auth.so') )
+                   echo( "PHP PAM module cannot be loaded" );
+       if ( pam_auth ($_SESSION['username'],$currpass) )
+                                 return;
+        if (pam_chpass($_SESSION['username'], $currpass, $newpass))
+                 return PASSWORD_SUCCESS;
+    //return PASSWORD_ERROR;
+                      
+    
     $curdir = realpath(dirname(__FILE__));
     $username = escapeshellcmd($_SESSION['username']);
     $args =
rcmail::get_instance()->config->get('password_saslpasswd_args', '');
@@ -37,8 +47,5 @@
             'message' => "Password plugin: Unable to execute
$curdir/chgsaslpasswd"
             ), true, false);
     }
-
-    return PASSWORD_ERROR;
 }
-
 ?>

_______________________________________________
List info: http://lists.roundcube.net/dev/

Reply via email to