Changeset 5419 in subversion


Ignore:
Timestamp:
Nov 13, 2011 7:02:18 AM (19 months ago)
Author:
alec
Message:
  • Added option to use punycode or unicode for domain names (#1488103)
Location:
trunk/plugins/password
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/password/config.inc.php.dist

    r4726 r5419  
    4848$rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)'; 
    4949 
     50// By default domains in variables are using unicode. 
     51// Enable this option to use punycoded names 
     52$rcmail_config['password_idn_ascii'] = false; 
     53 
    5054// Path for dovecotpw (if not in $PATH) 
    5155// $rcmail_config['password_dovecotpw'] = '/usr/local/sbin/dovecotpw'; 
  • trunk/plugins/password/drivers/sql.php

    r5367 r5419  
    131131    } 
    132132 
     133    $local_part  = $rcmail->user->get_username('local'); 
     134    $domain_part = $rcmail->user->get_username('domain'); 
     135    $username    = $_SESSION['username']; 
     136    $host        = $_SESSION['imap_host']; 
     137 
     138    // convert domains to/from punnycode 
     139    if ($rcmail->config->get('password_idn_ascii')) { 
     140        $domain_part = rcube_idn_to_ascii($domain_part); 
     141        $username    = rcube_idn_to_ascii($username); 
     142        $host        = rcube_idn_to_ascii($host); 
     143    } 
     144    else { 
     145        $domain_part = rcube_idn_to_utf8($domain_part); 
     146        $username    = rcube_idn_to_utf8($username); 
     147        $host        = rcube_idn_to_utf8($host); 
     148    } 
     149 
    133150    // at least we should always have the local part 
    134     $sql = str_replace('%l', $db->quote($rcmail->user->get_username('local'), 'text'), $sql); 
    135     $sql = str_replace('%d', $db->quote($rcmail->user->get_username('domain'), 'text'), $sql); 
    136     $sql = str_replace('%u', $db->quote($_SESSION['username'],'text'), $sql); 
    137     $sql = str_replace('%h', $db->quote($_SESSION['imap_host'],'text'), $sql); 
     151    $sql = str_replace('%l', $db->quote($local_part, 'text'), $sql); 
     152    $sql = str_replace('%d', $db->quote($domain_part, 'text'), $sql); 
     153    $sql = str_replace('%u', $db->quote($username, 'text'), $sql); 
     154    $sql = str_replace('%h', $db->quote($host, 'text'), $sql); 
    138155 
    139156    $res = $db->query($sql, $sql_vars); 
  • trunk/plugins/password/package.xml

    r5367 r5419  
    1616                <active>yes</active> 
    1717        </lead> 
    18         <date>2011-10-26</date> 
    19         <time>12:00</time> 
     18        <date></date> 
     19        <time></time> 
    2020        <version> 
    21                 <release>2.3</release> 
     21                <release></release> 
    2222                <api>1.6</api> 
    2323        </version> 
     
    2828        <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license> 
    2929        <notes> 
    30 - When old and new passwords are the same, do nothing, return success (#1487823) 
    31 - Fixed Samba password hashing in 'ldap' driver 
    32 - Added 'password_change' hook for plugin actions after successful password change 
    33 - Fixed bug where 'doveadm pw' command was used as dovecotpw utility 
    34 - Improve generated crypt() passwords (#1488136) 
     30- Added option to use punycode or unicode for domain names (#1488103) 
    3531    </notes> 
    3632        <contents> 
     
    266262            </notes> 
    267263        </release> 
     264        <release> 
     265                <date>2011-10-26</date> 
     266                <time>12:00</time> 
     267                <version> 
     268                        <release>2.3</release> 
     269                        <api>1.6</api> 
     270                </version> 
     271                <stability> 
     272                        <release>stable</release> 
     273                        <api>stable</api> 
     274                </stability> 
     275                <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license> 
     276                <notes> 
     277- When old and new passwords are the same, do nothing, return success (#1487823) 
     278- Fixed Samba password hashing in 'ldap' driver 
     279- Added 'password_change' hook for plugin actions after successful password change 
     280- Fixed bug where 'doveadm pw' command was used as dovecotpw utility 
     281- Improve generated crypt() passwords (#1488136) 
     282            </notes> 
     283        </release> 
    268284    </changelog> 
    269285</package> 
  • trunk/plugins/password/password.php

    r5036 r5419  
    224224        $config = rcmail::get_instance()->config; 
    225225        $driver = $this->home.'/drivers/'.$config->get('password_driver', 'sql').'.php'; 
    226      
     226 
    227227        if (!is_readable($driver)) { 
    228228            raise_error(array( 
     
    234234            return $this->gettext('internalerror'); 
    235235        } 
    236      
     236 
    237237        include($driver); 
    238238 
     
    271271 
    272272        return $reason; 
    273     }                                      
     273    } 
    274274} 
Note: See TracChangeset for help on using the changeset viewer.