[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed Sep 5 19:57:03 UTC 2018
The branch, master has been updated
via 778878a selftest: Run libsmbclient tests with NT1 and SMB3
via 931e64d s4:torture: Set credentials for libsmbclient correctly
via 0dae4e2 s3:libsmbclient: Add function to set protocol levels
via 50f89bc s3:libsmbclient: Do not call cli_RNetShareEnum if SMB1 is disabled
via eddcbfe s3:smbclient: Do not call cli_RNetShareEnum if SMB1 is disabled
via e0e86e8 smbclient: Fix errors printed if we can connect with SMB1
from aa07400 kdc: Improve code clarity with extra brackets
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 778878a39621d88edaf2167719292bb75b86b2be
Author: Andreas Schneider <asn at samba.org>
Date: Mon Sep 3 16:55:02 2018 +0200
selftest: Run libsmbclient tests with NT1 and SMB3
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Sep 5 21:56:11 CEST 2018 on sn-devel-144
commit 931e64d2e9e42707c53d32a6cc5006ec734ae4ab
Author: Andreas Schneider <asn at samba.org>
Date: Mon Sep 3 16:36:54 2018 +0200
s4:torture: Set credentials for libsmbclient correctly
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 0dae4e2f5c65167fdb2405e232436921a0bb17e6
Author: Andreas Schneider <asn at samba.org>
Date: Tue Sep 4 15:48:03 2018 +0200
s3:libsmbclient: Add function to set protocol levels
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 50f89bcdc9473abf69da1fee6f9014df63adc3e3
Author: Andreas Schneider <asn at samba.org>
Date: Tue Sep 4 16:08:58 2018 +0200
s3:libsmbclient: Do not call cli_RNetShareEnum if SMB1 is disabled
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit eddcbfea91d012f70a00c3ff2865fb1a23bec023
Author: Andreas Schneider <asn at samba.org>
Date: Tue Sep 4 11:11:49 2018 +0200
s3:smbclient: Do not call cli_RNetShareEnum if SMB1 is disabled
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e0e86e8ae6245341ffd2b32d6abbade1371046e5
Author: Andreas Schneider <asn at samba.org>
Date: Mon Sep 3 12:11:39 2018 +0200
smbclient: Fix errors printed if we can connect with SMB1
smbclient -L //server
before:
Reconnecting with SMB1 for workgroup listing.
Connection to earth.milkyway.site failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Failed to connect with SMB1 -- no workgroup available
after:
Reconnecting with SMB1 for workgroup listing.
Unable to connect with SMB1 -- no workgroup available
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
selftest/knownfail | 2 +-
source3/client/client.c | 10 ++++-
source3/include/libsmbclient.h | 19 ++++++++-
.../{smbclient-0.4.0.sigs => smbclient-0.5.0.sigs} | 1 +
source3/libsmb/clidfs.c | 6 +--
source3/libsmb/libsmb_dir.c | 35 ++++++++--------
source3/libsmb/libsmb_setget.c | 18 +++++++++
source3/libsmb/wscript | 2 +-
source4/selftest/tests.py | 9 +++--
source4/torture/libsmbclient/libsmbclient.c | 46 +++++++++++++++++++++-
10 files changed, 118 insertions(+), 30 deletions(-)
copy source3/libsmb/ABI/{smbclient-0.4.0.sigs => smbclient-0.5.0.sigs} (99%)
Changeset truncated at 500 lines:
diff --git a/selftest/knownfail b/selftest/knownfail
index 93c1a35..eef8134 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -125,7 +125,7 @@
^samba4.smb2.acls.*.ACCESSBASED
^samba4.ldap.dirsync.python.ad_dc_ntvfs..__main__.ExtendedDirsyncTests.test_dirsync_deleted_items
#^samba4.ldap.dirsync.python.ad_dc_ntvfs..__main__.ExtendedDirsyncTests.*
-^samba4.libsmbclient.opendir.opendir # This requires netbios browsing
+^samba4.libsmbclient.opendir.(NT1|SMB3).opendir # This requires netbios browsing
^samba4.rpc.drsuapi.*.drsuapi.DsGetDomainControllerInfo\(.*\)$
^samba4.smb2.oplock.exclusive2\(.*\)$ # samba 4 oplocks are a mess
^samba4.smb2.oplock.exclusive5\(.*\)$ # samba 4 oplocks are a mess
diff --git a/source3/client/client.c b/source3/client/client.c
index 25ba01d..fc6d9a3 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4901,6 +4901,7 @@ static bool browse_host_rpc(bool sort)
static bool browse_host(bool sort)
{
int ret;
+
if (!grepable) {
d_printf("\n\tSharename Type Comment\n");
d_printf("\t--------- ---- -------\n");
@@ -4910,7 +4911,12 @@ static bool browse_host(bool sort)
return true;
}
- if((ret = cli_RNetShareEnum(cli, browse_fn, NULL)) == -1) {
+ if (lp_client_min_protocol() > PROTOCOL_NT1) {
+ return false;
+ }
+
+ ret = cli_RNetShareEnum(cli, browse_fn, NULL);
+ if (ret == -1) {
NTSTATUS status = cli_nt_error(cli);
d_printf("Error returning browse list: %s\n",
nt_errstr(status));
@@ -6227,7 +6233,7 @@ static int do_host_query(const char *query_host)
smb_encrypt, max_proto,
NBT_SMB_PORT, name_type, &cli);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("Failed to connect with SMB1 "
+ d_printf("Unable to connect with SMB1 "
"-- no workgroup available\n");
return 0;
}
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index ca5c7f8..5e4a171 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -831,7 +831,24 @@ smbc_getOptionUseNTHash(SMBCCTX *c);
void
smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b);
-
+/**
+ * @brief Set the 'client min protocol' and the 'client max protocol'.
+ *
+ * IMPORTANT: This overrrides the values 'client min protocol' and 'client max
+ * protocol' set in the smb.conf file!
+ *
+ * @param[in] c The smbc context to use.
+ *
+ * @param[in] min_proto The minimal protocol to use or NULL for leaving it
+ * untouched.
+ *
+ * @param[in] max_proto The maximum protocol to use or NULL for leaving it
+ * untouched.
+ *
+ * @returns true for success, false otherwise
+ */
+smbc_bool
+smbc_setOptionProtocols(SMBCCTX *c, const char *min_proto, const char *max_proto);
/*************************************
* Getters and setters for FUNCTIONS *
diff --git a/source3/libsmb/ABI/smbclient-0.4.0.sigs b/source3/libsmb/ABI/smbclient-0.5.0.sigs
similarity index 99%
copy from source3/libsmb/ABI/smbclient-0.4.0.sigs
copy to source3/libsmb/ABI/smbclient-0.5.0.sigs
index 170cb52..b424597 100644
--- a/source3/libsmb/ABI/smbclient-0.4.0.sigs
+++ b/source3/libsmb/ABI/smbclient-0.5.0.sigs
@@ -156,6 +156,7 @@ smbc_setOptionFullTimeNames: void (SMBCCTX *, smbc_bool)
smbc_setOptionNoAutoAnonymousLogin: void (SMBCCTX *, smbc_bool)
smbc_setOptionOneSharePerServer: void (SMBCCTX *, smbc_bool)
smbc_setOptionOpenShareMode: void (SMBCCTX *, smbc_share_mode)
+smbc_setOptionProtocols: smbc_bool (SMBCCTX *, const char *, const char *)
smbc_setOptionSmbEncryptionLevel: void (SMBCCTX *, smbc_smb_encrypt_level)
smbc_setOptionUrlEncodeReaddirEntries: void (SMBCCTX *, smbc_bool)
smbc_setOptionUseCCache: void (SMBCCTX *, smbc_bool)
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 0dfb8b3..6918802 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -196,9 +196,9 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
flags, &c);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("Connection to %s failed (Error %s)\n",
- server,
- nt_errstr(status));
+ DBG_WARNING("Connection to %s failed (Error %s)\n",
+ server,
+ nt_errstr(status));
return status;
}
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index ff19ed5..886aa62 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -825,6 +825,7 @@ SMBC_opendir_ctx(SMBCCTX *context,
}
} else if (srv ||
(resolve_name(server, &rem_ss, 0x20, false))) {
+ int rc;
/*
* If we hadn't found the server, get one now
@@ -851,24 +852,24 @@ SMBC_opendir_ctx(SMBCCTX *context,
/* List the shares ... */
- if (net_share_enum_rpc(
- srv->cli,
- list_fn,
- (void *) dir) < 0 &&
- cli_RNetShareEnum(
- srv->cli,
- list_fn,
- (void *)dir) < 0) {
-
- errno = cli_errno(srv->cli);
- if (dir) {
- SAFE_FREE(dir->fname);
- SAFE_FREE(dir);
- }
+ rc = net_share_enum_rpc(srv->cli,
+ list_fn,
+ (void *)dir);
+ if (rc != 0 &&
+ lp_client_min_protocol() <= PROTOCOL_NT1) {
+ rc = cli_RNetShareEnum(srv->cli,
+ list_fn,
+ (void *)dir);
+ }
+ if (rc != 0) {
+ errno = cli_errno(srv->cli);
+ if (dir != NULL) {
+ SAFE_FREE(dir->fname);
+ SAFE_FREE(dir);
+ }
TALLOC_FREE(frame);
- return NULL;
-
- }
+ return NULL;
+ }
} else {
/* Neither the workgroup nor server exists */
errno = ECONNREFUSED;
diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c
index 60b822a..b1c4ff3 100644
--- a/source3/libsmb/libsmb_setget.c
+++ b/source3/libsmb/libsmb_setget.c
@@ -526,6 +526,24 @@ smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b)
}
}
+smbc_bool
+smbc_setOptionProtocols(SMBCCTX *c,
+ const char *min_proto,
+ const char *max_proto)
+{
+ bool ok = true;
+
+ if (min_proto != NULL) {
+ ok = lp_set_cmdline("client min protocol", min_proto);
+ }
+
+ if (max_proto != NULL) {
+ ok &= lp_set_cmdline("client min protocol", max_proto);
+ }
+
+ return ok;
+}
+
/** Get the function for obtaining authentication data */
smbc_get_auth_data_fn
smbc_getFunctionAuthData(SMBCCTX *c)
diff --git a/source3/libsmb/wscript b/source3/libsmb/wscript
index a3cf93be..d9e933e 100644
--- a/source3/libsmb/wscript
+++ b/source3/libsmb/wscript
@@ -25,5 +25,5 @@ def build(bld):
public_headers='../include/libsmbclient.h',
abi_directory='ABI',
abi_match='smbc_*',
- vnum='0.4.0',
+ vnum='0.5.0',
pc_files='smbclient.pc')
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 8c3547d..a768631 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -332,14 +332,17 @@ for t in base + raw + smb2 + netapi:
plansmbtorture4testsuite(t, "ad_dc_ntvfs", ['//$SERVER/tmp', '-U$USERNAME%$PASSWORD'] + ntvfsargs)
libsmbclient = smbtorture4_testsuites("libsmbclient.")
+protocols = [ 'NT1', 'SMB3' ]
for t in libsmbclient:
url = "smb://$USERNAME:$PASSWORD@$SERVER/tmp"
if t == "libsmbclient.list_shares":
url = "smb://$USERNAME:$PASSWORD@$SERVER"
- libsmbclient_testargs = ["--option=torture:smburl=" + url,
- "--option=torture:replace_smbconf=%s/testdata/samba3/smb_new.conf" % srcdir()]
- plansmbtorture4testsuite(t, "ad_dc", ['//$SERVER/tmp', '-U$USERNAME%$PASSWORD'] + libsmbclient_testargs)
+ for proto in protocols:
+ libsmbclient_testargs = ["--option=torture:smburl=" + url,
+ "--option=torture:replace_smbconf=%s/testdata/samba3/smb_new.conf" % srcdir(),
+ "--option=torture:clientprotocol=%s" % proto]
+ plansmbtorture4testsuite(t, "ad_dc", ['//$SERVER/tmp', '-U$USERNAME%$PASSWORD'] + libsmbclient_testargs, "samba4.%s.%s" % (t, proto))
plansmbtorture4testsuite("raw.qfileinfo.ipc", "ad_dc_ntvfs", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
diff --git a/source4/torture/libsmbclient/libsmbclient.c b/source4/torture/libsmbclient/libsmbclient.c
index fb27ddd..f9154e8 100644
--- a/source4/torture/libsmbclient/libsmbclient.c
+++ b/source4/torture/libsmbclient/libsmbclient.c
@@ -40,9 +40,41 @@ static void debug_callback(void *private_ptr, int level, const char *msg)
return;
}
+static void auth_callback(const char *srv,
+ const char *shr,
+ char *wg, int wglen,
+ char *un, int unlen,
+ char *pw, int pwlen)
+{
+ const char *workgroup =
+ cli_credentials_get_domain(popt_get_cmdline_credentials());
+ const char *username =
+ cli_credentials_get_username(popt_get_cmdline_credentials());
+ const char *password =
+ cli_credentials_get_password(popt_get_cmdline_credentials());
+
+ if (workgroup != NULL) {
+ snprintf(wg, wglen, "%s", workgroup);
+ }
+
+ if (username != NULL) {
+ snprintf(un, unlen, "%s", username);
+ }
+
+ if (password != NULL) {
+ snprintf(pw, pwlen, "%s", password);
+ }
+};
+
bool torture_libsmbclient_init_context(struct torture_context *tctx,
SMBCCTX **ctx_p)
{
+ const char *workgroup =
+ cli_credentials_get_domain(popt_get_cmdline_credentials());
+ const char *username =
+ cli_credentials_get_username(popt_get_cmdline_credentials());
+ const char *client_proto =
+ torture_setting_string(tctx, "clientprotocol", NULL);
SMBCCTX *ctx = NULL;
SMBCCTX *p = NULL;
bool ok = true;
@@ -64,8 +96,18 @@ bool torture_libsmbclient_init_context(struct torture_context *tctx,
smbc_setDebug(ctx, DEBUGLEVEL);
smbc_setOptionDebugToStderr(ctx, 1);
- smbc_setUser(ctx,
- cli_credentials_get_username(popt_get_cmdline_credentials()));
+ if (workgroup != NULL) {
+ smbc_setWorkgroup(ctx, workgroup);
+ }
+ if (username != NULL) {
+ smbc_setUser(ctx, username);
+ }
+
+ smbc_setFunctionAuthData(ctx, auth_callback);
+
+ if (client_proto != NULL) {
+ smbc_setOptionProtocols(ctx, client_proto, client_proto);
+ }
*ctx_p = ctx;
--
Samba Shared Repository
More information about the samba-cvs
mailing list