Change in libosmocore[master]: vty: check for reserved flags in application specific attributes

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/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Sat Oct 3 10:46:08 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/20417 )


Change subject: vty: check for reserved flags in application specific attributes
......................................................................

vty: check for reserved flags in application specific attributes

We agreed to reserve uppercase flag letters for libraries.

Change-Id: If0c332f7c86ff26a4060a14b947445d194a6702e
Related: SYS#4937
---
M src/vty/vty.c
M tests/vty/vty_test.c
M tests/vty/vty_test.err
3 files changed, 12 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/17/20417/1

diff --git a/src/vty/vty.c b/src/vty/vty.c
index 4d51165..3b723e1 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -1809,6 +1809,14 @@
 	for (i = 0; i < ARRAY_SIZE(app_info->usr_attr_letters); i++) {
 		if (app_info->usr_attr_letters[i] == '\0')
 			continue;
+
+		/* Upper case flag letters are reserved for libraries */
+		if (app_info->usr_attr_letters[i] >= 'A' &&
+		    app_info->usr_attr_letters[i] <= 'Z') {
+			fprintf(stderr, "Attribute flag letter '%c' is reserved "
+				"for libraries! Please fix.\n", app_info->usr_attr_letters[i]);
+		}
+
 		for (j = i + 1; j < ARRAY_SIZE(app_info->usr_attr_letters); j++) {
 			if (app_info->usr_attr_letters[j] != app_info->usr_attr_letters[i])
 				continue;
diff --git a/tests/vty/vty_test.c b/tests/vty/vty_test.c
index 1608b83..3a69e13 100644
--- a/tests/vty/vty_test.c
+++ b/tests/vty/vty_test.c
@@ -520,6 +520,7 @@
 	VTY_TEST_ATTR_ZOO,
 	VTY_TEST_ATTR_FOO_DUP,
 	VTY_TEST_ATTR_ZOO_DUP,
+	VTY_TEST_ATTR_UPPER,
 };
 
 int main(int argc, char **argv)
@@ -535,6 +536,8 @@
 			/* Duplicate detection check */
 			[VTY_TEST_ATTR_FOO_DUP]	= 'f',
 			[VTY_TEST_ATTR_ZOO_DUP]	= 'z',
+			/* Reserved for libraries */
+			[VTY_TEST_ATTR_UPPER]	= 'X',
 		},
 	};
 
diff --git a/tests/vty/vty_test.err b/tests/vty/vty_test.err
index 25c94e6..a85b129 100644
--- a/tests/vty/vty_test.err
+++ b/tests/vty/vty_test.err
@@ -1,5 +1,6 @@
 Found duplicate flag letter 'f' in application specific attributes (index 0 vs 3)! Please fix.
 Found duplicate flag letter 'z' in application specific attributes (index 2 vs 4)! Please fix.
+Attribute flag letter 'X' is reserved for libraries! Please fix.
 Got VTY event: 2
 Got VTY event: 2
 Got VTY event: 2

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20417
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If0c332f7c86ff26a4060a14b947445d194a6702e
Gerrit-Change-Number: 20417
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201003/83cd44c5/attachment.htm>


More information about the gerrit-log mailing list