mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
pyrpc: Fix segfault in ClientConnection
Fix segfault when connecting over TCP, the endpoints list in dummy_table was not initialised this caused a segfault when attempting to connect over TCP. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlet <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Apr 21 16:10:12 CEST 2017 on sn-devel-144
This commit is contained in:
parent
375d772d04
commit
9342b3ebf7
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
"""Tests for samba.tests.dcerpc.bare."""
|
"""Tests for samba.tests.dcerpc.bare."""
|
||||||
|
|
||||||
|
import os
|
||||||
from samba.dcerpc import ClientConnection
|
from samba.dcerpc import ClientConnection
|
||||||
import samba.tests
|
import samba.tests
|
||||||
|
|
||||||
@ -40,3 +41,20 @@ class BareTestCase(samba.tests.TestCase):
|
|||||||
basis_connection=x, lp_ctx=samba.tests.env_loadparm())
|
basis_connection=x, lp_ctx=samba.tests.env_loadparm())
|
||||||
self.assertEquals(24, len(x.request(0, chr(0) * 8)))
|
self.assertEquals(24, len(x.request(0, chr(0) * 8)))
|
||||||
self.assertEquals("\x01\x00\x00\x00", y.request(0, chr(0) * 4))
|
self.assertEquals("\x01\x00\x00\x00", y.request(0, chr(0) * 4))
|
||||||
|
|
||||||
|
def test_bare_tcp(self):
|
||||||
|
# Connect to the echo pipe
|
||||||
|
x = ClientConnection("ncacn_ip_tcp:%s" % os.environ["SERVER"],
|
||||||
|
("60a15ec5-4de8-11d7-a637-005056a20182", 1),
|
||||||
|
lp_ctx=samba.tests.env_loadparm())
|
||||||
|
self.assertEquals("\x01\x00\x00\x00", x.request(0, chr(0) * 4))
|
||||||
|
|
||||||
|
def test_two_contexts_tcp(self):
|
||||||
|
x = ClientConnection("ncacn_ip_tcp:%s" % os.environ["SERVER"],
|
||||||
|
("12345778-1234-abcd-ef00-0123456789ac", 1),
|
||||||
|
lp_ctx=samba.tests.env_loadparm())
|
||||||
|
y = ClientConnection("ncacn_ip_tcp:%s" % os.environ["SERVER"],
|
||||||
|
("60a15ec5-4de8-11d7-a637-005056a20182", 1),
|
||||||
|
basis_connection=x, lp_ctx=samba.tests.env_loadparm())
|
||||||
|
self.assertEquals(24, len(x.request(0, chr(0) * 8)))
|
||||||
|
self.assertEquals("\x01\x00\x00\x00", y.request(0, chr(0) * 4))
|
||||||
|
@ -293,6 +293,7 @@ static PyObject *dcerpc_interface_new(PyTypeObject *type, PyObject *args, PyObje
|
|||||||
"binding", "syntax", "lp_ctx", "credentials", "basis_connection", NULL
|
"binding", "syntax", "lp_ctx", "credentials", "basis_connection", NULL
|
||||||
};
|
};
|
||||||
static struct ndr_interface_table dummy_table;
|
static struct ndr_interface_table dummy_table;
|
||||||
|
static struct ndr_interface_string_array dummy_endpoints;
|
||||||
PyObject *args2 = Py_None;
|
PyObject *args2 = Py_None;
|
||||||
PyObject *kwargs2 = Py_None;
|
PyObject *kwargs2 = Py_None;
|
||||||
|
|
||||||
@ -316,6 +317,13 @@ static PyObject *dcerpc_interface_new(PyTypeObject *type, PyObject *args, PyObje
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialise the endpoints list in dummy_table if required
|
||||||
|
*/
|
||||||
|
if (dummy_table.endpoints == NULL) {
|
||||||
|
dummy_table.endpoints = &dummy_endpoints;
|
||||||
|
}
|
||||||
|
|
||||||
args2 = Py_BuildValue("(s)", binding_string);
|
args2 = Py_BuildValue("(s)", binding_string);
|
||||||
if (args2 == NULL) {
|
if (args2 == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user