From 3f3d2f9dfc0f319cc47e13cec6128be2e39400c4 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Mon, 10 Sep 2012 16:45:53 +0100 Subject: [PATCH] Check against python None type when filling in auth parameters 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 --- 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 768144a009..bb1d881f1e 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; -- GitLab