From 3182a4df5a24d568f624c17ea80fb09b2c62a2b1 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 2 Jan 2008 21:43:05 +0000 Subject: [PATCH] Fixed auth callback crash and config file reading --- libvirt-0.4.0-auth-null-cb.patch | 44 +++++++++++++++++++++++++++++++ libvirt-0.4.0-conffile-size.patch | 12 +++++++++ libvirt.spec | 10 ++++++- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 libvirt-0.4.0-auth-null-cb.patch create mode 100644 libvirt-0.4.0-conffile-size.patch diff --git a/libvirt-0.4.0-auth-null-cb.patch b/libvirt-0.4.0-auth-null-cb.patch new file mode 100644 index 0000000..e5e50b5 --- /dev/null +++ b/libvirt-0.4.0-auth-null-cb.patch @@ -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); diff --git a/libvirt-0.4.0-conffile-size.patch b/libvirt-0.4.0-conffile-size.patch new file mode 100644 index 0000000..5e8fae6 --- /dev/null +++ b/libvirt-0.4.0-conffile-size.patch @@ -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; + diff --git a/libvirt.spec b/libvirt.spec index 37e18db..a437718 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -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 - 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 - 0.4.0-1.fc8 - Release of 0.4.0 - SASL based authentication