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

Function log_header

plugin/server_audit/server_audit.cc:1187–1223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1185
1186
1187static size_t log_header(char *message, size_t message_len,
1188 const char *serverhost, size_t serverhost_len,
1189 const char *username, unsigned int username_len,
1190 const char *host, unsigned int host_len,
1191 const char *userip, unsigned int userip_len,
1192 unsigned int connection_id, unsigned int port,
1193 long long query_id, const char *operation)
1194{
1195 char port_str[16];
1196 if (host_len == 0 && userip_len != 0)
1197 {
1198 host_len= userip_len;
1199 host= userip;
1200 }
1201 if (port == 0) {
1202 port_str[0] = '\0';
1203 } else {
1204 my_snprintf(port_str, sizeof(port_str), ":%u", port);
1205 }
1206
1207 /*
1208 That was added to find the possible cause of the MENT-1438.
1209 Supposed to be removed after that.
1210 */
1211 if (username_len > MAX_AUDIT_PAYLOAD_LENGTH)
1212 {
1213 username= "unknown_user";
1214 username_len= (unsigned int) strlen(username);
1215 }
1216
1217 return my_snprintf(message, message_len,
1218 "%.*s,%.*s,%.*s%s,%d,%lld,%s",
1219 (int) serverhost_len, serverhost,
1220 username_len, username,
1221 host_len, host, port_str,
1222 connection_id, query_id, operation);
1223}
1224
1225static size_t create_tls_obj(const struct mysql_event_connection *ev, char *obj_str, size_t len) {
1226 size_t obj_len;

Callers 6

log_proxyFunction · 0.85
log_connectionFunction · 0.85
log_connection_eventFunction · 0.85
log_statement_exFunction · 0.85
log_tableFunction · 0.85
log_renameFunction · 0.85

Calls 1

my_snprintfFunction · 0.85

Tested by

no test coverage detected