summaryrefslogtreecommitdiff
path: root/source3/python/py_smb.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-09-09 04:07:32 +0000
committerGerald Carter <jerry@samba.org>2003-09-09 04:07:32 +0000
commit4093bf7ff8c8861cf7b941945ede53a8ec5bb6c8 (patch)
treedd0a9f32d9933e1f75d919b5083e007d7453f9c4 /source3/python/py_smb.c
parent3d7cb49747a9a7f5cdec0ee05c6270ec3604202f (diff)
downloadsamba-4093bf7ff8c8861cf7b941945ede53a8ec5bb6c8.tar.gz
samba-4093bf7ff8c8861cf7b941945ede53a8ec5bb6c8.tar.bz2
samba-4093bf7ff8c8861cf7b941945ede53a8ec5bb6c8.zip
sync 3.0 into HEAD for the last time
(This used to be commit c17a7dc9a190156a069da3e861c18fd3f81224ad)
Diffstat (limited to 'source3/python/py_smb.c')
-rw-r--r--source3/python/py_smb.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/source3/python/py_smb.c b/source3/python/py_smb.c
index bb84a337c9..e5e6506196 100644
--- a/source3/python/py_smb.c
+++ b/source3/python/py_smb.c
@@ -221,10 +221,10 @@ static PyObject *py_smb_query_secdesc(PyObject *self, PyObject *args,
{
cli_state_object *cli = (cli_state_object *)self;
static char *kwlist[] = { "fnum", NULL };
- PyObject *result;
+ PyObject *result = NULL;
SEC_DESC *secdesc = NULL;
int fnum;
- TALLOC_CTX *mem_ctx;
+ TALLOC_CTX *mem_ctx = NULL;
/* Parse parameters */
@@ -238,7 +238,6 @@ static PyObject *py_smb_query_secdesc(PyObject *self, PyObject *args,
if (cli_is_error(cli->cli)) {
PyErr_SetString(PyExc_RuntimeError, "query_secdesc failed");
- result = NULL;
goto done;
}
@@ -252,7 +251,6 @@ static PyObject *py_smb_query_secdesc(PyObject *self, PyObject *args,
PyErr_SetString(
PyExc_TypeError,
"Invalid security descriptor returned");
- result = NULL;
goto done;
}
@@ -268,11 +266,12 @@ static PyObject *py_smb_set_secdesc(PyObject *self, PyObject *args,
{
cli_state_object *cli = (cli_state_object *)self;
static char *kwlist[] = { "fnum", "security_descriptor", NULL };
+ PyObject *result = NULL;
PyObject *py_secdesc;
SEC_DESC *secdesc;
- TALLOC_CTX *mem_ctx = talloc_init("py_smb_set_secdesc");
+ TALLOC_CTX *mem_ctx = NULL;
int fnum;
- BOOL result;
+ BOOL err;
/* Parse parameters */
@@ -280,20 +279,26 @@ static PyObject *py_smb_set_secdesc(PyObject *self, PyObject *args,
args, kw, "iO", kwlist, &fnum, &py_secdesc))
return NULL;
+ mem_ctx = talloc_init("py_smb_set_secdesc");
+
if (!py_to_SECDESC(&secdesc, py_secdesc, mem_ctx)) {
PyErr_SetString(PyExc_TypeError,
"Invalid security descriptor");
- return NULL;
+ goto done;
}
- result = cli_set_secdesc(cli->cli, fnum, secdesc);
+ err = cli_set_secdesc(cli->cli, fnum, secdesc);
if (cli_is_error(cli->cli)) {
PyErr_SetString(PyExc_RuntimeError, "set_secdesc failed");
- return NULL;
+ goto done;
}
- return PyInt_FromLong(result);
+ result = PyInt_FromLong(err);
+ done:
+ talloc_destroy(mem_ctx);
+
+ return result;
}
static PyMethodDef smb_hnd_methods[] = {