2 * Copyright 1999 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5 * schema.c: parsing routines used by servers and clients to process
12 #include <ac/stdlib.h>
15 #include <ac/string.h>
20 #include <ldap_schema.h>
23 * When pretty printing the entities we will be appending to a buffer.
24 * Since checking for overflow, realloc'ing and checking if no error
25 * is extremely boring, we will use a protection layer that will let
26 * us blissfully ignore the error until the end. This layer is
27 * implemented with the help of the next type.
30 typedef struct safe_string {
38 new_safe_string(int size)
42 ss = LDAP_MALLOC(sizeof(safe_string));
46 ss->val = LDAP_MALLOC(size);
60 safe_string_free(safe_string * ss)
69 safe_string_val(safe_string * ss)
71 ss->val[ss->pos] = '\0';
76 append_to_safe_string(safe_string * ss, char * s)
82 * Some runaway process is trying to append to a string that
83 * overflowed and we could not extend.
88 /* We always make sure there is at least one position available */
89 if ( ss->pos + l >= ss->size-1 ) {
91 temp = LDAP_REALLOC(ss->val, ss->size);
93 /* Trouble, out of memory */
99 strncpy(&ss->val[ss->pos], s, l);
101 if ( ss->pos > 0 && ss->val[ss->pos-1] == ' ' )
110 print_literal(safe_string *ss, char *s)
112 return(append_to_safe_string(ss,s));
116 print_whsp(safe_string *ss)
119 return(append_to_safe_string(ss,""));
121 return(append_to_safe_string(ss," "));
125 print_numericoid(safe_string *ss, char *s)
128 return(append_to_safe_string(ss,s));
131 /* This one is identical to print_qdescr */
133 print_qdstring(safe_string *ss, char *s)
136 print_literal(ss,"'");
137 append_to_safe_string(ss,s);
138 print_literal(ss,"'");
139 return(print_whsp(ss));
143 print_qdescr(safe_string *ss, char *s)
146 print_literal(ss,"'");
147 append_to_safe_string(ss,s);
148 print_literal(ss,"'");
149 return(print_whsp(ss));
153 print_qdescrlist(safe_string *ss, char **sa)
158 for (sp=sa; *sp; sp++) {
159 ret = print_qdescr(ss,*sp);
161 /* If the list was empty, we return zero that is potentially
162 * incorrect, but since we will be still appending things, the
163 * overflow will be detected later. Maybe FIX.
169 print_qdescrs(safe_string *ss, char **sa)
171 /* The only way to represent an empty list is as a qdescrlist
172 * so, if the list is empty we treat it as a long list.
173 * Really, this is what the syntax mandates. We should not
174 * be here if the list was empty, but if it happens, a label
175 * has already been output and we cannot undo it.
177 if ( !sa[0] || ( sa[0] && sa[1] ) ) {
179 print_literal(ss,"(");
180 print_qdescrlist(ss,sa);
181 print_literal(ss,")");
182 return(print_whsp(ss));
184 return(print_qdescr(ss,*sa));
189 print_woid(safe_string *ss, char *s)
192 append_to_safe_string(ss,s);
193 return print_whsp(ss);
197 print_oidlist(safe_string *ss, char **sa)
201 for (sp=sa; *(sp+1); sp++) {
203 print_literal(ss,"$");
205 return(print_woid(ss,*sp));
209 print_oids(safe_string *ss, char **sa)
211 if ( sa[0] && sa[1] ) {
212 print_literal(ss,"(");
213 print_oidlist(ss,sa);
215 return(print_literal(ss,")"));
217 return(print_woid(ss,*sa));
222 print_noidlen(safe_string *ss, char *s, int l)
227 ret = print_numericoid(ss,s);
229 sprintf(buf,"{%d}",l);
230 ret = print_literal(ss,buf);
236 ldap_syntax2str( LDAP_SYNTAX * syn )
241 ss = new_safe_string(256);
245 print_literal(ss,"(");
248 print_numericoid(ss, syn->syn_oid);
251 if ( syn->syn_desc ) {
252 print_literal(ss,"DESC");
253 print_qdstring(ss,syn->syn_desc);
257 print_literal(ss,")");
259 retstring = LDAP_STRDUP(safe_string_val(ss));
260 safe_string_free(ss);
265 ldap_objectclass2str( LDAP_OBJECT_CLASS * oc )
270 ss = new_safe_string(256);
274 print_literal(ss,"(");
277 print_numericoid(ss, oc->oc_oid);
280 if ( oc->oc_names ) {
281 print_literal(ss,"NAME");
282 print_qdescrs(ss,oc->oc_names);
286 print_literal(ss,"DESC");
287 print_qdstring(ss,oc->oc_desc);
290 if ( oc->oc_obsolete == LDAP_SCHEMA_YES ) {
291 print_literal(ss, "OBSOLETE");
295 if ( oc->oc_sup_oids ) {
296 print_literal(ss,"SUP");
298 print_oids(ss,oc->oc_sup_oids);
302 switch (oc->oc_kind) {
303 case LDAP_SCHEMA_ABSTRACT:
304 print_literal(ss,"ABSTRACT");
306 case LDAP_SCHEMA_STRUCTURAL:
307 print_literal(ss,"STRUCTURAL");
309 case LDAP_SCHEMA_AUXILIARY:
310 print_literal(ss,"AUXILIARY");
313 print_literal(ss,"KIND-UNKNOWN");
318 if ( oc->oc_at_oids_must ) {
319 print_literal(ss,"MUST");
321 print_oids(ss,oc->oc_at_oids_must);
325 if ( oc->oc_at_oids_may ) {
326 print_literal(ss,"MAY");
328 print_oids(ss,oc->oc_at_oids_may);
333 print_literal(ss,")");
335 retstring = LDAP_STRDUP(safe_string_val(ss));
336 safe_string_free(ss);
341 ldap_attributetype2str( LDAP_ATTRIBUTE_TYPE * at )
346 ss = new_safe_string(256);
350 print_literal(ss,"(");
353 print_numericoid(ss, at->at_oid);
356 if ( at->at_names ) {
357 print_literal(ss,"NAME");
358 print_qdescrs(ss,at->at_names);
362 print_literal(ss,"DESC");
363 print_qdstring(ss,at->at_desc);
366 if ( at->at_obsolete == LDAP_SCHEMA_YES ) {
367 print_literal(ss, "OBSOLETE");
371 if ( at->at_sup_oid ) {
372 print_literal(ss,"SUP");
373 print_woid(ss,at->at_sup_oid);
376 if ( at->at_equality_oid ) {
377 print_literal(ss,"EQUALITY");
378 print_woid(ss,at->at_equality_oid);
381 if ( at->at_ordering_oid ) {
382 print_literal(ss,"ORDERING");
383 print_woid(ss,at->at_ordering_oid);
386 if ( at->at_substr_oid ) {
387 print_literal(ss,"SUBSTR");
388 print_woid(ss,at->at_substr_oid);
391 if ( at->at_syntax_oid ) {
392 print_literal(ss,"SYNTAX");
394 print_noidlen(ss,at->at_syntax_oid,at->at_syntax_len);
398 if ( at->at_single_value == LDAP_SCHEMA_YES ) {
399 print_literal(ss,"SINGLE-VALUE");
403 if ( at->at_collective == LDAP_SCHEMA_YES ) {
404 print_literal(ss,"COLLECTIVE");
408 if ( at->at_no_user_mod == LDAP_SCHEMA_YES ) {
409 print_literal(ss,"NO-USER-MODIFICATION");
413 if ( at->at_usage != LDAP_SCHEMA_USER_APPLICATIONS ) {
414 print_literal(ss,"USAGE");
416 switch (at->at_usage) {
417 case LDAP_SCHEMA_DIRECTORY_OPERATION:
418 print_literal(ss,"directoryOperation");
420 case LDAP_SCHEMA_DISTRIBUTED_OPERATION:
421 print_literal(ss,"distributedOperation");
423 case LDAP_SCHEMA_DSA_OPERATION:
424 print_literal(ss,"dSAOperation");
427 print_literal(ss,"UNKNOWN");
433 print_literal(ss,")");
435 retstring = LDAP_STRDUP(safe_string_val(ss));
436 safe_string_free(ss);
441 * Now come the parsers. There is one parser for each entity type:
442 * objectclasses, attributetypes, etc.
444 * Each of them is written as a recursive-descent parser, except that
445 * none of them is really recursive. But the idea is kept: there
446 * is one routine per non-terminal that eithers gobbles lexical tokens
447 * or calls lower-level routines, etc.
449 * The scanner is implemented in the routine get_token. Actually,
450 * get_token is more than a scanner and will return tokens that are
451 * in fact non-terminals in the grammar. So you can see the whole
452 * approach as the combination of a low-level bottom-up recognizer
453 * combined with a scanner and a number of top-down parsers. Or just
454 * consider that the real grammars recognized by the parsers are not
455 * those of the standards. As a matter of fact, our parsers are more
456 * liberal than the spec when there is no ambiguity.
458 * The difference is pretty academic (modulo bugs or incorrect
459 * interpretation of the specs).
462 #define TK_NOENDQUOTE -2
463 #define TK_OUTOFMEM -1
465 #define TK_UNEXPCHAR 1
466 #define TK_BAREWORD 2
467 #define TK_QDSTRING 3
468 #define TK_LEFTPAREN 4
469 #define TK_RIGHTPAREN 5
471 #define TK_QDESCR TK_QDSTRING
479 get_token(char ** sp, char ** token_val)
496 kind = TK_RIGHTPAREN;
507 while ( **sp != '\'' && **sp != '\0' )
509 if ( **sp == '\'' ) {
511 res = LDAP_MALLOC(q-p+1);
521 kind = TK_NOENDQUOTE;
527 while ( !isspace(**sp) && **sp != '\0' )
530 res = LDAP_MALLOC(q-p+1);
539 /* kind = TK_UNEXPCHAR; */
546 /* Gobble optional whitespace */
548 parse_whsp(char **sp)
550 while (isspace(**sp))
555 * General note for all parsers: to guarantee the algorithm halts they
556 * must always advance the pointer even when an error is found. For
557 * this one is not that important since an error here is fatal at the
558 * upper layers, but it is a simple strategy that will not get in
562 /* Parse a sequence of dot-separated decimal strings */
564 parse_numericoid(char **sp, int *code)
570 /* Each iteration of this loop gets one decimal string */
572 if ( !isdigit(**sp) ) {
574 * Initial char is not a digit or char after dot is
577 *code = LDAP_SCHERR_NODIGIT;
581 while ( isdigit(**sp) )
585 /* Otherwise, gobble the dot and loop again */
588 /* Now *sp points at the char past the numericoid. Perfect. */
590 res = LDAP_MALLOC(len+1);
592 *code = LDAP_SCHERR_OUTOFMEM;
595 strncpy(res,start,len);
600 /* Parse a qdescr or a list of them enclosed in () */
602 parse_qdescrs(char **sp, int *code)
612 kind = get_token(sp,&sval);
613 if ( kind == TK_LEFTPAREN ) {
614 /* Let's presume there will be at least 2 entries */
616 res = LDAP_CALLOC(3,sizeof(char *));
618 *code = LDAP_SCHERR_OUTOFMEM;
624 kind = get_token(sp,&sval);
625 if ( kind == TK_RIGHTPAREN )
627 if ( kind == TK_QDESCR ) {
628 if ( pos == size-2 ) {
630 res1 = LDAP_REALLOC(res,size*sizeof(char *));
633 *code = LDAP_SCHERR_OUTOFMEM;
643 *code = LDAP_SCHERR_UNEXPTOKEN;
650 } else if ( kind == TK_QDESCR ) {
651 res = LDAP_CALLOC(2,sizeof(char *));
653 *code = LDAP_SCHERR_OUTOFMEM;
661 *code = LDAP_SCHERR_BADNAME;
668 parse_woid(char **sp, int *code)
674 kind = get_token(sp, &sval);
675 if ( kind != TK_BAREWORD ) {
676 *code = LDAP_SCHERR_UNEXPTOKEN;
683 /* Parse a noidlen */
685 parse_noidlen(char **sp, int *code, int *len)
691 sval = parse_numericoid(sp, code);
698 while ( isdigit(**sp) )
701 *code = LDAP_SCHERR_UNEXPTOKEN;
711 * Next routine will accept a qdstring in place of an oid. This is
712 * necessary to interoperate with Netscape Directory server that
713 * will improperly quote each oid (at least those of the descr kind)
717 /* Parse a woid or a $-separated list of them enclosed in () */
719 parse_oids(char **sp, int *code)
729 * Strictly speaking, doing this here accepts whsp before the
730 * ( at the begining of an oidlist, but his is harmless. Also,
731 * we are very liberal in what we accept as an OID. Maybe
735 kind = get_token(sp,&sval);
736 if ( kind == TK_LEFTPAREN ) {
737 /* Let's presume there will be at least 2 entries */
739 res = LDAP_CALLOC(3,sizeof(char *));
741 *code = LDAP_SCHERR_OUTOFMEM;
746 kind = get_token(sp,&sval);
747 if ( kind == TK_BAREWORD || kind == TK_QDSTRING ) {
751 *code = LDAP_SCHERR_UNEXPTOKEN;
757 kind = get_token(sp,&sval);
758 if ( kind == TK_RIGHTPAREN )
760 if ( kind == TK_DOLLAR ) {
762 kind = get_token(sp,&sval);
763 if ( kind == TK_BAREWORD ||
764 kind == TK_QDSTRING ) {
765 if ( pos == size-2 ) {
767 res1 = LDAP_REALLOC(res,size*sizeof(char *));
770 *code = LDAP_SCHERR_OUTOFMEM;
778 *code = LDAP_SCHERR_UNEXPTOKEN;
784 *code = LDAP_SCHERR_UNEXPTOKEN;
792 } else if ( kind == TK_BAREWORD || kind == TK_QDSTRING ) {
793 res = LDAP_CALLOC(2,sizeof(char *));
795 *code = LDAP_SCHERR_OUTOFMEM;
803 *code = LDAP_SCHERR_BADNAME;
809 free_syn(LDAP_SYNTAX * syn)
811 LDAP_FREE(syn->syn_oid);
812 LDAP_FREE(syn->syn_desc);
817 ldap_str2syntax( char * s, int * code, char ** errp )
827 *code = LDAP_SCHERR_EMPTY;
833 syn = LDAP_CALLOC(1,sizeof(LDAP_SYNTAX));
836 *code = LDAP_SCHERR_OUTOFMEM;
840 kind = get_token(&ss,&sval);
841 if ( kind != TK_LEFTPAREN ) {
842 *code = LDAP_SCHERR_NOLEFTPAREN;
848 syn->syn_oid = parse_numericoid(&ss,code);
849 if ( !syn->syn_oid ) {
857 * Beyond this point we will be liberal and accept the items
861 kind = get_token(&ss,&sval);
864 *code = LDAP_SCHERR_NORIGHTPAREN;
871 if ( !strcmp(sval,"DESC") ) {
873 *code = LDAP_SCHERR_DUPOPT;
880 kind = get_token(&ss,&sval);
881 if ( kind != TK_QDSTRING ) {
882 *code = LDAP_SCHERR_UNEXPTOKEN;
887 syn->syn_desc = sval;
889 } else if ( sval[0] == 'X' && sval[1] == '-' ) {
890 /* Should be parse_qdstrings */
891 ssdummy = parse_qdescrs(&ss, code);
898 *code = LDAP_SCHERR_UNEXPTOKEN;
905 *code = LDAP_SCHERR_UNEXPTOKEN;
914 free_at(LDAP_ATTRIBUTE_TYPE * at)
916 LDAP_FREE(at->at_oid);
917 LDAP_VFREE(at->at_names);
918 LDAP_FREE(at->at_desc);
919 LDAP_FREE(at->at_sup_oid);
920 LDAP_FREE(at->at_equality_oid);
921 LDAP_FREE(at->at_ordering_oid);
922 LDAP_FREE(at->at_substr_oid);
923 LDAP_FREE(at->at_syntax_oid);
927 LDAP_ATTRIBUTE_TYPE *
928 ldap_str2attributetype( char * s, int * code, char ** errp )
935 int seen_obsolete = 0;
937 int seen_equality = 0;
938 int seen_ordering = 0;
945 LDAP_ATTRIBUTE_TYPE * at;
949 *code = LDAP_SCHERR_EMPTY;
955 at = LDAP_CALLOC(1,sizeof(LDAP_ATTRIBUTE_TYPE));
958 *code = LDAP_SCHERR_OUTOFMEM;
962 kind = get_token(&ss,&sval);
963 if ( kind != TK_LEFTPAREN ) {
964 *code = LDAP_SCHERR_NOLEFTPAREN;
970 at->at_oid = parse_numericoid(&ss,code);
979 * Beyond this point we will be liberal and accept the items
983 kind = get_token(&ss,&sval);
986 *code = LDAP_SCHERR_NORIGHTPAREN;
993 if ( !strcmp(sval,"NAME") ) {
995 *code = LDAP_SCHERR_DUPOPT;
1001 at->at_names = parse_qdescrs(&ss,code);
1002 if ( !at->at_names ) {
1003 if ( *code != LDAP_SCHERR_OUTOFMEM )
1004 *code = LDAP_SCHERR_BADNAME;
1009 } else if ( !strcmp(sval,"DESC") ) {
1011 *code = LDAP_SCHERR_DUPOPT;
1018 kind = get_token(&ss,&sval);
1019 if ( kind != TK_QDSTRING ) {
1020 *code = LDAP_SCHERR_UNEXPTOKEN;
1027 } else if ( !strcmp(sval,"OBSOLETE") ) {
1028 if ( seen_obsolete ) {
1029 *code = LDAP_SCHERR_DUPOPT;
1035 at->at_obsolete = LDAP_SCHEMA_YES;
1037 } else if ( !strcmp(sval,"SUP") ) {
1039 *code = LDAP_SCHERR_DUPOPT;
1045 at->at_sup_oid = parse_woid(&ss,code);
1046 if ( !at->at_sup_oid ) {
1051 } else if ( !strcmp(sval,"EQUALITY") ) {
1052 if ( seen_equality ) {
1053 *code = LDAP_SCHERR_DUPOPT;
1059 at->at_equality_oid = parse_woid(&ss,code);
1060 if ( !at->at_equality_oid ) {
1065 } else if ( !strcmp(sval,"ORDERING") ) {
1066 if ( seen_ordering ) {
1067 *code = LDAP_SCHERR_DUPOPT;
1073 at->at_ordering_oid = parse_woid(&ss,code);
1074 if ( !at->at_ordering_oid ) {
1079 } else if ( !strcmp(sval,"SUBSTR") ) {
1080 if ( seen_substr ) {
1081 *code = LDAP_SCHERR_DUPOPT;
1087 at->at_substr_oid = parse_woid(&ss,code);
1088 if ( !at->at_substr_oid ) {
1093 } else if ( !strcmp(sval,"SYNTAX") ) {
1094 if ( seen_syntax ) {
1095 *code = LDAP_SCHERR_DUPOPT;
1102 at->at_syntax_oid = parse_noidlen(&ss,code,&at->at_syntax_len);
1103 if ( !at->at_syntax_oid ) {
1109 } else if ( !strcmp(sval,"SINGLE-VALUE") ) {
1110 if ( at->at_single_value ) {
1111 *code = LDAP_SCHERR_DUPOPT;
1116 at->at_single_value = LDAP_SCHEMA_YES;
1118 } else if ( !strcmp(sval,"COLLECTIVE") ) {
1119 if ( at->at_collective ) {
1120 *code = LDAP_SCHERR_DUPOPT;
1125 at->at_collective = LDAP_SCHEMA_YES;
1127 } else if ( !strcmp(sval,"NO-USER-MODIFICATION") ) {
1128 if ( at->at_no_user_mod ) {
1129 *code = LDAP_SCHERR_DUPOPT;
1134 at->at_no_user_mod = LDAP_SCHEMA_YES;
1136 } else if ( !strcmp(sval,"USAGE") ) {
1138 *code = LDAP_SCHERR_DUPOPT;
1145 kind = get_token(&ss,&sval);
1146 if ( kind != TK_BAREWORD ) {
1147 *code = LDAP_SCHERR_UNEXPTOKEN;
1152 if ( !strcasecmp(sval,"userApplications") )
1154 LDAP_SCHEMA_USER_APPLICATIONS;
1155 else if ( !strcasecmp(sval,"directoryOperation") )
1157 LDAP_SCHEMA_DIRECTORY_OPERATION;
1158 else if ( !strcasecmp(sval,"distributedOperation") )
1160 LDAP_SCHEMA_DISTRIBUTED_OPERATION;
1161 else if ( !strcasecmp(sval,"dSAOperation") )
1163 LDAP_SCHEMA_DSA_OPERATION;
1165 *code = LDAP_SCHERR_UNEXPTOKEN;
1171 } else if ( sval[0] == 'X' && sval[1] == '-' ) {
1172 /* Should be parse_qdstrings */
1173 ssdummy = parse_qdescrs(&ss, code);
1180 *code = LDAP_SCHERR_UNEXPTOKEN;
1187 *code = LDAP_SCHERR_UNEXPTOKEN;
1196 free_oc(LDAP_OBJECT_CLASS * oc)
1198 LDAP_FREE(oc->oc_oid);
1199 LDAP_VFREE(oc->oc_names);
1200 LDAP_FREE(oc->oc_desc);
1201 LDAP_VFREE(oc->oc_sup_oids);
1202 LDAP_VFREE(oc->oc_at_oids_must);
1203 LDAP_VFREE(oc->oc_at_oids_may);
1208 ldap_str2objectclass( char * s, int * code, char ** errp )
1215 int seen_obsolete = 0;
1220 LDAP_OBJECT_CLASS * oc;
1224 *code = LDAP_SCHERR_EMPTY;
1230 oc = LDAP_CALLOC(1,sizeof(LDAP_OBJECT_CLASS));
1233 *code = LDAP_SCHERR_OUTOFMEM;
1237 kind = get_token(&ss,&sval);
1238 if ( kind != TK_LEFTPAREN ) {
1239 *code = LDAP_SCHERR_NOLEFTPAREN;
1245 oc->oc_oid = parse_numericoid(&ss,code);
1246 if ( !oc->oc_oid ) {
1254 * Beyond this point we will be liberal an accept the items
1258 kind = get_token(&ss,&sval);
1261 *code = LDAP_SCHERR_NORIGHTPAREN;
1268 if ( !strcmp(sval,"NAME") ) {
1270 *code = LDAP_SCHERR_DUPOPT;
1276 oc->oc_names = parse_qdescrs(&ss,code);
1277 if ( !oc->oc_names ) {
1278 if ( *code != LDAP_SCHERR_OUTOFMEM )
1279 *code = LDAP_SCHERR_BADNAME;
1284 } else if ( !strcmp(sval,"DESC") ) {
1286 *code = LDAP_SCHERR_DUPOPT;
1293 kind = get_token(&ss,&sval);
1294 if ( kind != TK_QDSTRING ) {
1295 *code = LDAP_SCHERR_UNEXPTOKEN;
1302 } else if ( !strcmp(sval,"OBSOLETE") ) {
1303 if ( seen_obsolete ) {
1304 *code = LDAP_SCHERR_DUPOPT;
1310 oc->oc_obsolete = LDAP_SCHEMA_YES;
1312 } else if ( !strcmp(sval,"SUP") ) {
1314 *code = LDAP_SCHERR_DUPOPT;
1320 oc->oc_sup_oids = parse_oids(&ss,code);
1321 if ( !oc->oc_sup_oids ) {
1326 } else if ( !strcmp(sval,"ABSTRACT") ) {
1328 *code = LDAP_SCHERR_DUPOPT;
1334 oc->oc_kind = LDAP_SCHEMA_ABSTRACT;
1336 } else if ( !strcmp(sval,"STRUCTURAL") ) {
1338 *code = LDAP_SCHERR_DUPOPT;
1344 oc->oc_kind = LDAP_SCHEMA_STRUCTURAL;
1346 } else if ( !strcmp(sval,"AUXILIARY") ) {
1348 *code = LDAP_SCHERR_DUPOPT;
1354 oc->oc_kind = LDAP_SCHEMA_AUXILIARY;
1356 } else if ( !strcmp(sval,"MUST") ) {
1358 *code = LDAP_SCHERR_DUPOPT;
1364 oc->oc_at_oids_must = parse_oids(&ss,code);
1365 if ( !oc->oc_at_oids_must ) {
1371 } else if ( !strcmp(sval,"MAY") ) {
1373 *code = LDAP_SCHERR_DUPOPT;
1379 oc->oc_at_oids_may = parse_oids(&ss,code);
1380 if ( !oc->oc_at_oids_may ) {
1386 } else if ( sval[0] == 'X' && sval[1] == '-' ) {
1387 /* Should be parse_qdstrings */
1388 ssdummy = parse_qdescrs(&ss, code);
1395 *code = LDAP_SCHERR_UNEXPTOKEN;
1402 *code = LDAP_SCHERR_UNEXPTOKEN;
1410 static char *err2text[] = {
1414 "Missing opening parenthesis",
1415 "Missing closing parenthesis",
1421 "Unexpected end of data"
1425 ldap_scherr2str(int code)
1427 if ( code < 1 || code >= (sizeof(err2text)/sizeof(char *)) ) {
1428 return "Unknown error";
1430 return err2text[code];