8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:03:03 +01:00

Fixed CORE-6329: GBAK with service_mgr and WinSSPI authentication for Windows SYSTEM user producing error in clumplet API

This commit is contained in:
AlexPeshkoff 2020-06-17 19:42:54 +03:00
parent 03afc1cc85
commit 7c1a0fee89
19 changed files with 39 additions and 21 deletions

View File

@ -185,7 +185,7 @@ bool TDR_attach_database(ISC_STATUS* status_vector, tdr* trans, const TEXT* path
if (tdgbl->ALICE_data.ua_debug)
ALICE_print(68, SafeArg() << pathname); // msg 68: ATTACH_DATABASE: attempted attach of %s
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
dpb.insertTag(isc_dpb_no_garbage_collect);
dpb.insertTag(isc_dpb_gfix_attach);
tdgbl->uSvc->fillDpb(dpb);

View File

@ -113,6 +113,24 @@ int DebugServer::authenticate(Firebird::CheckStatusWrapper* status, Firebird::IS
check(&s);
}
Firebird::RefPtr<Firebird::IConfigEntry> multi(Firebird::REF_NO_INCR, config->find(&s, "MULTIGROUPS"));
check(&s);
if (multi)
{
const int limit = multi->getIntValue();
// list groups using writerInterface
const char* grName = "FillWithBigData";
for (int n = 0; n < limit; ++n)
{
writerInterface->add(status, grName);
if (status->getState() & Firebird::IStatus::STATE_ERRORS)
return AUTH_FAILED;
writerInterface->setType(status, "Group");
if (status->getState() & Firebird::IStatus::STATE_ERRORS)
return AUTH_FAILED;
}
}
return AUTH_SUCCESS;
}
catch (const Firebird::Exception& ex)

View File

@ -217,7 +217,7 @@ void SecurityDatabase::prepare(const char* secureDbName)
lookup_db = lookup_req = 0;
// Perhaps build up a dpb
ClumpletWriter dpb(ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
ClumpletWriter dpb(ClumpletReader::dpbList, MAX_DPB_SIZE);
// Attachment is for the security database
dpb.insertByte(isc_dpb_sec_attach, TRUE);

View File

@ -1100,7 +1100,7 @@ int gbak(Firebird::UtilSvc* uSvc)
}
// Initialize 'dpb'
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
dpb.insertString(isc_dpb_gbak_attach, FB_VERSION, fb_strlen(FB_VERSION));
uSvc->fillDpb(dpb);

View File

@ -558,7 +558,7 @@ int RESTORE_restore (const TEXT* file_name, const TEXT* database_name)
BURP_verbose(360);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
add_access_dpb(tdgbl, dpb);
if (tdgbl->flag_on_line)
@ -934,7 +934,7 @@ void create_database(BurpGlobals* tdgbl, Firebird::IProvider* provider, const TE
if (tdgbl->gbl_sw_page_buffers)
page_buffers = tdgbl->gbl_sw_page_buffers;
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
tdgbl->uSvc->fillDpb(dpb);
const UCHAR* authBlock;

View File

@ -158,7 +158,7 @@ bool MET_database(gpre_dbb* database, bool print_version)
// generate a dpb for the attach from the specified
// compiletime user name and password
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
const TEXT* p;
if ((p = database->dbb_c_user)) {

View File

@ -6410,7 +6410,7 @@ static processing_state newdb(TEXT* dbname,
local_numbufs = global_numbufs;
// Build up a dpb
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
if (*setValues.ISQL_charset && strcmp(setValues.ISQL_charset, DEFCHARSET)) {
dpb.insertString(isc_dpb_lc_ctype, setValues.ISQL_charset, fb_strlen(setValues.ISQL_charset));

View File

@ -955,7 +955,7 @@ namespace Jrd {
// Establish context
// Need real attachment in order to make classic mode happy
ClumpletWriter writer(ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
ClumpletWriter writer(ClumpletReader::dpbList, MAX_DPB_SIZE);
writer.insertString(isc_dpb_user_name, DBA_USER_NAME);
writer.insertByte(isc_dpb_no_db_triggers, TRUE);

View File

@ -71,7 +71,7 @@ void check(const char* s, IStatus* st)
bool openDb(const char* securityDb, RefPtr<IAttachment>& att, RefPtr<ITransaction>& tra)
{
ClumpletWriter embeddedAttach(ClumpletWriter::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
ClumpletWriter embeddedAttach(ClumpletWriter::dpbList, MAX_DPB_SIZE);
embeddedAttach.insertString(isc_dpb_user_name, DBA_USER_NAME, fb_strlen(DBA_USER_NAME));
embeddedAttach.insertByte(isc_dpb_sec_attach, TRUE);
embeddedAttach.insertString(isc_dpb_config, ParsedList::getNonLoopbackProviders(securityDb));

View File

@ -189,7 +189,7 @@ bool Mapping::DbHandle::attach(const char* aliasDb, ICryptKeyCallback* cryptCb)
check("IProvider::setDbCryptCallback", &st);
}
ClumpletWriter embeddedSysdba(ClumpletWriter::Tagged, 1024, isc_dpb_version1);
ClumpletWriter embeddedSysdba(ClumpletWriter::dpbList, MAX_DPB_SIZE);
embeddedSysdba.insertString(isc_dpb_user_name, DBA_USER_NAME, fb_strlen(DBA_USER_NAME));
embeddedSysdba.insertByte(isc_dpb_sec_attach, TRUE);
embeddedSysdba.insertString(isc_dpb_config, ParsedList::getNonLoopbackProviders(aliasDb));
@ -1630,7 +1630,7 @@ RecordBuffer* MappingList::getList(thread_db* tdbb, jrd_rel* relation)
{
const char* dbName = tdbb->getDatabase()->dbb_config->getSecurityDatabase();
ClumpletWriter embeddedSysdba(ClumpletWriter::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
ClumpletWriter embeddedSysdba(ClumpletWriter::dpbList, MAX_DPB_SIZE);
embeddedSysdba.insertString(isc_dpb_user_name, DBA_USER_NAME, fb_strlen(DBA_USER_NAME));
embeddedSysdba.insertByte(isc_dpb_sec_attach, TRUE);
embeddedSysdba.insertString(isc_dpb_config, ParsedList::getNonLoopbackProviders(dbName));

View File

@ -2704,7 +2704,7 @@ static THREAD_ENTRY_DECLARE sweep_database(THREAD_ENTRY_PARAM database)
* Sweep database.
*
**************************************/
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
dpb.insertByte(isc_dpb_sweep, isc_dpb_records);
// use embedded authentication to attach database

View File

@ -720,7 +720,7 @@ static int validate(Firebird::UtilSvc* svc)
}
}
ClumpletWriter dpb(ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
ClumpletWriter dpb(ClumpletReader::dpbList, MAX_DPB_SIZE);
if (!userName.isEmpty())
{
dpb.insertString(isc_dpb_trusted_auth, userName);

View File

@ -512,7 +512,7 @@ void MET_delete_database( qli_dbb* dbb)
password_length = static_cast<USHORT>(strlen(QLI_default_password));
}
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
if (user_length)
{
dpb.insertString(isc_dpb_user_name, user, user_length);
@ -1382,7 +1382,7 @@ void MET_ready( qli_syntax* node, const bool create_flag)
* fail, all fail. Fair enough?
*
**************************************/
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
qli_dbb* temp = (qli_dbb*) node->syn_arg[0];

View File

@ -364,7 +364,7 @@ namespace
if (m_connected)
return m_sequence;
ClumpletWriter dpb(ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
ClumpletWriter dpb(ClumpletReader::dpbList, MAX_DPB_SIZE);
dpb.insertString(isc_dpb_user_name, DBA_USER_NAME);
dpb.insertString(isc_dpb_config, ParsedList::getNonLoopbackProviders(m_config->dbName));

View File

@ -43,7 +43,7 @@ int main(int argc, char** argv)
return -3;
}
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
dpb.insertByte(isc_dpb_set_db_readonly, TRUE);
isc_attach_database(sv, 0, argv[1], &db, dpb.getBufferLength(),
reinterpret_cast<const char*>(dpb.getBuffer()));

View File

@ -416,7 +416,7 @@ int gsec(Firebird::UtilSvc* uSvc)
{
// Get remote address info for management plugin
Firebird::string network_protocol, remote_address;
Firebird::ClumpletWriter tmp(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter tmp(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
uSvc->fillDpb(tmp);
if (tmp.find(isc_dpb_address_path))

View File

@ -772,7 +772,7 @@ int gstat(Firebird::UtilSvc* uSvc)
// Check to make sure that the user accessing the database is either
// SYSDBA or owner of the database
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
uSvc->fillDpb(dpb);
dpb.insertTag(isc_dpb_gstat_attach);
dpb.insertTag(isc_dpb_no_garbage_collect);

View File

@ -939,7 +939,7 @@ void NBackup::attach_database()
status_exception::raise(Arg::Gds(isc_nbackup_userpw_toolong));
}
ClumpletWriter dpb(ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
ClumpletWriter dpb(ClumpletReader::dpbList, MAX_DPB_SIZE);
const unsigned char* authBlock;
unsigned int authBlockSize = uSvc->getAuthBlock(&authBlock);

View File

@ -193,7 +193,7 @@ bool PREPARSE_execute(CheckStatusWrapper* status, Why::YAttachment** ptrAtt,
PathName file_name(getToken(pos, tks, STRING).ToPathName());
*stmt_eaten = false;
ClumpletWriter dpb(ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
ClumpletWriter dpb(ClumpletReader::dpbList, MAX_DPB_SIZE);
dpb.insertByte(isc_dpb_overwrite, 0);
dpb.insertInt(isc_dpb_sql_dialect, dialect);