8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00
This commit is contained in:
Adriano dos Santos Fernandes 2019-01-05 18:47:04 -02:00
parent 38823d0184
commit d936c74cdd
16 changed files with 632 additions and 616 deletions

View File

@ -797,9 +797,9 @@ Example:
select * from x order by rand();
--------------------
----------------------
RDB$GET_TRANSACTION_CN
--------------------
----------------------
(FB4 extension)
Function:

View File

@ -226,7 +226,6 @@ int main()
if (isc_dsql_free_statement(st, &stmt, DSQL_unprepare))
raiseError(status, st);
//
printf("\nPart 2. BLOB created using isc_create_blob.\n");
//

View File

@ -149,7 +149,7 @@ int SrpClient::authenticate(CheckStatusWrapper* status, IClientBlock* cb)
BigInteger cProof = client->clientProof(cb->getLogin(), salt.c_str(), sessionKey);
cProof.getText(data);
dumpIt("Clnt: Client Proof",cProof);
dumpIt("Clnt: Client Proof", cProof);
cb->putData(status, data.length(), data.c_str());
if (status->getState() & IStatus::STATE_ERRORS)

View File

@ -150,7 +150,7 @@ bool AuthSspi::checkAdminPrivilege()
// Query actual group information
Array<char> buffer;
TOKEN_GROUPS *ptg = (TOKEN_GROUPS *)buffer.getBuffer(token_len);
if (! GetTokenInformation(spc.AccessToken, TokenGroups, ptg, token_len, &token_len))
if (!GetTokenInformation(spc.AccessToken, TokenGroups, ptg, token_len, &token_len))
return false;
// Create a System Identifier for the Admin group.
@ -313,10 +313,10 @@ bool AuthSspi::accept(AuthSspi::DataHolder& data)
fFreeContextBuffer(name.sUserName);
wheel = checkAdminPrivilege();
}
if (fQueryContextAttributes(&ctxtHndl, SECPKG_ATTR_SESSION_KEY, &key) == SEC_E_OK)
{
sessionKey.assign(key.SessionKey, key.SessionKeyLength);
}
fDeleteSecurityContext(&ctxtHndl);
hasContext = false;
break;
@ -405,21 +405,27 @@ int WinSspiServer::authenticate(Firebird::CheckStatusWrapper* status,
writerInterface->add(status, FB_DOMAIN_ANY_RID_ADMINS);
if (status->getState() & IStatus::STATE_ERRORS)
return AUTH_FAILED;
writerInterface->setType(status, FB_PREDEFINED_GROUP);
if (status->getState() & IStatus::STATE_ERRORS)
return AUTH_FAILED;
}
// walk groups to which login belongs and list them using writerInterface
Firebird::string grName;
for (unsigned n = 0; n < grNames.getCount(); ++n)
{
grName = grNames[n];
ISC_systemToUtf8(grName);
writerInterface->add(status, grName.c_str());
if (status->getState() & IStatus::STATE_ERRORS)
return AUTH_FAILED;
writerInterface->setType(status, "Group");
if (status->getState() & IStatus::STATE_ERRORS)
return AUTH_FAILED;
}
@ -429,9 +435,12 @@ int WinSspiServer::authenticate(Firebird::CheckStatusWrapper* status,
if (key)
{
ICryptKey* cKey = sBlock->newKey(status);
if (status->getState() & IStatus::STATE_ERRORS)
return AUTH_FAILED;
cKey->setSymmetric(status, "Symmetric", key->getCount(), key->begin());
if (status->getState() & IStatus::STATE_ERRORS)
return AUTH_FAILED;
}
@ -485,12 +494,16 @@ int WinSspiClient::authenticate(Firebird::CheckStatusWrapper* status,
// set wire crypt key
const UCharBuffer* key = sspi.getKey();
if (key && !keySet)
{
ICryptKey* cKey = cBlock->newKey(status);
if (status->getState() & IStatus::STATE_ERRORS)
return AUTH_FAILED;
cKey->setSymmetric(status, "Symmetric", key->getCount(), key->begin());
if (status->getState() & IStatus::STATE_ERRORS)
return AUTH_FAILED;

View File

@ -47,7 +47,7 @@ public:
hModule = NULL;
m_shutFlag = pShutFlag;
const BOOL ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
const BOOL ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
(LPCSTR) thdFunc, &hModule);
}

View File

@ -103,6 +103,7 @@ ModuleLoader::Module* ModuleLoader::loadModule(ISC_STATUS* status, const Firebir
status[3] = (ISC_STATUS) dlerror();
status[4] = isc_arg_end;
}
return 0;
}

View File

@ -110,12 +110,14 @@ public:
static Module* fixAndLoadModule(ISC_STATUS* status, const Firebird::PathName& modName)
{
Module* mod = loadModule(NULL, modName);
if (!mod)
{
Firebird::PathName fixed(modName);
doctorModuleExtension(fixed);
mod = loadModule(status, fixed);
}
return mod;
}

View File

@ -75,18 +75,19 @@ void ModuleLoader::doctorModuleExtension(Firebird::PathName& name)
return;
Firebird::PathName::size_type pos = name.rfind("." SHRLIB_EXT);
if (pos != name.length() - 3)
{
pos = name.rfind("." SHRLIB_EXT ".");
if (pos == Firebird::PathName::npos)
name += "." SHRLIB_EXT;
}
pos = name.rfind('/');
pos = (pos == Firebird::PathName::npos) ? 0 : pos + 1;
if (name.find("lib", pos) != pos)
{
name.insert(pos, "lib");
}
}
#ifdef DEV_BUILD
@ -108,6 +109,7 @@ ModuleLoader::Module* ModuleLoader::loadModule(ISC_STATUS* status, const Firebir
status[3] = (ISC_STATUS) dlerror();
status[4] = isc_arg_end;
}
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -78,8 +78,8 @@ namespace Firebird {
template<class SHA>void get_digest(const unsigned char* message, size_t len, unsigned char* digest)
{
SHA sha;
sha.process(len, message);
SHA sha;
sha.process(len, message);
sha.getHash(digest);
}
@ -113,9 +113,11 @@ template<class SHA> void hashBased64(Firebird::string& hash, const Firebird::str
* by calling the "reset" method.
*/
class sha2_base : public GlobalStorage {
class sha2_base : public GlobalStorage
{
#else
class sha2_base {
class sha2_base
{
#endif
public:
sha2_base() {}
@ -163,7 +165,8 @@ public:
#endif
};
class sha256 : public sha2_base {
class sha256 : public sha2_base
{
public:
sha256();
const unsigned int get_DigestSize() { return SHA256_DIGEST_SIZE; }
@ -180,22 +183,23 @@ protected:
private:
void sha256_init(sha256_ctx* ctx);
void sha256_update(sha256_ctx* ctx, const unsigned char* message,
unsigned int len);
unsigned int len);
void sha256_final(sha256_ctx* ctx, unsigned char* digest);
protected:
sha256_ctx ctx;
void sha256_transf(sha256_ctx* ctx, const unsigned char* message,
unsigned int block_nb);
unsigned int block_nb);
void sha_init() { sha256_init(&ctx); }
void sha_update(const unsigned char* message, unsigned int len) { sha256_update(&ctx,message,len); }
void sha_final(unsigned char* digest) { sha256_final(&ctx,digest); }
};
class sha224 : public sha256 {
class sha224 : public sha256
{
public:
sha224();
sha224();
const unsigned int get_DigestSize() { return SHA224_DIGEST_SIZE; }
const unsigned int get_BlockSize() { return SHA224_BLOCK_SIZE; }
@ -203,7 +207,7 @@ private:
typedef sha256_ctx sha224_ctx;
void sha224_init(sha224_ctx* ctx);
void sha224_update(sha224_ctx* ctx, const unsigned char* message,
unsigned int len);
unsigned int len);
void sha224_final(sha224_ctx* ctx, unsigned char* digest);
protected:
@ -212,7 +216,8 @@ protected:
void sha_final(unsigned char* digest) { sha224_final(&ctx,digest); }
};
class sha512 : public sha2_base {
class sha512 : public sha2_base
{
public:
sha512();
const unsigned int get_DigestSize() { return SHA512_DIGEST_SIZE; }
@ -229,20 +234,21 @@ protected:
private:
void sha512_init(sha512_ctx* ctx);
void sha512_update(sha512_ctx* ctx, const unsigned char* message,
unsigned int len);
unsigned int len);
void sha512_final(sha512_ctx* ctx, unsigned char* digest);
protected:
sha512_ctx ctx;
void sha512_transf(sha512_ctx* ctx, const unsigned char* message,
unsigned int block_nb);
unsigned int block_nb);
void sha_init() { sha512_init(&ctx); }
void sha_update(const unsigned char* message, unsigned int len) { sha512_update(&ctx, message, len); }
void sha_final(unsigned char* digest) { sha512_final(&ctx, digest); }
};
class sha384 : public sha512 {
class sha384 : public sha512
{
public:
sha384();
const unsigned int get_DigestSize() { return SHA384_DIGEST_SIZE; }
@ -252,7 +258,7 @@ private:
typedef sha512_ctx sha384_ctx;
void sha384_init(sha384_ctx* ctx);
void sha384_update(sha384_ctx* ctx, const unsigned char* message,
unsigned int len);
unsigned int len);
void sha384_final(sha384_ctx* ctx, unsigned char* digest);
protected:

View File

@ -10467,12 +10467,14 @@ void MappingNode::addItem(string& ddl, const char* text, char quote)
{
ddl += quote;
char c;
while ((c = *text++))
{
ddl += c;
if (c == quote)
ddl += c;
}
ddl += quote;
}

View File

@ -7180,7 +7180,7 @@ value_special
%type <valueExprNode> value_primary
value_primary
: nonparenthesized_value
| '(' value_primary ')' { $$ = $2; }
| '(' value_primary ')' { $$ = $2; }
;
// Matches definition of <simple value specification> in SQL standard

View File

@ -2537,7 +2537,7 @@ public:
ptr = inBuf.getBuffer(BLOB_STEP);
len = blob->BLB_get_data(tdbb, inBuf.begin(), inBuf.getCount(), false);
}
catch(...)
catch (...)
{
closeBlobs();
}
@ -2582,6 +2582,7 @@ public:
if (hasData())
{
impure->vlu_desc.clear();
if (!blobMode)
{
dsc result;
@ -2626,6 +2627,7 @@ private:
newBlob->BLB_close(tdbb);
newBlob = nullptr;
}
if (blob)
{
blob->BLB_close(tdbb);

View File

@ -311,6 +311,7 @@ void Provider::generateDPB(thread_db* tdbb, ClumpletWriter& dpb,
dpb.insertByte(isc_dpb_sql_dialect, 0);
dpb.insertString(isc_dpb_sql_role_name, role);
}
attachment->att_user->populateDpb(dpb, false);
}

View File

@ -563,7 +563,7 @@ CommitNumber TipCache::snapshotState(thread_db* tdbb, TraNumber number)
// (they were probably not causing much harm, but consistency is a good thing)
// 2. Old TPC returned tra_active for transactions in limbo, which was not correct
//
// hvlad: tra_active is correct here as it allows caller to wait for prepared but
// hvlad: tra_active is correct here as it allows caller to wait for prepared but
// still active transaction
Lock temp_lock(tdbb, sizeof(TraNumber), LCK_tra);
temp_lock.setKey(number);

View File

@ -219,7 +219,7 @@ _br_find_exe_for_symbol (const void *symbol, BrInitError *error)
if ( !(strstr(line, " r-xp ") || strstr(line, " r--p "))
|| strchr (line, '/') == NULL)
continue;
/* Parse line. */
start_addr = line;
end_addr = strchr (line, '-');