示例#1
0
文件: module.c 项目: cptaffe/openldap
int
load_extop_module (
	const void *module,
	const char *file_name
)
{
	SLAP_EXTOP_MAIN_FN *ext_main;
	SLAP_EXTOP_GETOID_FN *ext_getoid;
	struct berval oid;
	int rc;

	ext_main = (SLAP_EXTOP_MAIN_FN *)module_resolve(module, "ext_main");
	if (ext_main == NULL) {
		return(-1);
	}

	ext_getoid = module_resolve(module, "ext_getoid");
	if (ext_getoid == NULL) {
		return(-1);
	}

	rc = (ext_getoid)(0, &oid, 256);
	if (rc != 0) {
		return(rc);
	}
	if (oid.bv_val == NULL || oid.bv_len == 0) {
		return(-1);
	}

	/* FIXME: this is broken, and no longer needed, 
	 * as a module can call load_extop() itself... */
	rc = load_extop( &oid, ext_main );
	return rc;
}
示例#2
0
int
extops_init (void)
{
	int i;

	for ( i = 0; builtin_extops[i].oid != NULL; i++ ) {
		load_extop( (struct berval *)builtin_extops[i].oid,
			builtin_extops[i].flags,
			builtin_extops[i].ext_main );
	}
	return(0);
}
示例#3
0
int
distproc_initialize( void )
{
	int	rc;

	/* Make sure we don't exceed the bits reserved for userland */
	config_check_userland( DP_LAST );

	rc = load_extop( (struct berval *)&slap_EXOP_CHAINEDREQUEST,
		SLAP_EXOP_HIDE, ldap_exop_chained_request );
	if ( rc != LDAP_SUCCESS ) {
		Debug( LDAP_DEBUG_ANY, "slapd-distproc: "
			"unable to register chainedRequest exop: %d.\n",
			rc, 0, 0 );
		return rc;
	}

#ifdef LDAP_DEVEL
	rc = supported_feature_load( &slap_FEATURE_CANCHAINOPS );
	if ( rc != LDAP_SUCCESS ) {
		Debug( LDAP_DEBUG_ANY, "slapd-distproc: "
			"unable to register canChainOperations supported feature: %d.\n",
			rc, 0, 0 );
		return rc;
	}
#endif

	rc = register_supported_control( LDAP_CONTROL_X_RETURNCONTREF,
			SLAP_CTRL_GLOBAL|SLAP_CTRL_ACCESS|SLAP_CTRL_HIDE, NULL,
			ldap_distproc_parse_returnContRef_ctrl, &sc_returnContRef );
	if ( rc != LDAP_SUCCESS ) {
		Debug( LDAP_DEBUG_ANY, "slapd-distproc: "
			"unable to register returnContinuationReference control: %d.\n",
			rc, 0, 0 );
		return rc;
	}

	distproc.on_bi.bi_type = "distproc";
	distproc.on_bi.bi_db_init = ldap_distproc_db_init;
	distproc.on_bi.bi_db_config = ldap_distproc_db_config;
	distproc.on_bi.bi_db_open = ldap_distproc_db_open;
	distproc.on_bi.bi_db_close = ldap_distproc_db_close;
	distproc.on_bi.bi_db_destroy = ldap_distproc_db_destroy;

	/* ... otherwise the underlying backend's function would be called,
	 * likely passing an invalid entry; on the contrary, the requested
	 * operational attributes should have been returned while chasing
	 * the referrals.  This all in all is a bit messy, because part
	 * of the operational attributes are generated by the backend;
	 * part by the frontend; back-ldap should receive all the available
	 * ones from the remote server, but then, on its own, it strips those
	 * it assumes will be (re)generated by the frontend (e.g.
	 * subschemaSubentry, entryDN, ...) */
	distproc.on_bi.bi_operational = ldap_distproc_operational;
	
	distproc.on_bi.bi_connection_destroy = ldap_distproc_connection_destroy;

	distproc.on_response = ldap_distproc_response;

	distproc.on_bi.bi_cf_ocs = distproc_ocs;

	rc = config_register_schema( distproc_cfg, distproc_ocs );
	if ( rc ) {
		return rc;
	}

	return overlay_register( &distproc );
}