Change in osmo-sgsn[master]: osmo-sgsn: get rid of OSMO_ASSERT() in 'auth-policy' handler

Vadim Yanitskiy gerrit-no-reply at
Mon May 27 00:43:18 UTC 2019

Vadim Yanitskiy has uploaded this change for review. (

Change subject: osmo-sgsn: get rid of OSMO_ASSERT() in 'auth-policy' handler

osmo-sgsn: get rid of OSMO_ASSERT() in 'auth-policy' handler

For some reason, libosmovty does accept incomplete commands
if a command definition contains 'choice' statements.

For example, the following command definition:

  auth-policy (accept-all|closed|acl-only|remote)

actually permits the following variations:

  auth-policy accept-all
  auth-policy accept
  auth-policy acl
  auth-policy re
  auth-policy c

so in case of such incomplete input, get_string_value() would fail
to find the corresponding enum value, and the whole process would
crash. That's not what a regular fun of the TAB-completion would
expect, right?

Instead of assert()ing the result of get_string_value(), let's
rather print a warning and return CMD_ERR_INCOMPLETE.

Change-Id: If9b0c0d031477ca87786aab5c269d00748e896c8
M src/gprs/sgsn_vty.c
1 file changed, 7 insertions(+), 3 deletions(-)

  git pull ssh:// refs/changes/95/14195/1

diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c
index 9155441..969156f 100644
--- a/src/gprs/sgsn_vty.c
+++ b/src/gprs/sgsn_vty.c
@@ -725,9 +725,13 @@
 	"Accept only subscribers in the ACL\n"
 	"Use remote subscription data only (HLR)\n")
-	int val = get_string_value(sgsn_auth_pol_strs, argv[0]);
-	g_cfg->auth_policy = val;
+	int val;
+	val = get_string_value(sgsn_auth_pol_strs, argv[0]);
+	if (val < 0)
+	g_cfg->auth_policy = (enum sgsn_auth_policy) val;
 	g_cfg->require_update_location = (val == SGSN_AUTH_POLICY_REMOTE);
 	/* Authentication is not possible without HLR */

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If9b0c0d031477ca87786aab5c269d00748e896c8
Gerrit-Change-Number: 14195
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list