Skip to content

Commit

Permalink
tls-openssl: removed dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Jul 31, 2018
1 parent 11d62b7 commit c8cd559
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 67 deletions.
43 changes: 0 additions & 43 deletions core/src/console/console.cc
Expand Up @@ -1072,49 +1072,6 @@ static bool SelectDirector(const char *director, DirectorResource **ret_dir, Con
return 1;
}

/**
* Callback calling director console connection
*/
static int dir_psk_client_callback(char *identity,
unsigned int max_identity_len,
unsigned char *psk,
unsigned int max_psk_len) {

Dmsg0(100, "dir_psk_client_callback");

int result = 0;

if (NULL != dir && NULL != dir->password.value) {
if (p_encoding_clear == dir->password.encoding) {
/* plain password */
} else if (p_encoding_md5 == dir->password.encoding) {
/* md5 string */
/* convert the PSK key to binary */
result = hex2bin(dir->password.value, psk, max_psk_len);
} else {
/* hex password encoding? */
}
} else {
Dmsg0(100, "Passowrd not set in Director Config\n");
result = 0;
}

if (result == 0 || result > (int)max_psk_len) {
Dmsg1(100, "Error, Could not convert PSK key '%s' to binary key\n", dir->password.value);
result = 0;
} else {
static char *psk_identity = (char *)"Nasenbaer";

int ret = Bsnprintf(identity, max_identity_len, "%s", psk_identity);
if (ret < 0 || (unsigned int)ret > max_identity_len) {
Dmsg0(100, "Error, psk_identify too long\n");
result = 0;
}
}

return result;
}

/*
* Main Bareos Console -- User Interface Program
*/
Expand Down
24 changes: 0 additions & 24 deletions core/src/lib/tls_openssl.cc
Expand Up @@ -30,30 +30,6 @@
#include "lib/bpoll.h"
#include <assert.h>

static inline int cval(char c)
{
if (c >= 'a')
return c - 'a' + 0x0a;
if (c >= 'A')
return c - 'A' + 0x0a;
return c - '0';
}

/* return value: number of bytes in out, <=0 if error */
int hex2bin(char *str, unsigned char *out, unsigned int max_out_len)
{
unsigned int i;
for (i = 0; str[i] && str[i + 1] && i < max_out_len * 2; i += 2) {
if (!isxdigit(str[i]) && !isxdigit(str[i + 1])) {
return -1;
}
out[i / 2] = (cval(str[i]) << 4) + cval(str[i + 1]);
}

return i / 2;
}


#if defined(HAVE_TLS) && defined(HAVE_OPENSSL)

#include <openssl/ssl.h>
Expand Down

0 comments on commit c8cd559

Please sign in to comment.