From b8b3839bba75a96acc852d83b02434d921b0e065 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Mon, 17 Jan 2022 11:39:53 +0100 Subject: #915 remove temporary file to store shell output Remove legacy behaviour, store it in the client object instead of a temporary file. --- src/client.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/client.c') diff --git a/src/client.c b/src/client.c index ad4c5d3..9796005 100644 --- a/src/client.c +++ b/src/client.c @@ -135,11 +135,9 @@ static int og_resp_probe(struct og_client *cli, json_t *data) static int og_resp_shell_run(struct og_client *cli, json_t *data) { const char *output = NULL; - char filename[4096]; const char *key; json_t *value; int err = -1; - FILE *file; if (json_typeof(data) != JSON_OBJECT) return -1; @@ -158,16 +156,8 @@ static int og_resp_shell_run(struct og_client *cli, json_t *data) return -1; } - sprintf(filename, "/tmp/_Seconsola_%s", inet_ntoa(cli->addr.sin_addr)); - file = fopen(filename, "wt"); - if (!file) { - syslog(LOG_ERR, "cannot open file %s: %s\n", - filename, strerror(errno)); - return -1; - } - - fprintf(file, "%s", output); - fclose(file); + free((void *)cli->shell_output); + cli->shell_output = strdup(output); return 0; } -- cgit v1.2.3-18-g5258