-#ifdef SLAPD_SCHEMA_COMPAT
- int i;
- char last;
- LDAP_OBJECT_CLASS *oc;
- int code;
- const char *err;
- char **namep;
-
- oc = (LDAP_OBJECT_CLASS *) ch_calloc( 1, sizeof(LDAP_OBJECT_CLASS) );
- oc->oc_names = ch_calloc( 2, sizeof(char *) );
- oc->oc_names[0] = ch_strdup( argv[1] );
- oc->oc_names[1] = NULL;
-
- if ( strcasecmp( oc->oc_names[0], "top" ) ) {
- /*
- * no way to distinguish "auxiliary" from "structural"
- * This may lead to future problems.
- */
- oc->oc_kind = LDAP_SCHEMA_STRUCTURAL;
- }
- for ( i = 2; i < argc; i++ ) {
- /* required attributes */
- if ( strcasecmp( argv[i], "requires" ) == 0 ) {
- do {
- i++;
- if ( i < argc ) {
- char **s = str2charray( argv[i], "," );
- last = argv[i][strlen( argv[i] ) - 1];
- charray_merge( &oc->oc_at_oids_must, s );
- charray_free( s );
- }
- } while ( i < argc && last == ',' );
-
- /* optional attributes */
- } else if ( strcasecmp( argv[i], "allows" ) == 0 ) {
- do {
- i++;
- if ( i < argc ) {
- char **s = str2charray( argv[i], "," );
- last = argv[i][strlen( argv[i] ) - 1];
-
- charray_merge( &oc->oc_at_oids_may, s );
- charray_free( s );
- }
- } while ( i < argc && last == ',' );
-
- } else {
- fprintf( stderr,
- "%s: line %d: expecting \"requires\" or \"allows\" got \"%s\"\n",
- fname, lineno, argv[i] );
- oc_usage_old();
- }
- }