mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Fix crash when no auth callback
This commit is contained in:
parent
4c50142381
commit
b2083ea907
@ -1,3 +1,8 @@
|
|||||||
|
Sun Jan 13 22:53:53 EST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* src/remote_internal.c: Fix crash when server has auth type
|
||||||
|
enabled but client has no auth callback
|
||||||
|
|
||||||
Thu Jan 10 14:40:53 GMT 2008 Mark McLoughlin <markmc@redhat.com>
|
Thu Jan 10 14:40:53 GMT 2008 Mark McLoughlin <markmc@redhat.com>
|
||||||
|
|
||||||
* src/iptables.c: fix an unused variable warning.
|
* src/iptables.c: fix an unused variable warning.
|
||||||
|
@ -3047,8 +3047,12 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
if ((remoteAddr = addrToString(&sa, salen)) == NULL)
|
if ((remoteAddr = addrToString(&sa, salen)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((saslcb = remoteAuthMakeCallbacks(auth->credtype, auth->ncredtype)) == NULL)
|
if (auth) {
|
||||||
goto cleanup;
|
if ((saslcb = remoteAuthMakeCallbacks(auth->credtype, auth->ncredtype)) == NULL)
|
||||||
|
goto cleanup;
|
||||||
|
} else {
|
||||||
|
saslcb = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Setup a handle for being a client */
|
/* Setup a handle for being a client */
|
||||||
err = sasl_client_new("libvirt",
|
err = sasl_client_new("libvirt",
|
||||||
@ -3161,15 +3165,21 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
/* Run the authentication callback */
|
/* Run the authentication callback */
|
||||||
if ((*(auth->cb))(cred, ncred, auth->cbdata) < 0) {
|
if (auth && auth->cb) {
|
||||||
|
if ((*(auth->cb))(cred, ncred, auth->cbdata) < 0) {
|
||||||
|
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||||
|
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||||
|
"Failed to collect auth credentials");
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
remoteAuthFillInteract(cred, interact);
|
||||||
|
goto restart;
|
||||||
|
} else {
|
||||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||||
"Failed to collect auth credentials");
|
"No authentication callback available");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
remoteAuthFillInteract(cred, interact);
|
|
||||||
goto restart;
|
|
||||||
}
|
}
|
||||||
free(iret.mechlist);
|
free(iret.mechlist);
|
||||||
|
|
||||||
@ -3233,15 +3243,22 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Run the authentication callback */
|
/* Run the authentication callback */
|
||||||
if ((*(auth->cb))(cred, ncred, auth->cbdata) < 0) {
|
if (auth && auth->cb) {
|
||||||
|
if ((*(auth->cb))(cred, ncred, auth->cbdata) < 0) {
|
||||||
|
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||||
|
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||||
|
"Failed to collect auth credentials");
|
||||||
|
goto cleanup;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
remoteAuthFillInteract(cred, interact);
|
||||||
|
goto restep;
|
||||||
|
} else {
|
||||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||||
"Failed to collect auth credentials");
|
"No authentication callback available");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
remoteAuthFillInteract(cred, interact);
|
|
||||||
goto restep;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serverin) {
|
if (serverin) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user