diff options
| author | David M. Syzdek <david@syzdek.net> | 2019-11-27 00:00:14 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2019-11-27 00:00:37 -0900 |
| commit | 1f61f562d52a7ca91e9b0028f30c2fd748728b0b (patch) | |
| tree | 0fdfa6260df2251bd9d567360ebe4d446e9d691b /lib/libldapschema | |
| parent | 389dcdfbe90ee4097f25f0ced60b75d4e4531f68 (diff) | |
| download | ldap-utils-1f61f562d52a7ca91e9b0028f30c2fd748728b0b.tar.gz ldap-utils-1f61f562d52a7ca91e9b0028f30c2fd748728b0b.tar.bz2 ldap-utils-1f61f562d52a7ca91e9b0028f30c2fd748728b0b.tar.xz ldap-utils-1f61f562d52a7ca91e9b0028f30c2fd748728b0b.zip | |
libldapschema: adding syntax checks for ldapSyntaxes
Diffstat (limited to 'lib/libldapschema')
| -rw-r--r-- | lib/libldapschema/llexer.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libldapschema/llexer.c b/lib/libldapschema/llexer.c index e9dd1bd..19a8672 100644 --- a/lib/libldapschema/llexer.c +++ b/lib/libldapschema/llexer.c | |||
| @@ -1332,6 +1332,11 @@ LDAPSchemaSyntax * ldapschema_parse_syntax(LDAPSchema * lsd, const struct berval | |||
| 1332 | else if (!(strcasecmp(argv[pos], "DESC"))) | 1332 | else if (!(strcasecmp(argv[pos], "DESC"))) |
| 1333 | { | 1333 | { |
| 1334 | pos++; | 1334 | pos++; |
| 1335 | if ((syntax->model.desc)) | ||
| 1336 | { | ||
| 1337 | ldapschema_schema_err_kw_dup(lsd, (LDAPSchemaModel *)syntax, "DESC"); | ||
| 1338 | continue; | ||
| 1339 | }; | ||
| 1335 | if (pos >= argc) | 1340 | if (pos >= argc) |
| 1336 | { | 1341 | { |
| 1337 | lsd->errcode = LDAPSCHEMA_SCHEMA_ERROR; | 1342 | lsd->errcode = LDAPSCHEMA_SCHEMA_ERROR; |
| @@ -1353,14 +1358,15 @@ LDAPSchemaSyntax * ldapschema_parse_syntax(LDAPSchema * lsd, const struct berval | |||
| 1353 | // handle unknown parameters | 1358 | // handle unknown parameters |
| 1354 | else | 1359 | else |
| 1355 | { | 1360 | { |
| 1356 | lsd->errcode = LDAPSCHEMA_SCHEMA_ERROR; | 1361 | ldapschema_schema_err_kw_unknown(lsd, (LDAPSchemaModel *)syntax, argv[pos]); |
| 1357 | ldapschema_value_free(argv); | ||
| 1358 | ldapschema_syntax_free(syntax); | ||
| 1359 | return(NULL); | ||
| 1360 | }; | 1362 | }; |
| 1361 | }; | 1363 | }; |
| 1362 | ldapschema_value_free(argv); | 1364 | ldapschema_value_free(argv); |
| 1363 | 1365 | ||
| 1366 | // checks syntax | ||
| 1367 | if (!(syntax->model.desc)) | ||
| 1368 | ldapschema_schema_err(lsd, (LDAPSchemaModel *)syntax, "missing DESC"); | ||
| 1369 | |||
| 1364 | // copies information from specification | 1370 | // copies information from specification |
| 1365 | if ((syntax->model.spec)) | 1371 | if ((syntax->model.spec)) |
| 1366 | { | 1372 | { |
