diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 6ad86c56fd..a73344639b 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -4033,6 +4033,8 @@ remoteAuthSASL(virConnectPtr conn, struct private_data *priv, virNetClientRemoteAddrString(priv->client), saslcb))) goto cleanup; + /* saslcb is now owned by sasl */ + saslcb = NULL; # ifdef WITH_GNUTLS /* Initialize some connection props we care about */ diff --git a/src/rpc/virnetsaslcontext.c b/src/rpc/virnetsaslcontext.c index 35dc6cfcb9..1baf41e21e 100644 --- a/src/rpc/virnetsaslcontext.c +++ b/src/rpc/virnetsaslcontext.c @@ -44,6 +44,7 @@ struct _virNetSASLSession { sasl_conn_t *conn; size_t maxbufsize; + sasl_callback_t *callbacks; }; @@ -167,7 +168,7 @@ virNetSASLSessionPtr virNetSASLSessionNewClient(virNetSASLContextPtr ctxt ATTRIB const char *hostname, const char *localAddr, const char *remoteAddr, - const sasl_callback_t *cbs) + sasl_callback_t *cbs) { virNetSASLSessionPtr sasl = NULL; int err; @@ -191,6 +192,7 @@ virNetSASLSessionPtr virNetSASLSessionNewClient(virNetSASLContextPtr ctxt ATTRIB err, sasl_errstring(err, NULL, NULL)); goto cleanup; } + sasl->callbacks = cbs; return sasl; @@ -674,5 +676,5 @@ void virNetSASLSessionDispose(void *obj) if (sasl->conn) sasl_dispose(&sasl->conn); - + VIR_FREE(sasl->callbacks); } diff --git a/src/rpc/virnetsaslcontext.h b/src/rpc/virnetsaslcontext.h index e7263022c6..54634d5f12 100644 --- a/src/rpc/virnetsaslcontext.h +++ b/src/rpc/virnetsaslcontext.h @@ -49,7 +49,7 @@ virNetSASLSessionPtr virNetSASLSessionNewClient(virNetSASLContextPtr ctxt, const char *hostname, const char *localAddr, const char *remoteAddr, - const sasl_callback_t *cbs); + sasl_callback_t *cbs); virNetSASLSessionPtr virNetSASLSessionNewServer(virNetSASLContextPtr ctxt, const char *service, const char *localAddr,