[PATCH v2 26/27] virnetlibsshsession: Replace VIR_DISPOSE_STRING with virSecureEraseString

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/rpc/virnetlibsshsession.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c
index 73f5e998fc..76934c7c0b 100644
--- a/src/rpc/virnetlibsshsession.c
+++ b/src/rpc/virnetlibsshsession.c
@@ -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,
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux