1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

pylibsmb: Avoid a segfault if no credentials are passed to libsmb.Conn()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>

Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Tue Apr  9 18:30:06 CEST 2013 on sn-devel-104
This commit is contained in:
Volker Lendecke 2013-04-09 14:29:11 +02:00 committed by Richard Sharpe
parent 045c446b5a
commit f61ee7238b

View File

@ -406,7 +406,7 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
{
NTSTATUS status;
char *host, *share;
PyObject *creds;
PyObject *creds = NULL;
struct cli_credentials *cli_creds;
bool ret;
@ -434,10 +434,10 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
return -1;
}
cli_creds = cli_credentials_from_py_object(creds);
if (cli_creds == NULL) {
PyErr_SetString(PyExc_TypeError, "Expected credentials");
return -1;
if (creds == NULL) {
cli_creds = cli_credentials_init_anon(NULL);
} else {
cli_creds = PyCredentials_AsCliCredentials(creds);
}
status = cli_full_connection(