Enable const_cast checks

const_cast is an anti pattern.  There are a few places we need to do it
for interacting with C APIs, so enable the checks, and ignore the
existing uses.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If1748213992b97f5e3e04cf9b86a6fcafbb7cf06
diff --git a/include/pam_authenticate.hpp b/include/pam_authenticate.hpp
index 1459ea6..10d9116 100644
--- a/include/pam_authenticate.hpp
+++ b/include/pam_authenticate.hpp
@@ -86,8 +86,11 @@
 {
     std::string userStr(username);
     std::string passStr(password);
-    const struct pam_conv localConversation = {
-        pamFunctionConversation, const_cast<char*>(passStr.c_str())};
+
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
+    char* passStrNoConst = const_cast<char*>(passStr.c_str());
+    const struct pam_conv localConversation = {pamFunctionConversation,
+                                               passStrNoConst};
     pam_handle_t* localAuthHandle = nullptr; // this gets set by pam_start
 
     int retval = pam_start("webserver", userStr.c_str(), &localConversation,
@@ -119,8 +122,10 @@
 inline int pamUpdatePassword(const std::string& username,
                              const std::string& password)
 {
-    const struct pam_conv localConversation = {
-        pamFunctionConversation, const_cast<char*>(password.c_str())};
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
+    char* passStrNoConst = const_cast<char*>(password.c_str());
+    const struct pam_conv localConversation = {pamFunctionConversation,
+                                               passStrNoConst};
     pam_handle_t* localAuthHandle = nullptr; // this gets set by pam_start
 
     int retval = pam_start("webserver", username.c_str(), &localConversation,