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

Function log_connection

plugin/server_audit/server_audit.cc:1264–1289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1262
1263
1264static int log_connection(const struct connection_info *cn,
1265 const struct mysql_event_connection *event,
1266 const char *type)
1267{
1268 time_t ctime;
1269 size_t csize;
1270 char raw_message[MAX_AUDIT_PAYLOAD_LENGTH + TIMESTAMP_OUTPUT_LENGTH];
1271 char *message= raw_message + TIMESTAMP_OUTPUT_LENGTH;
1272 char tls_obj[32];
1273 size_t obj_len;
1274
1275 (void) time(&ctime);
1276 csize= log_header(message, MAX_AUDIT_PAYLOAD_LENGTH - 1,
1277 servhost, servhost_len,
1278 cn->user, cn->user_length,
1279 cn->host, cn->host_length,
1280 cn->ip, cn->ip_length,
1281 event->thread_id, event->port, 0, type);
1282
1283 obj_len= create_tls_obj(event, tls_obj, sizeof(tls_obj));
1284 csize+= my_snprintf(message+csize, MAX_AUDIT_PAYLOAD_LENGTH - 1 - csize,
1285 ",%.*s,%.*s,%d", cn->db_length, cn->db, (int) obj_len, tls_obj,
1286 event->status);
1287 message[csize]= '\n';
1288 return write_log_and_lock(message, csize + 1, ctime);
1289}
1290
1291
1292static int log_connection_event(const struct mysql_event_connection *event,

Callers 1

auditingFunction · 0.85

Calls 4

log_headerFunction · 0.85
create_tls_objFunction · 0.85
my_snprintfFunction · 0.85
write_log_and_lockFunction · 0.85

Tested by

no test coverage detected