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

Unable to connect bundled embedded database on macOS [DNET744] #686

Closed
firebird-automations opened this issue Mar 23, 2017 · 2 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: Daniel Martin (sanosdole)

When bundling the Firebird database with a mono application, one must not provide a user and a password in the connection string as otherwise the libfbembed.dylib (Firebird binary) attempts to attach to the systems security2.fdb.
The FbConnectionString class forces the client to provide a user and password if LINUX is defined, as trusted auth does no exist on non-windows platforms.

This was locally fixed by checking the FbConnectionString.ServerType property in FbConnectionString.Validate and FbConnectionString.FallIntoTrustedAuth.
See the provided methods below for details.

I'm not sure whether this is the correct solution or if it creates any side effects.

----
internal bool FallIntoTrustedAuth
{
// on non-Win the UserID/Password is checked in Validate method
get { return ServerType != FbServerType.Embedded && string.IsNullOrEmpty(UserID) && string.IsNullOrEmpty(Password); } // Embedded does not require a password
}
---
public void Validate()
{
if (!ContextConnection)
{
if (
#⁠if (LINUX) // on Linux Trusted Auth isn't available
(ServerType != FbServerType.Embedded && (string.IsNullOrEmpty(this.UserID) || // Embedded does not require a password
string.IsNullOrEmpty(this.Password))) ||
#⁠endif
(string.IsNullOrEmpty(Database) && !_isServiceConnectionString) ||
(string.IsNullOrEmpty(DataSource) && ServerType != FbServerType.Embedded) ||
(string.IsNullOrEmpty(Charset)) ||
(Port == 0) ||
(!Enum.IsDefined(typeof(FbServerType), ServerType)) ||
(MinPoolSize > MaxPoolSize)
)
{
throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied.");
}
if (Dialect < 1 || Dialect > 3)
{
throw new ArgumentException("Incorrect database dialect it should be 1, 2, or 3.");
}
if (PacketSize < 512 || PacketSize > 32767)
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "'Packet Size' value of {0} is not valid.{1}The value should be an integer >= 512 and <= 32767.", PacketSize, Environment.NewLine));
}
if (DbCachePages < 0)
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "'Db Cache Pages' value of {0} is not valid.{1}The value should be an integer >= 0.", DbCachePages, Environment.NewLine));
}
if (Pooling && NoDatabaseTriggers)
{
throw new ArgumentException("Cannot use Pooling and NoDBTriggers together.");
}

			CheckIsolationLevel\(\);
		\}
	\}

---

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 5.1.0.0 [ 10761 ]

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