]> git.sur5r.net Git - openldap/commitdiff
check if handler is being installed twice (needs work to allow replacement)
authorPierangelo Masarati <ando@openldap.org>
Fri, 6 Jan 2006 16:30:43 +0000 (16:30 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 6 Jan 2006 16:30:43 +0000 (16:30 +0000)
servers/slapd/extended.c

index 7df5817ab901f4fb25f3c415429cd1884a33b4e6..e77ac961e7f8271e7a318a586e98f302470ac026 100644 (file)
@@ -254,11 +254,31 @@ load_extop(
        slap_mask_t ext_flags,
        SLAP_EXTOP_MAIN_FN *ext_main )
 {
-       struct extop_list *ext;
+       struct berval           oidm = BER_BVNULL;
+       struct extop_list       *ext;
+
+       if ( !ext_main ) {
+               return -1; 
+       }
+
+       if ( ext_oid == NULL || BER_BVISNULL( ext_oid ) || BER_BVISEMPTY( ext_oid ) ) {
+               return -1; 
+       }
 
-       if( ext_oid == NULL || ext_oid->bv_val == NULL ||
-               ext_oid->bv_val[0] == '\0' || ext_oid->bv_len == 0 ) return -1; 
-       if(!ext_main) return -1; 
+       if ( numericoidValidate( NULL, (struct berval *)ext_oid ) != LDAP_SUCCESS ) {
+               oidm.bv_val = oidm_find( ext_oid->bv_val );
+               if ( ext_oid == NULL ) {
+                       return -1;
+               }
+               oidm.bv_len = strlen( oidm.bv_val );
+               ext_oid = &oidm;
+       }
+
+       for ( ext = supp_ext_list; ext; ext = ext->next ) {
+               if ( bvmatch( ext_oid, &ext->oid ) ) {
+                       return -1;
+               }
+       }
 
        ext = ch_calloc(1, sizeof(struct extop_list) + ext_oid->bv_len + 1);
        if (ext == NULL)