diff options
| author | David M. Syzdek <david@syzdek.net> | 2019-11-26 23:09:17 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2019-11-26 23:09:17 -0900 |
| commit | dc857534293415a655f866969cd5d6b8a2e001b7 (patch) | |
| tree | 6a7363adb049a46a140255f722556a74e31610d9 | |
| parent | bc56de704b22c795da3d117cee6b63963dc15ac6 (diff) | |
| download | ldap-utils-dc857534293415a655f866969cd5d6b8a2e001b7.tar.gz ldap-utils-dc857534293415a655f866969cd5d6b8a2e001b7.tar.bz2 ldap-utils-dc857534293415a655f866969cd5d6b8a2e001b7.tar.xz ldap-utils-dc857534293415a655f866969cd5d6b8a2e001b7.zip | |
libldapschema: adding refernces from LDAPSchemaSyntax to LDAPSchemaMatchingRule and LDAPSchemaLDAPAttributeType
| -rw-r--r-- | lib/libldapschema/libldapschema.h | 4 | ||||
| -rw-r--r-- | lib/libldapschema/lldap.c | 5 | ||||
| -rw-r--r-- | lib/libldapschema/llexer.c | 6 | ||||
| -rw-r--r-- | lib/libldapschema/lmemory.c | 6 | ||||
| -rw-r--r-- | lib/libldapschema/loutput.c | 9 |
5 files changed, 27 insertions, 3 deletions
diff --git a/lib/libldapschema/libldapschema.h b/lib/libldapschema/libldapschema.h index f8b3bc5..07a9bf5 100644 --- a/lib/libldapschema/libldapschema.h +++ b/lib/libldapschema/libldapschema.h | |||
| @@ -196,6 +196,10 @@ struct ldap_schema_syntax | |||
| 196 | LDAPSchemaModel model; | 196 | LDAPSchemaModel model; |
| 197 | size_t data_class; | 197 | size_t data_class; |
| 198 | regex_t re; | 198 | regex_t re; |
| 199 | LDAPSchemaMatchingRule ** mtchngrls; | ||
| 200 | size_t mtchngrls_len; | ||
| 201 | LDAPSchemaAttributeType ** attrs; | ||
| 202 | size_t attrs_len; | ||
| 199 | }; | 203 | }; |
| 200 | 204 | ||
| 201 | 205 | ||
diff --git a/lib/libldapschema/lldap.c b/lib/libldapschema/lldap.c index 26e2bbe..fc8e14e 100644 --- a/lib/libldapschema/lldap.c +++ b/lib/libldapschema/lldap.c | |||
| @@ -52,6 +52,8 @@ | |||
| 52 | #include "llexer.h" | 52 | #include "llexer.h" |
| 53 | #include "lquery.h" | 53 | #include "lquery.h" |
| 54 | #include "lerror.h" | 54 | #include "lerror.h" |
| 55 | #include "lmemory.h" | ||
| 56 | #include "lsort.h" | ||
| 55 | 57 | ||
| 56 | 58 | ||
| 57 | ///////////////// | 59 | ///////////////// |
| @@ -206,7 +208,8 @@ int ldapschema_fetch(LDAPSchema * lsd, LDAP * ld) | |||
| 206 | { | 208 | { |
| 207 | attr->model.flags |= attrsup->model.flags; | 209 | attr->model.flags |= attrsup->model.flags; |
| 208 | if (!(attr->syntax)) | 210 | if (!(attr->syntax)) |
| 209 | attr->syntax = attrsup->syntax; | 211 | if ((attr->syntax = attrsup->syntax) != NULL) |
| 212 | ldapschema_insert(lsd, (void ***)&attr->syntax->attrs, &attr->syntax->attrs_len, attr, ldapschema_compar_models); | ||
| 210 | if (!(attr->min_upper)) | 213 | if (!(attr->min_upper)) |
| 211 | attr->min_upper = attrsup->min_upper; | 214 | attr->min_upper = attrsup->min_upper; |
| 212 | if (!(attr->usage)) | 215 | if (!(attr->usage)) |
diff --git a/lib/libldapschema/llexer.c b/lib/libldapschema/llexer.c index e761f7b..ce94e2a 100644 --- a/lib/libldapschema/llexer.c +++ b/lib/libldapschema/llexer.c | |||
| @@ -618,7 +618,10 @@ LDAPSchemaAttributeType * ldapschema_parse_attributetype(LDAPSchema * lsd, const | |||
| 618 | attr->min_upper = strtoull(&stridx[1], NULL, 10); | 618 | attr->min_upper = strtoull(&stridx[1], NULL, 10); |
| 619 | }; | 619 | }; |
| 620 | if ((attr->syntax = ldapschema_oid(lsd, argv[pos], LDAPSCHEMA_SYNTAX)) != NULL) | 620 | if ((attr->syntax = ldapschema_oid(lsd, argv[pos], LDAPSCHEMA_SYNTAX)) != NULL) |
| 621 | { | ||
| 621 | attr->model.flags |= attr->syntax->model.flags; | 622 | attr->model.flags |= attr->syntax->model.flags; |
| 623 | ldapschema_insert(lsd, (void ***)&attr->syntax->attrs, &attr->syntax->attrs_len, attr, ldapschema_compar_models); | ||
| 624 | }; | ||
| 622 | } | 625 | } |
| 623 | 626 | ||
| 624 | // inteprets attributeType SINGLE-VALUE | 627 | // inteprets attributeType SINGLE-VALUE |
| @@ -884,7 +887,8 @@ LDAPSchemaMatchingRule * ldapschema_parse_matchingrule(LDAPSchema * lsd, const s | |||
| 884 | else if (!(strcasecmp(argv[pos], "SYNTAX"))) | 887 | else if (!(strcasecmp(argv[pos], "SYNTAX"))) |
| 885 | { | 888 | { |
| 886 | pos++; | 889 | pos++; |
| 887 | rule->syntax = ldapschema_oid(lsd, argv[pos], LDAPSCHEMA_SYNTAX); | 890 | if ((rule->syntax = ldapschema_oid(lsd, argv[pos], LDAPSCHEMA_SYNTAX)) != NULL) |
| 891 | ldapschema_insert(lsd, (void ***)&rule->syntax->mtchngrls, &rule->syntax->mtchngrls_len, rule, ldapschema_compar_models); | ||
| 888 | } | 892 | } |
| 889 | 893 | ||
| 890 | // handle unknown parameters | 894 | // handle unknown parameters |
diff --git a/lib/libldapschema/lmemory.c b/lib/libldapschema/lmemory.c index 62da0c8..a151506 100644 --- a/lib/libldapschema/lmemory.c +++ b/lib/libldapschema/lmemory.c | |||
| @@ -780,6 +780,12 @@ void ldapschema_syntax_free(LDAPSchemaSyntax * syntax) | |||
| 780 | regfree(&syntax->re); | 780 | regfree(&syntax->re); |
| 781 | ldapschema_object_free(&syntax->model); | 781 | ldapschema_object_free(&syntax->model); |
| 782 | 782 | ||
| 783 | if ((syntax->attrs)) | ||
| 784 | free(syntax->attrs); | ||
| 785 | |||
| 786 | if ((syntax->mtchngrls)) | ||
| 787 | free(syntax->mtchngrls); | ||
| 788 | |||
| 783 | free(syntax); | 789 | free(syntax); |
| 784 | 790 | ||
| 785 | return; | 791 | return; |
diff --git a/lib/libldapschema/loutput.c b/lib/libldapschema/loutput.c index 167c702..4b386b3 100644 --- a/lib/libldapschema/loutput.c +++ b/lib/libldapschema/loutput.c | |||
| @@ -62,7 +62,7 @@ | |||
| 62 | #define LDAPSCHEMA_WIDTH_HEADER 19 | 62 | #define LDAPSCHEMA_WIDTH_HEADER 19 |
| 63 | #define LDAPSCHEMA_WIDTH_INDENT 3 | 63 | #define LDAPSCHEMA_WIDTH_INDENT 3 |
| 64 | #define LDAPSCHEMA_WIDTH_FIELD (LDAPSCHEMA_WIDTH_HEADER-LDAPSCHEMA_WIDTH_INDENT) | 64 | #define LDAPSCHEMA_WIDTH_FIELD (LDAPSCHEMA_WIDTH_HEADER-LDAPSCHEMA_WIDTH_INDENT) |
| 65 | #define LDAPSCHEMA_WIDTH_VALUE 30 | 65 | #define LDAPSCHEMA_WIDTH_VALUE 45 |
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | ////////////////// | 68 | ////////////////// |
| @@ -416,6 +416,11 @@ void ldapschema_print_list_models(LDAPSchema * lsd, | |||
| 416 | key = ((LDAPSchemaAttributeType *)list[pos])->names[0]; | 416 | key = ((LDAPSchemaAttributeType *)list[pos])->names[0]; |
| 417 | break; | 417 | break; |
| 418 | 418 | ||
| 419 | case LDAPSCHEMA_MATCHINGRULE: | ||
| 420 | if ((((LDAPSchemaMatchingRule *)list[pos])->names)) | ||
| 421 | key = ((LDAPSchemaMatchingRule *)list[pos])->names[0]; | ||
| 422 | break; | ||
| 423 | |||
| 419 | case LDAPSCHEMA_OBJECTCLASS: | 424 | case LDAPSCHEMA_OBJECTCLASS: |
| 420 | if ((((LDAPSchemaObjectclass *)list[pos])->names)) | 425 | if ((((LDAPSchemaObjectclass *)list[pos])->names)) |
| 421 | key = ((LDAPSchemaObjectclass *)list[pos])->names[0]; | 426 | key = ((LDAPSchemaObjectclass *)list[pos])->names[0]; |
| @@ -623,6 +628,8 @@ void ldapschema_print_obj_syntax(LDAPSchema * lsd, LDAPSchemaSyntax * syntax) | |||
| 623 | ldapschema_print_data_class(lsd, syntax->data_class); | 628 | ldapschema_print_data_class(lsd, syntax->data_class); |
| 624 | ldapschema_print_flags(lsd, &syntax->model); | 629 | ldapschema_print_flags(lsd, &syntax->model); |
| 625 | ldapschema_print_extensions(lsd, &syntax->model); | 630 | ldapschema_print_extensions(lsd, &syntax->model); |
| 631 | ldapschema_print_list_models(lsd, "attributeTypes:", (LDAPSchemaModel **)syntax->attrs, syntax->attrs_len); | ||
| 632 | ldapschema_print_list_models(lsd, "matchingRules:", (LDAPSchemaModel **)syntax->mtchngrls, syntax->mtchngrls_len); | ||
| 626 | ldapschema_print_spec(lsd, syntax->model.spec); | 633 | ldapschema_print_spec(lsd, syntax->model.spec); |
| 627 | ldapschema_print_definition(lsd, &syntax->model); | 634 | ldapschema_print_definition(lsd, &syntax->model); |
| 628 | ldapschema_print_issues(lsd, &syntax->model); | 635 | ldapschema_print_issues(lsd, &syntax->model); |
