Ejemplo n.º 1
0
WERROR registry_init_common(void)
{
	WERROR werr;

	werr = regdb_init();
	if (!W_ERROR_IS_OK(werr)) {
		DEBUG(0, ("Failed to initialize the registry: %s\n",
			  win_errstr(werr)));
		goto done;
	}

	werr = reghook_cache_init();
	if (!W_ERROR_IS_OK(werr)) {
		DEBUG(0, ("Failed to initialize the reghook cache: %s\n",
			  win_errstr(werr)));
		goto done;
	}

	/* setup the necessary keys and values */

	werr = init_registry_data();
	if (!W_ERROR_IS_OK(werr)) {
		DEBUG(0, ("Failed to initialize data in registry!\n"));
	}

done:
	return werr;
}
Ejemplo n.º 2
0
WERROR registry_init_full(void)
{
	int i;
	WERROR werr;

	werr = registry_init_common();
	if (!W_ERROR_IS_OK(werr)) {
		goto fail;
	}

	/* setup the necessary keys and values */

	werr = init_registry_data();
	if (!W_ERROR_IS_OK(werr)) {
		DEBUG(0, ("Failed to initialize data in registry!\n"));
		goto fail;
	}

	/* build the cache tree of registry hooks */

	for ( i=0; reg_hooks[i].keyname; i++ ) {
		werr = reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops);
		if (!W_ERROR_IS_OK(werr)) {
			goto fail;
		}
	}

	if ( DEBUGLEVEL >= 20 )
		reghook_dump_cache(20);

	/* add any keys for other services */

	svcctl_init_keys();
	eventlog_init_keys();
	perfcount_init_keys();

fail:
	/* close and let each smbd open up as necessary */
	regdb_close();
	return werr;
}
Ejemplo n.º 3
0
BOOL regdb_init( void )
{
	const char *vstring = "INFO/version";
	uint32 vers_id;

	if ( tdb_reg )
		return True;

	if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
	{
		tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
		if ( !tdb_reg ) {
			DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
				lock_path("registry.tdb"), strerror(errno) ));
			return False;
		}
		
		DEBUG(10,("regdb_init: Successfully created registry tdb\n"));
	}

	tdb_refcount = 1;
		

	vers_id = tdb_fetch_int32(tdb_reg, vstring);

	if ( vers_id != REGVER_V1 ) {
		/* any upgrade code here if needed */
	}

	/* always setup the necessary keys and values */

	if ( !init_registry_data() ) {
		DEBUG(0,("init_registry: Failed to initialize data in registry!\n"));
		return False;
	}

	return True;
}