]> xenbits.xensource.com Git - libvirt.git/commitdiff
virnetlibsshsession: Replace VIR_DISPOSE_STRING with virSecureEraseString
authorPeter Krempa <pkrempa@redhat.com>
Tue, 2 Feb 2021 16:22:02 +0000 (17:22 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Feb 2021 12:07:14 +0000 (13:07 +0100)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/rpc/virnetlibsshsession.c

index 73f5e998fcd0742860120d3c1b95ac840eae93e9..76934c7c0b2fa1abe99cd3af3dbfe00f48ca6475 100644 (file)
@@ -114,7 +114,8 @@ virNetLibsshSessionAuthMethodsFree(virNetLibsshSessionPtr sess)
     size_t i;
 
     for (i = 0; i < sess->nauths; i++) {
-        VIR_DISPOSE_STRING(sess->auths[i]->password);
+        virSecureEraseString(sess->auths[i]->password);
+        g_free(sess->auths[i]->password);
         VIR_FREE(sess->auths[i]->filename);
         VIR_FREE(sess->auths[i]);
     }
@@ -445,7 +446,8 @@ virNetLibsshAuthenticatePrivkeyCb(const char *prompt,
 
     p = virStrncpy(buf, retr_passphrase.result,
                    retr_passphrase.resultlen, len);
-    VIR_DISPOSE_STRING(retr_passphrase.result);
+    virSecureEraseString(retr_passphrase.result);
+    g_free(retr_passphrase.result);
     if (p < 0) {
         virReportError(VIR_ERR_LIBSSH, "%s",
                        _("passphrase is too long for the buffer"));
@@ -739,7 +741,8 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSessionPtr sess,
 
             ret = ssh_userauth_kbdint_setanswer(sess->session, iprompt,
                                                 retr_passphrase.result);
-            VIR_DISPOSE_STRING(retr_passphrase.result);
+            virSecureEraseString(retr_passphrase.result);
+            g_free(retr_passphrase.result);
             if (ret < 0) {
                 errmsg = ssh_get_error(sess->session);
                 virReportError(VIR_ERR_AUTH_FAILED,