Commit Graph

10 Commits (385f1ca5742d973a9d6f17c57dcdd1ec25245e65)

Author SHA1 Message Date
nirenjan 385f1ca574 Fix typo in logging error handler 2021-11-22 10:06:23 -08:00
nirenjan f6c6db6c61 Add command processing for logging configuration
This change adds the `logging show` and `logging set` commands to the
command processor module. This allows setting the log levels of the
individual modules via the socket.
2021-11-10 21:49:54 -08:00
nirenjan 2119e00647 Integrate pinelog module logging functionality 2021-11-10 09:29:27 -08:00
nirenjan 7448334824 Add `config apply` command 2021-11-07 16:06:49 -08:00
nirenjan f2b0110380 Allow upto 1024 arguments
Prior to this change, it was possible for a malicious client to send a
buffer of 1024 NUL bytes, which would cause the parser to overflow the
argv array and eventually crash the program.

This change makes the length of the argv array the same as the length of
the recv buffer, which means that even an input of all 0 bytes would not
cause any issues. The client would just get a bunch of ERR responses in
return.
2021-11-07 15:07:10 -08:00
nirenjan e82f9032eb Add 'config get' command to retrieve configuration
The command allows the client to retrieve individual parameters from the
configuration. This follows a similar syntax to the 'config set'
command, with the client supplying the section and key, and if there is
a matching entry in the configuration, it will return the corresponding
value.
2021-11-07 07:52:11 -08:00
nirenjan 2fe7b8af43 Cleanup response protocol
This change removes the unnecessary response length field from the
output buffer. It was added to check for possible issues in the
communication between client and server, but is not needed anymore. This
also makes the communication protocol standardized between client and
server.
2021-11-07 05:47:31 -08:00
nirenjan 116b9e2c0c Add config set command to daemon command processor
This change allows setting the configuration from the socket. It behaves
similar to the override, and requires the client to send the section,
key and value, and responds with an OK or error value.
2021-11-05 15:27:24 -07:00
nirenjan 7b8c71dd35 Add command parsing and response logic
This change adds the generic command parsing logic, as well as the
response for the following commands:

* config load <file>
* config reload
* config save
* config dump <file>
2021-11-05 15:10:20 -07:00
nirenjan d8a5a2c3b8 Add daemon command handler loop
This change adds the logic to read a packet from the socket, accept
connections from clients, and close connections from clients that have
hung up. This commit does not yet have support for parsing and handling
the commands, and simply echoes the request back to the client.
2021-11-04 18:32:18 -07:00