Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/rpc/virnetclient.c | 4 ++--
src/rpc/virnetlibsshsession.c | 7 ++-----
src/rpc/virnetsocket.c | 2 +-
src/rpc/virnetsshsession.c | 2 +-
4 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 1c5bef86a1..441f1502a6 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -428,7 +428,7 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host,
{
virNetSocketPtr sock = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *nc = NULL;
g_autofree char *command = NULL;
@@ -518,7 +518,7 @@ virNetClientPtr virNetClientNewLibssh(const char *host,
{
virNetSocketPtr sock = NULL;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *nc = NULL;
g_autofree char *command = NULL;
diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c
index 0a566eaa54..c9b31e9462 100644
--- a/src/rpc/virnetlibsshsession.c
+++ b/src/rpc/virnetlibsshsession.c
@@ -664,7 +664,7 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSessionPtr
sess,
while (ret == SSH_AUTH_INFO) {
const char *name, *instruction;
int nprompts, iprompt;
- virBuffer buff = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buff = VIR_BUFFER_INITIALIZER;
name = ssh_userauth_kbdint_getname(sess->session);
instruction = ssh_userauth_kbdint_getinstruction(sess->session);
@@ -706,7 +706,7 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSessionPtr
sess,
* buffer if specified
*/
if (virBufferUse(&buff) > 0) {
- virBuffer prompt_buff = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) prompt_buff = VIR_BUFFER_INITIALIZER;
virBufferAddBuffer(&prompt_buff, &buff);
virBufferAdd(&prompt_buff, promptStr, promptStrLen);
@@ -750,12 +750,9 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSessionPtr
sess,
prompt_error:
VIR_FREE(prompt);
- virBufferFreeAndReset(&buff);
return SSH_AUTH_ERROR;
}
- virBufferFreeAndReset(&buff);
-
ret = ssh_userauth_kbdint(sess->session, NULL, NULL);
++try;
if (ret == SSH_AUTH_DENIED && (priv->tries < 0 || try <
priv->tries))
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 3ea863f625..d1f4c531aa 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -849,7 +849,7 @@ int virNetSocketNewConnectSSH(const char *nodename,
{
char *quoted;
virCommandPtr cmd;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
*retsock = NULL;
diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c
index b4dea15452..490e9d5c5d 100644
--- a/src/rpc/virnetsshsession.c
+++ b/src/rpc/virnetsshsession.c
@@ -287,7 +287,7 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess)
int keyType;
size_t keyLength;
char *errmsg;
- virBuffer buff = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buff = VIR_BUFFER_INITIALIZER;
virConnectCredential askKey;
struct libssh2_knownhost *knownHostEntry = NULL;
size_t i;
--
2.25.4