MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / update_session

Method update_session

src/jrd/trace/TraceManager.cpp:253–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253void TraceManager::update_session(const TraceSession& session)
254{
255 // if this session is already known, nothing to do
256 FB_SIZE_T pos;
257 if (trace_sessions.find(session.ses_id, pos)) {
258 return;
259 }
260
261 // if this session is not from administrator, it may trace connections
262 // only created by the same user, or when it has TRACE_ANY_ATTACHMENT
263 // privilege in current context
264 if (!(session.ses_flags & (trs_admin | trs_system)))
265 {
266 const char* curr_user = nullptr;
267 string s_user = session.ses_user;
268 string t_role;
269 UserId::Privileges priv;
270
271 try
272 {
273 ULONG mapResult = 0;
274
275 if (attachment)
276 {
277 if (attachment->att_flags & ATT_mapping)
278 return;
279
280 if (attachment->att_user)
281 curr_user = attachment->att_user->getUserName().c_str();
282
283 if (session.ses_auth.hasData())
284 {
285 AutoSetRestoreFlag<ULONG> autoRestore(&attachment->att_flags, ATT_mapping, true);
286
287 Database* dbb = attachment->att_database;
288 fb_assert(dbb);
289 Mapping mapping(Mapping::MAP_NO_FLAGS, dbb->dbb_callback);
290 mapping.needSystemPrivileges(priv);
291 mapping.setAuthBlock(session.ses_auth);
292 mapping.setSqlRole(session.ses_role);
293 mapping.setSecurityDbAlias(dbb->dbb_config->getSecurityDatabase(), dbb->dbb_filename.c_str());
294
295 fb_assert(attachment->getInterface());
296 mapping.setDb(attachment->att_filename.c_str(), dbb->dbb_filename.c_str(),
297 attachment->getInterface());
298
299 EngineCheckout guard(attachment, FB_FUNCTION);
300 mapResult = mapping.mapUser(s_user, t_role);
301 }
302 }
303 else if (service)
304 {
305 curr_user = service->getUserName().nullStr();
306
307 if (session.ses_auth.hasData())
308 {
309 PathName dummy;
310 RefPtr<const Config> config;

Callers

nothing calls this directly

Calls 15

expandDatabaseNameFunction · 0.85
iscLogStatusFunction · 0.85
needSystemPrivilegesMethod · 0.80
setAuthBlockMethod · 0.80
setSecurityDbAliasMethod · 0.80
mapUserMethod · 0.80
upperMethod · 0.80
findMethod · 0.45
c_strMethod · 0.45
getUserNameMethod · 0.45
hasDataMethod · 0.45

Tested by

no test coverage detected