[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 3/5] Check against python None type when filling in auth parameters



From: "Daniel P. Berrange" <berrange redhat com>

When deciding whether to provide an auth function callback
in openAuth(), credcb was checked against NULL, when it
really needs to be checked against Py_None

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 python/libvirt-override.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 74a8abf..bf0b45b 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -1840,7 +1840,8 @@ libvirt_virConnectOpenAuth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
             auth.credtype[i] = (int)PyLong_AsLong(val);
         }
     }
-    auth.cb = pycredcb ? virConnectCredCallbackWrapper : NULL;
+    if (pycredcb && pycredcb != Py_None)
+        auth.cb = virConnectCredCallbackWrapper;
     auth.cbdata = pyauth;
 
     LIBVIRT_BEGIN_ALLOW_THREADS;
-- 
1.7.11.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]