Changeset 1049


Ignore:
Timestamp:
Apr 2, 2009, 9:55:40 PM (13 years ago)
Author:
mitchb
Message:
Make get-password deal with carriage returns, because the mysql client
puts up with this nonsense for Windows users.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • locker/sql/bin/get-password

    r1037 r1049  
    1212        global $env_user;
    1313        $cnfFile = file_get_contents($path);
    14         if (preg_match('/\[mysql\][^\[]*host *= *([^\n]*)/',$cnfFile,$match)) {
     14        if (preg_match('/\[mysql\][^\[]*host *= *([^\r\n]*)/',$cnfFile,$match)) {
    1515                $host = $match[1];
    16         } elseif (preg_match('/\[client\][^\[]*host *= *([^\n]*)/',$cnfFile,$match)) {
     16        } elseif (preg_match('/\[client\][^\[]*host *= *([^\r\n]*)/',$cnfFile,$match)) {
    1717                $host = $match[1];
    1818        } else {
    1919                $host = 'sql.mit.edu';
    2020        }
    21         if (preg_match('/\[mysql\][^\[]*user *= *([^\n]*)/',$cnfFile,$match)) {
     21        if (preg_match('/\[mysql\][^\[]*user *= *([^\r\n]*)/',$cnfFile,$match)) {
    2222                $user = $match[1];
    23         } elseif (preg_match('/\[client\][^\[]*user *= *([^\n]*)/',$cnfFile,$match)) {
     23        } elseif (preg_match('/\[client\][^\[]*user *= *([^\r\n]*)/',$cnfFile,$match)) {
    2424                $user = $match[1];
    2525        } else {
    2626                $user = $env_user;
    2727        }
    28         if (preg_match('/\[mysql\][^\[]*password *= *([^\n]*)/',$cnfFile,$match)) {
     28        if (preg_match('/\[mysql\][^\[]*password *= *([^\r\n]*)/',$cnfFile,$match)) {
    2929                $password = $match[1];
    30         } elseif (preg_match('/\[client\][^\[]*password *= *([^\n]*)/',$cnfFile,$match)) {
     30        } elseif (preg_match('/\[client\][^\[]*password *= *([^\r\n]*)/',$cnfFile,$match)) {
    3131                $password = $match[1];
    3232        } else {
Note: See TracChangeset for help on using the changeset viewer.