On 07/06/2017 08:46 AM, Tumeski wrote:
> Package: pure-ftpd-mysql
> Version: 1.0.43-3
> Severity: important
> 
> Hello,
> 
> After upgrading Debian 8 to Debian 9 pure-ftpd-mysql package fails with 
> MariaDB.
> 
> I had previously used MariaDB in Debian 8 enviroment too and package worked 
> fine.

Hello Tumeski,

you ran into a PureFTPd bug:

https://jira.mariadb.org/browse/MDEV-12889

Patch attached.

Thanks for the report

     Racke

> 
> Setting up pure-ftpd-mysql (1.0.43-3) ...
> Job for pure-ftpd-mysql.service failed because the control process exited 
> with error code.
> See "systemctl status pure-ftpd-mysql.service" and "journalctl -xe" for 
> details.
> invoke-rc.d: initscript pure-ftpd-mysql, action "start" failed.
> ● pure-ftpd-mysql.service
>    Loaded: loaded (/etc/init.d/pure-ftpd-mysql; generated; vendor preset: 
> enabled)
>    Active: failed (Result: exit-code) since Thu 2017-07-06 09:42:08 EEST; 
> 36ms ago
>      Docs: man:systemd-sysv-generator(8)
>   Process: 31513 ExecStart=/etc/init.d/pure-ftpd-mysql start (code=exited, 
> status=127)
> 
> Jul 06 09:42:08 megajorma systemd[1]: Starting pure-ftpd-mysql.service...
> Jul 06 09:42:08 megajorma pure-ftpd-mysql[31513]: Starting ftp server: 
> Running: /usr/sbin/pure-ftpd-mysql-virtualchroot -l 
> mysql:/etc/pure-ftpd/db/mysql.conf -l pam -Y 1 -D -b -E -O 
> clf:/var/log/pure-ftpd/…GH -8 UTF-8 -A -B
> Jul 06 09:42:08 megajorma pure-ftpd-mysql[31513]: 
> /usr/sbin/pure-ftpd-mysql-virtualchroot: 
> /usr/lib/x86_64-linux-gnu/libmariadbclient.so.18: no version information 
> available (required by /usr/sbin/pure-ftp…ql-virtualchroot)
> Jul 06 09:42:08 megajorma pure-ftpd-mysql[31513]: 
> /usr/sbin/pure-ftpd-mysql-virtualchroot: relocation error: 
> /usr/sbin/pure-ftpd-mysql-virtualchroot: symbol my_make_scrambled_password, 
> version libmariadbcl…nk time reference
> Jul 06 09:42:08 megajorma systemd[1]: pure-ftpd-mysql.service: Control 
> process exited, code=exited status=127
> Jul 06 09:42:08 megajorma systemd[1]: Failed to start pure-ftpd-mysql.service.
> Jul 06 09:42:08 megajorma systemd[1]: pure-ftpd-mysql.service: Unit entered 
> failed state.
> Jul 06 09:42:08 megajorma systemd[1]: pure-ftpd-mysql.service: Failed with 
> result 'exit-code'.
> Hint: Some lines were ellipsized, use -l to show in full.
> dpkg: error processing package pure-ftpd-mysql (--configure):
>  subprocess installed post-installation script returned error exit status 1
> Errors were encountered while processing:
>  pure-ftpd-mysql
> E: Sub-process /usr/bin/dpkg returned an error code (1)
> 
> 
> -- System Information:
> Debian Release: 9.0
>   APT prefers stable
>   APT policy: (500, 'stable')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 4.9.0-3-amd64 (SMP w/1 CPU core)
> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
> LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/bash
> Init: systemd (via /run/systemd/system)
> 
> Versions of packages pure-ftpd-mysql depends on:
> ii  libc6                             2.24-11+deb9u1
> ii  libcap2                           1:2.25-1
> ii  libmariadb3 [libmariadbclient18]  10.2.6+maria~stretch
> ii  libmariadbclient18                10.2.6+maria~stretch
> ii  libpam0g                          1.1.8-3.6
> ii  libssl1.1                         1.1.0f-3
> ii  lsb-base                          9.20161125
> ii  openbsd-inetd [inet-superserver]  0.20160825-2
> ii  pure-ftpd-common                  1.0.43-3
> ii  zlib1g                            1:1.2.8.dfsg-5
> 
> pure-ftpd-mysql recommends no packages.
> 
> pure-ftpd-mysql suggests no packages.
> 
> -- Configuration Files:
> /etc/pure-ftpd/db/mysql.conf changed:
> MYSQLServer     127.0.0.1
> MYSQLUser       IRemovedThese
> MYSQLPassword   IRemovedThese
> MYSQLDatabase   IRemovedThese
> MYSQLCrypt      crypt
> MYSQLGetPW      SELECT password FROM ftp_user WHERE active = 'y' AND 
> server_id = '1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 
> 00:00:00" OR expires > NOW())
> MYSQLGetUID     SELECT uid FROM ftp_user WHERE active = 'y' AND server_id = 
> '1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" 
> OR expires > NOW())
> MYSQLGetGID     SELECT gid FROM ftp_user WHERE active = 'y' AND server_id = 
> '1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" 
> OR expires > NOW())
> MYSQLGetDir     SELECT dir FROM ftp_user WHERE active = 'y' AND server_id = 
> '1' AND username="\L" AND (expires IS NULL OR expires="0000-00-00 00:00:00" 
> OR expires > NOW())
> MySQLGetQTAFS  SELECT quota_files FROM ftp_user WHERE active = 'y' AND 
> server_id = '1' AND quota_files != '-1' AND username="\L" AND (expires IS 
> NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
> MySQLGetQTASZ  SELECT quota_size FROM ftp_user WHERE active = 'y' AND 
> server_id = '1' AND quota_size != '-1' AND username="\L" AND (expires IS NULL 
> OR expires="0000-00-00 00:00:00" OR expires > NOW())
> MySQLGetRatioUL SELECT ul_ratio FROM ftp_user WHERE active = 'y' AND 
> server_id = '1' AND ul_ratio != '-1' AND username="\L" AND (expires IS NULL 
> OR expires="0000-00-00 00:00:00" OR expires > NOW())
> MySQLGetRatioDL SELECT dl_ratio FROM ftp_user WHERE active = 'y' AND 
> server_id = '1' AND dl_ratio != '-1' AND username="\L" AND (expires IS NULL 
> OR expires="0000-00-00 00:00:00" OR expires > NOW())
> MySQLGetBandwidthUL SELECT ul_bandwidth FROM ftp_user WHERE active = 'y' AND 
> server_id = '1' AND ul_bandwidth != '-1' AND username="\L" AND (expires IS 
> NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
> MySQLGetBandwidthDL SELECT dl_bandwidth FROM ftp_user WHERE active = 'y' AND 
> server_id = '1' AND dl_bandwidth != '-1' AND username="\L" AND (expires IS 
> NULL OR expires="0000-00-00 00:00:00" OR expires > NOW())
> MySQLTransactions On
> 
> 
> -- no debconf information
> 


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.
commit 27443b29320d85352d8b52c0120836843e10c0f9
Author: Frank Denis <git...@pureftpd.org>
Date:   Mon May 15 20:38:21 2017 +0200

    Always use the internal mysql_scramble implementation

diff --git a/configure.ac b/configure.ac
index 0d840d0..2e1e606 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1309,7 +1309,6 @@ AC_ARG_WITH(mysql,
         AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
     ],[])
     AC_MSG_RESULT(yes)
-    AC_CHECK_FUNCS(my_make_scrambled_password make_scrambled_password)
   fi ])
 
 AC_ARG_WITH(pgsql,
diff --git a/src/log_mysql.c b/src/log_mysql.c
index 615f99d..d508eea 100644
--- a/src/log_mysql.c
+++ b/src/log_mysql.c
@@ -469,34 +469,24 @@ void pw_mysql_check(AuthResult * const result,
     }
     if (crypto_mysql != 0) {
         char scrambled_password[42]; /* 2 * 20 (sha1 hash size) + 2 */
-
-# ifdef HAVE_MY_MAKE_SCRAMBLED_PASSWORD
-        my_make_scrambled_password(scrambled_password, password,
-                                   strlen(password));
-# elif defined(HAVE_MAKE_SCRAMBLED_PASSWORD)
-        make_scrambled_password(scrambled_password, password);
-# else
-        {
-            SHA1_CTX       ctx;
-            unsigned char  h0[20], h1[20];
-            char          *p;
-
-            SHA1Init(&ctx);
-            SHA1Update(&ctx, password, strlen(password));
-            SHA1Final(h0, &ctx);
-            SHA1Init(&ctx);
-            SHA1Update(&ctx, h0, sizeof h0);
-            pure_memzero(h0, sizeof h0);
-            SHA1Final(h1, &ctx);
+        SHA1_CTX        ctx;
+        unsigned char  h0[20], h1[20];
+        char          *p;
+
+        SHA1Init(&ctx);
+        SHA1Update(&ctx, password, strlen(password));
+        SHA1Final(h0, &ctx);
+        SHA1Init(&ctx);
+        SHA1Update(&ctx, h0, sizeof h0);
+        pure_memzero(h0, sizeof h0);
+        SHA1Final(h1, &ctx);
             *scrambled_password = '*';
-            hexify(scrambled_password + 1U, h1,
-                   (sizeof scrambled_password) - 1U, sizeof h1);
-            *(p = scrambled_password) = '*';
-            while (*p++ != 0) {
-                *p = (char) toupper((unsigned char) *p);
-            }
+        hexify(scrambled_password + 1U, h1,
+               (sizeof scrambled_password) - 1U, sizeof h1);
+        *(p = scrambled_password) = '*';
+        while (*p++ != 0) {
+            *p = (char) toupper((unsigned char) *p);
         }
-# endif
         if (pure_strcmp(scrambled_password, spwd) == 0) {
             goto auth_ok;
         }

Reply via email to