Fixed auth callback crash and config file reading

This commit is contained in:
Daniel P. Berrange 2008-01-02 21:43:05 +00:00
parent 4f667910e9
commit 3182a4df5a
3 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,44 @@
diff -rup libvirt-0.4.0.orig/src/remote_internal.c libvirt-0.4.0.new/src/remote_internal.c
--- libvirt-0.4.0.orig/src/remote_internal.c 2007-12-17 16:51:09.000000000 -0500
+++ libvirt-0.4.0.new/src/remote_internal.c 2008-01-02 16:28:44.000000000 -0500
@@ -3347,24 +3347,26 @@ remoteAuthPolkit (virConnectPtr conn, st
};
remoteDebug(priv, "Client initialize PolicyKit authentication");
- for (i = 0 ; i < auth->ncredtype ; i++) {
- if (auth->credtype[i] == VIR_CRED_EXTERNAL)
- allowcb = 1;
- }
+ if (auth && auth->cb) {
+ /* Check if the neccessary credential type for PolicyKit is supported */
+ for (i = 0 ; i < auth->ncredtype ; i++) {
+ if (auth->credtype[i] == VIR_CRED_EXTERNAL)
+ allowcb = 1;
+ }
- /* Run the authentication callback */
- 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;
+ if (allowcb) {
+ /* Run the authentication callback */
+ if ((*(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");
+ remoteDebug(priv, "Client auth callback does not support PolicyKit");
}
} else {
- remoteDebug(priv, "Client auth callback does not support PolicyKit");
+ remoteDebug(priv, "No auth callback provided");
}
memset (&ret, 0, sizeof ret);

View File

@ -0,0 +1,12 @@
diff -rup libvirt-0.4.0.orig/src/conf.c libvirt-0.4.0.new/src/conf.c
--- libvirt-0.4.0.orig/src/conf.c 2007-12-12 08:30:49.000000000 -0500
+++ libvirt-0.4.0.new/src/conf.c 2008-01-02 16:30:12.000000000 -0500
@@ -705,7 +705,7 @@ error:
virConfPtr
__virConfReadFile(const char *filename)
{
- char content[4096];
+ char content[8192];
int fd;
int len;

View File

@ -11,10 +11,12 @@
Summary: Library providing a simple API virtualization
Name: libvirt
Version: 0.4.0
Release: 1%{?dist}%{?extra_release}
Release: 2%{?dist}%{?extra_release}
License: LGPL
Group: Development/Libraries
Source: libvirt-%{version}.tar.gz
Patch1: libvirt-%{version}-auth-null-cb.patch
Patch2: libvirt-%{version}-conffile-size.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
URL: http://libvirt.org/
BuildRequires: python python-devel
@ -87,6 +89,8 @@ of recent versions of Linux (and other OSes).
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%build
# Xen is availble only on i386 x86_64 ia64
@ -212,6 +216,10 @@ fi
%doc docs/examples/python
%changelog
* Wed Jan 2 2008 Daniel P. Berrange <berrange@redhat.com> - 0.4.0-2.fc9
- Fix reading large config files (rhbz #426425)
- Fix crash when connecting to a PolicyKit enabled server with not auth callback (rhbz #427107)
* Tue Dec 18 2007 Daniel Veillard <veillard@redhat.com> - 0.4.0-1.fc8
- Release of 0.4.0
- SASL based authentication