8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 03:23:03 +01:00
This commit is contained in:
robocop 2009-12-01 12:32:31 +00:00
parent fa15710b89
commit c81b21a160

View File

@ -82,7 +82,8 @@ static inline void check_and_move(UCHAR from, Acl& to)
to.push(from); to.push(from);
} }
struct P_NAMES { struct P_NAMES
{
SecurityClass::flags_t p_names_priv; SecurityClass::flags_t p_names_priv;
USHORT p_names_acl; USHORT p_names_acl;
const TEXT* p_names_string; const TEXT* p_names_string;
@ -185,12 +186,14 @@ void SCL_check_access(thread_db* tdbb,
} }
} }
if (denied_db) { if (denied_db)
{
ERR_post(Arg::Gds(isc_no_priv) << Arg::Str(names->p_names_string) << ERR_post(Arg::Gds(isc_no_priv) << Arg::Str(names->p_names_string) <<
Arg::Str("DATABASE") << Arg::Str("DATABASE") <<
Arg::Str("")); Arg::Str(""));
} }
else { else
{
ERR_post(Arg::Gds(isc_no_priv) << Arg::Str(names->p_names_string) << ERR_post(Arg::Gds(isc_no_priv) << Arg::Str(names->p_names_string) <<
Arg::Str(type) << Arg::Str(type) <<
Arg::Str(name)); Arg::Str(name));
@ -276,7 +279,8 @@ void SCL_check_index(thread_db* tdbb, const Firebird::MetaName& index_name, UCHA
// No need to cache this request handle, it's only used when // No need to cache this request handle, it's only used when
// new constraints are created // new constraints are created
if (index_id < 1) { if (index_id < 1)
{
FOR(REQUEST_HANDLE request) IND IN RDB$INDICES FOR(REQUEST_HANDLE request) IND IN RDB$INDICES
CROSS REL IN RDB$RELATIONS CROSS REL IN RDB$RELATIONS
OVER RDB$RELATION_NAME OVER RDB$RELATION_NAME
@ -291,7 +295,8 @@ void SCL_check_index(thread_db* tdbb, const Firebird::MetaName& index_name, UCHA
CMP_release(tdbb, request); CMP_release(tdbb, request);
} }
else { else
{
idx_name_ptr = &aux_idx_name; idx_name_ptr = &aux_idx_name;
FOR (REQUEST_HANDLE request) IND IN RDB$INDICES FOR (REQUEST_HANDLE request) IND IN RDB$INDICES
CROSS REL IN RDB$RELATIONS CROSS REL IN RDB$RELATIONS
@ -359,7 +364,8 @@ void SCL_check_index(thread_db* tdbb, const Firebird::MetaName& index_name, UCHA
CMP_release(tdbb, request); CMP_release(tdbb, request);
} }
catch (const Firebird::Exception&) { catch (const Firebird::Exception&)
{
if (request) { if (request) {
CMP_release(tdbb, request); CMP_release(tdbb, request);
} }
@ -667,7 +673,8 @@ void SCL_init(thread_db* tdbb, bool create, const UserId& tempId)
// CVC: If we aren't creating a db and sql_role was specified, // CVC: If we aren't creating a db and sql_role was specified,
// then verify it against rdb$roles and rdb$user_privileges // then verify it against rdb$roles and rdb$user_privileges
if (!create && sql_role && *sql_role && strcmp(sql_role, NULL_ROLE)) { if (!create && sql_role && *sql_role && strcmp(sql_role, NULL_ROLE))
{
bool found = false; bool found = false;
jrd_req* request = CMP_find_request (tdbb, irq_verify_role_name, IRQ_REQUESTS); jrd_req* request = CMP_find_request (tdbb, irq_verify_role_name, IRQ_REQUESTS);
@ -726,7 +733,8 @@ void SCL_init(thread_db* tdbb, bool create, const UserId& tempId)
} }
} }
if (sql_role) { if (sql_role)
{
if (role_name != NULL_ROLE) { if (role_name != NULL_ROLE) {
role_name = sql_role; role_name = sql_role;
} }
@ -741,7 +749,8 @@ void SCL_init(thread_db* tdbb, bool create, const UserId& tempId)
user->usr_sql_role_name = role_name.c_str(); user->usr_sql_role_name = role_name.c_str();
attachment->att_user = user; attachment->att_user = user;
if (!create) { if (!create)
{
jrd_req* handle = NULL; jrd_req* handle = NULL;
jrd_req* handle1 = NULL; jrd_req* handle1 = NULL;
jrd_req* handle2 = NULL; jrd_req* handle2 = NULL;
@ -1187,6 +1196,7 @@ static SecurityClass::flags_t walk_acl(thread_db* tdbb,
else else
{ {
TEXT login_name[129]; TEXT login_name[129];
fb_assert(user.usr_user_name.length() < sizeof(login_name));
TEXT* pln = login_name; TEXT* pln = login_name;
const TEXT* q = user.usr_user_name.c_str(); const TEXT* q = user.usr_user_name.c_str();
while (*pln++ = UPPER7(*q)) { while (*pln++ = UPPER7(*q)) {
@ -1287,9 +1297,7 @@ static SecurityClass::flags_t walk_acl(thread_db* tdbb,
break; break;
case priv_write: case priv_write:
privilege |= privilege |= SCL_write | SCL_sql_insert | SCL_sql_update | SCL_sql_delete;
SCL_write | SCL_sql_insert | SCL_sql_update |
SCL_sql_delete;
break; break;
case priv_sql_insert: case priv_sql_insert: