X-Git-Url: http://git.samba.org/?a=blobdiff_plain;f=source%2Fpython%2Fpy_lsa.c;h=6095fdfc677f0fa1ef0561ce59621521647cba4e;hb=ba8c48244e140403b728d9a2ca297b40e8888964;hp=07191be86822e47b1a75bf6ba85841970c95886d;hpb=98cac74c67c454f636df5c1ea2baa029c482e402;p=samba.git diff --git a/source/python/py_lsa.c b/source/python/py_lsa.c index 07191be8682..6095fdfc677 100644 --- a/source/python/py_lsa.c +++ b/source/python/py_lsa.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,13 +14,12 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "python/py_lsa.h" -PyObject *new_lsa_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx, +PyObject *new_lsa_policy_hnd_object(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, POLICY_HND *pol) { lsa_policy_hnd_object *o; @@ -55,7 +54,7 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args, static char *kwlist[] = { "servername", "creds", "access", NULL }; char *server, *errstr; PyObject *creds = NULL, *result = NULL; - uint32 desired_access = MAXIMUM_ALLOWED_ACCESS; + uint32 desired_access = GENERIC_EXECUTE_ACCESS; struct cli_state *cli = NULL; NTSTATUS ntstatus; TALLOC_CTX *mem_ctx = NULL; @@ -89,15 +88,15 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args, goto done; } - ntstatus = cli_lsa_open_policy(cli, mem_ctx, True, - SEC_RIGHTS_MAXIMUM_ALLOWED, &hnd); + ntstatus = rpccli_lsa_open_policy( + cli->pipe_list, mem_ctx, True, desired_access, &hnd); if (!NT_STATUS_IS_OK(ntstatus)) { PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus)); goto done; } - result = new_lsa_policy_hnd_object(cli, mem_ctx, &hnd); + result = new_lsa_policy_hnd_object(cli->pipe_list, mem_ctx, &hnd); done: if (!result) { @@ -125,7 +124,7 @@ static PyObject *lsa_close(PyObject *self, PyObject *args, PyObject *kw) /* Call rpc function */ - result = cli_lsa_close(hnd->cli, hnd->mem_ctx, &hnd->pol); + result = rpccli_lsa_Close(hnd->cli, hnd->mem_ctx, &hnd->pol); /* Cleanup samba stuff */ @@ -147,7 +146,7 @@ static PyObject *lsa_lookup_names(PyObject *self, PyObject *args) const char **names; DOM_SID *sids; TALLOC_CTX *mem_ctx = NULL; - uint32 *name_types; + enum lsa_SidType *name_types; if (!PyArg_ParseTuple(args, "O", &py_names)) return NULL; @@ -167,7 +166,7 @@ static PyObject *lsa_lookup_names(PyObject *self, PyObject *args) /* Convert list to char ** array */ num_names = PyList_Size(py_names); - names = (const char **)talloc(mem_ctx, num_names * sizeof(char *)); + names = (const char **)_talloc(mem_ctx, num_names * sizeof(char *)); for (i = 0; i < num_names; i++) { PyObject *obj = PyList_GetItem(py_names, i); @@ -180,13 +179,14 @@ static PyObject *lsa_lookup_names(PyObject *self, PyObject *args) /* Just a single element */ num_names = 1; - names = (const char **)talloc(mem_ctx, sizeof(char *)); + names = (const char **)_talloc(mem_ctx, sizeof(char *)); names[0] = PyString_AsString(py_names); } - ntstatus = cli_lsa_lookup_names(hnd->cli, mem_ctx, &hnd->pol, - num_names, names, &sids, &name_types); + ntstatus = rpccli_lsa_lookup_names( + hnd->cli, mem_ctx, &hnd->pol, num_names, names, + NULL, 1, &sids, &name_types); if (!NT_STATUS_IS_OK(ntstatus) && NT_STATUS_V(ntstatus) != 0x107) { PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus)); @@ -241,7 +241,7 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args, /* Convert dictionary to char ** array */ num_sids = PyList_Size(py_sids); - sids = (DOM_SID *)talloc(mem_ctx, num_sids * sizeof(DOM_SID)); + sids = (DOM_SID *)_talloc(mem_ctx, num_sids * sizeof(DOM_SID)); memset(sids, 0, num_sids * sizeof(DOM_SID)); @@ -259,7 +259,7 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args, /* Just a single element */ num_sids = 1; - sids = (DOM_SID *)talloc(mem_ctx, sizeof(DOM_SID)); + sids = (DOM_SID *)_talloc(mem_ctx, sizeof(DOM_SID)); if (!string_to_sid(&sids[0], PyString_AsString(py_sids))) { PyErr_SetString(PyExc_ValueError, "string_to_sid failed"); @@ -267,9 +267,9 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args, } } - ntstatus = cli_lsa_lookup_sids(hnd->cli, mem_ctx, &hnd->pol, - num_sids, sids, &domains, &names, - &types); + ntstatus = rpccli_lsa_lookup_sids( + hnd->cli, mem_ctx, &hnd->pol, num_sids, sids, &domains, + &names, &types); if (!NT_STATUS_IS_OK(ntstatus)) { PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus)); @@ -306,7 +306,7 @@ static PyObject *lsa_enum_trust_dom(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "")) return NULL; - ntstatus = cli_lsa_enum_trust_dom( + ntstatus = rpccli_lsa_enum_trust_dom( hnd->cli, hnd->mem_ctx, &hnd->pol, &enum_ctx, &num_domains, &domain_names, &domain_sids);