From 5250f55c8a467829d9a29767bb84ade7f7d47a02 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 3 Jul 2014 13:33:53 -0700 Subject: [PATCH] scheduler: fix bugs related to changing code signing key Two separate problems: - a well-meaning change to remove compile warnings on 9 July 2013 broke the reading of key files - in the logic to scan old key files, we needed to use strip_whitespace() to remove the \n at end of file. --- lib/crypt.cpp | 3 +-- sched/handle_request.cpp | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/crypt.cpp b/lib/crypt.cpp index d1a0e1b20c..a473f5576d 100644 --- a/lib/crypt.cpp +++ b/lib/crypt.cpp @@ -213,8 +213,7 @@ int scan_key_hex(FILE* f, KEY* key, int size) { key->bits = num_bits; len = size - sizeof(key->bits); for (i=0; idata[i] = n; } fs = fscanf(f, "."); diff --git a/sched/handle_request.cpp b/sched/handle_request.cpp index 37bb55aa39..95e03de90d 100644 --- a/sched/handle_request.cpp +++ b/sched/handle_request.cpp @@ -863,6 +863,7 @@ bool send_code_sign_key(char* code_sign_key) { ); return false; } + strip_whitespace(oldkey); if (!strcmp(oldkey, g_request->code_sign_key)) { // We've found the client's key. // Get the signature for the new key. @@ -883,6 +884,9 @@ bool send_code_sign_key(char* code_sign_key) { free(oldkey); return false; } else { + log_messages.printf(MSG_NORMAL, + "sending new code sign key and signature\n" + ); safe_strcpy(g_reply->code_sign_key, code_sign_key); safe_strcpy(g_reply->code_sign_key_signature, signature); free(signature);