/* $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>.
*/
/*
#define UNSUPPORTED_EXTENDEDOP "unsupported extended operation"
+#ifdef LDAP_DEVEL
+#define SLAP_EXOP_HIDE 0x0000
+#else
+#define SLAP_EXOP_HIDE 0x8000
+#endif
+
static struct extop_list {
struct extop_list *next;
struct berval oid;
+ slap_mask_t flags;
SLAP_EXTOP_MAIN_FN *ext_main;
} *supp_ext_list = NULL;
static struct {
const struct berval *oid;
+ slap_mask_t flags;
SLAP_EXTOP_MAIN_FN *ext_main;
} builtin_extops[] = {
#ifdef LDAP_EXOP_X_CANCEL
- { &slap_EXOP_CANCEL, cancel_extop },
+ { &slap_EXOP_CANCEL, SLAP_EXOP_HIDE, cancel_extop },
#endif
- { &slap_EXOP_WHOAMI, whoami_extop },
- { &slap_EXOP_MODIFY_PASSWD, passwd_extop },
+ { &slap_EXOP_WHOAMI, 0, whoami_extop },
+ { &slap_EXOP_MODIFY_PASSWD, 0, passwd_extop },
#ifdef HAVE_TLS
- { &slap_EXOP_START_TLS, starttls_extop },
+ { &slap_EXOP_START_TLS, 0, starttls_extop },
#endif
- { NULL, NULL }
+ { NULL, 0, NULL }
};
if (ext == NULL) return NULL;
- return &ext->oid ;
+ return &ext->oid;
+}
+
+
+int exop_root_dse_info( Entry *e )
+{
+ AttributeDescription *ad_supportedExtension
+ = slap_schema.si_ad_supportedExtension;
+ struct berval vals[2];
+ struct extop_list *ext;
+
+ vals[1].bv_val = NULL;
+ vals[1].bv_len = 0;
+
+ for (ext = supp_ext_list; ext != NULL; ext = ext->next) {
+ if( ext->flags & SLAP_EXOP_HIDE ) continue;
+
+ vals[0] = ext->oid;
+
+ if( attr_merge( e, ad_supportedExtension, vals, NULL ) ) {
+ return LDAP_OTHER;
+ }
+ }
+
+ return LDAP_SUCCESS;
}
int
#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 ) {
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;
int
load_extop(
struct berval *ext_oid,
+ slap_mask_t ext_flags,
SLAP_EXTOP_MAIN_FN *ext_main )
{
struct extop_list *ext;
if (ext == NULL)
return(-1);
+ ext->flags = ext_flags;
+
ext->oid.bv_val = (char *)(ext + 1);
AC_MEMCPY( ext->oid.bv_val, ext_oid->bv_val, ext_oid->bv_len );
ext->oid.bv_len = ext_oid->bv_len;
int i;
for (i = 0; builtin_extops[i].oid != NULL; i++) {
- load_extop((struct berval *)builtin_extops[i].oid, builtin_extops[i].ext_main);
+ load_extop((struct berval *)builtin_extops[i].oid,
+ builtin_extops[i].flags,
+ builtin_extops[i].ext_main);
}
return(0);
}