+ if (!el)
+ return 0;
+ for(; el; el = el->next)
+ {
+ int schema_ok = 0;
+ int syntax_ok = 0;
+
+ if (!schema)
+ schema_ok = 1;
+ else
+ {
+ if (el->name && !strcmp(schema, el->name))
+ schema_ok = 1;
+ if (el->identifier && !strcmp(schema, el->identifier))
+ schema_ok = 1;
+ if (!el->name && !el->identifier)
+ schema_ok = 1;
+ }
+
+ if (syntax && el->syntax && !oid_oidcmp(syntax, el->syntax))
+ syntax_ok = 1;
+ if (!syntax)
+ syntax_ok = 1;
+
+ if (syntax_ok)
+ syntax_matches++;
+ if (schema_ok)
+ schema_matches++;
+ if (syntax_ok && schema_ok)
+ {
+ *match_syntax = el->syntax;
+ if (el->identifier)
+ *match_schema = el->identifier;
+ else
+ *match_schema = 0;
+ if (backend_schema)
+ *backend_schema = el->backend_name;
+ if (backend_syntax)
+ *backend_syntax = el->backend_syntax;
+ if (rc)
+ *rc = el->record_conv;
+ return 0;
+ }
+ }
+ if (!syntax_matches && syntax)
+ {
+ char buf[OID_STR_MAX];
+ wrbuf_printf(p->wr_error, "%s", oid_to_dotstring(syntax, buf));
+ return 2;
+ }
+ if (schema)
+ wrbuf_printf(p->wr_error, "%s", schema);
+ if (!schema_matches)
+ return 1;
+ return 3;