Example #1
0
static int
trace_db_close(
	BackendDB *be )
{
	Log0( LDAP_DEBUG_ANY, LDAP_LEVEL_INFO,
		"trace DB_CLOSE\n" );

	return 0;
}
Example #2
0
static int
trace_db_destroy(
	BackendDB *be )
{
	Log0( LDAP_DEBUG_ANY, LDAP_LEVEL_INFO,
		"trace DB_DESTROY\n" );

	return 0;
}
Example #3
0
static int
trace_db_open(
	BackendDB *be )
{
	Log0( LDAP_DEBUG_ANY, LDAP_LEVEL_INFO,
		"trace DB_OPEN\n" );

	return 0;
}
Example #4
0
static int
trace_db_init(
	BackendDB *be )
{
	Log0( LDAP_DEBUG_ANY, LDAP_LEVEL_INFO,
		"trace DB_INIT\n" );

	return 0;
}
Example #5
0
static int
dds_db_init(
	BackendDB	*be,
	ConfigReply	*cr)
{
	slap_overinst	*on = (slap_overinst *)be->bd_info;
	dds_info_t	*di;
	BackendInfo	*bi = on->on_info->oi_orig;

	if ( SLAP_ISGLOBALOVERLAY( be ) ) {
		Log0( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
			"DDS cannot be used as global overlay.\n" );
		return 1;
	}

	/* check support for required functions */
	/* FIXME: some could be provided by other overlays in between */
	if ( bi->bi_op_add == NULL			/* object creation */
		|| bi->bi_op_delete == NULL		/* object deletion */
		|| bi->bi_op_modify == NULL		/* object refresh */
		|| bi->bi_op_search == NULL		/* object expiration */
		|| bi->bi_entry_get_rw == NULL )	/* object type/existence checking */
	{
		Log1( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
			"DDS backend \"%s\" does not provide "
			"required functionality.\n",
			bi->bi_type );
		return 1;
	}

	di = (dds_info_t *)ch_calloc( 1, sizeof( dds_info_t ) );
	on->on_bi.bi_private = di;

	di->di_max_ttl = DDS_RF2589_DEFAULT_TTL;
	di->di_max_ttl = DDS_RF2589_DEFAULT_TTL;

	ldap_pvt_thread_mutex_init( &di->di_mutex );

	SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_DYNAMIC;

	return 0;
}
Example #6
0
static void HPEstablishUSBNotifications(struct udev *udev)
{
	struct udev_monitor *udev_monitor;
	int r, i;
	int fd;
	fd_set fds;

	udev_monitor = udev_monitor_new_from_netlink(udev, "udev");

	/* filter only the interfaces */
	r = udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb",
		"usb_interface");
	if (r)
	{
		Log2(PCSC_LOG_ERROR, "udev_monitor_filter_add_match_subsystem_devtype() error: %d\n", r);
		return;
	}

	r = udev_monitor_enable_receiving(udev_monitor);
	if (r)
	{
		Log2(PCSC_LOG_ERROR, "udev_monitor_enable_receiving() error: %d\n", r);
		return;
	}

	/* udev monitor file descriptor */
	fd = udev_monitor_get_fd(udev_monitor);

	while (!AraKiriHotPlug)
	{
		struct udev_device *dev, *parent;
		const char *action, *devpath;

#ifdef DEBUG_HOTPLUG
		Log0(PCSC_LOG_INFO);
#endif

		FD_ZERO(&fds);
		FD_SET(fd, &fds);

		/* wait for a udev event */
		r = select(fd+1, &fds, NULL, NULL, NULL);
		if (r < 0)
		{
			Log2(PCSC_LOG_ERROR, "select(): %s", strerror(errno));
			return;
		}

		dev = udev_monitor_receive_device(udev_monitor);
		if (!dev)
		{
			Log1(PCSC_LOG_ERROR, "udev_monitor_receive_device() error\n");
			return;
		}

		action = udev_device_get_action(dev);
		if (0 == strcmp("remove", action))
		{
			Log1(PCSC_LOG_INFO, "Device removed");
			HPRescanUsbBus(udev);
			continue;
		}

		if (strcmp("add", action))
			continue;

		parent = udev_device_get_parent_with_subsystem_devtype(dev, "usb",
			"usb_device");
		devpath = udev_device_get_devnode(parent);
		if (!devpath)
		{
			/* the device disapeared? */
			Log1(PCSC_LOG_ERROR, "udev_device_get_devnode() failed");
			continue;
		}

		HPAddDevice(dev, parent, devpath);

		/* free device */
		udev_device_unref(dev);

	}

	for (i=0; i<driverSize; i++)
	{
		/* free strings allocated by strdup() */
		free(driverTracker[i].bundleName);
		free(driverTracker[i].libraryPath);
		free(driverTracker[i].readerName);
	}
	free(driverTracker);

	Log1(PCSC_LOG_INFO, "Hotplug stopped");
} /* HPEstablishUSBNotifications */
Example #7
0
static int
slap_parse_refresh(
	struct berval	*in,
	struct berval	*ndn,
	time_t		*ttl,
	const char	**text,
	void		*ctx )
{
	int			rc = LDAP_SUCCESS;
	ber_tag_t		tag;
	ber_len_t		len = -1;
	BerElementBuffer	berbuf;
	BerElement		*ber = (BerElement *)&berbuf;
	struct berval		reqdata = BER_BVNULL;
	int			tmp;

	*text = NULL;

	if ( ndn ) {
		BER_BVZERO( ndn );
	}

	if ( in == NULL || in->bv_len == 0 ) {
		*text = "empty request data field in refresh exop";
		return LDAP_PROTOCOL_ERROR;
	}

	ber_dupbv_x( &reqdata, in, ctx );

	/* ber_init2 uses reqdata directly, doesn't allocate new buffers */
	ber_init2( ber, &reqdata, 0 );

	tag = ber_scanf( ber, "{" /*}*/ );

	if ( tag == LBER_ERROR ) {
		Log0( LDAP_DEBUG_TRACE, LDAP_LEVEL_ERR,
			"slap_parse_refresh: decoding error.\n" );
		goto decoding_error;
	}

	tag = ber_peek_tag( ber, &len );
	if ( tag != LDAP_TAG_EXOP_REFRESH_REQ_DN ) {
		Log0( LDAP_DEBUG_TRACE, LDAP_LEVEL_ERR,
			"slap_parse_refresh: decoding error.\n" );
		goto decoding_error;
	}

	if ( ndn ) {
		struct berval	dn;

		tag = ber_scanf( ber, "m", &dn );
		if ( tag == LBER_ERROR ) {
			Log0( LDAP_DEBUG_TRACE, LDAP_LEVEL_ERR,
				"slap_parse_refresh: DN parse failed.\n" );
			goto decoding_error;
		}

		rc = dnNormalize( 0, NULL, NULL, &dn, ndn, ctx );
		if ( rc != LDAP_SUCCESS ) {
			*text = "invalid DN in refresh exop request data";
			goto done;
		}

	} else {
		tag = ber_scanf( ber, "x" /* "m" */ );
		if ( tag == LBER_DEFAULT ) {
			goto decoding_error;
		}
	}

	tag = ber_peek_tag( ber, &len );

	if ( tag != LDAP_TAG_EXOP_REFRESH_REQ_TTL ) {
		Log0( LDAP_DEBUG_TRACE, LDAP_LEVEL_ERR,
			"slap_parse_refresh: decoding error.\n" );
		goto decoding_error;
	}

	tag = ber_scanf( ber, "i", &tmp );
	if ( tag == LBER_ERROR ) {
		Log0( LDAP_DEBUG_TRACE, LDAP_LEVEL_ERR,
			"slap_parse_refresh: TTL parse failed.\n" );
		goto decoding_error;
	}

	if ( ttl ) {
		*ttl = tmp;
	}

	tag = ber_peek_tag( ber, &len );

	if ( tag != LBER_DEFAULT || len != 0 ) {
decoding_error:;
		Log1( LDAP_DEBUG_TRACE, LDAP_LEVEL_ERR,
			"slap_parse_refresh: decoding error, len=%ld\n",
			(long)len );
		rc = LDAP_PROTOCOL_ERROR;
		*text = "data decoding error";

done:;
		if ( ndn && !BER_BVISNULL( ndn ) ) {
			slap_sl_free( ndn->bv_val, ctx );
			BER_BVZERO( ndn );
		}
	}

	if ( !BER_BVISNULL( &reqdata ) ) {
		ber_memfree_x( reqdata.bv_val, ctx );
	}

	return rc;
}