From 2b107c1610f758c47e8ac3348c79d2f24f5eb8e8 Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Sat, 6 Feb 2010 14:24:11 +0100 Subject: [PATCH] Added ticket 391, password storage configuration variable for Mercurial. --- doc/syncmercurial.mdtext | 8 ++++++++ src/IDF/Plugin/SyncMercurial.php | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/syncmercurial.mdtext b/doc/syncmercurial.mdtext index 0d13de9..30149bd 100644 --- a/doc/syncmercurial.mdtext +++ b/doc/syncmercurial.mdtext @@ -67,6 +67,14 @@ You also need to provide the base definition of the hgrc file. For example: 'extensions' => array(), ); +If you are note using Apache but Nginx, you may need to create the +passwords as plain text passwords (see ticket 391). You can configure +the password storage with the format you want. The default is `sha` +you can set it to `plain` for nginx. + + $cfg['idf_plugin_syncmercurial_passwd_mode'] = 'sha'; + +See the [`FILE_PASSWD_*` constants](http://euk1.php.net/package/File_Passwd/docs/latest/File_Passwd/_File_Passwd-1.1.7---Passwd.php.html) for more choices. ## Cron configuration diff --git a/src/IDF/Plugin/SyncMercurial.php b/src/IDF/Plugin/SyncMercurial.php index 1c37656..37a6c48 100644 --- a/src/IDF/Plugin/SyncMercurial.php +++ b/src/IDF/Plugin/SyncMercurial.php @@ -97,7 +97,8 @@ class IDF_Plugin_SyncMercurial } $ht = new File_Passwd_Authbasic($passwd_file); $ht->load(); - $ht->setMode(FILE_PASSWD_SHA); + $ht->setMode(Pluf::f('idf_plugin_syncmercurial_passwd_mode', + FILE_PASSWD_SHA)); if ($ht->userExists($user->login)) { $ht->changePasswd($user->login, $this->getMercurialPass($user)); } else { @@ -138,7 +139,8 @@ class IDF_Plugin_SyncMercurial throw new Exception (sprintf(__('%s does not exist or is not writable.'), $passwd_file)); } $ht = new File_Passwd_Authbasic($passwd_file); - $ht->setMode(FILE_PASSWD_SHA); + $ht->setMode(Pluf::f('idf_plugin_syncmercurial_passwd_mode', + FILE_PASSWD_SHA)); $ht->load(); $mem = $project->getMembershipData(); $members = array_merge((array)$mem['members'], (array)$mem['owners'],