]> granicus.if.org Git - icinga2/commitdiff
Delete ticket file once we have a signed certificate
authorGunnar Beutner <gunnar.beutner@icinga.com>
Wed, 30 Aug 2017 13:11:54 +0000 (15:11 +0200)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 12 Sep 2017 10:52:49 +0000 (12:52 +0200)
refs #5450

lib/remote/jsonrpcconnection-pki.cpp

index 449b07f8adddefcfdcb2e01cac77c3601a4277b7..64cf1c024953c08a8f9c014a3ddb8e1a0e09f6e9 100644 (file)
@@ -229,6 +229,15 @@ void JsonRpcConnection::CertificateRequestResponseHandler(const Dictionary::Ptr&
                    << boost::errinfo_file_name(tempCertPath));
        }
 
+       String ticketPath = Application::GetLocalStateDir() + "/lib/icinga2/pki/ticket";
+
+       if (unlink(ticketPath.CStr()) < 0 && errno != ENOENT) {
+               BOOST_THROW_EXCEPTION(posix_error()
+                   << boost::errinfo_api_function("unlink")
+                   << boost::errinfo_errno(errno)
+                   << boost::errinfo_file_name(ticketPath));
+       }
+
        Log(LogInformation, "JsonRpcConnection", "Updating the client certificate for the ApiListener object");
        listener->UpdateSSLContext();
 }