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

Function getUserInfo

src/jrd/jrd.cpp:8626–8719  ·  view source on GitHub ↗

getUserInfo @brief Fills UserId structure with resulting values. Takes into an account mapping of users and groups. @param user @param options @param aliasName @param dbName @param config @param creating @param iAtt @param cryptCb **/

Source from the content-addressed store, hash-verified

8624
8625 **/
8626static void getUserInfo(UserId& user, const DatabaseOptions& options, const char* aliasName,
8627 const RefPtr<const Config>* config, bool creating, Mapping& mapping, bool icuReset)
8628{
8629 bool wheel = false;
8630 int id = -1, group = -1; // CVC: This var contained trash
8631 string name, trusted_role, auth_method;
8632
8633 if (fb_utils::bootBuild())
8634 {
8635 auth_method = "bootBuild";
8636 wheel = true;
8637 }
8638 else
8639 {
8640 auth_method = "User name in DPB";
8641 if (options.dpb_trusted_login.hasData())
8642 {
8643 name = options.dpb_trusted_login;
8644 fb_utils::dpbItemUpper(name);
8645 }
8646 else if (options.dpb_user_name.hasData())
8647 {
8648 name = options.dpb_user_name;
8649 fb_utils::dpbItemUpper(name);
8650 }
8651 else if (options.dpb_auth_block.hasData())
8652 {
8653 mapping.needAuthMethod(auth_method);
8654 mapping.needAuthBlock(user.usr_auth_block);
8655
8656 if (mapping.mapUser(name, trusted_role) & Mapping::MAP_DOWN)
8657 user.setFlag(USR_mapdown);
8658
8659 if (creating && config) // when config is NULL we are in error handler
8660 {
8661 if (!checkCreateDatabaseGrant(name, trusted_role, options.dpb_role_name, (*config)->getSecurityDatabase()))
8662 (Arg::Gds(isc_no_priv) << "CREATE" << "DATABASE" << aliasName).raise();
8663 }
8664 }
8665 else
8666 {
8667 auth_method = "OS user name";
8668 wheel = ISC_get_user(&name, &id, &group);
8669 ISC_systemToUtf8(name);
8670 fb_utils::dpbItemUpper(name);
8671 if (wheel || id == 0)
8672 {
8673 auth_method = "OS user name / wheel";
8674 wheel = true;
8675 }
8676 }
8677
8678 // if the name from the user database is defined as SYSDBA,
8679 // we define that user id as having system privileges
8680
8681 if (name == DBA_USER_NAME)
8682 {
8683 wheel = true;

Callers 3

TraceFailedConnectionMethod · 0.85
internalAttachMethod · 0.85
createDatabaseMethod · 0.85

Calls 15

bootBuildFunction · 0.85
checkCreateDatabaseGrantFunction · 0.85
GdsClass · 0.85
ISC_get_userFunction · 0.85
ISC_systemToUtf8Function · 0.85
raiseFunction · 0.85
NumClass · 0.85
needAuthMethodMethod · 0.80
needAuthBlockMethod · 0.80
mapUserMethod · 0.80
setUserNameMethod · 0.80
setTrustedRoleMethod · 0.80

Tested by

no test coverage detected