コード例 #1
0
ファイル: samba.c プロジェクト: 0x24bin/winexe-1
static WERROR mount_samba_hive(struct registry_context *ctx,
			       struct tevent_context *event_ctx,
			       struct loadparm_context *lp_ctx,
			       struct auth_session_info *auth_info,
			       struct cli_credentials *creds,
			       const char *name,
			       uint32_t hive_id)
{
	WERROR error;
	struct hive_key *hive;
	const char *location;

	location = talloc_asprintf(ctx, "%s/%s.ldb",
				   lp_private_dir(lp_ctx),
				   name);

	error = reg_open_hive(ctx, location, auth_info, creds, event_ctx, lp_ctx, &hive);

	if (W_ERROR_EQUAL(error, WERR_BADFILE))
		error = reg_open_ldb_file(ctx, location, auth_info,
					  creds, event_ctx, lp_ctx, &hive);

	if (!W_ERROR_IS_OK(error))
		return error;

	return reg_mount_hive(ctx, hive, hive_id, NULL);
}
コード例 #2
0
ファイル: hive.c プロジェクト: Arkhont/samba
static bool hive_setup_ldb(struct torture_context *tctx, void **data)
{
	struct hive_key *key;
	WERROR error;
	char *dirname;
	NTSTATUS status;

	status = torture_temp_dir(tctx, "hive-ldb", &dirname);
	if (!NT_STATUS_IS_OK(status))
		return false;

	rmdir(dirname);

	error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->ev, tctx->lp_ctx, &key);
	if (!W_ERROR_IS_OK(error)) {
		fprintf(stderr, "Unable to initialize ldb hive\n");
		return false;
	}

	*data = key;

	return true;
}