Navigation Menu

Skip to content

Commit

Permalink
dird: add extra 6-character truncation to anticipate psk identity prefix
Browse files Browse the repository at this point in the history
When creating a Job name, we do a truncation to add a suffix and
make sure the string does not pass the 128 character limit.
Later, during TLS-PSK authentication process, a prefix `R_JOB^` is
added to the job name to create the identification key, and another 
truncation needs to happen in order to comply with OpenSSL1.1's 
128 character limit for identity.
This second truncation eats the last part of the Jobname containing
our custom suffix, and thus creates problems.
This issue does not show up with OpenSSL3, as the identity limit was
changed to 256 characters.

This commit then anticipates the extra 6 characters needed for the 
"R_JOB^" prefix added in the psk identity string.
  • Loading branch information
alaaeddineelamri committed Jul 13, 2022
1 parent b4ed359 commit f474fe9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/dird/job.cc
Expand Up @@ -1475,6 +1475,10 @@ void CreateUniqueJobName(JobControlRecord* jcr, const char* base_name)
bstrftime(dt, sizeof(dt), jcr->start_time, "%Y-%m-%d_%H.%M.%S");

len = strlen(dt) + 5; /* dt + .%02d EOS */

const int R_JOB_prefix_length_psk_identity = 6;
len += R_JOB_prefix_length_psk_identity; // Anticipating "R_JOB^" prefix
// addition for psk identity
bstrncpy(name, base_name, sizeof(name));
name[sizeof(name) - len] = 0; /* truncate if too long */
Bsnprintf(jcr->Job, sizeof(jcr->Job), "%s.%s_%02d", name, dt,
Expand Down

0 comments on commit f474fe9

Please sign in to comment.