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

s3:pylibsmb: Make lp a mandatory param for the SMB connection

Currently establishing the SMB connection relies on having initialized
the global source3 loadparm.

This patch makes the lp param mandatory, so that you always have to pass
the parameter in when establishing the SMB connection.

It also makes the source3 API more consistent with the current source4
API, which will make it easier to replace the source4 version later.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Tim Beale 2018-12-12 10:25:35 +13:00 committed by Tim Beale
parent b7d350b45b
commit 6fff2c26da
3 changed files with 6 additions and 5 deletions

View File

@ -42,7 +42,7 @@ class smb_pipe_socket(object):
def __init__(self, target_hostname, pipename, creds, impersonation_level, lp):
lp3 = s3param.get_context()
lp3.load(lp.configfile)
self.smbconn = libsmb_samba_internal.Conn(target_hostname, 'IPC$',
self.smbconn = libsmb_samba_internal.Conn(target_hostname, 'IPC$', lp3,
credentials=creds, sign=True)
self.smbfid = self.smbconn.create(pipename,
DesiredAccess=0x12019f,

View File

@ -60,7 +60,7 @@ class LibsmbTestCase(samba.tests.TestCase):
creds.set_password(os.getenv("PASSWORD"))
c = libsmb_samba_internal.Conn(os.getenv("SERVER_IP"), "tmp",
creds, multi_threaded=True,
lp, creds, multi_threaded=True,
force_smb1=True)
mythreads = []

View File

@ -423,6 +423,7 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
char *host, *share;
PyObject *creds = NULL;
struct cli_credentials *cli_creds;
PyObject *py_lp = Py_None;
PyObject *py_multi_threaded = Py_False;
bool multi_threaded = false;
PyObject *py_sign = Py_False;
@ -435,7 +436,7 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
int flags = 0;
static const char *kwlist[] = {
"host", "share", "credentials",
"host", "share", "lp", "credentials",
"multi_threaded", "sign", "force_smb1",
NULL
};
@ -447,8 +448,8 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
}
ret = ParseTupleAndKeywords(
args, kwds, "ss|O!OOO", kwlist,
&host, &share,
args, kwds, "ssO|O!OOO", kwlist,
&host, &share, &py_lp,
py_type_Credentials, &creds,
&py_multi_threaded,
&py_sign,