Re: building Dovecot in Debian 9

2017-04-25 Thread Peter van der Does
You might have to install the package default-libmysqlclient-dev from
the Debian repo.

Peter

On 4/25/17 1:37 PM, KT Walrus wrote:
> I’m trying to build Dovecot 2.2.29.1 in a Docker container today and have the 
> following error in ./configure:
> 
> checking for shadow.h... yes
> checking for pam_start in -lpam... no
> checking for auth_userokay... no
> checking for mysql_config... mysql_config
> checking for mysql_init in -lmysqlclient... no
> configure: error: Can't build with MySQL support: libmysqlclient not found
> 
> #> find / -name libmysqlclient\*
> /usr/share/doc/libmysqlclient20
> /usr/share/lintian/overrides/libmysqlclient20
> /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.5
> /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
> /var/lib/dpkg/info/libmysqlclient20:amd64.triggers
> /var/lib/dpkg/info/libmysqlclient20:amd64.shlibs
> /var/lib/dpkg/info/libmysqlclient20:amd64.list
> /var/lib/dpkg/info/libmysqlclient20:amd64.md5sums
> 
> I have installed MySQL 5.7.18 Debian 9 packages (including the 
> libmysqlclient-dev package) from the MySQL repo.
> 
> I’m not an expert, but is there a bug in the "./configure --prefix=/usr 
> --sysconfdir=/etc --with-mysql”?
> 
> I’ve been building Dovecot with this Dockerfile using Ubuntu 16.04 for a 
> while now without issue. Do I need some extra ./configure option to get it to 
> find libmysqlclient.so.20?
> 
> Kevin
> 


Re: building Dovecot in Debian 9

2017-04-25 Thread Peter van der Does
On 4/25/17 4:06 PM, KT Walrus wrote:
> 
>> On Apr 25, 2017, at 2:16 PM, Peter van der Does  
>> wrote:
>>
>> You might have to install the package default-libmysqlclient-dev from
>> the Debian repo.
> 
> Isn’t that the MariaDB package? I don’t really want to mix MariaDB with MySQL 
> (even though they are probably still compatible, but diverging as time 
> passes).
> 
> Dovecot does build with default-libmysqlclient-dev, but maybe ./configure 
> needs to be updated by the Dovecot devs to build against the libmysqlclient 
> package that Oracle built for Debian Stretch?
> 
> Since I’m only testing today to get ready for Debian 9, I don’t really need 
> this fixed now. But, when Debian 9 is released, it would be nice to be able 
> to do a production build of Dovecot using the Oracle MySQL packages and 
> Debian 9.
> 
> Kevin
> 

The problem with making the Dovecot check for libmysqlclient.so.20 would
be that you have have to make sure older/newer packages are also
supported. The 20 extension is subject to changes.

If I check the Oracle DEB file for Debian 9, it seems they do use the
name libmysqlclient.so, so not sure what to make of it. Double check to
make sure you really installed the file
libmysqlclient-dev_5.7.18-1debian9_amd64.deb from the Oracle repo.

If you still have problems I might setup a Docker file with Debian 9
later tonight to check myself.

Peter

-- 
Peter van der Does

Facebook : https://www.facebook.com/petervanderdoes
Twitter  : https://twitter.com/petervanderdoes
GitHub   : https://github.com/petervanderdoes
About Me : https://about.me/petervanderdoes


Re: building Dovecot in Debian 9

2017-04-25 Thread Peter van der Does
Kevin,

Regarding the configuration error, your missing a package:
zlib1g-dev

As far as the deprecation warning, it's a bit more complicated. The
source of Dovecot needs to be patched to check for the OpenSSL version
and depending on the version use a different DH_generate_numbers function.

Regards,

Peter

-- 
Peter van der Does

Facebook : https://www.facebook.com/petervanderdoes
Twitter  : https://twitter.com/petervanderdoes
GitHub   : https://github.com/petervanderdoes
About Me : https://about.me/petervanderdoes


[BUG] OpenSSL function has been deprecated

2017-04-25 Thread Peter van der Does
In src/lib-ssl-iostream/iostream-openssl-params.c a call is made to 
DH_generate_parameters. This function has been deprecated since OpenSSL 0.9.8. 
With OpenSSL 1.1 compilation will throw an error.

Not sure how to send patches, I don't even know if the patch I wrote actually 
works (I don't program in C, but gave it a shot anyway) but below is the patch.

--- a/src/lib-ssl-iostream/iostream-openssl-params.c
+++ b/src/lib-ssl-iostream/iostream-openssl-params.c
@@ -13,13 +13,21 @@ generate_dh_parameters(int bitsize, buffer_t *output, const 
char **error_r)
 {
 DH *dh;
unsigned char *p;
-   int len, len2;
+   int len, len2, success;
 
+#if OPENSSL_VERSION_NUMBER >= 0x00908000L
+   success = DH_generate_parameters_ex(dh, bitsize, DH_GENERATOR, NULL);
+#else
dh = DH_generate_parameters(bitsize, DH_GENERATOR, NULL, NULL);
if (dh == NULL) {
+   success = 0;
+   }
+#endif
+
+   if (success == 0) {
*error_r = t_strdup_printf(
-   "DH_generate_parameters(bits=%d, gen=%d) failed: %s",
-   bitsize, DH_GENERATOR, openssl_iostream_error());
+   "DH_generate_parameters(bits=%d, gen=%d) 
failed: %s",
+   bitsize, DH_GENERATOR, 
openssl_iostream_error());
return -1;
}
 
-- 


If anybody knows the instruction on how to send patches, please let me know and 
I follow those instructions.

Regards,

Peter van der Does


Re: [BUG] OpenSSL function has been deprecated

2017-04-26 Thread Peter van der Does
Patch v2

--- a/src/lib-ssl-iostream/iostream-openssl-params.c
+++ b/src/lib-ssl-iostream/iostream-openssl-params.c
@@ -13,10 +13,19 @@ generate_dh_parameters(int bitsize, buffer_t *output, const 
char **error_r)
 {
 DH *dh;
unsigned char *p;
-   int len, len2;
+   int len, len2, success;
 
+#if OPENSSL_VERSION_NUMBER >= 0x00908000L
+   success = DH_generate_parameters_ex(dh, bitsize, DH_GENERATOR, NULL);
+#else
+   success = 1;
dh = DH_generate_parameters(bitsize, DH_GENERATOR, NULL, NULL);
if (dh == NULL) {
+   success = 0;
+   }
+#endif
+
+   if (success == 0) {
*error_r = t_strdup_printf(
"DH_generate_parameters(bits=%d, gen=%d) failed: %s",
bitsize, DH_GENERATOR, openssl_iostream_error());
-- 


Re: [BUG] OpenSSL function has been deprecated

2017-04-26 Thread Peter van der Does
On 4/26/17 8:26 AM, Aki Tuomi wrote:
> 
> 
> I encourage you to open pull request at https://github.com/dovecot/core/pulls
> 
> Aki
> 


Thanks Aki.

I'll do that.

Peter