[packages/pure-ftpd] utf8 passwords in MySQL
arekm
arekm at pld-linux.org
Fri Jun 26 15:35:51 CEST 2015
commit 33f546fd45c4e9a8b5220747f4f77735d035eed5
Author: Wojciech Błaszkowski <wojciech at blaszkowski.com>
Date: Fri Jun 26 13:23:37 2015 +0200
utf8 passwords in MySQL
Pure-Ftpd By default, connects to MySQL server with default
character set, which drops internationalize characters
and make logins and/or passwords for virtual users useless.
If you only set the character set in a correct way,
there will be no more problem with utf8 characters.
pure-ftpd-mysql-utf8.patch | 31 +++++++++++++++++++++++++++++++
pure-ftpd.spec | 4 +++-
2 files changed, 34 insertions(+), 1 deletion(-)
---
diff --git a/pure-ftpd.spec b/pure-ftpd.spec
index cec4252..0820293 100644
--- a/pure-ftpd.spec
+++ b/pure-ftpd.spec
@@ -9,7 +9,7 @@
%bcond_without tls # disable SSL/TLS support
%bcond_without cap # disable capabilities
-%define rel 1
+%define rel 2
Summary: Small, fast and secure FTP server
Summary(pl.UTF-8): Mały, szybki i bezpieczny serwer FTP
Name: pure-ftpd
@@ -36,6 +36,7 @@ Patch5: %{name}-passwd_location.patch
Patch6: %{name}-additionalgid.patch
Patch7: audit_cap.patch
Patch8: pure-ftpd-apparmor.patch
+Patch9: pure-ftpd-mysql-utf8.patch
URL: http://www.pureftpd.org/
%{?with_extra:BuildRequires: autoconf}
%{?with_extra:BuildRequires: automake}
@@ -105,6 +106,7 @@ Ten pakiet zawiera schemat Pure-FTPd pureftpd.schema dla openldapa.
%patch6 -p1
%patch7 -p1
%patch8 -p1
+%patch9 -p1
%{?with_extra:%patch1 -p1}
%{?with_extra:%patch2 -p1}
diff --git a/pure-ftpd-mysql-utf8.patch b/pure-ftpd-mysql-utf8.patch
new file mode 100644
index 0000000..a3c6609
--- /dev/null
+++ b/pure-ftpd-mysql-utf8.patch
@@ -0,0 +1,31 @@
+diff --git a/src/log_mysql.c b/src/log_mysql.c
+index 2ce748a..f812a4d 100644
+--- a/src/log_mysql.c
++++ b/src/log_mysql.c
+@@ -226,6 +226,13 @@ static int pw_mysql_connect(MYSQL ** const id_sql_server)
+ }
+ server_down = 0;
+
++ if (mysql_set_character_set(*id_sql_server, "utf8"))
++ {
++ logfile(LOG_ERR, MSG_SQL_FAILED_CHSET_UTF8,
++ mysql_error(*id_sql_server),
++ mysql_character_set_name(*id_sql_server));
++ }
++
+ return 0;
+ }
+
+diff --git a/src/messages_en.h b/src/messages_en.h
+index 90999bb..201957a 100644
+--- a/src/messages_en.h
++++ b/src/messages_en.h
+@@ -200,6 +200,8 @@
+ #define MSG_UNKNOWN_ALTLOG "Unknown logging format"
+ #define MSG_ACCOUNT_DISABLED "Can't login as [%s]: account disabled"
+ #define MSG_SQL_WRONG_PARMS "Wrong SQL parameters"
++#define MSG_SQL_FAILED_CHSET_UTF8 "Failed to set character set for database to utf8: %s \n" \
++ "(using old character set: %s)"
+ #define MSG_ILLEGAL_CONFIG_FILE_SQL "Invalid SQL configuration file"
+ #define MSG_SQL_MISSING_SERVER "Missing server in the SQL configuration file"
+ #define MSG_SQL_DOWN "The SQL server seems to be down"
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/pure-ftpd.git/commitdiff/33f546fd45c4e9a8b5220747f4f77735d035eed5
More information about the pld-cvs-commit
mailing list