- Verifies presence of the certificate on sync, instead of blindly assuming it
  exists.
This commit is contained in:
Paul Beckingham
2013-09-15 23:32:31 -04:00
parent 27f65a821f
commit 9e7e807909

View File

@@ -88,8 +88,8 @@ int CmdSync::execute (std::string& output)
if (credentials.size () != 3) if (credentials.size () != 3)
throw std::string (STRING_CMD_SYNC_BAD_CRED); throw std::string (STRING_CMD_SYNC_BAD_CRED);
std::string certificate = context.config.get ("taskd.certificate"); File certificate (context.config.get ("taskd.certificate"));
if (certificate == "") if (! certificate.exists ())
throw std::string (STRING_CMD_SYNC_BAD_CERT); throw std::string (STRING_CMD_SYNC_BAD_CERT);
// If this is a first-time initialization, send pending.data, not // 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); signal (SIGUSR2, SIG_IGN);
Msg response; Msg response;
if (send (connection, certificate, request, response)) if (send (connection, certificate._data, request, response))
{ {
std::string code = response.get ("code"); std::string code = response.get ("code");
if (code == "200") if (code == "200")