[PATCH 1/3] nitb/ctrl: Add ctrl command to get/set auth policy

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Hans Peter Freyther holger at freyther.de
Wed May 7 07:16:36 UTC 2014


On Tue, May 06, 2014 at 07:35:57PM +0400, Ivan Kluchnikov wrote:

hi,


> +	if ((int)gsm_auth_policy_parse(value) < 0) {
> +		return -1;
> +	}

1.) Coding-Style.
2.) The (int) cast is fishy. Most likely even undefined C usage. We have
a int(-EINVAL) -> enum -> int conversion here. Add an invalid element to
the enum, change the implementation to compare to -EINVAL...

Then your verify call becomes a simple one liner and comparison against
the invalid element.


> +    def testAuthPolicy(self):
> +        r = self.do_set('auth-policy', 'qwerty')
> +        self.assertEquals(r['mtype'], 'ERROR')
> +        self.assertEquals(r['error'], 'Value failed verification.')

Check that the previous thing has not been changed. :)





More information about the OpenBSC mailing list