From 9e7e807909c758377e17ebd407173688849eb96f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 15 Sep 2013 23:32:31 -0400 Subject: [PATCH] Sync - Verifies presence of the certificate on sync, instead of blindly assuming it exists. --- src/commands/CmdSync.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/CmdSync.cpp b/src/commands/CmdSync.cpp index 1be4e71a5..fe557142a 100644 --- a/src/commands/CmdSync.cpp +++ b/src/commands/CmdSync.cpp @@ -88,8 +88,8 @@ int CmdSync::execute (std::string& output) if (credentials.size () != 3) throw std::string (STRING_CMD_SYNC_BAD_CRED); - std::string certificate = context.config.get ("taskd.certificate"); - if (certificate == "") + File certificate (context.config.get ("taskd.certificate")); + if (! certificate.exists ()) throw std::string (STRING_CMD_SYNC_BAD_CERT); // If this is a first-time initialization, send pending.data, not @@ -146,7 +146,7 @@ int CmdSync::execute (std::string& output) signal (SIGUSR2, SIG_IGN); Msg response; - if (send (connection, certificate, request, response)) + if (send (connection, certificate._data, request, response)) { std::string code = response.get ("code"); if (code == "200")