summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-05-07 17:30:02 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-05-07 17:35:26 +0200
commiteef4b80033e9ca8e61ccb40a710babcfe9b69b26 (patch)
tree8d6e5550e9123d34d6d955f6fd526230e17c3d5a /meson.build
parent6dbf40256bd88f1c74657bd9ffbd9eaa06c08706 (diff)
downloadsystemd-eef4b80033e9ca8e61ccb40a710babcfe9b69b26.tar.gz
Add a basic test that the configured fallback hostname is OK
Ideally, assert_cc() would be used for this, so that it is not possible to even compile systemd with something like '-Dfallback-hostname=.foo'. But to do a proper check we need to call hostname_is_valid(), and we cannot depend on being able to run code (e.g. during cross-compilation). So let's do a very superficial check in meson, and a proper on in test-util.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build9
1 files changed, 8 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 28494c9af2..fea226e2d6 100644
--- a/meson.build
+++ b/meson.build
@@ -639,7 +639,14 @@ endforeach
############################################################
-conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
+fallback_hostname = get_option('fallback-hostname')
+if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
+ error('Invalid fallback-hostname configuration')
+ # A more extensive test is done in test-hostname-util. Let's catch
+ # the most obvious errors here so we don't fail with an assert later.
+endif
+conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
+
conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])