mirror of https://git.48k.eu/ogserver
core: log payload if sequences do not match
We need to inspect the received payload if any error is raised related
to the X-Sequence header. Not just when a malformed X-Sequence header is
detected.
Fixes: d2c19ef13d ("core: add X-Sequence header support")
master
parent
d2c19ef13d
commit
3de8c25e4e
|
|
@ -180,13 +180,15 @@ static int og_agent_state_recv_hdr_rest(struct og_client *cli)
|
||||||
ptr = strstr(cli->buf, "X-Sequence: ");
|
ptr = strstr(cli->buf, "X-Sequence: ");
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
if (sscanf(ptr, "X-Sequence: %i[^\r\n]", &seq) != 1) {
|
if (sscanf(ptr, "X-Sequence: %i[^\r\n]", &seq) != 1) {
|
||||||
syslog(LOG_ERR, "Invalid sequence value from client %s. Payload:\n%s",
|
syslog(LOG_ERR, "Invalid sequence value from client %s.\n"
|
||||||
|
"Payload:\n%s",
|
||||||
inet_ntoa(cli->addr.sin_addr), cli->buf);
|
inet_ntoa(cli->addr.sin_addr), cli->buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (cli->seq != 0 && cli->seq != seq) {
|
if (cli->seq != 0 && cli->seq != seq) {
|
||||||
syslog(LOG_ERR, "Unexpected sequence %u from client %s, expecting %u.",
|
syslog(LOG_ERR, "Unexpected sequence %u from client %s, expecting %u.\n"
|
||||||
seq, inet_ntoa(cli->addr.sin_addr), cli->seq);
|
"Payload:\n%s",
|
||||||
|
seq, inet_ntoa(cli->addr.sin_addr), cli->seq, cli->buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue