提交 76122538 编写于 作者: D Daniel P. Berrange

Fix crash when no auth callback is provided

上级 935490d9
Wed Jan 2 17:45:53 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/remote_internal.c: fix policykit auth handling of NULL
callbacks to not crash
Wed Dec 26 06:38:53 CET 2007 Daniel Veillard <veillard@redhat.com> Wed Dec 26 06:38:53 CET 2007 Daniel Veillard <veillard@redhat.com>
* src/openvz.c: patch from Mikhail Pokidko to fix the OpenVZ * src/openvz.c: patch from Mikhail Pokidko to fix the OpenVZ
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* remote_internal.c: driver to provide access to libvirtd running * remote_internal.c: driver to provide access to libvirtd running
* on a remote machine * on a remote machine
* *
* Copyright (C) 2007 Red Hat, Inc. * Copyright (C) 2007-2008 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -3347,24 +3347,26 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open, ...@@ -3347,24 +3347,26 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
}; };
remoteDebug(priv, "Client initialize PolicyKit authentication"); remoteDebug(priv, "Client initialize PolicyKit authentication");
for (i = 0 ; i < auth->ncredtype ; i++) { if (auth && auth->cb) {
if (auth->credtype[i] == VIR_CRED_EXTERNAL) /* Check if the neccessary credential type for PolicyKit is supported */
allowcb = 1; for (i = 0 ; i < auth->ncredtype ; i++) {
} if (auth->credtype[i] == VIR_CRED_EXTERNAL)
allowcb = 1;
}
/* Run the authentication callback */ if (allowcb) {
if (allowcb) { /* Run the authentication callback */
if (auth && auth->cb && if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
(*(auth->cb))(&cred, 1, auth->cbdata) < 0) { __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");
"Failed to collect auth credentials"); return -1;
return -1; }
} else { } else {
remoteDebug(priv, "No auth callback provided for PolicyKit"); remoteDebug(priv, "Client auth callback does not support PolicyKit");
} }
} else { } else {
remoteDebug(priv, "Client auth callback does not support PolicyKit"); remoteDebug(priv, "No auth callback provided");
} }
memset (&ret, 0, sizeof ret); memset (&ret, 0, sizeof ret);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册