diff options
author | Tim Potter <tpot@samba.org> | 2002-05-16 02:24:22 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-16 02:24:22 +0000 |
commit | ce03ce2e5629930e582f9fd17445e52ce1b08907 (patch) | |
tree | 1681056b03ee12249d38fd45f89c45eeaca8e920 /source3/python/py_common.c | |
parent | ea8c45bbfd31151e91c1c57a162f255e706ca859 (diff) | |
download | samba-ce03ce2e5629930e582f9fd17445e52ce1b08907.tar.gz samba-ce03ce2e5629930e582f9fd17445e52ce1b08907.tar.bz2 samba-ce03ce2e5629930e582f9fd17445e52ce1b08907.zip |
Refactored open_pipe_creds() function to remove unused parameter.
(This used to be commit 36ed06cb5078429445f3bbb0f69baa2e0f8356a4)
Diffstat (limited to 'source3/python/py_common.c')
-rw-r--r-- | source3/python/py_common.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/source3/python/py_common.c b/source3/python/py_common.c index 5b80f09498..d286ed68f0 100644 --- a/source3/python/py_common.c +++ b/source3/python/py_common.c @@ -118,16 +118,20 @@ PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw) return Py_None; } +/* Return a cli_state to a RPC pipe on the given server. Use the + credentials passed if not NULL. Set an exception and return NULL if + there was an error creating the connection. */ + struct cli_state *open_pipe_creds(char *system_name, PyObject *creds, - cli_pipe_fn *connect_fn, - struct cli_state *cli) + cli_pipe_fn *connect_fn) { struct ntuser_creds nt_creds; - + struct cli_state *cli; + + cli = (struct cli_state *)malloc(sizeof(struct cli_state)); if (!cli) { - cli = (struct cli_state *)malloc(sizeof(struct cli_state)); - if (!cli) - return NULL; + PyErr_SetString(PyExc_RuntimeError, "out of memory"); + return NULL; } ZERO_STRUCTP(cli); @@ -151,7 +155,7 @@ struct cli_state *open_pipe_creds(char *system_name, PyObject *creds, password_obj = PyDict_GetItemString(creds, "password"); if (!username_obj || !domain_obj || !password_obj) { - error: + creds_error: /* TODO: Either pass in the exception for the module calling open_pipe_creds() or have a @@ -165,14 +169,14 @@ struct cli_state *open_pipe_creds(char *system_name, PyObject *creds, if (!PyString_Check(username_obj) || !PyString_Check(domain_obj) || !PyString_Check(password_obj)) - goto error; + goto creds_error; username = PyString_AsString(username_obj); domain = PyString_AsString(domain_obj); password = PyString_AsString(password_obj); if (!username || !domain || !password) - goto error; + goto creds_error; /* Initialise nt_creds structure with passed creds */ |