From 3554bd65355cf9bb3a6cecb7b4ec3b872288a75f Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Feb 12 2009 15:45:30 +0000 Subject: - Fix libiscsi.discover_sendtargets python method to accept None as valid authinfo argument (#485217) --- diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec index c2d4b42..e8e12d0 100644 --- a/iscsi-initiator-utils.spec +++ b/iscsi-initiator-utils.spec @@ -3,7 +3,7 @@ Summary: iSCSI daemon and utility programs Name: iscsi-initiator-utils 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 Source1: iscsid.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 Patch8: open-iscsi-2.0-870.1-no-exit.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 License: GPLv2+ @@ -55,6 +56,7 @@ developing applications that use %{name}. %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 %build @@ -158,6 +160,10 @@ fi %{_includedir}/libiscsi.h %changelog +* Thu Feb 12 2009 Hans de Goede 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 6.2.0.870-3 - Fix reading of iBFT firmware with newer kernels diff --git a/open-iscsi-2.0-870.1-485217.patch b/open-iscsi-2.0-870.1-485217.patch new file mode 100644 index 0000000..f80cf27 --- /dev/null +++ b/open-iscsi-2.0-870.1-485217.patch @@ -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)) {