1 # Unix SMB/CIFS implementation.
2 # Copyright Volker Lendecke <vl@samba.org> 2012
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 """Tests for samba.samba3.libsmb."""
20 from samba
.samba3
import libsmb_samba_internal
as libsmb
21 from samba
.dcerpc
import security
22 from samba
.samba3
import param
as s3param
23 from samba
import credentials
24 from samba
import (ntstatus
,NTSTATUSError
)
28 class LibsmbTests(samba
.tests
.TestCase
):
31 self
.lp
= s3param
.get_context()
32 self
.lp
.load(samba
.tests
.env_get_var_value("SMB_CONF_PATH"))
34 self
.creds
= credentials
.Credentials()
35 self
.creds
.guess(self
.lp
)
36 self
.creds
.set_domain(samba
.tests
.env_get_var_value("DOMAIN"))
37 self
.creds
.set_username(samba
.tests
.env_get_var_value("USERNAME"))
38 self
.creds
.set_password(samba
.tests
.env_get_var_value("PASSWORD"))
40 # Build the global inject file path
41 server_conf
= samba
.tests
.env_get_var_value("SERVERCONFFILE")
42 server_conf_dir
= os
.path
.dirname(server_conf
)
43 self
.global_inject
= os
.path
.join(server_conf_dir
, "global_inject.conf")
45 self
.server_ip
= samba
.tests
.env_get_var_value("SERVER_IP")
47 def clean_file(self
, conn
, filename
):
50 except NTSTATUSError
as e
:
51 if e
.args
[0] == ntstatus
.NT_STATUS_FILE_IS_A_DIRECTORY
:
53 elif not (e
.args
[0] == ntstatus
.NT_STATUS_OBJECT_NAME_NOT_FOUND
or
54 e
.args
[0] == ntstatus
.NT_STATUS_OBJECT_PATH_NOT_FOUND
):