mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
Use new version of open_pipe_creds() function.
Fix memory leaks on error. (This used to be commit b44e82667252c0ff4477d77487ff92b3af8ad418)
This commit is contained in:
parent
343751ca95
commit
2fe386d9b9
@ -276,9 +276,9 @@ static PyObject *samr_connect(PyObject *self, PyObject *args, PyObject *kw)
|
|||||||
static char *kwlist[] = { "server", "creds", "access", NULL };
|
static char *kwlist[] = { "server", "creds", "access", NULL };
|
||||||
uint32 desired_access = MAXIMUM_ALLOWED_ACCESS;
|
uint32 desired_access = MAXIMUM_ALLOWED_ACCESS;
|
||||||
char *server, *errstr;
|
char *server, *errstr;
|
||||||
struct cli_state *cli;
|
struct cli_state *cli = NULL;
|
||||||
POLICY_HND hnd;
|
POLICY_HND hnd;
|
||||||
TALLOC_CTX *mem_ctx;
|
TALLOC_CTX *mem_ctx = NULL;
|
||||||
PyObject *result = NULL, *creds = NULL;
|
PyObject *result = NULL, *creds = NULL;
|
||||||
NTSTATUS ntstatus;
|
NTSTATUS ntstatus;
|
||||||
|
|
||||||
@ -287,8 +287,7 @@ static PyObject *samr_connect(PyObject *self, PyObject *args, PyObject *kw)
|
|||||||
&creds, &desired_access))
|
&creds, &desired_access))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(cli = open_pipe_creds(
|
if (!(cli = open_pipe_creds(server, creds, PIPE_SAMR, &errstr))) {
|
||||||
server, creds, cli_lsa_initialise, &errstr))) {
|
|
||||||
PyErr_SetString(samr_error, errstr);
|
PyErr_SetString(samr_error, errstr);
|
||||||
free(errstr);
|
free(errstr);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -312,6 +311,14 @@ static PyObject *samr_connect(PyObject *self, PyObject *args, PyObject *kw)
|
|||||||
result = new_samr_connect_hnd_object(cli, mem_ctx, &hnd);
|
result = new_samr_connect_hnd_object(cli, mem_ctx, &hnd);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
if (!result) {
|
||||||
|
if (cli)
|
||||||
|
cli_shutdown(cli);
|
||||||
|
|
||||||
|
if (mem_ctx)
|
||||||
|
talloc_destroy(cli);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user