[libvirt] [PATCH v4 04/13] _virConnectCredential: turn @prompt into char *

Michal Privoznik mprivozn at redhat.com
Mon May 20 17:55:30 UTC 2013


Currently, @prompt member within _virConnectCredential struct is const
char. This violates const correctness as we are not just strdup()-ing
the value, we are even changing it (e.g. in virNetSSHKbIntCb()).
---
 include/libvirt/libvirt.h.in | 2 +-
 src/remote/remote_driver.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 1804c93..1bd3d1a 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1294,7 +1294,7 @@ typedef enum {
 
 struct _virConnectCredential {
     int type; /* One of virConnectCredentialType constants */
-    const char *prompt; /* Prompt to show to user */
+    char *prompt; /* Prompt to show to user */
     const char *challenge; /* Additional challenge to show */
     const char *defresult; /* Optional default result */
     char *result; /* Result to be filled with user response (or defresult) */
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 13212d0..97be2a0 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -3733,7 +3733,7 @@ static int remoteAuthMakeCredentials(sasl_interact_t *interact,
         }
         if (interact[*ncred].challenge)
             (*cred)[*ncred].challenge = interact[ninteract].challenge;
-        (*cred)[*ncred].prompt = interact[ninteract].prompt;
+        (*cred)[*ncred].prompt = (char *) interact[ninteract].prompt;
         if (interact[*ncred].defresult)
             (*cred)[*ncred].defresult = interact[ninteract].defresult;
         (*cred)[*ncred].result = NULL;
-- 
1.8.2.1




More information about the libvir-list mailing list