diff options
author | Ben Pfaff <blp@nicira.com> | 2009-11-19 16:48:12 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2009-11-19 16:48:12 -0800 |
commit | b966380b45d66ae058c31fbcab67ccfcb8751005 (patch) | |
tree | e6baf05fff92d7c53e224325bd4a1f515ba44d54 /lib | |
parent | b9edf64b05c7de01f39b7d88aa45af3d13b5cc72 (diff) | |
download | openvswitch-b966380b45d66ae058c31fbcab67ccfcb8751005.tar.gz |
ovsdb: Require database, table, column names to be valid identifiers.
Database, table, and column names have always been required by the OVSDB
specification to be identifiers (e.g. valid C identifiers), but this has
never been enforced.
This commit adds enforcement and fixes one instance of an invalid column
name in the vswitch schema.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ovsdb-parser.c | 6 | ||||
-rw-r--r-- | lib/ovsdb-parser.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/ovsdb-parser.c b/lib/ovsdb-parser.c index 5419467c7..2a4c3d99e 100644 --- a/lib/ovsdb-parser.c +++ b/lib/ovsdb-parser.c @@ -41,8 +41,8 @@ ovsdb_parser_init(struct ovsdb_parser *parser, const struct json *json, } } -static bool -is_id(const char *string) +bool +ovsdb_parser_is_id(const char *string) { unsigned char c; @@ -83,7 +83,7 @@ ovsdb_parser_member(struct ovsdb_parser *parser, const char *name, if ((value->type >= 0 && value->type < JSON_N_TYPES && types & (1u << value->type)) || (types & OP_ID && value->type == JSON_STRING - && is_id(value->u.string))) + && ovsdb_parser_is_id(value->u.string))) { svec_add(&parser->used, name); return value; diff --git a/lib/ovsdb-parser.h b/lib/ovsdb-parser.h index 6a3e32df6..6efa0a73c 100644 --- a/lib/ovsdb-parser.h +++ b/lib/ovsdb-parser.h @@ -71,4 +71,6 @@ struct ovsdb_error *ovsdb_parser_get_error(const struct ovsdb_parser *); struct ovsdb_error *ovsdb_parser_finish(struct ovsdb_parser *) WARN_UNUSED_RESULT; +bool ovsdb_parser_is_id(const char *string); + #endif /* ovsdb-parser.h */ |