Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 1 | From 1c304e7886a08fb56485e41614ff3f8685afb59d Mon Sep 17 00:00:00 2001 |
| 2 | From: Jiaqing Zhao <jiaqing.zhao@intel.com> |
| 3 | Date: Tue, 8 Mar 2022 15:05:32 +0000 |
| 4 | Subject: [PATCH] Add build option for NTLM support |
| 5 | |
| 6 | Currently, NTLM plugin is built by default when openssl is available |
| 7 | and STARTTLS is enabled. But in libesmtp 1.0.6, there is a separate |
| 8 | build option. This commits adds the 'ntlm' option back. It's also |
| 9 | disabled by default. |
| 10 | |
| 11 | Like 1.0.6, it will check openssl MD4 algorithm support as MD4 is |
| 12 | insecure and modern systems may drop MD4 support. |
| 13 | |
| 14 | Upstream-Status: Accepted [https://github.com/libesmtp/libESMTP/commit/1c304e7886a08fb56485e41614ff3f8685afb59d] |
| 15 | Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com> |
| 16 | --- |
| 17 | meson.build | 13 ++++++++++--- |
| 18 | meson_options.txt | 1 + |
| 19 | ntlm/meson.build | 2 +- |
| 20 | 3 files changed, 12 insertions(+), 4 deletions(-) |
| 21 | |
| 22 | diff --git a/meson.build b/meson.build |
| 23 | index 11d6ed8..d2a0e06 100644 |
| 24 | --- a/meson.build |
| 25 | +++ b/meson.build |
| 26 | @@ -61,6 +61,7 @@ add_project_arguments(cc.get_supported_arguments(cflags), language: 'c') |
| 27 | ################################################################################ |
| 28 | dldep = cc.find_library('dl') |
| 29 | ssldep = dependency('openssl', version : '>=1.1.0', required : get_option('tls')) |
| 30 | +ntlmdep = dependency('openssl', version : '>=1.1.0', required : get_option('ntlm')) |
| 31 | threaddep = dependency('threads', required : get_option('pthreads')) |
| 32 | |
| 33 | #XXX add test for libbind9.so |
| 34 | @@ -69,6 +70,7 @@ lwresdep = cc.find_library('lwres', required : get_option('lwres')) |
| 35 | deps = [ |
| 36 | dldep, |
| 37 | ssldep, |
| 38 | + ntlmdep, |
| 39 | threaddep, |
| 40 | lwresdep, |
| 41 | ] |
| 42 | @@ -237,8 +239,12 @@ include_dir = include_directories('.') |
| 43 | subdir('login') |
| 44 | subdir('plain') |
| 45 | subdir('crammd5') |
| 46 | -if ssldep.found() |
| 47 | - subdir('ntlm') |
| 48 | +if ntlmdep.found() |
| 49 | + if cc.has_header('openssl/md4.h') and cc.has_function('MD4_Init', dependencies : ntlmdep) |
| 50 | + subdir('ntlm') |
| 51 | + else |
| 52 | + error('MD4 is not supported in current openssl, unable to build NTLM plugin') |
| 53 | + endif |
| 54 | endif |
| 55 | |
| 56 | ################################################################################ |
| 57 | @@ -264,4 +270,5 @@ summary({'current:revision:age': libesmtp_cra, |
| 58 | 'STARTTLS': ssldep.found(), |
| 59 | 'CHUNKING': get_option('bdat'), |
| 60 | 'ETRN': get_option('etrn'), |
| 61 | - 'XUSR': get_option('xusr')}) |
| 62 | + 'XUSR': get_option('xusr'), |
| 63 | + 'NTLM': ntlmdep.found()}) |
| 64 | diff --git a/meson_options.txt b/meson_options.txt |
| 65 | index 8375e2c..158f38f 100644 |
| 66 | --- a/meson_options.txt |
| 67 | +++ b/meson_options.txt |
| 68 | @@ -5,3 +5,4 @@ option('lwres', type : 'feature', value : 'disabled', description : 'use lwres l |
| 69 | option('bdat', type : 'boolean', value : 'true', description : 'enable SMTP BDAT extension') |
| 70 | option('etrn', type : 'boolean', value : 'true', description : 'enable SMTP ETRN extension') |
| 71 | option('xusr', type : 'boolean', value : 'true', description : 'enable sendmail XUSR extension') |
| 72 | +option('ntlm', type : 'feature', value : 'disabled', description : 'build with support for NTLM authentication') |
| 73 | diff --git a/ntlm/meson.build b/ntlm/meson.build |
| 74 | index e0eef58..11d7f58 100644 |
| 75 | --- a/ntlm/meson.build |
| 76 | +++ b/ntlm/meson.build |
| 77 | @@ -5,7 +5,7 @@ sasl_ntlm_sources = [ |
| 78 | 'ntlmstruct.c', |
| 79 | ] |
| 80 | |
| 81 | -ntlm_deps = [ ssldep, ] |
| 82 | +ntlm_deps = [ ntlmdep, ] |
| 83 | |
| 84 | sasl_ntlm = shared_module('ntlm', sasl_ntlm_sources, |
| 85 | name_prefix : 'sasl-', |