+Sat Dec 15 12:12:14 EST 2007 Daniel P. Berrange <berrange@redhat.com>
+
+ * src/libvirt.c: Return error code if passed unsupported
+ credential types.
+ * src/remote_internal.c: Don't run callback if it doesn't
+ support the VIR_CRED_EXTERNAL credential type
+
Fri Dec 14 16:50:14 CET 2007 Daniel Veillard <veillard@redhat.com>
* src/xm_internal.c: patch from Saori Fukuta to fix setting
virConnectAuthPtr auth)
{
remote_auth_polkit_ret ret;
+ int i, allowcb = 0;
virConnectCredential cred = {
VIR_CRED_EXTERNAL,
conn->flags & VIR_CONNECT_RO ? "org.libvirt.unix.monitor" : "org.libvirt.unix.manage",
};
remoteDebug(priv, "Client initialize PolicyKit authentication");
+ for (i = 0 ; i < auth->ncredtype ; i++) {
+ if (auth->credtype[i] == VIR_CRED_EXTERNAL)
+ allowcb = 1;
+ }
+
/* Run the authentication callback */
- if (auth && auth->cb && (*(auth->cb))(&cred, 1, 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");
- return -1;
+ if (allowcb) {
+ if (auth && auth->cb &&
+ (*(auth->cb))(&cred, 1, 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");
+ return -1;
+ } else {
+ remoteDebug(priv, "No auth callback provided for PolicyKit");
+ }
+ } else {
+ remoteDebug(priv, "Client auth callback does not support PolicyKit");
}
memset (&ret, 0, sizeof ret);