[SCM] Samba Shared Repository - branch v4-0-test updated

Karolin Seeger kseeger at samba.org
Thu Mar 21 04:16:04 MDT 2013


The branch, v4-0-test has been updated
       via  9ec44d4 Fix bug #9724 - is_encrypted_packet() function incorrectly used inside server.
       via  a654c08 torture: Add ntprinting latin1 test.
       via  b534ead s3-net: Add encoding=<CP> to 'net printing dump'.
       via  70dcc78 s3-net: Add encoding=<CP> to 'net printing migrate'.
       via  0489843 ndr: Pass down string_flags in ndr_pull_ntprinting_printer().
       via  55412b5 idl: Add flags for strings in ntprinting idl.
       via  cf9ee96 ndr: Add ndr_ntprinting_string_flags() function.
       via  741fd64 pidl: Add skip option to elements.
       via  8fad4c2 s4:torture: let raw.read accept larger reads than 0x10000
       via  da2f210 s4:torture: raw.read fix large reads against windows
       via  cb3060c s3:selftest: Add LARGE_READX test into our make test infrastructure.
       via  1b5cd25 s3:torture: Add new LARGE_READX test to investigate large SMBreadX behavior.
       via  08b2857 s4:smb_server: fix large read_andx requests
       via  3344ca5 s3:smbd: Add functions calc_max_read_pdu()/calc_read_size() to work out the length we should return.
       via  675795f s3:smbd: Remove server_will_accept_large_read() and erroneous comment.
       via  9489ebc s3:smbd: Fix off-by 4 error in wrap protection code in create_outbuf()
       via  4c28065 s3:smbd: add some const to req_is_in_chain()
       via  3cc5f83 s3:smbd: remove silly (SMB_OFF_T_BITS == 64) checks
       via  279d3d5 s3:smbd: keep global_client_caps and max_send from the first successful session setup
       via  0048feb s3:libsmb: let cli_read_andx_create() accept any length
       via  6f5301f libcli/smb: smb1cli_inbuf_parse_chain() and smb1cli_conn_dispatch_incoming() should use smb_len_tcp.
       via  6b94fa4 libcli/smb: defer failing for missing NEGOTIATE_SECURITY_SIGNATURES_ENABLED
       via  fdb9831 s3:libsmb: make use of SMB_CAP_LEGACY_CLIENT_MASK instead of SMB_CAP_CLIENT_MASK
       via  69e441d libcli/smb: add SMB_CAP_LEGACY_CLIENT_MASK define
       via  615bdb0 s4:winbindd: do not drop the workgroup name in the getgrgid call
       via  4eb6093 s4:winbindd: do not drop the workgroup name in the getgrnam and getgrent calls.
       via  0e7afd7 WHATSNEW: clarify how being a domain member server is supported in Samba 4.0
      from  50c476e VERSION: Bump version number up to 4.0.5.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 9ec44d4df48cc9fd25e97edde9b4a9e92a7c1559
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 15 15:05:31 2013 -0700

    Fix bug #9724 - is_encrypted_packet() function incorrectly used inside server.
    
    The is_encrypted_packet() function should only be used on the raw received data
    to determine if a packet came in encrypted. Once we're inside the SMB1
    processing code in smbd/reply.c we should be looking at the
    smb1request->encrypted field to determine if a packet was really encrypted or
    not.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Sat Mar 16 12:44:44 CET 2013 on sn-devel-104
    (cherry picked from commit 1d15fc75a33b7368049876368f4b70c188bbd55e)
    
    Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-0-test): Thu Mar 21 11:15:16 CET 2013 on sn-devel-104

commit a654c08d87c2756164d87807282c4f0a3d235a2a
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Mar 14 07:29:20 2013 +0100

    torture: Add ntprinting latin1 test.
    
    Reviewed-by: Günther Deschner <gd at samba.org>
    
    The last 7 patches address bug #9723 - Add a tool to migrate latin1 printing
    tdb's to registry.

commit b534eada1bf730b2115143f0f562262f7e2dc106
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 12 18:42:02 2013 +0100

    s3-net: Add encoding=<CP> to 'net printing dump'.
    
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 70dcc78ad58ced5f6d88f6feae46385302e60503
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 12 11:39:08 2013 +0100

    s3-net: Add encoding=<CP> to 'net printing migrate'.
    
    This allows you to convert printing tdb's which are in e.g. in latin1 to
    convert to UTF-8 and import them into the registry.
    
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 0489843ac207a339611a9aab713e2f3104e9cef8
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 12 15:17:54 2013 +0100

    ndr: Pass down string_flags in ndr_pull_ntprinting_printer().
    
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 55412b5558fd6e83208b3d2e13c68ce474e0955b
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Mar 11 15:47:00 2013 +0100

    idl: Add flags for strings in ntprinting idl.
    
    Reviewed-by: Günther Deschner <gd at samba.org>

commit cf9ee9602bfb5e8f5bcd4753d2bcb46dcaa840b1
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Mar 11 15:45:15 2013 +0100

    ndr: Add ndr_ntprinting_string_flags() function.
    
    It defaults to utf8string.
    
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 741fd646ea5f697ec6508d76fb135b55a4ff962d
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 12 11:36:38 2013 +0100

    pidl: Add skip option to elements.
    
    This option allows to skip struct elements in pull and push function.
    This can be used to pass flags to the structure e.g. for string values.
    
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 8fad4c28716ae230d74e065524d989e049a47cca
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 20 08:49:20 2013 +0100

    s4:torture: let raw.read accept larger reads than 0x10000
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    The last 16 patches address bug #9706 - Parameter is incorrect on Android.

commit da2f210925d4932319b749b7283d2c00d4d47ac6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 19 17:11:03 2013 +0100

    s4:torture: raw.read fix large reads against windows
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cb3060cbe69ff9d3d6d105437d6faba80d2d44ea
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 13 15:45:12 2013 -0700

    s3:selftest: Add LARGE_READX test into our make test infrastructure.
    
    Tested against non-encrypted and encrypted connections.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 1b5cd254031d41442d03c4360655aa427ba2b8b0
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 13 15:43:21 2013 -0700

    s3:torture: Add new LARGE_READX test to investigate large SMBreadX behavior.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 08b28578be3bfbee15ee6569fb2a3492c1ae7067
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Mar 18 19:50:38 2013 +0100

    s4:smb_server: fix large read_andx requests
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3344ca5744039aad0857925650dbd20f6a447763
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 15 11:57:48 2013 -0700

    s3:smbd: Add functions calc_max_read_pdu()/calc_read_size() to work out the length we should return.
    
    LARGE_READX test shows it's always safe to return a short read.
    Windows does so. Do the calculations to return what will fit
    in a read depending on what the client negotiated.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 675795fbcc259509e81c77d35f5a908a97f155d8
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 15 11:53:04 2013 -0700

    s3:smbd: Remove server_will_accept_large_read() and erroneous comment.
    
    We're going to replace this with a function that calculates
    the max PDU to return on a read and supports short reads.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 9489ebc573e26d2857a00b598352298268fabbf8
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 18 15:05:24 2013 -0700

    s3:smbd: Fix off-by 4 error in wrap protection code in create_outbuf()
    
    Subtract 4 from smb_size (39) here as the length
    of the SMB reply following the 4 byte type+length
    field can be up to 0xFFFFFF bytes.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 4c280654bc073876dcdda45c7a870eea69c7f6ff
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Mar 18 12:36:30 2013 +0100

    s3:smbd: add some const to req_is_in_chain()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3cc5f83ec23fd9c9b980e851a50b2460e32c54af
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 19 13:24:46 2013 +0100

    s3:smbd: remove silly (SMB_OFF_T_BITS == 64) checks
    
    configure will abort if sizeof(off_t) is not 8.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 279d3d58e6289d183fcc613900538c43b2eea726
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Mar 18 10:10:25 2013 +0100

    s3:smbd: keep global_client_caps and max_send from the first successful session setup
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0048feb8dd6704eb4842804f0a50cca54c7cc684
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Mar 18 09:33:00 2013 +0100

    s3:libsmb: let cli_read_andx_create() accept any length
    
    It's up to the server to decide the allowed length.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6f5301f263a87498b720cca5c19d927ffee06128
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 13 15:23:52 2013 -0700

    libcli/smb: smb1cli_inbuf_parse_chain() and smb1cli_conn_dispatch_incoming() should use smb_len_tcp.
    
    They have to cope with large READX call replies that have
    a length greater than smb_len_nbt() can handle.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 6b94fa4773ef13691944e2f5afa412ddb8d2e729
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Mar 18 15:02:55 2013 +0100

    libcli/smb: defer failing for missing NEGOTIATE_SECURITY_SIGNATURES_ENABLED
    
    Windows servers take a look at the FLAGS2_SMB_SECURITY_SIGNATURES_REQUIRED
    flag during a session setup and turn on signing if the client requires it.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fdb9831bbe0c3095cf2c6e7b394ce1abf6a0c04b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 19 09:03:38 2013 +0100

    s3:libsmb: make use of SMB_CAP_LEGACY_CLIENT_MASK instead of SMB_CAP_CLIENT_MASK
    
    This should allow smbclient to keep using large reads against older Samba versions
    (<= 3.6.x) and other servers that may also require this.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 69e441de2e5bad9ee0b5e028d6cd982e24f8470f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 19 09:02:52 2013 +0100

    libcli/smb: add SMB_CAP_LEGACY_CLIENT_MASK define
    
    Older Samba releases (<= 3.6.x)
    expect the client to send CAP_LARGE_READX
    in order to let the client use large reads.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 615bdb0f108f78ce177b4ccccc76358c4f06dd37
Author: Michael Adam <obnox at samba.org>
Date:   Wed Feb 27 01:04:46 2013 +0100

    s4:winbindd: do not drop the workgroup name in the getgrgid call
    
    Second part of fix for bug #9711.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed Feb 27 05:44:39 CET 2013 on sn-devel-104
    (cherry picked from commit bb0e4cbc3c30137245ca6b6cf9d74812ad17cee1)

commit 4eb60937c73590916540d158d09058362a2daa7b
Author: Michael Adam <obnox at samba.org>
Date:   Wed Feb 27 00:45:55 2013 +0100

    s4:winbindd: do not drop the workgroup name in the getgrnam and getgrent calls.
    
    First part of fix for bug #9711.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit ecd0b10d2f1de986303f8aab2915c20c2f025244)

commit 0e7afd7d64b04781802501ef01f1ab9cbdf4b93b
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 18 02:47:46 2013 +0100

    WHATSNEW: clarify how being a domain member server is supported in Samba 4.0
    
    Signed-off-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 WHATSNEW.txt                                    |   17 +-
 libcli/smb/smbXcli_base.c                       |   13 +-
 libcli/smb/smb_constants.h                      |   10 +
 librpc/idl/ntprinting.idl                       |   69 +++--
 librpc/ndr/ndr_ntprinting.c                     |   17 ++
 librpc/ndr/ndr_ntprinting.h                     |    2 +
 pidl/lib/Parse/Pidl/NDR.pm                      |    1 +
 pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm        |   12 +-
 source3/libsmb/cliconnect.c                     |    8 +-
 source3/libsmb/clireadwrite.c                   |    7 -
 source3/printing/nt_printing_migrate.c          |   14 +-
 source3/printing/nt_printing_migrate.h          |    6 +-
 source3/printing/nt_printing_migrate_internal.c |    6 +-
 source3/selftest/tests.py                       |    2 +-
 source3/smbd/negprot.c                          |    5 +-
 source3/smbd/process.c                          |   19 +-
 source3/smbd/proto.h                            |    2 +-
 source3/smbd/reply.c                            |  121 +++++---
 source3/smbd/sesssetup.c                        |   14 +-
 source3/torture/torture.c                       |  338 ++++++++++++++++++++++-
 source3/utils/net_printing.c                    |  134 ++++++++-
 source4/smb_server/smb/reply.c                  |   18 +-
 source4/torture/ndr/ntprinting.c                |  217 +++++++++++++++
 source4/torture/raw/read.c                      |   18 +-
 source4/winbind/wb_cmd_getgrgid.c               |   12 +-
 source4/winbind/wb_cmd_getgrnam.c               |   12 +-
 26 files changed, 948 insertions(+), 146 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index d623330..30cc886 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -401,6 +401,18 @@ For pure file server work, the binaries users would expect from that
 series (smbd, nmbd, winbindd, smbpasswd) continue to be available.
 
 
+Domain Member Support
+=====================
+
+Domain member support in the 'samba' binary is in its infancy, and
+is not comparable to the support found in 'winbindd'. As such, on
+Samba domain member servers, the binaries 'smbd', 'nmbd' and 'winbindd'
+are to be used, as known from Samba 3 domain member server setups.
+The only exceptions from this rule are the cases which explicitly
+require the 'samba' binary, namely running the ntvfs file server,
+the CIFS proxy or OpenChange on a domain member.
+
+
 DNS
 ===
 
@@ -450,11 +462,6 @@ Known Issues
   headers at compile time) is known to cause errors when dealing with
   non-ASCII characters.
 
-- Domain member support in the 'samba' binary is in its infancy, and
-  is not comparable to the support found in winbindd.  As such, do not
-  use the 'samba' binary (provided for the AD server) on a member
-  server.
-
 - There is no NetBIOS browsing support (network neighbourhood)
   available for the AD domain controller.  (Support in nmbd and smbd
   for classic domains and member/standalone servers is unchanged).
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index c547515..c971a6d 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -1618,7 +1618,7 @@ static NTSTATUS smb1cli_inbuf_parse_chain(uint8_t *buf, TALLOC_CTX *mem_ctx,
 	NTSTATUS status;
 	size_t min_size = MIN_SMB_SIZE;
 
-	buflen = smb_len_nbt(buf);
+	buflen = smb_len_tcp(buf);
 	taken = 0;
 
 	hdr = buf + NBT_HDR_SIZE;
@@ -1845,7 +1845,7 @@ static NTSTATUS smb1cli_conn_dispatch_incoming(struct smbXcli_conn *conn,
 	uint16_t mid;
 	bool oplock_break;
 	uint8_t *inhdr = inbuf + NBT_HDR_SIZE;
-	size_t len = smb_len_nbt(inbuf);
+	size_t len = smb_len_tcp(inbuf);
 	struct iovec *iov = NULL;
 	int num_iov = 0;
 	struct tevent_req **chain = NULL;
@@ -4046,6 +4046,15 @@ static void smbXcli_negprot_smb1_done(struct tevent_req *subreq)
 		if (server_security_mode & NEGOTIATE_SECURITY_SIGNATURES_ENABLED) {
 			server_signing = "supported";
 			server_allowed = true;
+		} else if (conn->mandatory_signing) {
+			/*
+			 * We have mandatory signing as client
+			 * lets assume the server will look at our
+			 * FLAGS2_SMB_SECURITY_SIGNATURES_REQUIRED
+			 * flag in the session setup
+			 */
+			server_signing = "not announced";
+			server_allowed = true;
 		}
 		if (server_security_mode & NEGOTIATE_SECURITY_SIGNATURES_REQUIRED) {
 			server_signing = "required";
diff --git a/libcli/smb/smb_constants.h b/libcli/smb/smb_constants.h
index 8cb3b6e..bcfd84e 100644
--- a/libcli/smb/smb_constants.h
+++ b/libcli/smb/smb_constants.h
@@ -253,6 +253,16 @@ enum smb_signing_setting {
 #define SMB_CAP_CLIENT_MASK ( \
 	CAP_DYNAMIC_REAUTH | \
 	0)
+/*
+ * Older Samba releases (<= 3.6.x)
+ * expect the client to send CAP_LARGE_READX
+ * in order to let the client use large reads.
+ */
+#define SMB_CAP_LEGACY_CLIENT_MASK ( \
+	SMB_CAP_CLIENT_MASK | \
+	CAP_LARGE_READX | \
+	CAP_LARGE_WRITEX | \
+	0)
 
 /* Client-side offline caching policy types */
 enum csc_policy {
diff --git a/librpc/idl/ntprinting.idl b/librpc/idl/ntprinting.idl
index 7013566..8152144 100644
--- a/librpc/idl/ntprinting.idl
+++ b/librpc/idl/ntprinting.idl
@@ -30,20 +30,24 @@ interface ntprinting
 		[in] ntprinting_form form
 		);
 
-	/* Samba 3 tdb storage format: drivers
+	/*
+	 * First the string flags and then the Samba 3 tdb storage
+	 * format: drivers
 	 * "dffffffff" followed by a remaining buffer of "f" array */
 
 	typedef [flag(NDR_NOALIGN),public] struct {
+		[skip] uint32 string_flags;
+
 		uint32 version;
-		utf8string name;
-		utf8string environment;
-		utf8string driverpath;
-		utf8string datafile;
-		utf8string configfile;
-		utf8string helpfile;
-		utf8string monitorname;
-		utf8string defaultdatatype;
-		[flag(STR_UTF8|STR_NOTERM|NDR_REMAINING)] string_array dependent_files;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string name;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string environment;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string driverpath;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string datafile;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string configfile;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string helpfile;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string monitorname;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string defaultdatatype;
+		[flag((ndr_ntprinting_string_flags(r->string_flags)&~STR_NULLTERM)|STR_NOTERM|NDR_REMAINING)] string_array dependent_files;
 	} ntprinting_driver;
 
 	[public] void decode_ntprinting_driver(
@@ -57,9 +61,11 @@ interface ntprinting
 	 * "B" private data blob */
 
 	typedef [flag(NDR_NOALIGN),public] struct {
+		[skip] uint32 string_flags;
+
 		/* uint32 devicemode_ptr; */
-		utf8string devicename;
-		utf8string formname;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string devicename;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string formname;
 		uint16 specversion;
 		uint16 driverversion;
 		uint16 size;
@@ -95,21 +101,30 @@ interface ntprinting
 		DATA_BLOB *nt_dev_private;
 	} ntprinting_devicemode;
 
-	/* Samba 3 tdb storage format: printer_data
+	/*
+	 * First the string flags and then the Samba 3 tdb storage
+	 * format: printer_data
 	 * "p" ptr to printer_data
 	 * "fdB" */
 
 	typedef [flag(NDR_NOALIGN),public] struct {
+		[skip] uint32 string_flags;
+
 		uint32 ptr;
-		utf8string name;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string name;
 		uint32 type;
 		DATA_BLOB data;
 	} ntprinting_printer_data;
 
-	/* Samba 3 tdb storage format: printer_info
-	 * "dddddddddddfffffPfffff" */
+	/*
+	 * First the string flags and then the Samba 3 tdb storage
+	 * format: printer_info
+	 * "dddddddddddfffffPfffff"
+	 */
 
 	typedef [flag(NDR_NOALIGN),public] struct {
+		[skip] uint32 string_flags;
+
 		uint32 attributes;
 		uint32 priority;
 		uint32 default_priority;
@@ -121,17 +136,17 @@ interface ntprinting
 		uint32 changeid;
 		uint32 c_setprinter;
 		uint32 setuptime;
-		utf8string servername;
-		utf8string printername;
-		utf8string sharename;
-		utf8string portname;
-		utf8string drivername;
-		utf8string comment;
-		utf8string location;
-		utf8string sepfile;
-		utf8string printprocessor;
-		utf8string datatype;
-		utf8string parameters;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string servername;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string printername;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string sharename;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string portname;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string drivername;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string comment;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string location;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string sepfile;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string printprocessor;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string datatype;
+		[flag(ndr_ntprinting_string_flags(r->string_flags))] string parameters;
 	} ntprinting_printer_info;
 
 	/* Abstract Samba 3 printer
diff --git a/librpc/ndr/ndr_ntprinting.c b/librpc/ndr/ndr_ntprinting.c
index 76b296d..e4f47bb 100644
--- a/librpc/ndr/ndr_ntprinting.c
+++ b/librpc/ndr/ndr_ntprinting.c
@@ -22,6 +22,21 @@
 #include "includes.h"
 #include "../librpc/gen_ndr/ndr_ntprinting.h"
 
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t string_flags)
+{
+	uint32_t flags = LIBNDR_FLAG_STR_NULLTERM;
+
+	if (string_flags & LIBNDR_FLAG_STR_ASCII) {
+		flags |= LIBNDR_FLAG_STR_ASCII;
+	} else if (string_flags & LIBNDR_FLAG_STR_RAW8) {
+		flags |= LIBNDR_FLAG_STR_RAW8;
+	} else {
+		flags |= LIBNDR_FLAG_STR_UTF8;
+	}
+
+	return flags;
+}
+
 _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r)
 {
 	uint32_t _ptr_devmode;
@@ -43,6 +58,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int
 			if (r->devmode) {
 				_mem_save_devmode_0 = NDR_PULL_GET_MEM_CTX(ndr);
 				NDR_PULL_SET_MEM_CTX(ndr, r->devmode, 0);
+				r->devmode->string_flags = r->info.string_flags;
 				NDR_CHECK(ndr_pull_ntprinting_devicemode(ndr, NDR_SCALARS|NDR_BUFFERS, r->devmode));
 				NDR_PULL_SET_MEM_CTX(ndr, _mem_save_devmode_0, 0);
 			}
@@ -59,6 +75,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int
 				}
 				r->printer_data = talloc_realloc(ndr, r->printer_data, struct ntprinting_printer_data, r->count + 1);
 				NDR_ERR_HAVE_NO_MEMORY(r->printer_data);
+				r->printer_data[r->count].string_flags = r->info.string_flags;
 				NDR_CHECK(ndr_pull_ntprinting_printer_data(ndr, NDR_SCALARS, &r->printer_data[r->count]));
 				r->count++;
 			}
diff --git a/librpc/ndr/ndr_ntprinting.h b/librpc/ndr/ndr_ntprinting.h
index 8bda430..3b6ee01 100644
--- a/librpc/ndr/ndr_ntprinting.h
+++ b/librpc/ndr/ndr_ntprinting.h
@@ -22,4 +22,6 @@
 #include "includes.h"
 #include "../librpc/gen_ndr/ndr_ntprinting.h"
 
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t string_flags);
+
 _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r);
diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm
index ed7fdab..6827152 100644
--- a/pidl/lib/Parse/Pidl/NDR.pm
+++ b/pidl/lib/Parse/Pidl/NDR.pm
@@ -1073,6 +1073,7 @@ my %property_list = (
 	"noprint"		=> ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP", "ELEMENT", "PIPE"],
 	"nopython"		=> ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP"],
 	"todo"			=> ["FUNCTION"],
+	"skip"			=> ["ELEMENT"],
 
 	# union
 	"switch_is"		=> ["ELEMENT"],
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 8eb935b..5ffb678 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -958,7 +958,11 @@ sub ParseDataPull($$$$$$$)
 
 		$var_name = get_pointer_to($var_name);
 
-		$self->pidl("NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+		if (has_property($e, "skip")) {
+			$self->pidl("/* [skip] '$var_name' */");
+		} else {
+			$self->pidl("NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+		}
 
 		my $pl = GetPrevLevel($e, $l);
 
@@ -996,7 +1000,11 @@ sub ParseDataPush($$$$$$$)
 			$var_name = get_pointer_to($var_name);
 		}
 
-		$self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+		if (has_property($e, "skip")) {
+			$self->pidl("/* [skip] '$var_name' */");
+		} else {
+			$self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+		}
 	} else {
 		$self->ParseTypePush($l->{DATA_TYPE}, $ndr, $var_name, $primitives, $deferred);
 	}
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 9ce013e..d1e161f 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -341,9 +341,13 @@ static uint32_t cli_session_setup_capabilities(struct cli_state *cli,
 	 * - client only flags
 	 * - flags used in both directions
 	 *
-	 * We do not echo the server only flags.
+	 * We do not echo the server only flags, except some legacy flags.
+	 *
+	 * SMB_CAP_LEGACY_CLIENT_MASK contains CAP_LARGE_READX and
+	 * CAP_LARGE_WRITEX in order to allow us to do large reads
+	 * against old Samba releases (<= 3.6.x).
 	 */
-	client_capabilities &= (SMB_CAP_BOTH_MASK | SMB_CAP_CLIENT_MASK);
+	client_capabilities &= (SMB_CAP_BOTH_MASK | SMB_CAP_LEGACY_CLIENT_MASK);
 
 	/*
 	 * Session Setup specific flags CAP_DYNAMIC_REAUTH
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index 3cc6cf8..c429d30 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -132,13 +132,6 @@ struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
 	struct cli_read_andx_state *state;
 	uint8_t wct = 10;
 
-	if (size > cli_read_max_bufsize(cli)) {
-		DEBUG(0, ("cli_read_andx_send got size=%d, can only handle "
-			  "size=%d\n", (int)size,
-			  (int)cli_read_max_bufsize(cli)));
-		return NULL;
-	}
-
 	req = tevent_req_create(mem_ctx, &state, struct cli_read_andx_state);
 	if (req == NULL) {
 		return NULL;
diff --git a/source3/printing/nt_printing_migrate.c b/source3/printing/nt_printing_migrate.c
index 616d7af..ce42a06 100644
--- a/source3/printing/nt_printing_migrate.c
+++ b/source3/printing/nt_printing_migrate.c
@@ -88,7 +88,8 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
 				     struct rpc_pipe_client *winreg_pipe,
 				     const char *key_name,
 				     unsigned char *data,
-				     size_t length)
+				     size_t length,
+				     bool do_string_conversion)
 {
 	struct dcerpc_binding_handle *b = winreg_pipe->binding_handle;
 	enum ndr_err_code ndr_err;
@@ -105,6 +106,10 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
 
 	ZERO_STRUCT(r);
 
+	if (do_string_conversion) {
+		r.string_flags = LIBNDR_FLAG_STR_ASCII;
+	}
+
 	ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
 		   (ndr_pull_flags_fn_t)ndr_pull_ntprinting_driver);
 	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -150,7 +155,8 @@ NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
 				      struct rpc_pipe_client *winreg_pipe,
 				      const char *key_name,
 				      unsigned char *data,
-				      size_t length)
+				      size_t length,
+				      bool do_string_conversion)
 {
 	struct dcerpc_binding_handle *b = winreg_pipe->binding_handle;
 	enum ndr_err_code ndr_err;
@@ -173,6 +179,10 @@ NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
 
 	ZERO_STRUCT(r);
 
+	if (do_string_conversion) {
+		r.info.string_flags = LIBNDR_FLAG_STR_ASCII;
+	}
+
 	ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
 		   (ndr_pull_flags_fn_t) ndr_pull_ntprinting_printer);
 	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
diff --git a/source3/printing/nt_printing_migrate.h b/source3/printing/nt_printing_migrate.h
index 3da8db4..0c9800d 100644
--- a/source3/printing/nt_printing_migrate.h
+++ b/source3/printing/nt_printing_migrate.h
@@ -30,12 +30,14 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
 				     struct rpc_pipe_client *winreg_pipe,
 				     const char *key_name,
 				     unsigned char *data,
-				     size_t length);
+				     size_t length,
+				     bool do_string_conversion);
 NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
 				      struct rpc_pipe_client *winreg_pipe,
 				      const char *key_name,
 				      unsigned char *data,
-				      size_t length);
+				      size_t length,
+				      bool do_string_conversion);
 NTSTATUS printing_tdb_migrate_secdesc(TALLOC_CTX *mem_ctx,
 				      struct rpc_pipe_client *winreg_pipe,
 				      const char *key_name,
diff --git a/source3/printing/nt_printing_migrate_internal.c b/source3/printing/nt_printing_migrate_internal.c
index 7142a5c..200db07 100644
--- a/source3/printing/nt_printing_migrate_internal.c
+++ b/source3/printing/nt_printing_migrate_internal.c
@@ -114,7 +114,8 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
 						winreg_pipe,
 						(const char *) kbuf.dptr + strlen(DRIVERS_PREFIX),
 						dbuf.dptr,
-						dbuf.dsize);
+						dbuf.dsize,
+						false);
 			SAFE_FREE(dbuf.dptr);
 			if (!NT_STATUS_IS_OK(status)) {
 				tdb_close(tdb);
@@ -130,7 +131,8 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
 						 winreg_pipe,
 						 printer_name,
 						 dbuf.dptr,
-						 dbuf.dsize);
+						 dbuf.dsize,
+						 false);
 			SAFE_FREE(dbuf.dptr);
 			if (!NT_STATUS_IS_OK(status)) {
 				tdb_close(tdb);
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 57c80f2..4453c4d 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -54,7 +54,7 @@ plantestsuite("samba3.blackbox.registry.upgrade", "s3dc:local", [os.path.join(sa
 tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7", "LOCK9",
         "UNLINK", "BROWSE", "ATTR", "TRANS2", "TORTURE",
         "OPLOCK1", "OPLOCK2", "OPLOCK4", "STREAMERROR",
-        "DIR", "DIR1", "DIR-CREATETIME", "TCON", "TCONDEV", "RW1", "RW2", "RW3", "RW-SIGNING",
+        "DIR", "DIR1", "DIR-CREATETIME", "TCON", "TCONDEV", "RW1", "RW2", "RW3", "LARGE_READX", "RW-SIGNING",
         "OPEN", "XCOPY", "RENAME", "DELETE", "DELETE-LN", "PROPERTIES", "W2K",
         "TCON2", "IOCTL", "CHKPATH", "FDSESS", "CHAIN1", "CHAIN2",
         "CHAIN3",
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index e33350c..cfe0983 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -284,11 +284,10 @@ static void reply_nt1(struct smb_request *req, uint16 choice)
 		capabilities |= CAP_UNIX;
 	}
 
-	if (lp_large_readwrite() && (SMB_OFF_T_BITS == 64))
+	if (lp_large_readwrite())
 		capabilities |= CAP_LARGE_READX|CAP_LARGE_WRITEX|CAP_W2K_SMBS;
 
-	if (SMB_OFF_T_BITS == 64)
-		capabilities |= CAP_LARGE_FILES;
+	capabilities |= CAP_LARGE_FILES;
 
 	if (lp_readraw() && lp_writeraw())
 		capabilities |= CAP_RAW_MODE;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index e934eaa..f03a20f 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1270,11 +1270,13 @@ static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req,
 			  const char *inbuf, char **outbuf, uint8_t num_words,
 			  uint32_t num_bytes)
 {
+	size_t smb_len = MIN_SMB_SIZE + VWV(num_words) + num_bytes;
+
 	/*
-         * Protect against integer wrap
-         */
-	if ((num_bytes > 0xffffff)
-	    || ((num_bytes + smb_size + num_words*2) > 0xffffff)) {
+	 * Protect against integer wrap.
+	 * The SMB layer reply can be up to 0xFFFFFF bytes.
+	 */
+	if ((num_bytes > 0xffffff) || (smb_len > 0xffffff)) {
 		char *msg;
 		if (asprintf(&msg, "num_bytes too large: %u",
 			     (unsigned)num_bytes) == -1) {
@@ -1283,8 +1285,11 @@ static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req,
 		smb_panic(msg);
 	}
 
+	/*
+	 * Here we include the NBT header for now.
+	 */
 	*outbuf = talloc_array(mem_ctx, char,
-			       smb_size + num_words*2 + num_bytes);
+			       NBT_HDR_SIZE + smb_len);
 	if (*outbuf == NULL) {
 		return false;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list