]> git.sur5r.net Git - openldap/blob - servers/slapd/index.c
fix schema definitions (duplicate objectClass OID still there)
[openldap] / servers / slapd / index.c
1 /* index.c - index utilities */
2 /* $OpenLDAP$ */
3 /*
4  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6  */
7
8 #include "portable.h"
9
10 #include <stdio.h>
11
12 #include "slap.h"
13
14 int slap_str2index( const char *str, slap_mask_t *idx )
15 {
16         if ( strcasecmp( str, "pres" ) == 0 ) {
17                 *idx = SLAP_INDEX_PRESENT;
18         } else if ( strcasecmp( str, "eq" ) == 0 ) {
19                 *idx = SLAP_INDEX_EQUALITY;
20         } else if ( strcasecmp( str, "approx" ) == 0 ) {
21                 *idx = SLAP_INDEX_APPROX;
22         } else if ( strcasecmp( str, "subinitial" ) == 0 ) {
23                 *idx = SLAP_INDEX_SUBSTR_INITIAL;
24         } else if ( strcasecmp( str, "subany" ) == 0 ) {
25                 *idx = SLAP_INDEX_SUBSTR_ANY;
26         } else if ( strcasecmp( str, "subfinal" ) == 0 ) {
27                 *idx = SLAP_INDEX_SUBSTR_FINAL;
28         } else if ( strcasecmp( str, "substr" ) == 0 ||
29                 strcasecmp( str, "sub" ) == 0 )
30         {
31                 *idx = SLAP_INDEX_SUBSTR_DEFAULT;
32         } else if ( strcasecmp( str, "nolang" ) == 0 || /* backwards compat */
33                     strcasecmp( str, "notags" ) == 0 ) {
34                 *idx = SLAP_INDEX_NOTAGS;
35         } else if ( strcasecmp( str, "nosubtypes" ) == 0 ) {
36                 *idx = SLAP_INDEX_NOSUBTYPES;
37         } else {
38                 return LDAP_OTHER;
39         }
40
41         return LDAP_SUCCESS;
42 }