- Fix libiscsi.discover_sendtargets python method to accept None as valid

authinfo argument (#485217)
This commit is contained in:
Hans de Goede 2009-02-12 15:45:30 +00:00
parent 2043c5a8d9
commit 3554bd6535
2 changed files with 45 additions and 1 deletions

View File

@ -3,7 +3,7 @@
Summary: iSCSI daemon and utility programs Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils Name: iscsi-initiator-utils
Version: 6.2.0.870 Version: 6.2.0.870
Release: 3%{?dist} Release: 4%{?dist}
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-870.1.tar.gz Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-870.1.tar.gz
Source1: iscsid.init Source1: iscsid.init
Source2: iscsidevs.init Source2: iscsidevs.init
@ -18,6 +18,7 @@ Patch6: iscsi-initiator-utils-start-iscsid.patch
Patch7: open-iscsi-2.0-870.1-add-libiscsi.patch Patch7: open-iscsi-2.0-870.1-add-libiscsi.patch
Patch8: open-iscsi-2.0-870.1-no-exit.patch Patch8: open-iscsi-2.0-870.1-no-exit.patch
Patch9: open-iscsi-2.0-870.1-ibft-newer-kernel.patch Patch9: open-iscsi-2.0-870.1-ibft-newer-kernel.patch
Patch10: open-iscsi-2.0-870.1-485217.patch
Group: System Environment/Daemons Group: System Environment/Daemons
License: GPLv2+ License: GPLv2+
@ -55,6 +56,7 @@ developing applications that use %{name}.
%patch7 -p1 %patch7 -p1
%patch8 -p1 %patch8 -p1
%patch9 -p1 %patch9 -p1
%patch10 -p1
%build %build
@ -158,6 +160,10 @@ fi
%{_includedir}/libiscsi.h %{_includedir}/libiscsi.h
%changelog %changelog
* Thu Feb 12 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-4
- Fix libiscsi.discover_sendtargets python method to accept None as valid
authinfo argument (#485217)
* Wed Jan 28 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-3 * Wed Jan 28 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-3
- Fix reading of iBFT firmware with newer kernels - Fix reading of iBFT firmware with newer kernels

View File

@ -0,0 +1,38 @@
diff -up open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c~ open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c
--- open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c~ 2009-02-12 15:30:52.000000000 +0100
+++ open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c 2009-02-12 15:48:30.000000000 +0100
@@ -485,19 +485,28 @@ static PyObject *pylibiscsi_discover_sen
char *kwlist[] = {"address", "port", "authinfo", NULL};
const char *address = NULL;
int i, nr_found, port = 3260;
- PyIscsiChapAuthInfo *pyauthinfo = NULL;
+ PyObject *authinfo_arg = NULL;
const struct libiscsi_auth_info *authinfo = NULL;
struct libiscsi_node *found_nodes;
PyObject* found_node_list;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO!",
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO",
kwlist, &address, &port,
- &PyIscsiChapAuthInfo_Type,
- &pyauthinfo))
+ &authinfo_arg))
return NULL;
- if (pyauthinfo)
- authinfo = &pyauthinfo->info;
+ if (authinfo_arg) {
+ if (PyObject_IsInstance(authinfo_arg, (PyObject *)
+ &PyIscsiChapAuthInfo_Type)) {
+ PyIscsiChapAuthInfo *pyauthinfo =
+ (PyIscsiChapAuthInfo *)authinfo_arg;
+ authinfo = &pyauthinfo->info;
+ } else if (authinfo_arg != Py_None) {
+ PyErr_SetString(PyExc_ValueError,
+ "invalid authinfo type");
+ return NULL;
+ }
+ }
if (libiscsi_discover_sendtargets(context, address, port, authinfo,
&nr_found, &found_nodes)) {