diff options
author | Gary Lockyer <gary@catalyst.net.nz> | 2017-03-21 16:00:38 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-03-29 02:37:25 +0200 |
commit | b57e3cf1dfab2734baf63d06546f28fdf96fab9d (patch) | |
tree | ea8bfb21c9be09ddce1b280a3281c71585086867 /source4 | |
parent | 6fcb61b7919bef76b28377a20c061815b3b4e697 (diff) | |
download | samba-b57e3cf1dfab2734baf63d06546f28fdf96fab9d.tar.gz |
pysmb: Check for credentials using same method as pyrpc
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/libcli/pysmb.c | 9 |
1 files changed, 8 insertions, 1 deletions
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(); |