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 <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2012-09-10 16:45:53 +01:00
parent 01573bdf4f
commit 3f3d2f9dfc
1 changed files with 2 additions and 1 deletions

View File

@ -1840,7 +1840,8 @@ libvirt_virConnectOpenAuth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
auth.credtype[i] = (int)PyLong_AsLong(val); auth.credtype[i] = (int)PyLong_AsLong(val);
} }
} }
auth.cb = pycredcb ? virConnectCredCallbackWrapper : NULL; if (pycredcb && pycredcb != Py_None)
auth.cb = virConnectCredCallbackWrapper;
auth.cbdata = pyauth; auth.cbdata = pyauth;
LIBVIRT_BEGIN_ALLOW_THREADS; LIBVIRT_BEGIN_ALLOW_THREADS;