/*!
	If share is NULL, the default authentication for the server is returned.
*/
bool
AuthenticationServer::_GetAuthentication(const char* context,
	const char* server, const char* share, String* user, String* password)
{
	if (!context || !server || !user || !password)
		return B_BAD_VALUE;
	// get the server entry
	AutoLocker<Locker> _(fLock);
	ServerKey key(context, server);
	ServerEntry* serverEntry = fServerEntries->Get(key);
	if (!serverEntry)
		return false;
	// get the authentication
	const Authentication* authentication = NULL;
	if (share) {
		serverEntry->GetAuthentication(share);
		if (!authentication && serverEntry->UseDefaultAuthentication())
			authentication = &serverEntry->GetDefaultAuthentication();
	} else
		authentication = &serverEntry->GetDefaultAuthentication();
	if (!authentication || !authentication->IsValid())
		return false;
	return (user->SetTo(authentication->GetUser())
		&& password->SetTo(authentication->GetPassword()));
}