diff --git a/ChangeLog b/ChangeLog index fcc84a598d..84d8e1daf1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,6 +64,9 @@ phpMyAdmin - ChangeLog - issue #12634 Drop DB error in import if DB doesn't exist - issue #12338 Designer reverts to first saved ER after EACH relation create or delete - issue #12639 'Show trace' in Console generates JS error for functions in query's trace called without any arguments +- issue #12366 Fix user creation with certain MariaDB setups +- issue #12616 Refuse to work with mbstring.func_overload enabled +- issue #12472 Properly report connection without password in setup 4.6.4 (2016-08-16) - issue [security] Weaknesses with cookie encryption, see PMASA-2016-29 diff --git a/index.php b/index.php index 5fe048ab43..62c0a4d63f 100644 --- a/index.php +++ b/index.php @@ -428,21 +428,6 @@ echo ''; echo ''; -/** - * As we try to handle charsets by ourself, mbstring overloads just - * break it, see bug 1063821. - */ -if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) { - trigger_error( - __( - 'You have enabled mbstring.func_overload in your PHP ' - . 'configuration. This option is incompatible with phpMyAdmin ' - . 'and might cause some data to be corrupted!' - ), - E_USER_WARNING - ); -} - /** * mbstring is used for handling multibytes inside parser, so it is good * to tell user something might be broken without it, see bug #1063149. diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 0a04b5e618..ccd8119d53 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -530,6 +530,20 @@ if ($GLOBALS['PMA_Config']->error_config_default_file) { trigger_error($error, E_USER_ERROR); } +/** + * As we try to handle charsets by ourself, mbstring overloads just + * break it, see bug 1063821. + */ +if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') != '0') { + PMA_fatalError( + __( + 'You have enabled mbstring.func_overload in your PHP ' + . 'configuration. This option is incompatible with phpMyAdmin ' + . 'and might cause some data to be corrupted!' + ) + ); +} + /******************************************************************************/ /* setup servers LABEL_setup_servers */ diff --git a/libraries/config/ConfigFile.php b/libraries/config/ConfigFile.php index c051d5b080..b74c1cc838 100644 --- a/libraries/config/ConfigFile.php +++ b/libraries/config/ConfigFile.php @@ -416,7 +416,9 @@ class ConfigFile $dsn = 'mysqli://'; if ($this->getValue("$path/auth_type") == 'config') { $dsn .= $this->getValue("$path/user"); - if (! $this->getValue("$path/nopassword")) { + if (! $this->getValue("$path/nopassword") + || ! empty($this->getValue("$path/password")) + ) { $dsn .= ':***'; } $dsn .= '@'; diff --git a/libraries/config/Validator.php b/libraries/config/Validator.php index 0825e24b2b..faa115e899 100644 --- a/libraries/config/Validator.php +++ b/libraries/config/Validator.php @@ -271,8 +271,10 @@ class Validator } if (! $error && $values['Servers/1/auth_type'] == 'config') { - $password = !empty($values['Servers/1/nopassword']) && $values['Servers/1/nopassword'] ? null - : (empty($values['Servers/1/password']) ? '' : $values['Servers/1/password']); + $password = ''; + if (! empty($values['Servers/1/password'])) { + $password = $values['Servers/1/password']; + } $test = static::testDBConnection( empty($values['Servers/1/connect_type']) ? '' : $values['Servers/1/connect_type'], empty($values['Servers/1/host']) ? '' : $values['Servers/1/host'], @@ -282,6 +284,24 @@ class Validator $password, 'Server' ); + + // If failed 'with' password, try 'without' password + if ($test !== true + && !empty($values['Servers/1/nopassword']) + && $values['Servers/1/nopassword'] + ) { + $password = ''; + $test = static::testDBConnection( + empty($values['Servers/1/connect_type']) ? '' : $values['Servers/1/connect_type'], + empty($values['Servers/1/host']) ? '' : $values['Servers/1/host'], + empty($values['Servers/1/port']) ? '' : $values['Servers/1/port'], + empty($values['Servers/1/socket']) ? '' : $values['Servers/1/socket'], + empty($values['Servers/1/user']) ? '' : $values['Servers/1/user'], + $password, + 'Server' + ); + } + if ($test !== true) { $result = array_merge($result, $test); } diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index c3aa830fcf..0c50ea119d 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -5217,6 +5217,31 @@ function PMA_getHashedPassword($password) return $hashedPassword; } +/** + * Check if MariaDB's 'simple_password_check' + * OR 'cracklib_password_check' is ACTIVE + * + * @return boolean if atleast one of the plugins is ACTIVE + */ +function PMA_checkIfMariaDBPwdCheckPluginActive() +{ + if (Util::getServerType() !== 'MariaDB') { + return false; + } + + $result = $GLOBALS['dbi']->query( + 'SHOW PLUGINS SONAME LIKE \'%_password_check%\'' + ); + + while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { + if ($row['Status'] === 'ACTIVE') { + return true; + } + } + + return false; +} + /** * Get SQL queries for Display and Add user @@ -5240,6 +5265,7 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) $slashedUsername, $slashedHostname ); + $isMariaDBPwdPluginActive = PMA_checkIfMariaDBPwdCheckPluginActive(); // See https://github.com/phpmyadmin/phpmyadmin/pull/11560#issuecomment-147158219 // for details regarding details of syntax usage for various versions @@ -5259,6 +5285,7 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) if ($serverType == 'MariaDB' && PMA_MYSQL_INT_VERSION >= 50200 && isset($_REQUEST['authentication_plugin']) + && ! $isMariaDBPwdPluginActive ) { $create_user_stmt .= ' IDENTIFIED VIA ' . $_REQUEST['authentication_plugin']; @@ -5288,9 +5315,10 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) $_REQUEST['authentication_plugin'] ); } + // Use 'CREATE USER ... WITH ... AS ..' syntax for // newer MySQL versions - // and 'CREATE USER ... USING .. VIA ..' syntax for + // and 'CREATE USER ... VIA .. USING ..' syntax for // newer MariaDB versions if ((($serverType == 'MySQL' || $serverType == 'Percona Server') && PMA_MYSQL_INT_VERSION >= 50706) @@ -5305,8 +5333,13 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) ); // MariaDB uses 'USING' whereas MySQL uses 'AS' - if ($serverType == 'MariaDB') { + // but MariaDB with validation plugin needs cleartext password + if ($serverType == 'MariaDB' + && ! $isMariaDBPwdPluginActive + ) { $create_user_stmt .= ' USING \'%s\''; + } elseif ($serverType == 'MariaDB') { + $create_user_stmt .= ' IDENTIFIED BY \'%s\''; } else { $create_user_stmt .= ' AS \'%s\''; } @@ -5330,7 +5363,14 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) '***' ); } else { - $hashedPassword = PMA_getHashedPassword($_POST['pma_pw']); + if (! ($serverType == 'MariaDB' + && $isMariaDBPwdPluginActive) + ) { + $hashedPassword = PMA_getHashedPassword($_POST['pma_pw']); + } else { + // MariaDB with validation plugin needs cleartext password + $hashedPassword = $_POST['pma_pw']; + } $create_user_real = sprintf( $create_user_stmt, $hashedPassword diff --git a/po/ko.po b/po/ko.po index 03e7cf4bd4..3ad8ed8eed 100644 --- a/po/ko.po +++ b/po/ko.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.6.5-dev\n" "Report-Msgid-Bugs-To: translators@phpmyadmin.net\n" "POT-Creation-Date: 2016-08-17 11:29+0200\n" -"PO-Revision-Date: 2016-10-15 07:33+0000\n" +"PO-Revision-Date: 2016-10-17 12:10+0000\n" "Last-Translator: SDSkyKlouD \n" "Language-Team: Korean " "\n" @@ -4565,16 +4565,12 @@ msgid "Analyze Explain at %s" msgstr "" #: libraries/Util.php:1258 -#, fuzzy -#| msgid "Without PHP Code" msgid "Without PHP code" msgstr "PHP 코드 없이 보기" #: libraries/Util.php:1270 -#, fuzzy -#| msgid "Submit Query" msgid "Submit query" -msgstr "질의 실행" +msgstr "쿼리 실행" #: libraries/Util.php:1281 libraries/config/messages.inc.php:888 msgid "Create PHP code" @@ -5060,10 +5056,8 @@ msgid "Allow users to customize this value" msgstr "이 값을 사용자화하기 위한 사용자 허용" #: libraries/config/PageSettings.php:141 -#, fuzzy -#| msgid "Cannot save settings, submitted form contains errors!" msgid "Cannot save settings, submitted configuration form contains errors!" -msgstr "설정을 저장할 수 없음, 전송된 폼 값에 오류가 있음!" +msgstr "설정을 저장할 수 없습니다. 제출하신 구성 폼에 오류가 있습니다!" #: libraries/config/ServerConfigChecks.php:157 msgid "You should use SSL connections if your database server supports it." @@ -5074,10 +5068,8 @@ msgid "You allow for connecting to the server without a password." msgstr "암호 없이 서버 접속을 허용합니다." #: libraries/config/ServerConfigChecks.php:347 -#, fuzzy -#| msgid "Key is too short, it should have at least 8 characters." msgid "Key is too short, it should have at least 32 characters." -msgstr "키가 너무 짧습니다. 최소 8글자 이상이어야 합니다." +msgstr "키가 너무 짧습니다. 최소 32글자 이상이어야 합니다." #: libraries/config/ServerConfigChecks.php:357 msgid "Key should contain letters, numbers [em]and[/em] special characters." @@ -5208,10 +5200,8 @@ msgid "Could not connect to the database server!" msgstr "데이터베이스 서버에 접속할 수 없습니다!" #: libraries/config/Validator.php:243 -#, fuzzy -#| msgid "Authentication type" msgid "Invalid authentication type!" -msgstr "인증 형식" +msgstr "잘못된 인증 방식!" #: libraries/config/Validator.php:250 msgid "Empty username while using [kbd]config[/kbd] authentication method!" @@ -5318,14 +5308,8 @@ msgid "Highlight pointer" msgstr "포인터 하이라이트" #: libraries/config/messages.inc.php:47 -#, fuzzy -#| msgid "" -#| "Enable [a@https://en.wikipedia.org/wiki/Bzip2]bzip2[/a] compression for " -#| "import operations." msgid "Enable bzip2 compression for import operations." -msgstr "" -"가져오기 작업시 [a@https://en.wikipedia.org/wiki/Bzip2]bzip2[/a] 압축을 활성" -"화합니다." +msgstr "가져오기 작업 시 bzip2 압축을 활성화합니다." #: libraries/config/messages.inc.php:50 msgid "Bzip2" @@ -5345,16 +5329,10 @@ msgid "CHAR columns editing" msgstr "CHAR 컬럼 편집" #: libraries/config/messages.inc.php:58 -#, fuzzy -#| msgid "" -#| "Use user-friendly editor for editing SQL queries ([a@https://codemirror." -#| "net/]CodeMirror[/a]) with syntax highlighting and line numbers." msgid "" "Use user-friendly editor for editing SQL queries (CodeMirror) with syntax " "highlighting and line numbers." -msgstr "" -"사용하기 쉬운 편집기([a@https://codemirror.net/]CodeMirror[/a], 문법 강조 및 " -"줄 번호 지원)로 SQL 쿼리를 편집." +msgstr "문법 강조와 줄 개수 등의 기능이 있는 SQL 쿼리 에디터 CodeMirror를 사용하세요." #: libraries/config/messages.inc.php:62 msgid "Enable CodeMirror" @@ -5480,10 +5458,8 @@ msgid "Whether the table structure actions should be hidden." msgstr "테이블 구조 관련 기능을 숨겨 놓을지 말지 여부." #: libraries/config/messages.inc.php:117 -#, fuzzy -#| msgid "Table comments" msgid "Show column comments" -msgstr "테이블 설명" +msgstr "칼럼 설명 보이기" #: libraries/config/messages.inc.php:119 msgid "Whether column comments should be shown in table structure view" @@ -6452,74 +6428,53 @@ msgid "Enable highlighting" msgstr "강조 표시 사용" #: libraries/config/messages.inc.php:521 -#, fuzzy -#| msgid "Whether to disable the possibility of database expansion or not." msgid "" "Whether to offer the possibility of tree expansion in the navigation panel." -msgstr "데이터베이스 확장 가능 여부를 비활성화할 것인지." +msgstr "내비게이션 패널에서 트리 확장을 가능하게 할 지 설정합니다." #: libraries/config/messages.inc.php:524 -#, fuzzy -#| msgid "Table navigation bar" msgid "Enable navigation tree expansion" -msgstr "테이블 네비게이션 바" +msgstr "내비게이션 트리 확장 사용" #: libraries/config/messages.inc.php:525 -#, fuzzy -#| msgid "Show/Hide tables list" msgid "Show tables in tree" -msgstr "테이블 목록 표시/숨김" +msgstr "트리에 테이블 표시" #: libraries/config/messages.inc.php:527 -#, fuzzy -#| msgid "Whether to disable the possibility of database expansion or not." msgid "Whether to show tables under database in the navigation tree" -msgstr "데이터베이스 확장 가능 여부를 비활성화할 것인지." +msgstr "내비게이션 트리에 테이블 안에 있는 데이터베이스를 표시할 지 설정합니다" #: libraries/config/messages.inc.php:528 -#, fuzzy -#| msgid "Show versions" msgid "Show views in tree" -msgstr "버전 보기" +msgstr "트리에 뷰 보기" #: libraries/config/messages.inc.php:530 -#, fuzzy -#| msgid "Show hidden navigation tree items." msgid "Whether to show views under database in the navigation tree" -msgstr "숨겨진 탐색 트리의 항목보기." +msgstr "내비게이션 트리에 데이터베이스 안의 뷰를 보일지 설정합니다" #: libraries/config/messages.inc.php:531 -#, fuzzy -#| msgid "Show function fields" msgid "Show functions in tree" -msgstr "함수 필드 보이기" +msgstr "트리에 기능 보이기" #: libraries/config/messages.inc.php:533 -#, fuzzy msgid "Whether to show functions under database in the navigation tree" -msgstr "내비게이션 트리의 데이터베이스 항목 아래에 기능을 표시할지 설정합니다" +msgstr "내비게이션 트리에 데이터베이스에서 사용 가능한 기능을 보일지 설정합니다" #: libraries/config/messages.inc.php:534 -#, fuzzy -#| msgid "procedures" msgid "Show procedures in tree" -msgstr "프로시저" +msgstr "트리에 프로시저 보이기" #: libraries/config/messages.inc.php:536 msgid "Whether to show procedures under database in the navigation tree" msgstr "" #: libraries/config/messages.inc.php:537 -#, fuzzy -#| msgid "Show versions" msgid "Show events in tree" -msgstr "버전 보기" +msgstr "트리에 이벤트 보이기" #: libraries/config/messages.inc.php:539 -#, fuzzy -#| msgid "Show hidden navigation tree items." msgid "Whether to show events under database in the navigation tree" -msgstr "숨겨진 탐색 트리의 항목보기." +msgstr "내비게이션 트리에서 데이터베이스의 이벤트를 보일지 설정합니다" #: libraries/config/messages.inc.php:541 msgid "Maximum number of recently used tables; set 0 to disable." @@ -6754,10 +6709,8 @@ msgid "Allow root login" msgstr "루트 사용자 로그인 허용" #: libraries/config/messages.inc.php:627 -#, fuzzy -#| msgid "Session value" msgid "Session timezone" -msgstr "세션 값" +msgstr "세션 시간대" #: libraries/config/messages.inc.php:629 msgid "" @@ -6826,17 +6779,12 @@ msgid "Control user password" msgstr "유저 비밀번호 제어" #: libraries/config/messages.inc.php:654 -#, fuzzy -#| msgid "" -#| "A special MySQL user configured with limited permissions, more " -#| "information available on [a@https://wiki.phpmyadmin.net/pma/" -#| "controluser]wiki[/a]." msgid "" "A special MySQL user configured with limited permissions, more information " "available on [doc@linked-tables]documentation[/doc]." msgstr "" -"제한된 권한 설정을 위한 특별한 MySQL 사용자 설정. 추가 정보는 [a@https://" -"wiki.phpmyadmin.net/pma/controluser]위키[/a]에." +"특별한 MySQL 사용자가 제한된 권한으로 구성되었습니다. [doc@linked-tables]이 문서[/doc]에서 더 많은 정보를 " +"찾아보실 수 있습니다." #: libraries/config/messages.inc.php:657 msgid "Control user" @@ -6925,50 +6873,30 @@ msgid "QBE saved searches table" msgstr "QBE가 검색 테이블에 저장되었습니다" #: libraries/config/messages.inc.php:693 -#, fuzzy -#| msgid "" -#| "Leave blank for no PDF schema support, suggested: [kbd]pma__pdf_pages[/" -#| "kbd]" msgid "" "Leave blank for no QBE saved searches support, suggested: " "[kbd]pma__savedsearches[/kbd]." -msgstr "" -"PDF 스키마를 제공하지 않을 경우 비워두세요. 제안값: [kbd]pma__pdf_pages[/kbd]" +msgstr "QBE 저장된 검색 지원을 사용하지 않으려면 비워두세요. 제안하는 값 : [kbd]pma__savedsearches[/kbd]." #: libraries/config/messages.inc.php:696 -#, fuzzy -#| msgid "Export views as tables" msgid "Export templates table" -msgstr "뷰를 테이블로 내보내기" +msgstr "템플릿 테이블 내보내기" #: libraries/config/messages.inc.php:698 -#, fuzzy -#| msgid "" -#| "Leave blank for no PDF schema support, suggested: [kbd]pma__pdf_pages[/" -#| "kbd]." msgid "" "Leave blank for no export template support, suggested: " "[kbd]pma__export_templates[/kbd]." -msgstr "" -"PDF 스키마를 제공하지 않을 경우 비워두세요. 권장: [kbd]pma__pdf_pages[/kbd]." +msgstr "템플릿 내보내기를 활성화하지 않으려면 비워두세요. 제안하는 값 : [kbd]pma__export_templates[/kbd]." #: libraries/config/messages.inc.php:701 -#, fuzzy -#| msgid "Central columns" msgid "Central columns table" -msgstr "중심 열" +msgstr "중심 열 테이블" #: libraries/config/messages.inc.php:703 -#, fuzzy -#| msgid "" -#| "Leave blank for no PDF schema support, suggested: [kbd]pma__table_coords[/" -#| "kbd]." msgid "" "Leave blank for no central columns support, suggested: " "[kbd]pma__central_columns[/kbd]." -msgstr "" -"PDF 스키마를 제공하지 않을 경우 비워두세요. 제안값: [kbd]pma__table_coords[/" -"kbd]." +msgstr "중심 열 지원을 비활성화하려면 비워두세요. 제안하는 값 : [kbd]pma__central_columns[/kbd]." #: libraries/config/messages.inc.php:706 msgid "Try to connect without password." @@ -7010,19 +6938,14 @@ msgid "PDF schema: pages table" msgstr "PDF 스키마: 페이지 테이블" #: libraries/config/messages.inc.php:721 -#, fuzzy -#| msgid "" -#| "Database used for relations, bookmarks, and PDF features. See [a@https://" -#| "wiki.phpmyadmin.net/pma/pmadb]pmadb[/a] for complete information. Leave " -#| "blank for no support. Suggested: [kbd]phpmyadmin[/kbd]." msgid "" "Database used for relations, bookmarks, and PDF features. See [doc@linked-" "tables]pmadb[/doc] for complete information. Leave blank for no support. " "Suggested: [kbd]phpmyadmin[/kbd]." msgstr "" -"릴레이션, 북마크, PDF 기능을 위한 데이터베이스. 자세한 정보는 [a@https://" -"wiki.phpmyadmin.net/pma/pmadb]pmadb[/a]를 참고하세요. 이 기능들을 제공하지 않" -"으려면 비워두세요. 권장: [kbd]phpmyadmin[/kbd]." +"릴레이션, 북마크, PDF 기능 지원을 위해 필요한 데이터베이스입니다. 자세한 정보는 [doc@linked-" +"tables]pmadb[/doc]를 참고해주세요. 이 기능들을 사용하지 않으려면 비워두세요. 제안하는 값 : " +"[kbd]phpmyadmin[/kbd]." #: libraries/config/messages.inc.php:725 #: templates/server/databases/create.phtml:20 @@ -7066,8 +6989,6 @@ msgstr "" "[kbd]pma__userconfig[/kbd]" #: libraries/config/messages.inc.php:738 -#, fuzzy -#| msgid "Favorite tables" msgid "Favorites table" msgstr "즐겨찾기 테이블" diff --git a/test/classes/config/ConfigFileTest.php b/test/classes/config/ConfigFileTest.php index cb727e2de0..df77943322 100644 --- a/test/classes/config/ConfigFileTest.php +++ b/test/classes/config/ConfigFileTest.php @@ -529,6 +529,26 @@ class ConfigFileTest extends PMATestCase "mysqli://testUser@123", $this->object->getServerDSN(1) ); + + $this->object->updateWithGlobalConfig( + array( + 'Servers' => array( + 1 => array( + "auth_type" => "config", + "user" => "testUser", + "connect_type" => "tcp", + "host" => "example.com", + "port" => "21", + "nopassword" => "yes", + "password" => "testPass" + ) + ) + ) + ); + $this->assertEquals( + "mysqli://testUser:***@example.com:21", + $this->object->getServerDSN(1) + ); } /**