summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-04-09 14:29:11 +0200
committerRichard Sharpe <sharpe@samba.org>2013-04-09 18:30:06 +0200
commitf61ee7238b8430572fb266521dad3ee000d1f252 (patch)
tree3f14e27a23da73024dbfb0ec8a1843e5aa5b050d
parent045c446b5a3ffc7e56d46ac4aa4acae9d27d9f49 (diff)
downloadsamba-f61ee7238b8430572fb266521dad3ee000d1f252.tar.gz
samba-f61ee7238b8430572fb266521dad3ee000d1f252.tar.bz2
samba-f61ee7238b8430572fb266521dad3ee000d1f252.zip
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
-rw-r--r--source3/libsmb/pylibsmb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index 4fd5921f23..2b253f9d19 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -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(