Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSEC hiding error - CryptAcquireContext [CORE1057] #1478

Closed
firebird-automations opened this issue Dec 17, 2006 · 10 comments
Closed

GSEC hiding error - CryptAcquireContext [CORE1057] #1478

firebird-automations opened this issue Dec 17, 2006 · 10 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @AlexPeshkoff

By some unknown reason for me, in guid.cpp the call to
CryptAcquireContext(..., CRYPT_NEWKEYSET) generates a error, in a WinXP
environment.

The error is hidden, I see nothing from gsec console, that's the bug.

Commits: 73e1f97 513b6a5

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

It was pretty easy to fix this error in HEAD.

Unfortunately, there is no special LongJump class in 2.0. And I want to ask for other peolple opinions - what is better: backport this class to 2.0 (good backport requies multiple changes in the tree) or create gsec specific flag, notifying that gsec_exit() was called?

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

What about catching Firebird::status_exception and checking for *ex.value() to distingiush between "long jump" usage and a status-based one?

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Currently gsec_exit() in 2.0 throws std::exception(). And knows absolutely nothing about Firebird::status_exception.
Should we change it to become empty status_exception? In that case your suggestion will sooner work then not due to the fact that isc_arg_end is zero and we may use stuff_exception() with empty status_exception.

The dark side here is that when good status_vector, received in an old manner, is passed to stuff_exception(), vector's content may be destroyed in it. In head it's fixed with empty virtual LongJump::stuff_exception() and missing empty raise But in 2.0 loosing status_vector is quite possible - we do not test for empty status_exception before changing first element of status_vector.

Should it be fixed too?

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Consider calling Firebird::status_exception::raise() in gsec_exit() -- as we do in alice.cpp -- and then catchig the exception like this:

catch \(const Firebird::status\_exception& e\) \{
	int exit\_code = tdsec\-\>tsec\_exit\_code;
	if \(e\.value\(\)\) \{
		// Real exceptions are coming here
		ISC\_STATUS\_ARRAY status;
		Firebird::CircularStringsBuffer<4096\> localStrings;
		e\.stuff\_exception\(status, &localStrings\);
		GSEC\_print\_status\(status, false\);
		exit\_code = 127;
	\}
\}

return exit\_code;

I don't see how it could lose status vector data.

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

In this way it can loose non-Firebird exceptions, like std::bad_alloc. But appears there is a way to catch it too, using stuff_exception.

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

A bit ugly, but now it works in any case.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.0.1 [ 10090 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 11402 ] => Firebird [ 14238 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants