MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / ACLLoadUsersAtStartup

Function ACLLoadUsersAtStartup

src/acl.cpp:1729–1755  ·  view source on GitHub ↗

This function is called once the server is already running, modules are * loaded, and we are ready to start, in order to load the ACLs either from * the pending list of users defined in keydb.conf, or from the ACL file. * The function will just exit with an error if the user is trying to mix * both the loading methods. */

Source from the content-addressed store, hash-verified

1727 * The function will just exit with an error if the user is trying to mix
1728 * both the loading methods. */
1729void ACLLoadUsersAtStartup(void) {
1730 if (g_pserver->acl_filename[0] != '\0' && listLength(UsersToLoad) != 0) {
1731 serverLog(LL_WARNING,
1732 "Configuring KeyDB with users defined in keydb.conf and at "
1733 "the same setting an ACL file path is invalid. This setup "
1734 "is very likely to lead to configuration errors and security "
1735 "holes, please define either an ACL file or declare users "
1736 "directly in your keydb.conf, but not both.");
1737 exit(1);
1738 }
1739
1740 if (ACLLoadConfiguredUsers() == C_ERR) {
1741 serverLog(LL_WARNING,
1742 "Critical error while loading ACLs. Exiting.");
1743 exit(1);
1744 }
1745
1746 if (g_pserver->acl_filename[0] != '\0') {
1747 sds errors = ACLLoadFromFile(g_pserver->acl_filename);
1748 if (errors) {
1749 serverLog(LL_WARNING,
1750 "Aborting KeyDB startup because of ACL errors: %s", errors);
1751 sdsfree(errors);
1752 exit(1);
1753 }
1754 }
1755}
1756
1757/* =============================================================================
1758 * ACL log

Callers 1

mainFunction · 0.85

Calls 4

serverLogFunction · 0.85
ACLLoadConfiguredUsersFunction · 0.85
ACLLoadFromFileFunction · 0.85
sdsfreeFunction · 0.85

Tested by

no test coverage detected