[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Tue Mar 10 23:09:02 UTC 2020
The branch, master has been updated
via 12596a3a8d0 libcli: Align integer types
via 52b5bcb602a lib: Fix a typo
via c8d5195349d smbd: Fix a comment, "flags" expanded to 2 bytes
via 9653a107389 libsmbclient: Put it back to a known, well-working state
from 0982980dc6d mit-kdc: Explicitly reject S4U requests
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 12596a3a8d057bd0afad530195ae71f55499bebf
Author: Volker Lendecke <vl at samba.org>
Date: Sun Mar 8 16:50:59 2020 +0100
libcli: Align integer types
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Mar 10 23:08:20 UTC 2020 on sn-devel-184
commit 52b5bcb602afc9ce9d2401994b4af54883cc3086
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 9 15:28:14 2020 +0100
lib: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c8d5195349ddc34095cc9c77e6b63afb180bb5c1
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 9 12:36:31 2020 +0100
smbd: Fix a comment, "flags" expanded to 2 bytes
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 9653a1073898b9e78b579b12adedadb669ae2b94
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 10 11:51:09 2020 -0700
libsmbclient: Put it back to a known, well-working state
For adapting unix extensions in our client libraries, we need a fresh start
with additional APIs. We can't change existing application behaviour.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
libcli/smb/smb2_negotiate_context.c | 2 +-
selftest/knownfail | 3 +-
selftest/knownfail.d/libsmbclient | 2 -
selftest/selftesthelpers.py | 15 +--
source3/include/client.h | 6 -
source3/include/libsmb_internal.h | 4 +-
source3/lib/ctdbd_conn.c | 2 +-
source3/libsmb/clifile.c | 122 +++++++++------------
source3/libsmb/clilist.c | 69 +-----------
source3/libsmb/libsmb_dir.c | 64 ++++-------
source3/libsmb/libsmb_file.c | 44 +++-----
source3/libsmb/libsmb_misc.c | 15 +--
source3/libsmb/libsmb_server.c | 1 +
source3/libsmb/libsmb_stat.c | 2 +-
source3/libsmb/proto.h | 8 +-
source3/locking/share_mode_lock.c | 2 +-
.../script/tests/test_smbtorture_s3_no_unix_ext.sh | 14 ---
source3/selftest/tests.py | 24 +---
source4/selftest/tests.py | 47 ++------
source4/torture/libsmbclient/libsmbclient.c | 24 ++--
20 files changed, 134 insertions(+), 336 deletions(-)
delete mode 100644 selftest/knownfail.d/libsmbclient
delete mode 100755 source3/script/tests/test_smbtorture_s3_no_unix_ext.sh
Changeset truncated at 500 lines:
diff --git a/libcli/smb/smb2_negotiate_context.c b/libcli/smb/smb2_negotiate_context.c
index f9c98fcf805..b9b8c763a8e 100644
--- a/libcli/smb/smb2_negotiate_context.c
+++ b/libcli/smb/smb2_negotiate_context.c
@@ -125,7 +125,7 @@ static NTSTATUS smb2_negotiate_context_push_one(TALLOC_CTX *mem_ctx, DATA_BLOB *
NTSTATUS smb2_negotiate_context_push(TALLOC_CTX *mem_ctx, DATA_BLOB *buffer,
const struct smb2_negotiate_contexts contexts)
{
- int i;
+ uint32_t i;
NTSTATUS status;
*buffer = data_blob(NULL, 0);
diff --git a/selftest/knownfail b/selftest/knownfail
index d4381b39a84..4dc434aca7e 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -19,6 +19,7 @@
^samba3.nbt.dgram.*netlogon2\(nt4_dc\)
^samba3.*rap.sam.*.useradd # Not provided by Samba 3
^samba3.*rap.sam.*.userdelete # Not provided by Samba 3
+^samba3.libsmbclient.opendir # This requires a workgroup called 'WORKGROUP' and for netbios browse lists to have been registered
# see bug 8412
^samba3.smb2.rename.*.simple_nodelete
^samba3.smb2.rename.*.no_share_delete_no_delete_access
@@ -140,7 +141,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.(NT1|SMB3).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/selftest/knownfail.d/libsmbclient b/selftest/knownfail.d/libsmbclient
deleted file mode 100644
index 43c3fb6774d..00000000000
--- a/selftest/knownfail.d/libsmbclient
+++ /dev/null
@@ -1,2 +0,0 @@
-# We don't have SMB3 unix extensions yet
-samba4.unix_ext.libsmbclient.readdirplus2.SMB3.readdirplus2.*
diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py
index 1fdb2e461e1..1afabf3cdca 100644
--- a/selftest/selftesthelpers.py
+++ b/selftest/selftesthelpers.py
@@ -172,21 +172,14 @@ smbtorture4_options = [
"--format=subunit"
] + get_env_torture_options()
-def smbtorture4testsuite_cmdarray(name, env, options, target):
- cmdarray = [ valgrindify(smbtorture4), "$LISTOPT", "$LOADLIST" ]
- cmdarray += smbtorture4_options
- cmdarray += [ "--target=%s" % target ]
- cmdarray += options
- cmdarray += [ name ]
- return cmdarray
def plansmbtorture4testsuite(name, env, options, target, modname=None):
if modname is None:
modname = "samba4.%s" % name
- if isinstance(options, str):
- options = options.split()
- cmdarray = smbtorture4testsuite_cmdarray(name, env, options, target)
- cmdline = " ".join(cmdarray)
+ if isinstance(options, list):
+ options = " ".join(options)
+ options = " ".join(smbtorture4_options + ["--target=%s" % target]) + " " + options
+ cmdline = "%s $LISTOPT $LOADLIST %s %s" % (valgrindify(smbtorture4), options, name)
plantestsuite_loadlist(modname, env, cmdline)
diff --git a/source3/include/client.h b/source3/include/client.h
index 34b6a9fc383..23ba86d2a2c 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -114,12 +114,6 @@ struct file_info {
struct timespec mtime_ts;
struct timespec atime_ts;
struct timespec ctime_ts;
-
- /*
- * Native sbuf from posix extensions. Valid if st_ex_nlink!=0.
- */
- SMB_STRUCT_STAT posix_sbuf;
-
char *name;
char *short_name;
};
diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index 78c2cb555e0..21a11c1a024 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -98,7 +98,6 @@ struct smbc_dir_list {
struct smbc_dirplus_list {
struct smbc_dirplus_list *next;
struct libsmb_file_info *smb_finfo;
- SMB_STRUCT_STAT *posix_sbuf;
uint64_t ino;
};
@@ -432,7 +431,8 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
/* Functions in libsmb_misc.c */
-bool SMBC_dlist_contains(SMBCFILE * list, SMBCFILE *p);
+int
+SMBC_dlist_contains(SMBCFILE * list, SMBCFILE *p);
int
SMBC_errno(SMBCCTX *context,
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 843e57287b6..db6ad9404d8 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -1327,7 +1327,7 @@ static void ctdb_pkt_send_cleanup(struct tevent_req *req,
*
* This function will modify the iov array! But
* this is a static function and our only caller
- * ctdb_parse_send/recv is preparared for this to
+ * ctdb_parse_send/recv is prepared for this to
* happen!
**/
static struct tevent_req *ctdb_pkt_send_send(TALLOC_CTX *mem_ctx,
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 164be11386c..dd08b0e30f3 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -736,65 +736,12 @@ NTSTATUS cli_posix_setacl(struct cli_state *cli,
return status;
}
-static void fetch_file_unix_basic_info(
- const uint8_t data[100], SMB_STRUCT_STAT *sbuf)
-{
- ZERO_STRUCTP(sbuf);
-
- /* total size, in bytes */
- sbuf->st_ex_size = IVAL2_TO_SMB_BIG_UINT(data, 0);
-
- /* number of blocks allocated */
- sbuf->st_ex_blocks = IVAL2_TO_SMB_BIG_UINT(data,8);
-#if defined (HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
- sbuf->st_ex_blocks /= STAT_ST_BLOCKSIZE;
-#else
- /* assume 512 byte blocks */
- sbuf->st_ex_blocks /= 512;
-#endif
- /* time of last change */
- sbuf->st_ex_ctime = interpret_long_date((const char *)(data + 16));
-
- /* time of last access */
- sbuf->st_ex_atime = interpret_long_date((const char *)(data + 24));
-
- /* time of last modification */
- sbuf->st_ex_mtime = interpret_long_date((const char *)(data + 32));
-
- sbuf->st_ex_uid = (uid_t) IVAL(data, 40); /* user ID of owner */
- sbuf->st_ex_gid = (gid_t) IVAL(data, 48); /* group ID of owner */
- sbuf->st_ex_mode = unix_filetype_from_wire(IVAL(data, 56));
-
-#if defined(HAVE_MAKEDEV)
- {
- uint32_t dev_major = IVAL(data,60);
- uint32_t dev_minor = IVAL(data,68);
- sbuf->st_ex_rdev = makedev(dev_major, dev_minor);
- }
-#endif
- /* inode */
- sbuf->st_ex_ino = (SMB_INO_T)IVAL2_TO_SMB_BIG_UINT(data, 76);
-
- /* protection */
- sbuf->st_ex_mode |= wire_perms_to_unix(IVAL(data, 84));
-
- /* number of hard links */
- sbuf->st_ex_nlink = BIG_UINT(data, 92);
-}
-
-void fetch_file_unix_basic_info2(
- const uint8_t data[116], SMB_STRUCT_STAT *sbuf)
-{
- fetch_file_unix_basic_info(data, sbuf);
- sbuf->st_ex_btime = interpret_long_date((const char *)(data + 100));
-}
-
/****************************************************************************
Stat a file (UNIX extensions).
****************************************************************************/
struct stat_state {
- SMB_STRUCT_STAT sbuf;
+ SMB_STRUCT_STAT *sbuf;
};
static void cli_posix_stat_done(struct tevent_req *subreq);
@@ -802,7 +749,8 @@ static void cli_posix_stat_done(struct tevent_req *subreq);
struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct cli_state *cli,
- const char *fname)
+ const char *fname,
+ SMB_STRUCT_STAT *sbuf)
{
struct tevent_req *req = NULL, *subreq = NULL;
struct stat_state *state = NULL;
@@ -811,6 +759,7 @@ struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
if (req == NULL) {
return NULL;
}
+ state->sbuf = sbuf;
subreq = cli_qpathinfo_send(state, ev, cli, fname,
SMB_QUERY_FILE_UNIX_BASIC, 100, 100);
@@ -826,7 +775,7 @@ static void cli_posix_stat_done(struct tevent_req *subreq)
struct tevent_req *req = tevent_req_callback_data(
subreq, struct tevent_req);
struct stat_state *state = tevent_req_data(req, struct stat_state);
- SMB_STRUCT_STAT *sbuf = &state->sbuf;
+ SMB_STRUCT_STAT *sbuf = state->sbuf;
uint8_t *data;
uint32_t num_data = 0;
NTSTATUS status;
@@ -846,25 +795,54 @@ static void cli_posix_stat_done(struct tevent_req *subreq)
return;
}
- fetch_file_unix_basic_info(data, sbuf);
+ *sbuf = (SMB_STRUCT_STAT) { 0 };
+
+ /* total size, in bytes */
+ sbuf->st_ex_size = IVAL2_TO_SMB_BIG_UINT(data, 0);
+
+ /* number of blocks allocated */
+ sbuf->st_ex_blocks = IVAL2_TO_SMB_BIG_UINT(data,8);
+#if defined (HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
+ sbuf->st_ex_blocks /= STAT_ST_BLOCKSIZE;
+#else
+ /* assume 512 byte blocks */
+ sbuf->st_ex_blocks /= 512;
+#endif
+ /* time of last change */
+ sbuf->st_ex_ctime = interpret_long_date((char *)(data + 16));
+
+ /* time of last access */
+ sbuf->st_ex_atime = interpret_long_date((char *)(data + 24));
+
+ /* time of last modification */
+ sbuf->st_ex_mtime = interpret_long_date((char *)(data + 32));
+
+ sbuf->st_ex_uid = (uid_t) IVAL(data, 40); /* user ID of owner */
+ sbuf->st_ex_gid = (gid_t) IVAL(data, 48); /* group ID of owner */
+ sbuf->st_ex_mode = unix_filetype_from_wire(IVAL(data, 56));
+
+#if defined(HAVE_MAKEDEV)
+ {
+ uint32_t dev_major = IVAL(data,60);
+ uint32_t dev_minor = IVAL(data,68);
+ sbuf->st_ex_rdev = makedev(dev_major, dev_minor);
+ }
+#endif
+ /* inode */
+ sbuf->st_ex_ino = (SMB_INO_T)IVAL2_TO_SMB_BIG_UINT(data, 76);
+
+ /* protection */
+ sbuf->st_ex_mode |= wire_perms_to_unix(IVAL(data, 84));
+
+ /* number of hard links */
+ sbuf->st_ex_nlink = BIG_UINT(data, 92);
tevent_req_done(req);
}
-NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
- SMB_STRUCT_STAT *sbuf)
+NTSTATUS cli_posix_stat_recv(struct tevent_req *req)
{
- struct stat_state *state = tevent_req_data(req, struct stat_state);
- NTSTATUS status;
-
- if (tevent_req_is_nterror(req, &status)) {
- return status;
- }
- if (sbuf != NULL) {
- *sbuf = state->sbuf;
- }
- tevent_req_received(req);
- return NT_STATUS_OK;
+ return tevent_req_simple_recv_ntstatus(req);
}
NTSTATUS cli_posix_stat(struct cli_state *cli,
@@ -890,7 +868,7 @@ NTSTATUS cli_posix_stat(struct cli_state *cli,
goto fail;
}
- req = cli_posix_stat_send(frame, ev, cli, fname);
+ req = cli_posix_stat_send(frame, ev, cli, fname, sbuf);
if (req == NULL) {
status = NT_STATUS_NO_MEMORY;
goto fail;
@@ -900,7 +878,7 @@ NTSTATUS cli_posix_stat(struct cli_state *cli,
goto fail;
}
- status = cli_posix_stat_recv(req, sbuf);
+ status = cli_posix_stat_recv(req);
fail:
TALLOC_FREE(frame);
diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c
index ca6d8b53129..f868e72a239 100644
--- a/source3/libsmb/clilist.c
+++ b/source3/libsmb/clilist.c
@@ -305,63 +305,6 @@ static size_t interpret_long_filename(TALLOC_CTX *ctx,
}
return calc_next_entry_offset(base, pdata_end);
}
- case SMB_FIND_FILE_UNIX_INFO2:
- {
- SMB_STRUCT_STAT *sbuf = &finfo->posix_sbuf;
- size_t namelen;
-
- if (pdata_end - base < 128) {
- return pdata_end - base;
- }
-
- p += 4; /* next entry offset */
-
- if (p_resume_key) {
- *p_resume_key = IVAL(p,0);
- }
- p += 4; /* fileindex */
-
- fetch_file_unix_basic_info2((const uint8_t *)p, sbuf);
- p += 116;
-
- finfo->mode = S_ISDIR(sbuf->st_ex_mode) ?
- FILE_ATTRIBUTE_DIRECTORY :
- FILE_ATTRIBUTE_NORMAL;
- if (sbuf->st_ex_mode & S_IXUSR) {
- finfo->mode |= FILE_ATTRIBUTE_ARCHIVE;
- }
-
- finfo->size = sbuf->st_ex_size;
- finfo->allocated_size =
- sbuf->st_ex_blksize * sbuf->st_ex_blocks;
- finfo->uid = sbuf->st_ex_uid;
- finfo->gid = sbuf->st_ex_gid;
- finfo->ino = sbuf->st_ex_ino;
- finfo->btime_ts = sbuf->st_ex_btime;
- finfo->mtime_ts = sbuf->st_ex_mtime;
- finfo->atime_ts = sbuf->st_ex_atime;
- finfo->ctime_ts = sbuf->st_ex_ctime;
-
- namelen = IVAL(p, 0);
- p += 4;
-
- if (namelen > (pdata_end - p)) {
- return pdata_end - base;
- }
-
- ret = clistr_pull_talloc(
- ctx,
- base_ptr,
- recv_flags2,
- &finfo->name,
- p,
- namelen,
- 0);
- if (ret == (size_t)-1) {
- return pdata_end - base;
- }
- return calc_next_entry_offset(base, pdata_end);
- }
}
DEBUG(1,("Unknown long filename format %d\n",level));
@@ -1100,7 +1043,6 @@ NTSTATUS cli_list(struct cli_state *cli, const char *mask, uint16_t attribute,
NTSTATUS status = NT_STATUS_NO_MEMORY;
struct file_info *finfo;
size_t i, num_finfo = 0;
- uint32_t caps;
uint16_t info_level;
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
@@ -1121,15 +1063,8 @@ NTSTATUS cli_list(struct cli_state *cli, const char *mask, uint16_t attribute,
goto fail;
}
- caps = smb1cli_conn_capabilities(cli->conn);
-
- if (caps & CAP_UNIX) {
- info_level = SMB_FIND_FILE_UNIX_INFO2;
- } else if (caps & CAP_NT_SMBS) {
- info_level = SMB_FIND_FILE_BOTH_DIRECTORY_INFO;
- } else {
- info_level = SMB_FIND_INFO_STANDARD;
- }
+ info_level = (smb1cli_conn_capabilities(cli->conn) & CAP_NT_SMBS)
+ ? SMB_FIND_FILE_BOTH_DIRECTORY_INFO : SMB_FIND_INFO_STANDARD;
req = cli_list_send(frame, ev, cli, mask, attribute, info_level);
if (req == NULL) {
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 801d556f53b..00d2a878e84 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -49,7 +49,6 @@ static void remove_dirplus(SMBCFILE *dir)
struct smbc_dirplus_list *f = d;
d = d->next;
- SAFE_FREE(f->posix_sbuf);
SAFE_FREE(f->smb_finfo->short_name);
SAFE_FREE(f->smb_finfo->name);
SAFE_FREE(f->smb_finfo);
@@ -213,20 +212,6 @@ static int add_dirplus(SMBCFILE *dir, struct file_info *finfo)
}
new_entry->smb_finfo = info;
- if (finfo->posix_sbuf.st_ex_nlink != 0) {
- new_entry->posix_sbuf = SMB_MALLOC_P(SMB_STRUCT_STAT);
- if (new_entry->posix_sbuf == NULL) {
- SAFE_FREE(info->short_name);
- SAFE_FREE(info->name);
- SAFE_FREE(info);
- SAFE_FREE(new_entry);
- dir->dir_error = ENOMEM;
- return -1;
- }
- *new_entry->posix_sbuf = finfo->posix_sbuf;
- new_entry->posix_sbuf->st_ex_dev = dir->srv->dev;
- }
-
/* Now add to the list. */
if (dir->dirplus_list == NULL) {
/* Empty list - point everything at new_entry. */
@@ -561,12 +546,6 @@ SMBC_opendir_ctx(SMBCCTX *context,
dir->cli_fd = 0;
dir->fname = SMB_STRDUP(fname);
- if (dir->fname == NULL) {
- SAFE_FREE(dir);
- TALLOC_FREE(frame);
- errno = ENOMEM;
- return NULL;
- }
dir->srv = NULL;
dir->offset = 0;
dir->file = False;
@@ -1055,7 +1034,7 @@ SMBC_closedir_ctx(SMBCCTX *context,
return -1;
}
- if (!SMBC_dlist_contains(context->internal->files, dir)) {
+ if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
errno = EBADF;
TALLOC_FREE(frame);
return -1;
@@ -1168,7 +1147,7 @@ SMBC_readdir_ctx(SMBCCTX *context,
}
- if (!SMBC_dlist_contains(context->internal->files, dir)) {
+ if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
errno = EBADF;
DEBUG(0, ("Invalid dir in SMBC_readdir_ctx()\n"));
@@ -1247,7 +1226,9 @@ SMBC_readdirplus_ctx(SMBCCTX *context,
return NULL;
}
- if (!SMBC_dlist_contains(context->internal->files, dir)) {
+ if (dir == NULL ||
+ SMBC_dlist_contains(context->internal->files,
+ dir) == 0) {
DBG_ERR("Invalid dir in SMBC_readdirplus_ctx()\n");
TALLOC_FREE(frame);
errno = EBADF;
@@ -1326,7 +1307,10 @@ const struct libsmb_file_info *SMBC_readdirplus2_ctx(SMBCCTX *context,
return NULL;
}
- if (!SMBC_dlist_contains(context->internal->files, dir)) {
+ if (dir == NULL ||
+ SMBC_dlist_contains(context->internal->files,
+ dir) == 0)
+ {
DBG_ERR("Invalid dir in SMBC_readdirplus2_ctx()\n");
TALLOC_FREE(frame);
errno = EBADF;
@@ -1375,20 +1359,15 @@ const struct libsmb_file_info *SMBC_readdirplus2_ctx(SMBCCTX *context,
return NULL;
}
- if (dp_list->posix_sbuf != NULL) {
- setup_stat_from_stat_ex(dp_list->posix_sbuf, path, st);
- } else {
- setup_stat(
- st,
- path,
--
Samba Shared Repository
More information about the samba-cvs
mailing list