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

Fixed grants display - thanks to Claudio

This commit is contained in:
alexpeshkoff 2008-06-11 12:41:36 +00:00
parent 104f30b6f2
commit cdbe8183ee
4 changed files with 30 additions and 5 deletions

View File

@ -125,6 +125,9 @@ int EXTRACT_ddl(LegacyTables flag,
return FINI_ERROR;
}
did_attach = true;
// Make it read owner name to display grantor correctly
SHOW_read_owner();
}
ISQL_get_version(false);

View File

@ -3875,6 +3875,9 @@ static processing_state create_db(const TEXT* statement,
}
if (DB) {
// Make it read owner name to display grantor correctly
SHOW_read_owner();
// No use in cancel when running non-end-user operators
fb_cancel_operation(isc_status, &DB, fb_cancel_disable);
@ -6312,6 +6315,9 @@ static processing_state newdb(TEXT* dbname,
return FAIL;
}
// Make it read owner name to display grantor correctly
SHOW_read_owner();
// No use in cancel when running non-end-user operators
fb_cancel_operation(isc_status, &DB, fb_cancel_disable);
} // scope

View File

@ -104,6 +104,7 @@ static processing_state show_users();
const char* const spaces = " ";
static TEXT Print_buffer[512];
static TEXT SQL_identifier[BUFFER_LENGTH128];
static bool reReadDbOwner = true;
// Initialize types
@ -463,6 +464,22 @@ processing_state SHOW_grants(const SCHAR* object,
}
void SHOW_read_owner()
{
/**************************************
*
* S H O W _ r e a d _ o w n e r
*
**************************************
*
* Functional description
* Make granted_by() re-read db owner name.
*
**************************************/
reReadDbOwner = true;
}
static const char* granted_by(char* buffer, const char* grantor)
{
/**************************************
@ -472,15 +489,12 @@ static const char* granted_by(char* buffer, const char* grantor)
**************************************
*
* Functional description
* Output message only if not granted by SYSDBA.
* Output message only if not granted by DB owner.
*
**************************************/
static SCHAR last_Db_name[MAXPATHLEN] = "";
static BASED_ON RDB$RELATIONS.RDB$OWNER_NAME owner;
if (strcmp(isqlGlob.global_Db_name, last_Db_name))
if (reReadDbOwner)
{
strcpy(last_Db_name, isqlGlob.global_Db_name);
// Get the owner name
strcpy(owner, SYSDBA_USER_NAME);
FOR REL IN RDB$RELATIONS WITH
@ -495,6 +509,7 @@ static const char* granted_by(char* buffer, const char* grantor)
return "";
END_ERROR;
fb_utils::exact_name(owner);
reReadDbOwner = false;
}
strcpy(buffer, grantor);

View File

@ -32,6 +32,7 @@ void SHOW_grant_roles (const SCHAR*, bool*);
void SHOW_grant_roles2 (const SCHAR*, bool*, const TEXT*, bool);
void SHOW_print_metadata_text_blob(FILE*, ISC_QUAD*, bool escape_squote = false);
processing_state SHOW_metadata(const SCHAR* const*, SCHAR**);
void SHOW_read_owner();
#endif // ISQL_SHOW_PROTO_H