diff options
author | Tim Potter <tpot@samba.org> | 2002-05-27 06:34:13 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-27 06:34:13 +0000 |
commit | 343751ca95af59ac771295df45cc1d0a1cda31de (patch) | |
tree | 93b151d118575417c39d5c333291f3a3ee15861b /source3 | |
parent | 24def691ef1832d921e6f83daf9b1809de891bcf (diff) | |
download | samba-343751ca95af59ac771295df45cc1d0a1cda31de.tar.gz samba-343751ca95af59ac771295df45cc1d0a1cda31de.tar.bz2 samba-343751ca95af59ac771295df45cc1d0a1cda31de.zip |
Use new version of open_pipe_creds() function.
A compile fix for enumerating trusted domains.
(This used to be commit fc75c3ccc3bc45ab72db85d46dbedbbdb0e2dff7)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/python/py_lsa.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c index 04af993e3e..7edd651642 100644 --- a/source3/python/py_lsa.c +++ b/source3/python/py_lsa.c @@ -54,11 +54,11 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args, { static char *kwlist[] = { "servername", "creds", "access", NULL }; char *server, *errstr; - PyObject *creds = NULL, *result; + PyObject *creds = NULL, *result = NULL; uint32 desired_access = MAXIMUM_ALLOWED_ACCESS; - struct cli_state *cli; + struct cli_state *cli = NULL; NTSTATUS ntstatus; - TALLOC_CTX *mem_ctx; + TALLOC_CTX *mem_ctx = NULL; POLICY_HND hnd; if (!PyArg_ParseTupleAndKeywords( @@ -66,31 +66,36 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args, &creds, &desired_access)) return NULL; - if (!(cli = open_pipe_creds( - server, creds, cli_lsa_initialise, &errstr))) { + if (!(cli = open_pipe_creds(server, creds, PIPE_LSARPC, &errstr))) { PyErr_SetString(lsa_error, errstr); free(errstr); return NULL; } if (!(mem_ctx = talloc_init())) { - PyErr_SetString( - lsa_error, "unable to init talloc context\n"); - return NULL; + PyErr_SetString(lsa_error, "unable to init talloc context\n"); + goto done; } ntstatus = cli_lsa_open_policy(cli, mem_ctx, True, SEC_RIGHTS_MAXIMUM_ALLOWED, &hnd); if (!NT_STATUS_IS_OK(ntstatus)) { - cli_shutdown(cli); - SAFE_FREE(cli); PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus)); - return NULL; + goto done; } result = new_lsa_policy_hnd_object(cli, mem_ctx, &hnd); +done: + if (!result) { + if (cli) + cli_shutdown(cli); + + if (mem_ctx) + talloc_destroy(mem_ctx); + } + return result; } @@ -259,7 +264,7 @@ static PyObject *lsa_enum_trust_dom(PyObject *self, PyObject *args) { lsa_policy_hnd_object *hnd = (lsa_policy_hnd_object *)self; NTSTATUS ntstatus; - uint32 enum_ctx = 0, num_domains, i; + uint32 enum_ctx = 0, num_domains, i, pref_num_domains = 0; char **domain_names; DOM_SID *domain_sids; PyObject *result; @@ -267,10 +272,9 @@ static PyObject *lsa_enum_trust_dom(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "")) return NULL; - ntstatus = cli_lsa_enum_trust_dom(hnd->cli, hnd->mem_ctx, - &hnd->pol, &enum_ctx, - &num_domains, &domain_names, - &domain_names, &domain_sids); + ntstatus = cli_lsa_enum_trust_dom( + hnd->cli, hnd->mem_ctx, &hnd->pol, &enum_ctx, + &pref_num_domains, &num_domains, &domain_names, &domain_sids); if (!NT_STATUS_IS_OK(ntstatus)) { PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus)); |