]> xenbits.xensource.com Git - libvirt.git/commitdiff
virnetsshsession: Adapt to changed libssh2 API
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 5 Jun 2023 12:24:48 +0000 (14:24 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 5 Jun 2023 14:06:46 +0000 (16:06 +0200)
In one of its commits [1] libssh2 changed the 'text' member of
LIBSSH2_USERAUTH_KBDINT_PROMPT struct from 'char' to 'unsigned
char'. But we g_strdup() the member in order to fill 'prompt'
member of virConnectCredential struct. Typecast the value to
avoid warnings. Also, drop @prompt variable, as it's needless.

1: https://github.com/libssh2/libssh2/commit/83853f8aea0e2f739cacd491632eb7fd3d03ad2d
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/rpc/virnetsshsession.c

index f84805825b34ec6e37ff0e6891dcb2972bdcc97f..1df43bb0448817dd6c05dd811da7c8b7eb59e885 100644 (file)
@@ -216,9 +216,7 @@ virNetSSHKbIntCb(const char *name G_GNUC_UNUSED,
 
     /* fill data structures for auth callback */
     for (i = 0; i < num_prompts; i++) {
-        char *prompt;
-        prompt = g_strdup(prompts[i].text);
-        askcred[i].prompt = prompt;
+        askcred[i].prompt = g_strdup((char*)prompts[i].text);
 
         /* remove colon and trailing spaces from prompts, as default behavior
          * of libvirt's auth callback is to add them */