[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Wed Oct 30 22:19:02 UTC 2019


The branch, master has been updated
       via  2b060f93502 s3:smbclient added ABI signature file
       via  fe7737135a8 s4: torture: Add additional smbc_readdirplus2() tests into readdirplus_seek().
       via  a5f850a93f5 s4: torture Add a test for smbc_readdirplus2()
       via  abbbbbff376 s3: libsmb: Added new API smbc_readdirplus2()
       via  e26487aab01 s3: libsmb: Add missing ino field to internal struct smbc_dirplus_list.
       via  1f0715c0e5e s3: libsmb: Move setting all struct stat fields into setup_stat().
       via  7d3b4f47be0 s3: libsmb: Move setting st->st_ino into setup_stat.
       via  d44a84295b4 s3: libsmb: Change generate_inode()/setup_stat() to modern coding standards.
       via  f30b8b3aa13 s3: utils: smbtree. Ensure we don't call cli_RNetShareEnum() on an SMB1 connection.
       via  1cfcad6283d s3: libsmb: Ensure we don't call cli_RNetShareEnum() on an SMB1 connection.
      from  41edeff4164 s3:smb2_server: add message mid to SMB2 request done log message

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2b060f935026e68d7ad7a5d4e614452a5119dae8
Author: Puran Chand <pchand at vmware.com>
Date:   Mon Oct 21 11:39:18 2019 +0530

    s3:smbclient added ABI signature file
    
    Signed-off-by: Puran Chand <pchand at vmware.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Wed Oct 30 22:18:15 UTC 2019 on sn-devel-184

commit fe7737135a8f4b28cadc0f79e4de5363a8855a38
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 18 11:44:07 2019 -0700

    s4: torture: Add additional smbc_readdirplus2() tests into readdirplus_seek().
    
    Make sure we haven't broken anything :-).
    
    Signed-off-by: Puran Chand <pchand at vmware.com>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit a5f850a93f5e2eb371ca0a628c94e28c3d033e0f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 18 11:29:19 2019 -0700

    s4: torture Add a test for smbc_readdirplus2()
    
    Signed-off-by: Puran Chand <pchand at vmware.com>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit abbbbbff376877bbe92f3695e480472a4070937a
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 18 10:29:48 2019 -0700

    s3: libsmb: Added new API smbc_readdirplus2()
    
    Returns the same as smbc_readdirplus() but also
    can return a struct stat if passed in by the caller.
    
    struct stat is synthesized from the data
    returned by the SMB server.
    
    Signed-off-by: Puran Chand <pchand at vmware.com>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit e26487aab01096492ec5ed4251039147963a8d1b
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 18 09:45:33 2019 -0700

    s3: libsmb: Add missing ino field to internal struct smbc_dirplus_list.
    
    This should have been added to struct libsmb_file_info, but
    this is user-visible so I don't want to change this now. Adding
    it to the containing struct allows us to synthesise a struct stat
    to return from smbc_readdirplus2() to return all the info from
    the server to callers.
    
    Signed-off-by: Puran Chand <pchand at vmware.com>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 1f0715c0e5e6ff371e3b393a0b35222c8b6f49bc
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 18 10:48:55 2019 -0700

    s3: libsmb: Move setting all struct stat fields into setup_stat().
    
    That way we only have one place where a struct stat is synthesised
    for libsmbclient callers.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 7d3b4f47be0359b496087fc40f89b815c7958dd6
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 18 09:34:02 2019 -0700

    s3: libsmb: Move setting st->st_ino into setup_stat.
    
    Signed-off-by: Puran Chand <pchand at vmware.com>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit d44a84295b46cc6c540a9730a615a59c1f22a277
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 18 09:24:38 2019 -0700

    s3: libsmb: Change generate_inode()/setup_stat() to modern coding standards.
    
    Change setup_stat() to be void. It doesn't return anything. Export
    so it can be used by upcoming smbc_readdirplus2() call.
    
    Remove unused SMBCCTX *context parameters.
    Remove unused talloc_stackframe().
    
    Signed-off-by: Puran Chand <pchand at vmware.com>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit f30b8b3aa1309e9daeb9a3601b537dead81e5dbb
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Oct 29 12:11:49 2019 -0700

    s3: utils: smbtree. Ensure we don't call cli_RNetShareEnum() on an SMB1 connection.
    
    Last unprotected call of cli_RNetShareEnum(). Not a libsmbclient
    bug here but might as well fix the last caller as part of the
    fix for the bug.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14174
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 1cfcad6283da855d3e97237a7a6fd6f4d2436ee2
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Oct 29 12:11:01 2019 -0700

    s3: libsmb: Ensure we don't call cli_RNetShareEnum() on an SMB1 connection.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14174
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/include/libsmb_internal.h                  |  16 ++
 source3/include/libsmbclient.h                     |  26 +++
 .../{smbclient-0.5.0.sigs => smbclient-0.6.0.sigs} |   3 +
 source3/libsmb/libsmb_compat.c                     |   7 +
 source3/libsmb/libsmb_context.c                    |   1 +
 source3/libsmb/libsmb_dir.c                        | 107 +++++++++-
 source3/libsmb/libsmb_setget.c                     |  10 +
 source3/libsmb/libsmb_stat.c                       |  90 ++++----
 source3/libsmb/wscript                             |   2 +-
 source3/selftest/tests.py                          |   3 +-
 source3/utils/smbtree.c                            |   5 +
 source4/torture/libsmbclient/libsmbclient.c        | 231 +++++++++++++++++++++
 12 files changed, 458 insertions(+), 43 deletions(-)
 copy source3/libsmb/ABI/{smbclient-0.5.0.sigs => smbclient-0.6.0.sigs} (97%)


Changeset truncated at 500 lines:

diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index f3e44e875d8..bfb3e064297 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -97,6 +97,7 @@ struct smbc_dir_list {
 struct smbc_dirplus_list {
 	struct smbc_dirplus_list *next;
 	struct libsmb_file_info *smb_finfo;
+	uint64_t ino;
 };
 
 /*
@@ -305,6 +306,11 @@ const struct libsmb_file_info *
 SMBC_readdirplus_ctx(SMBCCTX *context,
                      SMBCFILE *dir);
 
+const struct libsmb_file_info *
+SMBC_readdirplus2_ctx(SMBCCTX *context,
+		SMBCFILE *dir,
+		struct stat *st);
+
 int
 SMBC_getdents_ctx(SMBCCTX *context,
                   SMBCFILE *dir,
@@ -522,6 +528,16 @@ SMBC_attr_server(TALLOC_CTX *ctx,
 
 
 /* Functions in libsmb_stat.c */
+void setup_stat(struct stat *st,
+		const char *fname,
+		off_t size,
+		int mode,
+		ino_t ino,
+		dev_t dev,
+		struct timespec access_time_ts,
+		struct timespec change_time_ts,
+		struct timespec write_time_ts);
+
 int
 SMBC_stat_ctx(SMBCCTX *context,
               const char *fname,
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index b045221f12b..835c832b76a 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -1046,6 +1046,12 @@ typedef const struct libsmb_file_info * (*smbc_readdirplus_fn)(SMBCCTX *c,
 smbc_readdirplus_fn smbc_getFunctionReaddirPlus(SMBCCTX *c);
 void smbc_setFunctionReaddirPlus(SMBCCTX *c, smbc_readdirplus_fn fn);
 
+typedef const struct libsmb_file_info * (*smbc_readdirplus2_fn)(SMBCCTX *c,
+					SMBCFILE *dir,
+					struct stat *st);
+smbc_readdirplus2_fn smbc_getFunctionReaddirPlus2(SMBCCTX *c);
+void smbc_setFunctionReaddirPlus2(SMBCCTX *c, smbc_readdirplus2_fn fn);
+
 typedef int (*smbc_getdents_fn)(SMBCCTX *c,
                                 SMBCFILE *dir,
                                 struct smbc_dirent *dirp,
@@ -1654,6 +1660,25 @@ struct smbc_dirent* smbc_readdir(unsigned int dh);
  */
 const struct libsmb_file_info *smbc_readdirplus(unsigned int dh);
 
+/**@ingroup directory
+ * Works similar as smbc_readdirplus as well as fills up stat structure if
+ * provided.
+ *
+ * @param dh        Valid directory as returned by smbc_opendir()
+ *
+ * @param stat      Pointer to stat structure which will receive the
+ *                  information. If this pointer is null the call
+ *                  is identical to smbc_readdirplus.
+ *
+ * @return          A const pointer to a libsmb_file_info structure,
+ *                  or NULL if an error occurs or end-of-directory is reached:
+ *                  - EBADF Invalid directory handle
+ *                  - EINVAL smbc_init() failed or has not been called
+ *
+ * @see             smbc_open(), smbc_readdir(), smbc_readdirplus2()
+ */
+const struct libsmb_file_info *smbc_readdirplus2(unsigned int dh,
+					struct stat *st);
 
 /**@ingroup directory
  * Get the current directory offset.
@@ -3104,6 +3129,7 @@ struct _SMBCCTX
         smbc_closedir_fn                closedir DEPRECATED_SMBC_INTERFACE;
         smbc_readdir_fn                 readdir DEPRECATED_SMBC_INTERFACE;
         smbc_readdirplus_fn             readdirplus DEPRECATED_SMBC_INTERFACE;
+	smbc_readdirplus2_fn            readdirplus2 DEPRECATED_SMBC_INTERFACE;
         smbc_getdents_fn                getdents DEPRECATED_SMBC_INTERFACE;
         smbc_mkdir_fn                   mkdir DEPRECATED_SMBC_INTERFACE;
         smbc_rmdir_fn                   rmdir DEPRECATED_SMBC_INTERFACE;
diff --git a/source3/libsmb/ABI/smbclient-0.5.0.sigs b/source3/libsmb/ABI/smbclient-0.6.0.sigs
similarity index 97%
copy from source3/libsmb/ABI/smbclient-0.5.0.sigs
copy to source3/libsmb/ABI/smbclient-0.6.0.sigs
index b4245979c24..ee758e21b50 100644
--- a/source3/libsmb/ABI/smbclient-0.5.0.sigs
+++ b/source3/libsmb/ABI/smbclient-0.6.0.sigs
@@ -40,6 +40,7 @@ smbc_getFunctionPurgeCachedServers: smbc_purge_cached_fn (SMBCCTX *)
 smbc_getFunctionRead: smbc_read_fn (SMBCCTX *)
 smbc_getFunctionReaddir: smbc_readdir_fn (SMBCCTX *)
 smbc_getFunctionReaddirPlus: smbc_readdirplus_fn (SMBCCTX *)
+smbc_getFunctionReaddirPlus2: smbc_readdirplus2_fn (SMBCCTX *)
 smbc_getFunctionRemoveCachedServer: smbc_remove_cached_srv_fn (SMBCCTX *)
 smbc_getFunctionRemoveUnusedServer: smbc_remove_unused_server_fn (SMBCCTX *)
 smbc_getFunctionRemovexattr: smbc_removexattr_fn (SMBCCTX *)
@@ -98,6 +99,7 @@ smbc_print_file: int (const char *, const char *)
 smbc_read: ssize_t (int, void *, size_t)
 smbc_readdir: struct smbc_dirent *(unsigned int)
 smbc_readdirplus: const struct libsmb_file_info *(unsigned int)
+smbc_readdirplus2: const struct libsmb_file_info *(unsigned int, struct stat *)
 smbc_removexattr: int (const char *, const char *)
 smbc_rename: int (const char *, const char *)
 smbc_rmdir: int (const char *)
@@ -132,6 +134,7 @@ smbc_setFunctionPurgeCachedServers: void (SMBCCTX *, smbc_purge_cached_fn)
 smbc_setFunctionRead: void (SMBCCTX *, smbc_read_fn)
 smbc_setFunctionReaddir: void (SMBCCTX *, smbc_readdir_fn)
 smbc_setFunctionReaddirPlus: void (SMBCCTX *, smbc_readdirplus_fn)
+smbc_setFunctionReaddirPlus2: void (SMBCCTX *, smbc_readdirplus2_fn)
 smbc_setFunctionRemoveCachedServer: void (SMBCCTX *, smbc_remove_cached_srv_fn)
 smbc_setFunctionRemoveUnusedServer: void (SMBCCTX *, smbc_remove_unused_server_fn)
 smbc_setFunctionRemovexattr: void (SMBCCTX *, smbc_removexattr_fn)
diff --git a/source3/libsmb/libsmb_compat.c b/source3/libsmb/libsmb_compat.c
index eb38480a5c6..c916122d0b8 100644
--- a/source3/libsmb/libsmb_compat.c
+++ b/source3/libsmb/libsmb_compat.c
@@ -291,6 +291,13 @@ const struct libsmb_file_info *smbc_readdirplus(unsigned int dh)
 	return smbc_getFunctionReaddirPlus(statcont)(statcont, file);
 }
 
+const struct libsmb_file_info *smbc_readdirplus2(unsigned int dh,
+		struct stat *st)
+{
+	SMBCFILE *file = find_fd(dh);
+	return smbc_getFunctionReaddirPlus2(statcont)(statcont, file, st);
+}
+
 off_t
 smbc_telldir(int dh)
 {
diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c
index 9e7b083952f..48e417ba523 100644
--- a/source3/libsmb/libsmb_context.c
+++ b/source3/libsmb/libsmb_context.c
@@ -209,6 +209,7 @@ smbc_new_context(void)
         smbc_setFunctionClosedir(context, SMBC_closedir_ctx);
         smbc_setFunctionReaddir(context, SMBC_readdir_ctx);
         smbc_setFunctionReaddirPlus(context, SMBC_readdirplus_ctx);
+	smbc_setFunctionReaddirPlus2(context, SMBC_readdirplus2_ctx);
         smbc_setFunctionGetdents(context, SMBC_getdents_ctx);
         smbc_setFunctionMkdir(context, SMBC_mkdir_ctx);
         smbc_setFunctionRmdir(context, SMBC_rmdir_ctx);
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index df606c4adfe..851be5de8ff 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -170,6 +170,7 @@ static int add_dirplus(SMBCFILE *dir, struct file_info *finfo)
 		return -1;
 	}
 	ZERO_STRUCTP(new_entry);
+	new_entry->ino = finfo->ino;
 
 	info = SMB_MALLOC_P(struct libsmb_file_info);
 	if (info == NULL) {
@@ -856,7 +857,12 @@ SMBC_opendir_ctx(SMBCCTX *context,
 							list_fn,
 							(void *)dir);
 				if (rc != 0 &&
-				    lp_client_min_protocol() <= PROTOCOL_NT1) {
+				    smbXcli_conn_protocol(srv->cli->conn) <=
+						PROTOCOL_NT1) {
+					/*
+					 * Only call cli_RNetShareEnum()
+					 * on SMB1 connections, not SMB2+.
+					 */
 					rc = cli_RNetShareEnum(srv->cli,
 							       list_fn,
 							       (void *)dir);
@@ -1246,6 +1252,105 @@ SMBC_readdirplus_ctx(SMBCCTX *context,
 	return smb_finfo;
 }
 
+/*
+ * Routine to get a directory entry plus a filled in stat structure if
+ * requested.
+ */
+
+const struct libsmb_file_info *SMBC_readdirplus2_ctx(SMBCCTX *context,
+			SMBCFILE *dir,
+			struct stat *st)
+{
+	struct libsmb_file_info *smb_finfo = NULL;
+	struct smbc_dirplus_list *dp_list = NULL;
+	ino_t ino;
+	char *full_pathname = NULL;
+	TALLOC_CTX *frame = NULL;
+
+	/*
+	 * Allow caller to pass in NULL for stat pointer if
+	 * required. This makes this call identical to
+	 * smbc_readdirplus().
+	 */
+
+	if (st == NULL) {
+		return SMBC_readdirplus_ctx(context, dir);
+	}
+
+	frame = talloc_stackframe();
+
+	/* Check that all is ok first ... */
+	if (context == NULL || !context->internal->initialized) {
+		DBG_ERR("Invalid context in SMBC_readdirplus2_ctx()\n");
+		TALLOC_FREE(frame);
+		errno = EINVAL;
+		return NULL;
+	}
+
+	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;
+		return NULL;
+	}
+
+	dp_list = dir->dirplus_next;
+	if (dp_list == NULL) {
+		TALLOC_FREE(frame);
+		return NULL;
+	}
+
+	ino = (ino_t)dp_list->ino;
+
+	smb_finfo = dp_list->smb_finfo;
+	if (smb_finfo == NULL) {
+		TALLOC_FREE(frame);
+		errno = ENOENT;
+		return NULL;
+	}
+
+	full_pathname = talloc_asprintf(frame,
+				"%s/%s",
+				dir->fname,
+				smb_finfo->name);
+	if (full_pathname == NULL) {
+		TALLOC_FREE(frame);
+		errno = ENOENT;
+		return NULL;
+	}
+
+	setup_stat(st,
+		full_pathname,
+		smb_finfo->size,
+		smb_finfo->attrs,
+		ino,
+		dir->srv->dev,
+		smb_finfo->atime_ts,
+		smb_finfo->ctime_ts,
+		smb_finfo->mtime_ts);
+
+	TALLOC_FREE(full_pathname);
+
+	dir->dirplus_next = dir->dirplus_next->next;
+
+	/*
+	 * If we are returning file entries, we
+	 * have a duplicate list in dir_list
+	 *
+	 * Update dir_next also so readdir and
+	 * readdirplus are kept in sync.
+	 */
+	if (dir->dir_list) {
+		dir->dir_next = dir->dir_next->next;
+	}
+
+	TALLOC_FREE(frame);
+	return smb_finfo;
+}
+
 /*
  * Routine to get directory entries
  */
diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c
index 9696f5f00ac..d071efa1191 100644
--- a/source3/libsmb/libsmb_setget.c
+++ b/source3/libsmb/libsmb_setget.c
@@ -907,6 +907,16 @@ void smbc_setFunctionReaddirPlus(SMBCCTX *c, smbc_readdirplus_fn fn)
 	c->readdirplus = fn;
 }
 
+smbc_readdirplus2_fn smbc_getFunctionReaddirPlus2(SMBCCTX *c)
+{
+	return c->readdirplus2;
+}
+
+void smbc_setFunctionReaddirPlus2(SMBCCTX *c, smbc_readdirplus2_fn fn)
+{
+	c->readdirplus2 = fn;
+}
+
 smbc_getdents_fn
 smbc_getFunctionGetdents(SMBCCTX *c)
 {
diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index 2f6e66c08e5..0db9be3677b 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -32,16 +32,11 @@
  * Generate an inode number from file name for those things that need it
  */
 
-static ino_t
-generate_inode(SMBCCTX *context,
-               const char *name)
+static ino_t generate_inode(const char *name)
 {
-	if (!context || !context->internal->initialized) {
-		errno = EINVAL;
-		return -1;
+	if (name == NULL) {
+		return (ino_t)-1;
 	}
-
-	if (!*name) return 2; /* FIXME, why 2 ??? */
 	return (ino_t)str_checksum(name);
 }
 
@@ -50,15 +45,16 @@ generate_inode(SMBCCTX *context,
  * fstat below.
  */
 
-static int
-setup_stat(SMBCCTX *context,
-           struct stat *st,
-           const char *fname,
-           off_t size,
-           int mode)
+void setup_stat(struct stat *st,
+		const char *fname,
+		off_t size,
+		int mode,
+		ino_t ino,
+		dev_t dev,
+		struct timespec access_time_ts,
+		struct timespec change_time_ts,
+		struct timespec write_time_ts)
 {
-	TALLOC_CTX *frame = talloc_stackframe();
-
 	st->st_mode = 0;
 
 	if (IS_DOS_DIR(mode)) {
@@ -67,10 +63,18 @@ setup_stat(SMBCCTX *context,
 		st->st_mode = SMBC_FILE_MODE;
 	}
 
-	if (IS_DOS_ARCHIVE(mode)) st->st_mode |= S_IXUSR;
-	if (IS_DOS_SYSTEM(mode)) st->st_mode |= S_IXGRP;
-	if (IS_DOS_HIDDEN(mode)) st->st_mode |= S_IXOTH;
-	if (!IS_DOS_READONLY(mode)) st->st_mode |= S_IWUSR;
+	if (IS_DOS_ARCHIVE(mode)) {
+		st->st_mode |= S_IXUSR;
+	}
+	if (IS_DOS_SYSTEM(mode)) {
+		st->st_mode |= S_IXGRP;
+	}
+	if (IS_DOS_HIDDEN(mode)) {
+		st->st_mode |= S_IXOTH;
+	}
+	if (!IS_DOS_READONLY(mode)) {
+		st->st_mode |= S_IWUSR;
+	}
 
 	st->st_size = size;
 #ifdef HAVE_STAT_ST_BLKSIZE
@@ -91,12 +95,16 @@ setup_stat(SMBCCTX *context,
 		st->st_nlink = 1;
 	}
 
-	if (st->st_ino == 0) {
-		st->st_ino = generate_inode(context, fname);
+	if (ino != 0) {
+		st->st_ino = ino;
+	} else {
+		st->st_ino = generate_inode(fname);
 	}
 
-	TALLOC_FREE(frame);
-	return True;  /* FIXME: Is this needed ? */
+	st->st_dev = dev;
+	st->st_atime = convert_timespec_to_time_t(access_time_ts);
+	st->st_ctime = convert_timespec_to_time_t(change_time_ts);
+	st->st_mtime = convert_timespec_to_time_t(write_time_ts);
 }
 
 /*
@@ -181,14 +189,15 @@ SMBC_stat_ctx(SMBCCTX *context,
 		return -1;
 	}
 
-	st->st_ino = ino;
-
-	setup_stat(context, st, fname, size, mode);
-
-	st->st_atime = convert_timespec_to_time_t(access_time_ts);
-	st->st_ctime = convert_timespec_to_time_t(change_time_ts);
-	st->st_mtime = convert_timespec_to_time_t(write_time_ts);
-	st->st_dev   = srv->dev;
+	setup_stat(st,
+		fname,
+		size,
+		mode,
+		ino,
+		srv->dev,
+		access_time_ts,
+		change_time_ts,
+		write_time_ts);
 
 	TALLOC_FREE(frame);
 	return 0;
@@ -286,14 +295,15 @@ SMBC_fstat_ctx(SMBCCTX *context,
 		write_time_ts = convert_time_t_to_timespec(write_time);
 	}
 
-	st->st_ino = ino;
-
-	setup_stat(context, st, file->fname, size, mode);
-
-	st->st_atime = convert_timespec_to_time_t(access_time_ts);
-	st->st_ctime = convert_timespec_to_time_t(change_time_ts);
-	st->st_mtime = convert_timespec_to_time_t(write_time_ts);
-	st->st_dev = file->srv->dev;
+	setup_stat(st,
+		file->fname,
+		size,
+		mode,
+		ino,
+		file->srv->dev,
+		access_time_ts,
+		change_time_ts,
+		write_time_ts);
 
 	TALLOC_FREE(frame);
 	return 0;
diff --git a/source3/libsmb/wscript b/source3/libsmb/wscript
index febff9df7fc..ec4a516b2ee 100644
--- a/source3/libsmb/wscript
+++ b/source3/libsmb/wscript
@@ -26,5 +26,5 @@ def build(bld):
                        public_headers='../include/libsmbclient.h',
                        abi_directory='ABI',
                        abi_match='smbc_*',
-                       vnum='0.5.0',
+                       vnum='0.6.0',
                        pc_files='smbclient.pc')
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index a7b098d6518..a744e22fe88 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -509,7 +509,8 @@ libsmbclient = ["libsmbclient.version", "libsmbclient.initialize",
                 "libsmbclient.configuration", "libsmbclient.setConfiguration",
                 "libsmbclient.options", "libsmbclient.opendir",
                 "libsmbclient.list_shares", "libsmbclient.readdirplus",
-		"libsmbclient.readdirplus_seek"]
+		"libsmbclient.readdirplus_seek",
+		"libsmbclient.readdirplus2"]
 
 vfs = [
     "vfs.fruit",
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index 0a0dac0f9d5..8e4caf0e80b 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -26,6 +26,7 @@
 #include "libsmb/libsmb.h"
 #include "libsmb/namequery.h"
 #include "libsmb/clirap.h"
+#include "../libcli/smb/smbXcli_base.h"
 
 static int use_bcast;
 
@@ -231,6 +232,10 @@ static bool get_shares(char *server_name, const struct user_auth_info *user_info
 	if (get_rpc_shares(cli, add_name, &shares))
 		return True;
 
+	if (smbXcli_conn_protocol(cli->conn) > PROTOCOL_NT1) {
+		return false;
+	}
+
         if (!cli_RNetShareEnum(cli, add_name, &shares))
                 return False;
 
diff --git a/source4/torture/libsmbclient/libsmbclient.c b/source4/torture/libsmbclient/libsmbclient.c
index b74d87aabed..586e1772425 100644
--- a/source4/torture/libsmbclient/libsmbclient.c
+++ b/source4/torture/libsmbclient/libsmbclient.c
@@ -395,6 +395,10 @@ static bool torture_libsmbclient_readdirplus_seek(struct torture_context *tctx)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list