From e33374f3796e7641815a7313345cadf5b7170a4c Mon Sep 17 00:00:00 2001 From: Frank Ueberschar Date: Sun, 16 Dec 2018 14:54:25 +0100 Subject: [PATCH] stored: store the session key before sending it to the director --- core/src/dird/socket_server.cc | 2 -- core/src/filed/socket_server.cc | 2 -- core/src/stored/job.cc | 8 ++++---- core/src/stored/socket_server.cc | 2 -- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/core/src/dird/socket_server.cc b/core/src/dird/socket_server.cc index fdc4d42b25f..e5290df2460 100644 --- a/core/src/dird/socket_server.cc +++ b/core/src/dird/socket_server.cc @@ -77,8 +77,6 @@ static void *HandleConnectionRequest(ConfigurationParser *config, void *arg) jcr.ua = bs; - Bmicrosleep(0,250000); - if (!TryTlsHandshakeAsAServer(bs, config)) { bs->signal(BNET_TERMINATE); bs->close(); diff --git a/core/src/filed/socket_server.cc b/core/src/filed/socket_server.cc index 89b8eef233b..9675331a22c 100644 --- a/core/src/filed/socket_server.cc +++ b/core/src/filed/socket_server.cc @@ -59,8 +59,6 @@ static void *HandleConnectionRequest(ConfigurationParser *config, void *arg) { BareosSocket *bs = (BareosSocket *)arg; - Bmicrosleep(0,250000); - if (!TryTlsHandshakeAsAServer(bs, config)) { bs->signal(BNET_TERMINATE); bs->close(); diff --git a/core/src/stored/job.cc b/core/src/stored/job.cc index 12767f1ccad..34e48cfc662 100644 --- a/core/src/stored/job.cc +++ b/core/src/stored/job.cc @@ -163,10 +163,10 @@ bool job_cmd(JobControlRecord *jcr) */ Bsnprintf(seed, sizeof(seed), "%p%d", jcr, JobId); MakeSessionKey(auth_key, seed, 1); - dir->fsend(OK_job, jcr->VolSessionId, jcr->VolSessionTime, auth_key); - Dmsg2(50, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg); jcr->sd_auth_key = bstrdup(auth_key); + dir->fsend(OK_job, jcr->VolSessionId, jcr->VolSessionTime, auth_key); memset(auth_key, 0, sizeof(auth_key)); + Dmsg2(50, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg); DispatchNewPluginOptions(jcr); GeneratePluginEvent(jcr, bsdEventJobStart, (void *)"JobStart"); @@ -275,13 +275,13 @@ bool nextRunCmd(JobControlRecord *jcr) */ Bsnprintf(seed, sizeof(seed), "%p%d", jcr, jcr->JobId); MakeSessionKey(auth_key, seed, 1); - dir->fsend(OK_nextrun, auth_key); - Dmsg2(50, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg); if (jcr->sd_auth_key) { free(jcr->sd_auth_key); } jcr->sd_auth_key = bstrdup(auth_key); + dir->fsend(OK_nextrun, auth_key); memset(auth_key, 0, sizeof(auth_key)); + Dmsg2(50, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg); jcr->sendJobStatus(JS_WaitFD); /* wait for FD to connect */ diff --git a/core/src/stored/socket_server.cc b/core/src/stored/socket_server.cc index c17316b592c..084f88a973b 100644 --- a/core/src/stored/socket_server.cc +++ b/core/src/stored/socket_server.cc @@ -67,8 +67,6 @@ void *HandleConnectionRequest(ConfigurationParser *config, void *arg) char name[MAX_NAME_LENGTH]; char tbuf[MAX_TIME_LENGTH]; - Bmicrosleep(0,250000); - if (!TryTlsHandshakeAsAServer(bs, config)) { bs->signal(BNET_TERMINATE); bs->close();