]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/oc.c
silence warning
[openldap] / servers / slapd / oc.c
index 42879ee76e362aebbf22a2afd96e386a9d045e67..5c4f6a984f610cac04acc66c90dc7f1f87cb2e29 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2007 The OpenLDAP Foundation.
+ * Copyright 1998-2011 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -92,6 +92,9 @@ int is_entry_objectclass(
                        e->e_dn == NULL ? "" : e->e_dn,
                        oc->soc_oclass.oc_oid, 0 );
 
+               /* mark flags as set */
+               e->e_ocflags |= SLAP_OC__END;
+
                return 0;
        }
 
@@ -227,6 +230,10 @@ oc_bvfind_undef( struct berval *ocname )
        oc->soc_cname.bv_len = ocname->bv_len;
        oc->soc_cname.bv_val = (char *)&oc[ 1 ];
        AC_MEMCPY( oc->soc_cname.bv_val, ocname->bv_val, ocname->bv_len );
+       oc->soc_cname.bv_val[ oc->soc_cname.bv_len ] = '\0';
+
+       /* canonical to upper case */
+       ldap_pvt_str2upper( oc->soc_cname.bv_val );
 
        LDAP_STAILQ_NEXT( oc, soc_next ) = NULL;
        ldap_pvt_thread_mutex_lock( &oc_undef_mutex );
@@ -502,6 +509,10 @@ oc_next( ObjectClass **oc )
        }
 #endif
 
+       if ( *oc == NULL ) {
+               return 0;
+       }
+
        *oc = LDAP_STAILQ_NEXT(*oc,soc_next);
 
        return (*oc != NULL);
@@ -626,6 +637,8 @@ oc_insert(
                assert( oc_bvfind( &oir->oir_name ) != NULL );
        }
 
+       assert( soc != NULL );
+
        if ( (names = soc->soc_names) ) {
                while ( *names ) {
                        oir = (struct oindexrec *)
@@ -634,9 +647,6 @@ oc_insert(
                        oir->oir_name.bv_len = strlen( *names );
                        oir->oir_oc = soc;
 
-                       assert( oir->oir_name.bv_val != NULL );
-                       assert( oir->oir_oc != NULL );
-
                        if ( avl_insert( &oc_index, (caddr_t) oir,
                                oc_index_cmp, avl_dup_error ) )
                        {
@@ -796,6 +806,10 @@ done:;
                        ch_free( soc->soc_allowed );
                }
 
+               if ( soc->soc_oidmacro ) {
+                       ch_free( soc->soc_oidmacro );
+               }
+
                ch_free( soc );
 
        } else if ( rsoc ) {
@@ -892,7 +906,7 @@ oc_schema_info( Entry *e )
 }
 
 int
-register_oc( char *def, ObjectClass **soc, int dupok )
+register_oc( const char *def, ObjectClass **soc, int dupok )
 {
        LDAPObjectClass *oc;
        int code;