- char *save;
- struct asyntaxinfo *a;
- int i, lasti;
-
- if ( argc < 2 ) {
- Debug( LDAP_DEBUG_ANY,
-"%s: line %d: missing name in \"attribute <name>+ <syntax>\" (ignored)\n",
- fname, lineno, 0 );
- return;
- }
-
- a = (struct asyntaxinfo *) ch_calloc( 1, sizeof(struct asyntaxinfo) );
-
- lasti = argc - 1;
- if ( strcasecmp( argv[lasti], "caseignorestring" ) == 0 ||
- strcasecmp( argv[lasti], "cis" ) == 0 ) {
- a->asi_syntax = SYNTAX_CIS;
- } else if ( strcasecmp( argv[lasti], "telephone" ) == 0 ||
- strcasecmp( argv[lasti], "tel" ) == 0 ) {
- a->asi_syntax = (SYNTAX_CIS | SYNTAX_TEL);
- } else if ( strcasecmp( argv[lasti], "dn" ) == 0 ) {
- a->asi_syntax = (SYNTAX_CIS | SYNTAX_DN);
- } else if ( strcasecmp( argv[lasti], "caseexactstring" ) == 0 ||
- strcasecmp( argv[lasti], "ces" ) == 0 ) {
- a->asi_syntax = SYNTAX_CES;
- } else if ( strcasecmp( argv[lasti], "binary" ) == 0 ||
- strcasecmp( argv[lasti], "bin" ) == 0 ) {
- a->asi_syntax = SYNTAX_BIN;
- } else {
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: unknown syntax \"%s\" in attribute line (ignored)\n",
- fname, lineno, 0 );
- Debug( LDAP_DEBUG_ANY,
- "possible syntaxes are \"cis\", \"ces\", \"tel\", \"dn\", or \"bin\"\n",
- 0, 0, 0 );
- free( (char *) a );
- return;
- }
- save = argv[lasti];
- argv[lasti] = NULL;
- a->asi_names = charray_dup( argv );
- argv[lasti] = save;
-
- switch ( avl_insert( &attr_syntaxes, (caddr_t) a, attr_syntax_cmp,
- attr_syntax_dup ) ) {
- case -1: /* duplicate - different syntaxes */
- Debug( LDAP_DEBUG_ARGS, "%s: line %d: duplicate attribute\n",
- fname, lineno, 0 );
- /* FALL */
-
- case 1: /* duplicate - same syntaxes */
- charray_free( a->asi_names );
- free( (char *) a );
- break;
-
- default: /* inserted */
- break;
- }
-}
-
-#ifdef LDAP_DEBUG