From 286d3a80fdcd316ebbf63b007a24e787143313a4 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 16 May 2002 04:00:31 +0000 Subject: More cleanups. - removed dodgy fprintf() error handling - return an error string from open_pipe_creds() so the appropriate exception can be raised by the caller - reformatting (This used to be commit d35cad359df3bd53e6bb49f6655d4c7b9993abb0) --- source3/python/py_lsa.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source3/python/py_lsa.c') diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c index cf96928790..82055181cc 100644 --- a/source3/python/py_lsa.c +++ b/source3/python/py_lsa.c @@ -53,7 +53,7 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args, PyObject *kw) { static char *kwlist[] = { "servername", "creds", "access", NULL }; - char *server_name; + char *server, *errstr; PyObject *creds = NULL, *result; uint32 desired_access = MAXIMUM_ALLOWED_ACCESS; struct cli_state *cli; @@ -62,17 +62,20 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args, POLICY_HND hnd; if (!PyArg_ParseTupleAndKeywords( - args, kw, "s|O!i", kwlist, &server_name, &PyDict_Type, - &creds, &desired_access)) + args, kw, "s|O!i", kwlist, &server, &PyDict_Type, + &creds, &desired_access)) return NULL; - if (!(cli = open_pipe_creds(server_name, creds, cli_lsa_initialise))) { - fprintf(stderr, "could not initialise cli state\n"); + if (!(cli = open_pipe_creds( + server, creds, cli_lsa_initialise, &errstr))) { + PyErr_SetString(lsa_error, errstr); + free(errstr); return NULL; } if (!(mem_ctx = talloc_init())) { - fprintf(stderr, "unable to initialise talloc context\n"); + PyErr_SetString( + lsa_error, "unable to initialise talloc context\n"); return NULL; } -- cgit