]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/ad.c
Added proposed request parameters to Operation. #ifdef'd, not active.
[openldap] / servers / slapd / ad.c
index 6451a23c0b06ab16916c6c85571770e1272d2452..cc3e7c1674a8fadcc73bf89e69618c8cf80ca66f 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* ad.c - routines for dealing with attribute descriptions */
@@ -191,8 +191,7 @@ int slap_bv2ad(
                        desc.ad_flags |= SLAP_DESC_BINARY;
                        continue;
 
-               } else if ( ad_find_option_definition( opt, optlen ) )
-               {
+               } else if ( ad_find_option_definition( opt, optlen ) ) {
                        int i;
 
                        if( opt[optlen-1] == '-' ) {
@@ -325,6 +324,7 @@ done:;
                }
 
                d2 = ch_malloc(sizeof(AttributeDescription) + dlen);
+               d2->ad_next = NULL;
                d2->ad_type = desc.ad_type;
                d2->ad_flags = desc.ad_flags;
                d2->ad_cname.bv_len = desc.ad_type->sat_cname.bv_len;
@@ -748,7 +748,8 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
 int
 ad_define_option( const char *name, const char *fname, int lineno )
 {
-       int i, j, len, optlen;
+       int i;
+       unsigned int optlen;
 
        if ( options == &lang_option ) {
                options = NULL;
@@ -774,7 +775,7 @@ ad_define_option( const char *name, const char *fname, int lineno )
        } while ( name[++optlen] );
 
        options = ch_realloc( options,
-                             (option_count+1) * sizeof(Attr_option) );
+               (option_count+1) * sizeof(Attr_option) );
 
        if ( strcasecmp( name, "binary" ) == 0
             || ad_find_option_definition( name, optlen ) ) {
@@ -844,3 +845,25 @@ ad_find_option_definition( const char *opt, int optlen )
        }
        return NULL;
 }
+
+MatchingRule *ad_mr(
+       AttributeDescription *ad,
+       unsigned usage )
+{
+       switch( usage & SLAP_MR_TYPE_MASK ) {
+       case SLAP_MR_NONE:
+       case SLAP_MR_EQUALITY:
+               return ad->ad_type->sat_equality;
+               break;
+       case SLAP_MR_ORDERING:
+               return ad->ad_type->sat_ordering;
+               break;
+       case SLAP_MR_SUBSTR:
+               return ad->ad_type->sat_substr;
+               break;
+       case SLAP_MR_EXT:
+       default:
+               assert( 0 /* ad_mr: bad usage */);
+       }
+       return NULL;
+}