summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-10-21 21:21:33 +0000
committerTim Potter <tpot@samba.org>2002-10-21 21:21:33 +0000
commit5324adb825c406360ee1482c6413cee9d63bfb40 (patch)
tree2e7320bf6cc38ff0a7a86135a518ffc73d93032b /source3
parentc7731c988ed289952310f4bec19f6afdb6c1d1fc (diff)
downloadsamba-5324adb825c406360ee1482c6413cee9d63bfb40.tar.gz
samba-5324adb825c406360ee1482c6413cee9d63bfb40.tar.bz2
samba-5324adb825c406360ee1482c6413cee9d63bfb40.zip
Fixed bug in session setup kwlist.
Added some basic error handling. Just throw a RuntimeError exception on error. (This used to be commit 06caeed588f702814be76a2b2aa7ed43504adef5)
Diffstat (limited to 'source3')
-rw-r--r--source3/python/py_smb.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/source3/python/py_smb.c b/source3/python/py_smb.c
index c9ac24659d..85f7792047 100644
--- a/source3/python/py_smb.c
+++ b/source3/python/py_smb.c
@@ -97,7 +97,7 @@ static PyObject *py_smb_session_setup(PyObject *self, PyObject *args,
PyObject *kw)
{
cli_state_object *cli = (cli_state_object *)self;
- static char *kwlist[] = { "creds" };
+ static char *kwlist[] = { "creds", NULL };
PyObject *creds;
char *username, *domain, *password, *errstr;
BOOL result;
@@ -114,6 +114,11 @@ static PyObject *py_smb_session_setup(PyObject *self, PyObject *args,
cli->cli, username, password, strlen(password) + 1,
password, strlen(password) + 1, domain);
+ if (cli_is_error(cli->cli)) {
+ PyErr_SetString(PyExc_RuntimeError, "session setup failed");
+ return NULL;
+ }
+
return Py_BuildValue("i", result);
}
@@ -131,6 +136,11 @@ static PyObject *py_smb_tconx(PyObject *self, PyObject *args, PyObject *kw)
cli->cli, service, strequal(service, "IPC$") ? "IPC" :
"?????", "", 1);
+ if (cli_is_error(cli->cli)) {
+ PyErr_SetString(PyExc_RuntimeError, "tconx failed");
+ return NULL;
+ }
+
return Py_BuildValue("i", result);
}
@@ -159,6 +169,11 @@ static PyObject *py_smb_nt_create_andx(PyObject *self, PyObject *args,
cli->cli, filename, desired_access, file_attributes,
share_access, create_disposition, create_options);
+ if (cli_is_error(cli->cli)) {
+ PyErr_SetString(PyExc_RuntimeError, "nt_create_andx failed");
+ return NULL;
+ }
+
/* Return FID */
return PyInt_FromLong(result);
@@ -184,7 +199,10 @@ static PyObject *py_smb_query_secdesc(PyObject *self, PyObject *args,
secdesc = cli_query_secdesc(cli->cli, fnum, mem_ctx);
- /* FIXME: we should raise an exception here */
+ if (cli_is_error(cli->cli)) {
+ PyErr_SetString(PyExc_RuntimeError, "query_secdesc failed");
+ return NULL;
+ }
if (!secdesc) {
Py_INCREF(Py_None);
@@ -232,6 +250,11 @@ static PyObject *py_smb_set_secdesc(PyObject *self, PyObject *args,
result = cli_set_secdesc(cli->cli, fnum, secdesc);
+ if (cli_is_error(cli->cli)) {
+ PyErr_SetString(PyExc_RuntimeError, "set_secdesc failed");
+ return NULL;
+ }
+
return PyInt_FromLong(result);
}