minor ssl logging changes and buffer fix

This commit is contained in:
2019-01-03 22:35:23 +02:00
parent 9cd8cc2c90
commit 0382ead79b
3 changed files with 6 additions and 8 deletions

View File

@@ -150,7 +150,7 @@ void* get_uptime(void *args)
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t)); SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
} else { } else {
memcpy(&job->buf.chunk.data, &sys.uptime, sizeof(long)); memcpy(&job->buf.chunk.data, &sys.uptime, sizeof(long));
//sprintf((char*)&job->buf.chunk.data, "%ld", sys.uptime); sprintf((char*)&job->buf.chunk.data, "%ld", sys.uptime);
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t)); SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
} }
job->slot = FREE; job->slot = FREE;

View File

@@ -63,7 +63,7 @@ static void show_certs(SSL *ssl)
static void *servlet(void *args) /* Serve the connection -- threadable */ static void *servlet(void *args) /* Serve the connection -- threadable */
{ {
struct msg_t buf; struct msg_t buf = {0};
int bytes, ret; int bytes, ret;
//unsigned short job[MAXJOBS] = { 0 }; //unsigned short job[MAXJOBS] = { 0 };
struct agent_args *agent = (struct agent_args *)args; struct agent_args *agent = (struct agent_args *)args;
@@ -77,7 +77,7 @@ static void *servlet(void *args) /* Serve the connection -- threadable */
} else { } else {
show_certs(agent->ssl); show_certs(agent->ssl);
do { do {
buf.meta.type = GET_MEMORY; buf.meta.type = GET_OS;
sleep(1); sleep(1);
SSL_write(agent->ssl, &buf, sizeof(buf)); SSL_write(agent->ssl, &buf, sizeof(buf));
bytes = SSL_read(agent->ssl, &buf, sizeof(buf)); bytes = SSL_read(agent->ssl, &buf, sizeof(buf));
@@ -96,12 +96,10 @@ static void *servlet(void *args) /* Serve the connection -- threadable */
} }
if (SSL_get_shutdown(agent->ssl) if (SSL_get_shutdown(agent->ssl)
== SSL_RECEIVED_SHUTDOWN) == SSL_RECEIVED_SHUTDOWN)
log(VERBOSE, log(VERBOSE, "SSL_RECEIVED_SHUTDOWN from agent [%s]",
"SSL_RECEIVED_SHUTDOWN from agent [%s]",
agent->ip); agent->ip);
else { else {
log(VERBOSE, log(VERBOSE, "Client didn't send data!");
"Client didn't send data! SSL error below:");
/* I think logging is NOT needed here */ /* I think logging is NOT needed here */
//log_ssl(); //log_ssl();
sprintf((char *)buf.chunk.data, "%s", sprintf((char *)buf.chunk.data, "%s",

View File

@@ -79,7 +79,7 @@ static void *servlet(void *args) /* Serve the connection -- threadable */
if (SSL_get_shutdown(client->ssl) == SSL_RECEIVED_SHUTDOWN) if (SSL_get_shutdown(client->ssl) == SSL_RECEIVED_SHUTDOWN)
log(VERBOSE, "SSL_RECEIVED_SHUTDOWN from client [%s]", client->ip); log(VERBOSE, "SSL_RECEIVED_SHUTDOWN from client [%s]", client->ip);
else { else {
log(VERBOSE, "Client didn't send data! SSL error below:"); log(VERBOSE, "Client didn't send data!");
//log_ssl(); /* We actually don't have anything to log from SSL */ //log_ssl(); /* We actually don't have anything to log from SSL */
sprintf((char *)buf.chunk.data, "%s", "Where's the data, m8?"); sprintf((char *)buf.chunk.data, "%s", "Where's the data, m8?");
SSL_write(client->ssl, &buf, sizeof(struct msg_t)); SSL_write(client->ssl, &buf, sizeof(struct msg_t));