MCPcopy Create free account
hub / github.com/MariaDB/server / server_audit_init

Function server_audit_init

plugin/server_audit/server_audit.cc:2118–2193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2116static int init_done= 0;
2117
2118static int server_audit_init(void*)
2119{
2120 thd_priv_host_ptr= reinterpret_cast<decltype(thd_priv_host_ptr)>
2121 (dlsym(RTLD_DEFAULT, "thd_priv_host"));
2122
2123 if (gethostname(servhost, sizeof(servhost)))
2124 strcpy(servhost, "unknown");
2125
2126 servhost_len= (uint)strlen(servhost);
2127
2128 logger_init_mutexes();
2129 lock_operations.init();
2130
2131 coll_init(&incl_user_coll);
2132 coll_init(&excl_user_coll);
2133
2134 if (incl_users)
2135 {
2136 if (excl_users)
2137 {
2138 incl_users= excl_users= NULL;
2139 error_header();
2140 fprintf(stderr, "INCL_DML_USERS and EXCL_DML_USERS specified"
2141 " simultaneously - both set to empty\n");
2142 }
2143 update_incl_users(NULL, NULL, NULL, &incl_users);
2144 }
2145 else if (excl_users)
2146 {
2147 update_excl_users(NULL, NULL, NULL, &excl_users);
2148 }
2149 if (timestamp_format && timestamp_format[0])
2150 {
2151 update_timestamp_format(NULL, NULL, NULL, &timestamp_format);
2152 }
2153
2154
2155 error_header();
2156 fprintf(stderr, "MariaDB Audit Plugin version %s%s STARTED.\n",
2157 PLUGIN_STR_VERSION, PLUGIN_DEBUG_VERSION);
2158
2159 /* The Query Cache shadows TABLE events if the result is taken from it */
2160 /* so we warn users if both Query Caсhe and TABLE events enabled. */
2161 if (FILTER(EVENT_TABLE))
2162 {
2163 ulonglong *qc_size= (ulonglong *) dlsym(RTLD_DEFAULT, "query_cache_size");
2164 if (qc_size == NULL || *qc_size != 0)
2165 {
2166 struct loc_system_variables *g_sys_var=
2167 (struct loc_system_variables *) dlsym(RTLD_DEFAULT,
2168 "global_system_variables");
2169 if (g_sys_var && g_sys_var->query_cache_type != 0)
2170 {
2171 error_header();
2172 fprintf(stderr, "Query cache is enabled with the TABLE events."
2173 " Some table reads can be veiled.");
2174 }
2175 }

Callers

nothing calls this directly

Calls 9

logger_init_mutexesFunction · 0.85
coll_initFunction · 0.85
error_headerFunction · 0.85
update_incl_usersFunction · 0.85
update_excl_usersFunction · 0.85
update_timestamp_formatFunction · 0.85
FILTERClass · 0.85
start_loggingFunction · 0.85
initMethod · 0.45

Tested by

no test coverage detected