turn ssl setting from command line to tls (ssl no longer exists)

This commit is contained in:
yrutschle 2018-09-30 21:34:22 +02:00
parent 2ee0088c5f
commit aa77922ffd
2 changed files with 22 additions and 2 deletions

View File

@ -52,7 +52,6 @@ static struct proto builtins[] = {
{ "tinc", NULL, NULL, 1, 0, 1, is_tinc_protocol },
{ "xmpp", NULL, NULL, 1, 0, 0, is_xmpp_protocol },
{ "http", NULL, NULL, 1, 0, 0, is_http_protocol },
{ "ssl", NULL, NULL, 1, 0, 0, is_tls_protocol },
{ "tls", NULL, NULL, 1, 0, 0, is_tls_protocol },
{ "adb", NULL, NULL, 1, 0, 0, is_adb_protocol },
{ "socks5", NULL, NULL, 1, 0, 0, is_socks5_protocol },

View File

@ -147,11 +147,28 @@ static void printsettings(void)
}
/* To removed in v1.21 */
const char* ssl_err_msg = "Usage of 'ssl' setting is deprecated and will be removed in v1.21. Please use 'tls' instead\n";
void ssl_to_tls(char* setting)
{
if (!strcmp(setting, "ssl")) {
strcpy(setting, "tls"); /* legacy configuration */
log_message(LOG_INFO, "Usage of 'ssl' setting is deprecated and will be removed in v1.21. Please use 'tls' instead\n");
log_message(LOG_INFO, ssl_err_msg);
}
}
/* Turn 'ssl' command line option to 'tls'. To removed in v1.21 */
void cmd_ssl_to_tls(int argc, char* argv[])
{
int i;
for (i = 0; i < argc; i++) {
if (!strcmp(argv[i], "--ssl")) {
strcpy(argv[i], "--tls");
/* foreground option not parsed yet, syslog not open, just print on
* stderr and hope for the best */
fprintf(stderr, ssl_err_msg);
}
}
}
@ -334,8 +351,10 @@ static int config_protocols(config_t *config, struct proto **prots)
config_setting_lookup_string(prot, "host", &hostname) &&
config_setting_lookup_string(prot, "port", &port)
)) {
/* To removed in v1.21 */
name = strdup(cfg_name);
ssl_to_tls(name);
/* /remove */
p->description = name;
config_setting_lookup_string(prot, "service", &(p->service));
config_setting_lookup_bool(prot, "keepalive", &p->keepalive);
@ -485,6 +504,8 @@ static void cmdline_config(int argc, char* argv[], struct proto** prots)
char *config_filename;
#endif
cmd_ssl_to_tls(argc, argv); /* To remove in v1.21 */
make_alloptions();
#ifdef LIBCONFIG