[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Nov 11 20:00:01 UTC 2021


The branch, master has been updated
       via  240addaed7b smbd: Convert ret==false into !ret
       via  b063aa1cf13 lib: Use a direct struct initialization
       via  8f248bee5be smbd: Make sure we don't overwrite tmp_buf
       via  b829d6671f9 smbd: Avoid casts
       via  62d21fac5ff smbd: Fix typos
       via  738dc11cb33 vfs: Use cp_smb_filename_nostream() in vfswrap_parent_pathname()
       via  d64e180ba93 smbd: Move "struct fd_handle" into fd_handle.c
       via  05c41a02dd6 lib: Slightly tune cp_smb_filename_nostream()
       via  68078e560aa libcli4: Remove outdated README file
       via  5e9a781dcb8 vfs: Fix a few typos
       via  cde87d62d35 smbd: Fix a typo
       via  d542cbb9a76 smb.conf.5: Fix a typo for "username map script"
       via  a21bc14e13b libsmb: Move cli_qfilename() to its only user in torture.c
       via  69546f56fe8 dbwrap: Remove unused dbwrap_watched_wakeup()
       via  72e9b8ceede lib: Fix a debug typo in g_lock.c
       via  b7fc678107d libcli: Remove NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT error code
       via  8b89be8c379 VFS: Fix a typo
       via  d0759cb648f libsmb: move reparse_symlink to libcli/smb/
       via  2bb63e04035 libsmb: Avoid a talloc_stackframe.c dependency
       via  5823634b46e libsmb: Introduce "struct symlink_reparse_struct"
       via  58c8289b2ff libsmb: Give reparse_symlink.c its own header
       via  fadce102d47 libcli: "smb_util.h" needs "ntstatus.h"
       via  c05bc2d2218 libsmb: Remove "trans_oob()" macro
       via  8820101cd0b smbclient: Use cli_checkpath in "cd" command
       via  c0fda0bd626 libsmb: Use cli_ntcreate in cli_chkpath
       via  99d1f1fa10d smbd: Remove unused "struct connections_key"
       via  ca8afc66047 smbd: Give smbXsrv_open.c its own header file
      from  c89799beda6 docs-xml: Fix smbget manpage

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


- Log -----------------------------------------------------------------
commit 240addaed7b87759dff13c1c6c18681815c28c92
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 2 10:35:35 2021 +0100

    smbd: Convert ret==false into !ret
    
    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): Thu Nov 11 19:59:03 UTC 2021 on sn-devel-184

commit b063aa1cf13ece9673edbf225281993cfa39085d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 5 11:48:25 2021 +0100

    lib: Use a direct struct initialization
    
    Don't init with 0 just to overwrite again. Probably the compiler will
    figure that out anyway, but to me this looks cleaner.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8f248bee5be182cfbffce99f373cd3675724adba
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Nov 7 19:33:31 2021 +0100

    smbd: Make sure we don't overwrite tmp_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b829d6671f93deeea07ce8b42a023bf9944cb55b
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 5 18:52:56 2021 +0100

    smbd: Avoid casts
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 62d21fac5ff243d92089a635ce07298dc3c3b7c9
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 5 18:52:40 2021 +0100

    smbd: Fix typos
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 738dc11cb336d658ff325fb85ac7402428e24d62
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 5 12:58:58 2021 +0100

    vfs: Use cp_smb_filename_nostream() in vfswrap_parent_pathname()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d64e180ba93630867d0027cca92c51f8f0ca7d31
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 5 12:03:02 2021 +0100

    smbd: Move "struct fd_handle" into fd_handle.c
    
    A separate header file is not required here, everything goes through
    the API published by fd_handle.c. This makes it harder to include the
    fd_handle definition and violate the guarantees.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 05c41a02dd6dee3e29b44b69ac3dd6f60d87b475
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 5 11:51:33 2021 +0100

    lib: Slightly tune cp_smb_filename_nostream()
    
    Don't talloc_strdup() the stream_name, just to free it again.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 68078e560aae6bafbe9ffc48133271b6552ef1e1
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Oct 30 11:45:20 2021 +0200

    libcli4: Remove outdated README file
    
    This has not materialized since 2005. We can easily add it once we
    create libsmbclient4.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5e9a781dcb82f6c1b8049c0cabdf674f2cb76261
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 2 11:16:57 2021 +0100

    vfs: Fix a few typos
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cde87d62d35e7691d29bd7a5aa45022c96db4fd3
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 2 11:06:18 2021 +0100

    smbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d542cbb9a769b6205b990cf9d077a431e0256d5f
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 10 16:19:40 2021 +0100

    smb.conf.5: Fix a typo for "username map script"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a21bc14e13b48fb4d6f0c89159162cb4f4511769
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Oct 29 14:18:02 2021 +0200

    libsmb: Move cli_qfilename() to its only user in torture.c
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 69546f56fe8e259246ce0136471569c621b9f5a5
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Oct 22 13:32:36 2021 +0200

    dbwrap: Remove unused dbwrap_watched_wakeup()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 72e9b8ceede2ac9fc9180a798fec7a2cb62e2be1
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Oct 22 17:30:46 2021 +0200

    lib: Fix a debug typo in g_lock.c
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b7fc678107d99cbd64cd7018840ce2bf8d0eb811
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 14 15:08:55 2021 +0200

    libcli: Remove NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT error code
    
    This is the same as STATUS_STOPPED_ON_SYMLINK, and this is what also
    wireshark displays. Avoid some confusion.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8b89be8c37936272d38d5e7245818f141cbe6828
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 12 12:36:16 2021 +0200

    VFS: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d0759cb648f3d17f7501ea2cf3333d79e4ebcd98
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 24 20:38:19 2021 +0200

    libsmb: move reparse_symlink to libcli/smb/
    
    This will be useful for smbXcli_create to parse the symlink error
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2bb63e04035a65f445ec13206b752b34db4c5f99
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 24 15:28:35 2021 +0200

    libsmb: Avoid a talloc_stackframe.c dependency
    
    This is simple enough for explicit TALLOC_FREE()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5823634b46ef7c1ef959916dd427656e11f76e61
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 24 15:24:42 2021 +0200

    libsmb: Introduce "struct symlink_reparse_struct"
    
    Simplify symlink_reparse_buffer_parse() slightly, failure cleanup
    becomes simpler with that, and this struct will be useful elsewhere
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 58c8289b2ff8bf3a413e82f1d4dc05ab10a6e2d6
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 24 12:45:23 2021 +0200

    libsmb: Give reparse_symlink.c its own header
    
    While there, avoid an "includes.h"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fadce102d477c2cd9ba5cf071b03b1bc5525d2ec
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 24 12:44:56 2021 +0200

    libcli: "smb_util.h" needs "ntstatus.h"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c05bc2d22189f8136aaacd5fc9d76a26c1b5eeeb
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 24 12:38:21 2021 +0200

    libsmb: Remove "trans_oob()" macro
    
    It was just a 1:1 substitution for smb_buffer_oob()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8820101cd0b33aff95febcbe760bb59434b5b289
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 26 10:14:28 2021 +0200

    smbclient: Use cli_checkpath in "cd" command
    
    No need for special qpathinfo_basic code
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c0fda0bd6262a571159b9df02fdc313ef8b32113
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 26 08:51:16 2021 +0200

    libsmb: Use cli_ntcreate in cli_chkpath
    
    cli_ntcreate handles smb2, thus remove cli_smb2_chkpath.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 99d1f1fa10da5c0ab3bb5ebc36152fe091bd3700
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 26 13:56:54 2021 +0200

    smbd: Remove unused "struct connections_key"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ca8afc660474bad2327300bc19d3b01e617f171b
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 26 13:48:28 2021 +0200

    smbd: Give smbXsrv_open.c its own header file
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 docs-xml/smbdotconf/security/usernamemapscript.xml |   2 +-
 {source3/libsmb => libcli/smb}/reparse_symlink.c   | 136 ++++++++++++---------
 .../addrchange.h => libcli/smb/reparse_symlink.h   |  37 +++---
 libcli/smb/smb_util.h                              |   1 +
 libcli/smb/wscript                                 |   1 +
 libcli/util/nterr.c                                |   1 -
 libcli/util/ntstatus.h                             |   1 -
 source3/client/client.c                            |  56 +++------
 source3/include/smb_macros.h                       |   3 -
 source3/include/vfs.h                              |   8 +-
 source3/lib/dbwrap/dbwrap_watch.c                  |  54 --------
 source3/lib/dbwrap/dbwrap_watch.h                  |   8 --
 source3/lib/filename_util.c                        |  25 ++--
 source3/lib/g_lock.c                               |   2 +-
 source3/libsmb/cli_smb2_fnum.c                     |  81 ------------
 source3/libsmb/cli_smb2_fnum.h                     |   6 -
 source3/libsmb/clierror.c                          |   2 +-
 source3/libsmb/clifile.c                           |  53 ++++++--
 source3/libsmb/clirap.c                            |  42 -------
 source3/libsmb/clirap.h                            |   2 -
 source3/libsmb/clireadwrite.c                      |   2 +-
 source3/libsmb/clisymlink.c                        |  23 ++--
 source3/libsmb/proto.h                             |   9 --
 source3/modules/vfs_default.c                      |   3 +-
 source3/smbd/close.c                               |   1 +
 source3/smbd/dosmode.c                             |   2 +-
 source3/smbd/fd_handle.c                           |  19 ++-
 source3/smbd/fd_handle_private.h                   |  41 -------
 source3/smbd/filename.c                            |   2 +-
 source3/smbd/files.c                               |  11 +-
 source3/smbd/globals.h                             |  36 ------
 source3/smbd/ipc.c                                 |  16 +--
 source3/smbd/nttrans.c                             |  16 +--
 source3/smbd/process.c                             |   1 +
 source3/smbd/reply.c                               |   1 +
 source3/smbd/scavenger.c                           |   1 +
 source3/smbd/server.c                              |   1 +
 source3/smbd/smb2_create.c                         |   1 +
 source3/smbd/smb2_server.c                         |   1 +
 source3/smbd/smbXsrv_open.c                        |   1 +
 source3/smbd/smbXsrv_open.h                        |  73 +++++++++++
 source3/smbd/trans2.c                              |  16 +--
 source3/smbd/vfs.c                                 |   2 +-
 source3/torture/torture.c                          |  44 +++++++
 source3/utils/conn_tdb.c                           |  13 +-
 source3/utils/conn_tdb.h                           |   8 +-
 source3/utils/net_serverid.c                       |   1 +
 source3/utils/net_status.c                         |   6 +-
 source3/utils/status.c                             |   3 +-
 source3/wscript_build                              |   1 -
 source4/libcli/smbc/README                         |   1 -
 51 files changed, 378 insertions(+), 499 deletions(-)
 rename {source3/libsmb => libcli/smb}/reparse_symlink.c (67%)
 copy source3/lib/addrchange.h => libcli/smb/reparse_symlink.h (54%)
 delete mode 100644 source3/smbd/fd_handle_private.h
 create mode 100644 source3/smbd/smbXsrv_open.h
 delete mode 100644 source4/libcli/smbc/README


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/security/usernamemapscript.xml b/docs-xml/smbdotconf/security/usernamemapscript.xml
index 7b797cbae1c..7123c536455 100644
--- a/docs-xml/smbdotconf/security/usernamemapscript.xml
+++ b/docs-xml/smbdotconf/security/usernamemapscript.xml
@@ -6,7 +6,7 @@
 <description>
 	<para>This script is a mutually exclusive alternative to the 
 	<smbconfoption name="username map"/> parameter.  This parameter 
-	specifies and external program or script that must accept a single 
+	specifies an external program or script that must accept a single 
 	command line option (the username transmitted in the authentication
 	request) and return a line on standard output (the name to which
 	the account should mapped).  In this way, it is possible to store
diff --git a/source3/libsmb/reparse_symlink.c b/libcli/smb/reparse_symlink.c
similarity index 67%
rename from source3/libsmb/reparse_symlink.c
rename to libcli/smb/reparse_symlink.c
index b0b51814a55..c06195f324c 100644
--- a/source3/libsmb/reparse_symlink.c
+++ b/libcli/smb/reparse_symlink.c
@@ -20,10 +20,13 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "includes.h"
-#include "include/client.h"
-#include "libsmb/proto.h"
-#include "include/ntioctl.h"
+#include "replace.h"
+#include "reparse_symlink.h"
+#include "lib/util/charset/charset.h"
+#include "lib/util/byteorder.h"
+#include "libcli/smb/smb_constants.h"
+#include "libcli/smb/smb_util.h"
+#include "lib/util/debug.h"
 
 bool symlink_reparse_buffer_marshall(
 	const char *substitute, const char *printname, uint32_t flags,
@@ -35,6 +38,8 @@ bool symlink_reparse_buffer_marshall(
 	uint8_t *print_utf16 = NULL;
 	size_t subst_len = 0;
 	size_t print_len = 0;
+	bool ret = false;
+	bool ok;
 
 	if (substitute == NULL) {
 		return false;
@@ -43,14 +48,27 @@ bool symlink_reparse_buffer_marshall(
 		printname = substitute;
 	}
 
-	if (!convert_string_talloc(talloc_tos(), CH_UNIX, CH_UTF16,
-				   substitute, strlen(substitute),
-				   &subst_utf16, &subst_len)) {
+	ok = convert_string_talloc(
+		mem_ctx,
+		CH_UNIX,
+		CH_UTF16,
+		substitute,
+		strlen(substitute),
+		&subst_utf16,
+		&subst_len);
+	if (!ok) {
 		goto fail;
 	}
-	if (!convert_string_talloc(talloc_tos(), CH_UNIX, CH_UTF16,
-				   printname, strlen(printname),
-				   &print_utf16, &print_len)) {
+
+	ok = convert_string_talloc(
+		mem_ctx,
+		CH_UNIX,
+		CH_UTF16,
+		printname,
+		strlen(printname),
+		&print_utf16,
+		&print_len);
+	if (!ok) {
 		goto fail;
 	}
 
@@ -78,42 +96,39 @@ bool symlink_reparse_buffer_marshall(
 
 	if ((subst_utf16 != NULL) && (subst_len != 0)) {
 		memcpy(dst + 20, subst_utf16, subst_len);
-		TALLOC_FREE(subst_utf16);
 	}
 
 	if ((print_utf16 != NULL) && (print_len != 0)) {
 		memcpy(dst + 20 + subst_len, print_utf16, print_len);
-		TALLOC_FREE(print_utf16);
 	}
 
 	*pdst = dst;
 	*pdstlen = dst_len;
-	return true;
+	ret = true;
+
 fail:
 	TALLOC_FREE(subst_utf16);
 	TALLOC_FREE(print_utf16);
-	return false;
+	return ret;
 }
 
-bool symlink_reparse_buffer_parse(
-	const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
-	char **psubstitute_name, char **pprint_name, uint32_t *pflags)
+struct symlink_reparse_struct *symlink_reparse_buffer_parse(
+	TALLOC_CTX *mem_ctx, const uint8_t *src, size_t srclen)
 {
+	struct symlink_reparse_struct *result = NULL;
 	uint16_t reparse_data_length;
 	uint16_t substitute_name_offset, substitute_name_length;
 	uint16_t print_name_offset, print_name_length;
-	uint32_t flags;
-	char *substitute_name = NULL;
-	char *print_name = NULL;
+	bool ok;
 
 	if (srclen < 20) {
 		DEBUG(10, ("srclen = %d, expected >= 20\n", (int)srclen));
-		return false;
+		goto fail;
 	}
 	if (IVAL(src, 0) != IO_REPARSE_TAG_SYMLINK) {
 		DEBUG(10, ("Got ReparseTag %8.8x, expected %8.8x\n",
 			   IVAL(src, 0), IO_REPARSE_TAG_SYMLINK));
-		return false;
+		goto fail;
 	}
 
 	reparse_data_length	= SVAL(src, 4);
@@ -121,65 +136,76 @@ bool symlink_reparse_buffer_parse(
 	substitute_name_length	= SVAL(src, 10);
 	print_name_offset	= SVAL(src, 12);
 	print_name_length	= SVAL(src, 14);
-	flags			= IVAL(src, 16);
 
 	if (reparse_data_length < 12) {
 		DEBUG(10, ("reparse_data_length = %d, expected >= 12\n",
 			   (int)reparse_data_length));
-		return false;
+		goto fail;
 	}
-	if (trans_oob(srclen - 8, reparse_data_length, 0)) {
+	if (smb_buffer_oob(srclen - 8, reparse_data_length, 0)) {
 		DEBUG(10, ("reparse_data_length (%d) too large for "
 			   "src_len (%d)\n", (int)reparse_data_length,
 			   (int)srclen));
-		return false;
+		goto fail;
 	}
-	if (trans_oob(reparse_data_length - 12, substitute_name_offset,
-		      substitute_name_length)) {
+	if (smb_buffer_oob(reparse_data_length - 12, substitute_name_offset,
+			   substitute_name_length)) {
 		DEBUG(10, ("substitute_name (%d/%d) does not fit in "
 			   "reparse_data_length (%d)\n",
 			   (int)substitute_name_offset,
 			   (int)substitute_name_length,
 			   (int)reparse_data_length - 12));
-		return false;
+		goto fail;
 	}
-	if (trans_oob(reparse_data_length - 12, print_name_offset,
-		      print_name_length)) {
+	if (smb_buffer_oob(reparse_data_length - 12, print_name_offset,
+			   print_name_length)) {
 		DEBUG(10, ("print_name (%d/%d) does not fit in "
 			   "reparse_data_length (%d)\n",
 			   (int)print_name_offset,
 			   (int)print_name_length,
 			   (int)reparse_data_length - 12));
-		return false;
+		goto fail;
 	}
 
-	if ((psubstitute_name != NULL) &&
-	    !convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX,
-				   src + 20 + substitute_name_offset,
-				   substitute_name_length,
-				   &substitute_name, NULL)) {
+	result = talloc_zero(mem_ctx, struct symlink_reparse_struct);
+	if (result == NULL) {
+		DBG_DEBUG("talloc failed\n");
+		goto fail;
+	}
+
+	ok = convert_string_talloc(
+		result,
+		CH_UTF16,
+		CH_UNIX,
+		src + 20 + substitute_name_offset,
+		substitute_name_length,
+		&result->substitute_name,
+		NULL);
+	if (!ok) {
 		DEBUG(10, ("convert_string_talloc for substitute_name "
 			   "failed\n"));
-		return false;
+		goto fail;
 	}
-	if ((pprint_name != NULL) &&
-	    !convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX,
-				   src + 20 + print_name_offset,
-				   print_name_length,
-				   &print_name, NULL)) {
+
+	ok = convert_string_talloc(
+		result,
+		CH_UTF16,
+		CH_UNIX,
+		src + 20 + print_name_offset,
+		print_name_length,
+		&result->print_name,
+		NULL);
+	if (!ok) {
 		DEBUG(10, ("convert_string_talloc for print_name "
 			   "failed\n"));
-		TALLOC_FREE(substitute_name);
-		return false;
-	}
-	if (psubstitute_name != NULL) {
-		*psubstitute_name = substitute_name;
-	}
-	if (pprint_name != NULL) {
-		*pprint_name = print_name;
-	}
-	if (pflags != NULL) {
-		*pflags = flags;
+		goto fail;
 	}
-	return true;
+
+	result->unparsed_path_length = SVAL(src, 6);
+	result->flags = IVAL(src, 16);
+
+	return result;
+fail:
+	TALLOC_FREE(result);
+	return NULL;
 }
diff --git a/source3/lib/addrchange.h b/libcli/smb/reparse_symlink.h
similarity index 54%
copy from source3/lib/addrchange.h
copy to libcli/smb/reparse_symlink.h
index 1106380e910..b561fa9fc98 100644
--- a/source3/lib/addrchange.h
+++ b/libcli/smb/reparse_symlink.h
@@ -1,5 +1,9 @@
 /*
- * Samba Unix/Linux SMB client library
+ * Unix SMB/CIFS implementation.
+ *
+ * Implementation of
+ * http://msdn.microsoft.com/en-us/library/cc232006%28v=PROT.13%29.aspx
+ *
  * Copyright (C) Volker Lendecke 2011
  *
  * This program is free software; you can redistribute it and/or modify
@@ -16,30 +20,23 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __ADDRCHANGE_H__
-#define __ADDRCHANGE_H__
+#ifndef __REPARSE_SYMLINK_H__
+#define __REPARSE_SYMLINK_H__
 
 #include "replace.h"
-#include "system/network.h"
 #include <talloc.h>
-#include <tevent.h>
-#include "libcli/util/ntstatus.h"
-
-struct addrchange_context;
-
-NTSTATUS addrchange_context_create(TALLOC_CTX *mem_ctx,
-				   struct addrchange_context **pctx);
-
-struct tevent_req *addrchange_send(TALLOC_CTX *mem_ctx,
-				   struct tevent_context *ev,
-				   struct addrchange_context *ctx);
 
-enum addrchange_type {
-	ADDRCHANGE_ADD,
-	ADDRCHANGE_DEL
+struct symlink_reparse_struct {
+	uint16_t unparsed_path_length; /* reserved for the reparse point */
+	char *substitute_name;
+	char *print_name;
+	uint32_t flags;
 };
 
-NTSTATUS addrchange_recv(struct tevent_req *req, enum addrchange_type *type,
-			 struct sockaddr_storage *addr);
+bool symlink_reparse_buffer_marshall(
+	const char *substitute, const char *printname, uint32_t flags,
+	TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
+struct symlink_reparse_struct *symlink_reparse_buffer_parse(
+	TALLOC_CTX *mem_ctx, const uint8_t *src, size_t srclen);
 
 #endif
diff --git a/libcli/smb/smb_util.h b/libcli/smb/smb_util.h
index 2a727db8b6f..f2cc0fba9cc 100644
--- a/libcli/smb/smb_util.h
+++ b/libcli/smb/smb_util.h
@@ -23,6 +23,7 @@
 #include "system/filesys.h"
 #include "smb_constants.h"
 #include <talloc.h>
+#include "libcli/util/ntstatus.h"
 
 #ifndef _SMB_UTIL_H
 #define _SMB_UTIL_H
diff --git a/libcli/smb/wscript b/libcli/smb/wscript
index c047fd33278..0c9b38ca299 100644
--- a/libcli/smb/wscript
+++ b/libcli/smb/wscript
@@ -45,6 +45,7 @@ def build(bld):
            smb2cli_echo.c
            smb2_posix.c
            tstream_smbXcli_np.c
+           reparse_symlink.c
     ''',
     deps='''
         LIBCRYPTO gnutls NDR_SMB2_LEASE_STRUCT samba-errors gensec krb5samba
diff --git a/libcli/util/nterr.c b/libcli/util/nterr.c
index afcb6c4ba13..3bca6da1b55 100644
--- a/libcli/util/nterr.c
+++ b/libcli/util/nterr.c
@@ -54,7 +54,6 @@ static const nt_err_code_struct special_errs[] =
         { "NT_STATUS_ERROR_DS_OBJ_STRING_NAME_EXISTS", NT_STATUS_ERROR_DS_OBJ_STRING_NAME_EXISTS },
         { "NT_STATUS_ERROR_DS_INCOMPATIBLE_VERSION", NT_STATUS_ERROR_DS_INCOMPATIBLE_VERSION },
         { "NT_STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP", NT_STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP },
-	{ "NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT", NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT },
 	{ "NT_STATUS_ABIOS_NOT_PRESENT", NT_STATUS_ABIOS_NOT_PRESENT },
 	{ "NT_STATUS_ABIOS_LID_NOT_EXIST", NT_STATUS_ABIOS_LID_NOT_EXIST },
 	{ "NT_STATUS_ABIOS_LID_ALREADY_OWNED", NT_STATUS_ABIOS_LID_ALREADY_OWNED },
diff --git a/libcli/util/ntstatus.h b/libcli/util/ntstatus.h
index 66cfd11bc58..6262270472d 100644
--- a/libcli/util/ntstatus.h
+++ b/libcli/util/ntstatus.h
@@ -56,7 +56,6 @@ typedef uint32_t NTSTATUS;
 #define STATUS_NO_MORE_FILES		  NT_STATUS_NO_MORE_FILES
 #define STATUS_INVALID_EA_NAME		  NT_STATUS_INVALID_EA_NAME
 #define STATUS_SOME_UNMAPPED 		  NT_STATUS_SOME_NOT_MAPPED
-#define NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT		NT_STATUS(0x8000002d)
 
 #define NT_STATUS_ABIOS_NOT_PRESENT 		NT_STATUS(0xC0000000 | 0x010f)
 #define NT_STATUS_ABIOS_LID_NOT_EXIST 		NT_STATUS(0xC0000000 | 0x0110)
diff --git a/source3/client/client.c b/source3/client/client.c
index 98425048f4b..a45215a7795 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -388,8 +388,6 @@ static int do_cd(const char *new_dir)
 	char *new_cd = NULL;
 	char *targetpath = NULL;
 	struct cli_state *targetcli = NULL;
-	SMB_STRUCT_STAT sbuf;
-	uint32_t attributes;
 	int ret = 1;
 	TALLOC_CTX *ctx = talloc_stackframe();
 	struct cli_credentials *creds = samba_cmdline_get_creds();
@@ -449,46 +447,24 @@ static int do_cd(const char *new_dir)
 		return 0;
 	}
 
-	/* Use a trans2_qpathinfo to test directories for modern servers.
-	   Except Win9x doesn't support the qpathinfo_basic() call..... */
-
-	if (smbXcli_conn_protocol(targetcli->conn) > PROTOCOL_LANMAN2 && !targetcli->win95) {
-
-		status = cli_qpathinfo_basic(targetcli, targetpath, &sbuf,
-					     &attributes);
-		if (!NT_STATUS_IS_OK(status)) {
-			d_printf("cd %s: %s\n", new_cd, nt_errstr(status));
-			client_set_cur_dir(saved_dir);
-			goto out;
-		}
-
-		if (!(attributes & FILE_ATTRIBUTE_DIRECTORY)) {
-			d_printf("cd %s: not a directory\n", new_cd);
-			client_set_cur_dir(saved_dir);
-			goto out;
-		}
-	} else {
 
-		targetpath = talloc_asprintf(ctx,
-				"%s%s",
-				targetpath,
-				CLI_DIRSEP_STR );
-		if (!targetpath) {
-			client_set_cur_dir(saved_dir);
-			goto out;
-		}
-		targetpath = client_clean_name(ctx, targetpath);
-		if (!targetpath) {
-			client_set_cur_dir(saved_dir);
-			goto out;
-		}
+	targetpath = talloc_asprintf(
+		ctx, "%s%s", targetpath, CLI_DIRSEP_STR);
+	if (!targetpath) {
+		client_set_cur_dir(saved_dir);
+		goto out;
+	}
+	targetpath = client_clean_name(ctx, targetpath);
+	if (!targetpath) {
+		client_set_cur_dir(saved_dir);
+		goto out;
+	}
 
-		status = cli_chkpath(targetcli, targetpath);
-		if (!NT_STATUS_IS_OK(status)) {
-			d_printf("cd %s: %s\n", new_cd, nt_errstr(status));
-			client_set_cur_dir(saved_dir);
-			goto out;
-		}
+	status = cli_chkpath(targetcli, targetpath);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("cd %s: %s\n", new_cd, nt_errstr(status));
+		client_set_cur_dir(saved_dir);
+		goto out;
 	}
 
 	ret = 0;
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index ba2c76764d1..344a997cbd2 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -302,7 +302,4 @@ do { \
 #define ADD_TO_LARGE_ARRAY(mem_ctx, type, elem, array, num, size) \
 	add_to_large_array((mem_ctx), sizeof(type), &(elem), (void *)(array), (num), (size));
 
-#define trans_oob(bufsize, offset, length) \
-	smb_buffer_oob(bufsize, offset, length)
-
 #endif /* _SMB_MACROS_H */
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index da19ed406df..695ba0aebd0 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -523,7 +523,7 @@ typedef struct files_struct {
  * file descriptor that can be used with all VFS calls.
  *
  * The flag "is_fsa" is a property of the FSA layer in Samba. The term FSA
- * layer refers to the parts of smbs that implement Windows NTFS semantics
+ * layer refers to the parts of smbd that implement Windows NTFS semantics
  * on-top of a POSIX filesystem. If "is_fsa" is true, the fsp was
  * processed by the SMB_VFS_CREATE_FILE() VFS call, otherwise the fsp was
  * created by openat_pathref_fsp() which only connected the low-level
@@ -573,7 +573,7 @@ typedef struct files_struct {
  * reference to a filesystem object by opening it with the O_RDONLY flag
  * requires that the caller have read permission on the object, even when
  * the subsequent operation (e.g., fchdir(2), fstat(2)) does not require
- * read permis‐ sion on the object. [1]
+ * read permission on the object. [1]
  *
  * If for example Samba receives an SMB request to open a file requesting
  * SEC_FILE_READ_ATTRIBUTE access rights because the client wants to read
@@ -626,7 +626,7 @@ typedef struct files_struct {
  *
  * A fallback is needed that allows opening a file-handle with the same
  * higher level semantics even if the system doesn't support O_PATH. This
- * is implemented by qimpersonating the root user for the open()
+ * is implemented by impersonating the root user for the open()
  * syscall. To avoid bypassing restrictive permissions on intermediate
  * directories components of a path, the root user is only impersonated
  * after changing directory to the parent directory of the client
@@ -634,7 +634,7 @@ typedef struct files_struct {
  *
  * In order to avoid privilege escalation security issues with these root
  * opened file-handles we must carefully control their usage throughout
- * the codebase. Therefor we
+ * the codebase. Therefore we
  *
  * - tag the pathref fsp's with the flag "is_pathref" and
  *
diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c
index c442bf2e8f6..17a52de37cc 100644
--- a/source3/lib/dbwrap/dbwrap_watch.c
+++ b/source3/lib/dbwrap/dbwrap_watch.c
@@ -811,60 +811,6 @@ static size_t dbwrap_watched_id(struct db_context *db, uint8_t *id,
 	return dbwrap_db_id(ctx->backend, id, idlen);
 }
 
-static void dbwrap_watched_wakeup_fn(
-	struct db_record *rec,
-	TDB_DATA value,
-	void *private_data)
-{
-	uint8_t num_watchers_buf[4] = { 0 };
-	TDB_DATA dbufs[2] = {
-		{
-			.dptr = num_watchers_buf,
-			.dsize = sizeof(num_watchers_buf),
-		},
-		{ 0 },		/* filled in with existing data */


-- 
Samba Shared Repository



More information about the samba-cvs mailing list