]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/extended.c
Move global to ldapsync
[openldap] / servers / slapd / extended.c
index a9a601476e9ef5df29cd86754955e1e34951a017..7c2efda7bf4736ec09840d6eac9dfd1dca775c70 100644 (file)
@@ -1,12 +1,16 @@
 /* $OpenLDAP$ */
-/* 
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
  * Copyright 1999-2003 The OpenLDAP Foundation.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted only
- * as authorized by the OpenLDAP Public License.  A copy of this
- * license is available at http://www.OpenLDAP.org/license.html or
- * in file LICENSE in the top-level directory of the distribution.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
  */
 
 /*
@@ -81,13 +85,31 @@ static struct {
 #ifdef HAVE_TLS
        { &slap_EXOP_START_TLS, 0, starttls_extop },
 #endif
-       { NULL, NULL }
+       { NULL, 0, NULL }
 };
 
 
 static struct extop_list *find_extop(
        struct extop_list *list, struct berval *oid );
 
+struct berval *
+get_supported_extop (int index)
+{
+       struct extop_list *ext;
+
+       /* linear scan is slow, but this way doesn't force a
+        * big change on root_dse.c, where this routine is used.
+        */
+       for (ext = supp_ext_list; ext != NULL && --index >= 0; ext = ext->next) {
+               ; /* empty */
+       }
+
+       if (ext == NULL) return NULL;
+
+       return &ext->oid;
+}
+
+
 int exop_root_dse_info( Entry *e )
 {
        AttributeDescription *ad_supportedExtension
@@ -224,35 +246,7 @@ do_extended(
 #endif
 
 #if defined(LDAP_SLAPI)
-       if (ext != NULL) { /* OpenLDAP extended operation */
-#endif /* defined(LDAP_SLAPI) */
-
-               if (reqdata.bv_val) op->ore_reqdata = &reqdata;
-               rs->sr_err = (ext->ext_main)( op, rs );
-
-               if( rs->sr_err != SLAPD_ABANDON ) {
-                       if ( rs->sr_err == LDAP_REFERRAL && rs->sr_ref == NULL ) {
-                               rs->sr_ref = referral_rewrite( default_referral,
-                                       NULL, NULL, LDAP_SCOPE_DEFAULT );
-                       }
-
-                       send_ldap_extended( op, rs );
-
-                       ber_bvarray_free( rs->sr_ref );
-               }
-
-               if ( rs->sr_rspoid != NULL ) {
-                       free( (char *)rs->sr_rspoid );
-               }
-
-               if ( rs->sr_rspdata != NULL ) {
-                       ber_bvfree( rs->sr_rspdata );
-               }
-
-#if defined( LDAP_SLAPI )
-               goto done;  /* end of OpenLDAP extended operation */
-
-       } else { /* start of Netscape extended operation */
+       if ( funcAddr != NULL ) {
                rs->sr_err = slapi_pblock_set( pb, SLAPI_EXT_OP_REQ_OID,
                                (void *)op->ore_reqoid.bv_val);
                if ( rs->sr_err != LDAP_SUCCESS ) {
@@ -311,9 +305,32 @@ done2:;
                if ( rs->sr_rspdata != NULL ) {
                        ber_bvfree( rs->sr_rspdata );
                }
-
-       } /* end of Netscape extended operation */
+       } else { /* start of OpenLDAP extended operation */
 #endif /* defined( LDAP_SLAPI ) */
+               if (reqdata.bv_val) op->ore_reqdata = &reqdata;
+               rs->sr_err = (ext->ext_main)( op, rs );
+
+               if( rs->sr_err != SLAPD_ABANDON ) {
+                       if ( rs->sr_err == LDAP_REFERRAL && rs->sr_ref == NULL ) {
+                               rs->sr_ref = referral_rewrite( default_referral,
+                                       NULL, NULL, LDAP_SCOPE_DEFAULT );
+                       }
+
+                       send_ldap_extended( op, rs );
+
+                       ber_bvarray_free( rs->sr_ref );
+               }
+
+               if ( rs->sr_rspoid != NULL ) {
+                       free( (char *)rs->sr_rspoid );
+               }
+
+               if ( rs->sr_rspdata != NULL ) {
+                       ber_bvfree( rs->sr_rspdata );
+               }
+#ifdef LDAP_SLAPI
+       } /* end of OpenLDAP extended operation */
+#endif /* LDAP_SLAPI */
 
 done:
        return rs->sr_err;