mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 21:23:04 +01:00
Implemented CORE-5536: Connections compressed and encrypted in MON$ATTACHMENTS table. Also added fb_info_conn_flags item to getInfo() call to return connection flags.
This commit is contained in:
parent
5627033ceb
commit
4e4be00b7d
@ -148,6 +148,7 @@
|
||||
<address-element> ::=
|
||||
isc_dpb_addr_protocol <byte-clumplet-length> <protocol-string> |
|
||||
isc_dpb_addr_endpoint <byte-clumplet-length> <remote-endpoint-string>
|
||||
isc_dpb_addr_flags <byte-clumplet-length> <link-flags_int>
|
||||
|
||||
<protocol-string> ::=
|
||||
"TCPv4" |
|
||||
@ -161,12 +162,20 @@
|
||||
<IPv6-address> | // such as "2001:0:13FF:09FF::1"
|
||||
<xnet-process-id> | // such as "17864"
|
||||
...
|
||||
|
||||
<link-flags_int> ::=
|
||||
bitmask of possible flags of a link
|
||||
*/
|
||||
|
||||
#define isc_dpb_address 1
|
||||
|
||||
#define isc_dpb_addr_protocol 1
|
||||
#define isc_dpb_addr_endpoint 2
|
||||
#define isc_dpb_addr_flags 3
|
||||
|
||||
/* possible addr flags */
|
||||
#define isc_dpb_addr_flag_compress 0x01
|
||||
#define isc_dpb_addr_flag_crypt 0x02
|
||||
|
||||
/*********************************/
|
||||
/* isc_dpb_verify specific flags */
|
||||
|
@ -521,6 +521,8 @@
|
||||
const USHORT f_mon_att_idle_timeout = 20;
|
||||
const USHORT f_mon_att_idle_timer = 21;
|
||||
const USHORT f_mon_att_stmt_timeout = 22;
|
||||
const USHORT f_mon_att_conn_compressed = 23;
|
||||
const USHORT f_mon_att_conn_encrypted = 24;
|
||||
|
||||
|
||||
// Relation 35 (MON$TRANSACTIONS)
|
||||
|
@ -316,6 +316,7 @@ public:
|
||||
Firebird::string att_network_protocol; // Network protocol used by client for connection
|
||||
Firebird::string att_remote_address; // Protocol-specific address of remote client
|
||||
SLONG att_remote_pid; // Process id of remote client
|
||||
ULONG att_remote_flags; // Connection flags
|
||||
Firebird::PathName att_remote_process; // Process name of remote client
|
||||
Firebird::string att_client_version; // Version of the client library
|
||||
Firebird::string att_remote_protocol; // Details about the remote protocol
|
||||
@ -334,6 +335,7 @@ public:
|
||||
ULONG att_ext_call_depth; // external connection call depth, 0 for user attachment
|
||||
TraceManager* att_trace_manager; // Trace API manager
|
||||
|
||||
static const ULONG DPB_REMOTE_PRESENT = 0x80000000; // Special flag in att_remote_flags
|
||||
enum UtilType { UTIL_NONE, UTIL_GBAK, UTIL_GFIX, UTIL_GSTAT };
|
||||
|
||||
UtilType att_utility;
|
||||
|
@ -898,6 +898,14 @@ void Monitoring::putAttachment(SnapshotData::DumpRecord& record, const Jrd::Atta
|
||||
record.storeInteger(f_mon_att_remote_pid, attachment->att_remote_pid);
|
||||
// remote process name
|
||||
record.storeString(f_mon_att_remote_process, attachment->att_remote_process);
|
||||
// remote connection flags
|
||||
if (attachment->att_remote_flags & Attachment::DPB_REMOTE_PRESENT)
|
||||
{
|
||||
record.storeBoolean(f_mon_att_conn_compressed,
|
||||
attachment->att_remote_flags & isc_dpb_addr_flag_compress);
|
||||
record.storeBoolean(f_mon_att_conn_encrypted,
|
||||
attachment->att_remote_flags & isc_dpb_addr_flag_crypt);
|
||||
}
|
||||
// charset
|
||||
record.storeInteger(f_mon_att_charset_id, attachment->att_charset);
|
||||
// timestamp
|
||||
|
@ -769,6 +769,11 @@ void INF_database_info(thread_db* tdbb,
|
||||
dbb->dbb_crypto_manager->getCurrentState() : 0, buffer);
|
||||
break;
|
||||
|
||||
case fb_info_conn_flags:
|
||||
length = INF_convert(tdbb->getAttachment()->att_remote_flags &
|
||||
~Attachment::DPB_REMOTE_PRESENT, buffer);
|
||||
break;
|
||||
|
||||
case fb_info_statement_timeout_db:
|
||||
length = INF_convert(dbb->dbb_config->getStatementTimeout(), buffer);
|
||||
break;
|
||||
|
@ -149,6 +149,8 @@ enum db_info_types
|
||||
fb_info_ses_idle_timeout_att,
|
||||
fb_info_ses_idle_timeout_run,
|
||||
|
||||
fb_info_conn_flags,
|
||||
|
||||
isc_info_db_last_value /* Leave this LAST! */
|
||||
};
|
||||
|
||||
|
@ -949,6 +949,7 @@ public:
|
||||
bool dpb_nolinger;
|
||||
bool dpb_reset_icu;
|
||||
bool dpb_map_attach;
|
||||
ULONG dpb_remote_flags;
|
||||
|
||||
// here begin compound objects
|
||||
// for constructor to work properly dpb_user_name
|
||||
@ -6108,11 +6109,15 @@ void DatabaseOptions::get(const UCHAR* dpb, USHORT dpb_length, bool& invalid_cli
|
||||
case isc_dpb_addr_endpoint:
|
||||
address.getString(dpb_remote_address);
|
||||
break;
|
||||
case isc_dpb_addr_flags:
|
||||
dpb_remote_flags = address.getInt();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
address.moveNext();
|
||||
}
|
||||
dpb_remote_flags |= Attachment::DPB_REMOTE_PRESENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -6388,6 +6393,7 @@ static JAttachment* create_attachment(const PathName& alias_name,
|
||||
attachment->att_network_protocol = options.dpb_network_protocol;
|
||||
attachment->att_remote_address = options.dpb_remote_address;
|
||||
attachment->att_remote_pid = options.dpb_remote_pid;
|
||||
attachment->att_remote_flags = options.dpb_remote_flags;
|
||||
attachment->att_remote_process = options.dpb_remote_process;
|
||||
attachment->att_remote_host = options.dpb_remote_host;
|
||||
attachment->att_remote_os_user = options.dpb_remote_os_user;
|
||||
|
@ -413,3 +413,6 @@ NAME("MON$IDLE_TIMEOUT", nam_idle_timeout)
|
||||
NAME("MON$IDLE_TIMER", nam_idle_timer)
|
||||
NAME("MON$STATEMENT_TIMEOUT", nam_stmt_timeout)
|
||||
NAME("MON$STATEMENT_TIMER", nam_stmt_timer)
|
||||
|
||||
NAME("MON$CONNECTION_COMPRESSED", nam_conn_compressed)
|
||||
NAME("MON$CONNECTION_ENCRYPTED", nam_conn_encrypted)
|
||||
|
@ -520,6 +520,8 @@ RELATION(nam_mon_attachments, rel_mon_attachments, ODS_11_1, rel_virtual)
|
||||
FIELD(f_mon_att_idle_timeout, nam_idle_timeout, fld_idle_timeout, 0, ODS_13_0)
|
||||
FIELD(f_mon_att_idle_timer, nam_idle_timer, fld_idle_timer, 0, ODS_13_0)
|
||||
FIELD(f_mon_att_stmt_timeout, nam_stmt_timeout, fld_stmt_timeout, 0, ODS_13_0)
|
||||
FIELD(f_mon_att_conn_compressed, nam_conn_compressed, fld_bool, 0, ODS_13_0)
|
||||
FIELD(f_mon_att_conn_encrypted, nam_conn_encrypted, fld_bool, 0, ODS_13_0)
|
||||
END_RELATION
|
||||
|
||||
// Relation 35 (MON$TRANSACTIONS)
|
||||
|
@ -2182,6 +2182,23 @@ static void addClumplets(ClumpletWriter* dpb_buffer,
|
||||
if (port->port_address.hasData())
|
||||
address_record.insertString(isc_dpb_addr_endpoint, port->port_address);
|
||||
|
||||
if (port->port_crypt_plugin
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
|| port->port_compressed
|
||||
#endif
|
||||
)
|
||||
{
|
||||
int flags = 0;
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
if (port->port_compressed)
|
||||
flags |= isc_dpb_addr_flag_compress;
|
||||
#endif
|
||||
if (port->port_crypt_plugin)
|
||||
flags |= isc_dpb_addr_flag_crypt;
|
||||
|
||||
address_record.insertInt(isc_dpb_addr_flags, flags);
|
||||
}
|
||||
|
||||
// We always insert remote address descriptor as a first element
|
||||
// of appropriate clumplet so user cannot fake it and engine may somewhat trust it.
|
||||
fb_assert(address_stack_buffer.getCurOffset() == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user