Don't allow enabling encryption when it's not compiled in

This commit is contained in:
Ari Koivula 2016-06-07 13:13:33 +03:00
parent 8eb087120e
commit 182038c743

View file

@ -861,9 +861,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
if (toggle == 1) {
cfg->crypto_features = KVZ_CRYPTO_ON;
}
return 1;
}
} else {
// Try and parse "feature1+feature2" type list.
for (;;) {
if (*cur == '+' || *cur == '\0') {
@ -884,6 +882,18 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
++cur;
}
}
}
// Disallow turning on the encryption when it's not compiled in.
bool encryption_compiled_in = false;
#ifdef KVZ_SEL_ENCRYPTION
encryption_compiled_in = true;
#endif
if (!encryption_compiled_in && cfg->crypto_features) {
fprintf(stderr, "--crypto cannot be enabled because it's not compiled in.\n");
cfg->crypto_features = KVZ_CRYPTO_OFF;
return 0;
}
return 1;
}