From b57e3cf1dfab2734baf63d06546f28fdf96fab9d Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Tue, 21 Mar 2017 16:00:38 +1300 Subject: pysmb: Check for credentials using same method as pyrpc Signed-off-by: Gary Lockyer --- source4/libcli/pysmb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/libcli/pysmb.c b/source4/libcli/pysmb.c index ac04f584b11..10ab54a9338 100644 --- a/source4/libcli/pysmb.c +++ b/source4/libcli/pysmb.c @@ -599,10 +599,17 @@ static PyObject *py_smb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs spdata->lp_ctx = lpcfg_from_py_object(spdata, py_lp); if (spdata->lp_ctx == NULL) { + PyErr_SetString(PyExc_TypeError, "Expected loadparm context"); + TALLOC_FREE(frame); + return NULL; + } + + spdata->creds = cli_credentials_from_py_object(py_creds); + if (spdata->creds == NULL) { + PyErr_SetString(PyExc_TypeError, "Expected credentials"); TALLOC_FREE(frame); return NULL; } - spdata->creds = PyCredentials_AsCliCredentials(py_creds); spdata->ev_ctx = s4_event_context_init(spdata); if (spdata->ev_ctx == NULL) { PyErr_NoMemory(); -- cgit v1.2.1