interpret domain '*' as 'allow any domain'

Make the 'domain NAME' vty doc more descriptive, and add the hint that '*'
means any domain.

In check_domain_name(), exit early in success if the configured domain name is
'*'.

(Do not implement other wildcard functionality for partial matches or the
like, just the single '*'.)

Related: OS#3490
Change-Id: Ie0220c88d2f5cee15f2a90390b3c4590ac61d5eb
This commit is contained in:
Neels Hofmeyr
2018-08-20 23:59:32 +02:00
parent 0a89e92a5e
commit 352eed09ae
2 changed files with 7 additions and 1 deletions

View File

@@ -219,6 +219,10 @@ static int check_domain_name(struct mgcp_config *cfg, const char *mgcp)
if (!domain_to_check)
return -EINVAL;
/* Accept any domain if configured as "*" */
if (!strcmp(cfg->domain, "*"))
return 0;
if (strcmp(domain_to_check+1, cfg->domain) != 0)
return -EINVAL;

View File

@@ -1208,7 +1208,9 @@ DEFUN(cfg_mgcp_osmux_dummy,
DEFUN(cfg_mgcp_domain,
cfg_mgcp_domain_cmd,
"domain NAME", "domain\n" "qualified domain name\n")
"domain NAME",
"Set the domain part expected in MGCP messages' endpoint names\n"
"Qualified domain name expected in MGCP endpoint names, or '*' to accept any domain\n")
{
osmo_strlcpy(g_cfg->domain, argv[0], sizeof(g_cfg->domain));
return CMD_SUCCESS;