[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Pre-approval request for a fix to samba, targeted at wheezy (bug #696675)



Hello dear release team,

This is a bit overdue but I'd like to fix bug #696675 in samba.

This bug is currently "severity important" but one's mileage may vary,
and for some users, it might become release critical, particularly
because it implies a regression from squeeze.

Because of samba upstream bug #9042, upgrading from samba 3.5 and, I
suspect samba 3.4 as well, may lead to lose printer definitions for
shared printers, because the TDB file cannot be migrated.

This might heavily break existing installs.

As the fix is quite not too invasive and it has been proven reliable
upstream (there have been a few upstream releases since 3.6.7 and none
of them showed regressions wrt this fix), I think it would be good to
have this in wheezy.

Please find the proposed diff attached.

-- 


Index: debian/changelog
===================================================================
--- debian/changelog	(révision 4183)
+++ debian/changelog	(copie de travail)
@@ -1,3 +1,11 @@
+samba (2:3.6.6-4) UNRELEASED; urgency=low
+
+  * Fix printers tdb migration by including an upstream fix
+    from 3.6.7 (upstream bug #9026)
+    Closes: #696675
+
+ -- Christian Perrier <bubulle@debian.org>  Sat, 05 Jan 2013 08:13:30 +0100
+
 samba (2:3.6.6-3) unstable; urgency=low
 
   [ Ansgar Burchardt ]
Index: debian/patches/0001-ndr-fix-push-pull-DATA_BLOB-with-NDR_NOALIGN.patch
===================================================================
--- debian/patches/0001-ndr-fix-push-pull-DATA_BLOB-with-NDR_NOALIGN.patch	(révision 0)
+++ debian/patches/0001-ndr-fix-push-pull-DATA_BLOB-with-NDR_NOALIGN.patch	(révision 0)
@@ -0,0 +1,134 @@
+Description: ndr: fix push/pull DATA_BLOB with NDR_NOALIGN
+Author: David Disseldorp <ddiss@samba.org>
+Bug-Debian: http://bugs.debian.org/696675
+Forwarded: https://bugzilla.samba.org/show_bug.cgi?id=9026
+
+From 447802bbde046dddf30ed8292bb309cfc92f75d4 Mon Sep 17 00:00:00 2001
+From: David Disseldorp <ddiss@samba.org>
+Date: Fri, 6 Jul 2012 14:00:27 +0200
+Subject: [PATCH] ndr: fix push/pull DATA_BLOB with NDR_NOALIGN
+
+This change addresses bug 9026.
+There are 3 use cases for DATA_BLOB marshalling/unmarshalling:
+
+1)
+ndr_push_DATA_BLOB and ndr_pull_DATA_BLOB when called with
+LIBNDR_FLAG_ALIGN* alignment flags set, are used to push/pull padding
+bytes _only_. The length is determined by the alignment required and
+the current ndr offset.
+e.g. dcerpc.idl:
+        typedef struct {
+...
+                [flag(NDR_ALIGN8)]    DATA_BLOB _pad;
+        } dcerpc_request;
+
+2)
+When called with the LIBNDR_FLAG_REMAINING flag, all remaining bytes in
+the ndr buffer are pushed/pulled.
+e.g. dcerpc.idl:
+        typedef struct {
+...
+                [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
+        } dcerpc_request;
+
+3)
+When called without alignment flags, push/pull a uint32 length _and_ a
+corresponding byte array to/from the ndr buffer.
+e.g. drsblobs.idl
+        typedef [public] struct {
+...
+                DATA_BLOB data;
+        } DsCompressedChunk;
+
+The fix for bug 8373 changed the definition of "alignment flags", such
+that when called with LIBNDR_FLAG_NOALIGN ndr_push/pull_DATA_BLOB
+behaves as (1: padding bytes) rather than (3: uint32 length + byte
+array).
+
+This breaks marshalling/unmarshalling for the following structures.
+eventlog.idl:
+        typedef [flag(NDR_NOALIGN|NDR_PAHEX),public] struct {
+...
+                DATA_BLOB sid;
+...
+        } eventlog_Record_tdb;
+
+ntprinting.idl:
+        typedef [flag(NDR_NOALIGN),public] struct {
+...
+                DATA_BLOB *nt_dev_private;
+        } ntprinting_devicemode;
+
+        typedef [flag(NDR_NOALIGN),public] struct {
+...
+                DATA_BLOB data;
+        } ntprinting_printer_data;
+---
+ librpc/ndr/ndr_basic.c |   34 ++++++++++++++++++++++------------
+ 1 files changed, 22 insertions(+), 12 deletions(-)
+
+diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
+index 7a4e22a..1887838 100644
+--- a/librpc/ndr/ndr_basic.c
++++ b/librpc/ndr/ndr_basic.c
+@@ -1247,16 +1247,21 @@ _PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_
+ 
+ 
+ /*
+-  push a DATA_BLOB onto the wire. 
+-*/
++ * Push a DATA_BLOB onto the wire.
++ * 1) When called with LIBNDR_FLAG_ALIGN* alignment flags set, push padding
++ *    bytes _only_. The length is determined by the alignment required and the
++ *    current ndr offset.
++ * 2) When called with the LIBNDR_FLAG_REMAINING flag, push the byte array to
++ *    the ndr buffer.
++ * 3) Otherwise, push a uint32 length _and_ a corresponding byte array to the
++ *    ndr buffer.
++ */
+ _PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob)
+ {
+ 	if (ndr->flags & LIBNDR_FLAG_REMAINING) {
+ 		/* nothing to do */
+-	} else if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
+-		if (ndr->flags & LIBNDR_FLAG_NOALIGN) {
+-			blob.length = 0;
+-		} else if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
++	} else if (ndr->flags & (LIBNDR_ALIGN_FLAGS & ~LIBNDR_FLAG_NOALIGN)) {
++		if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
+ 			blob.length = NDR_ALIGN(ndr, 2);
+ 		} else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
+ 			blob.length = NDR_ALIGN(ndr, 4);
+@@ -1273,18 +1278,23 @@ _PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flag
+ }
+ 
+ /*
+-  pull a DATA_BLOB from the wire. 
+-*/
++ * Pull a DATA_BLOB from the wire.
++ * 1) when called with LIBNDR_FLAG_ALIGN* alignment flags set, pull padding
++ *    bytes _only_. The length is determined by the alignment required and the
++ *    current ndr offset.
++ * 2) When called with the LIBNDR_FLAG_REMAINING flag, pull all remaining bytes
++ *    from the ndr buffer.
++ * 3) Otherwise, pull a uint32 length _and_ a corresponding byte array from the
++ *    ndr buffer.
++ */
+ _PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob)
+ {
+ 	uint32_t length = 0;
+ 
+ 	if (ndr->flags & LIBNDR_FLAG_REMAINING) {
+ 		length = ndr->data_size - ndr->offset;
+-	} else if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
+-		if (ndr->flags & LIBNDR_FLAG_NOALIGN) {
+-			length = 0;
+-		} else if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
++	} else if (ndr->flags & (LIBNDR_ALIGN_FLAGS & ~LIBNDR_FLAG_NOALIGN)) {
++		if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
+ 			length = NDR_ALIGN(ndr, 2);
+ 		} else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
+ 			length = NDR_ALIGN(ndr, 4);
+-- 
+1.7.1
+
Index: debian/patches/series
===================================================================
--- debian/patches/series	(révision 4183)
+++ debian/patches/series	(copie de travail)
@@ -21,3 +21,4 @@
 libutil_drop_AI_ADDRCONFIG.patch
 shadow_copy2_backport.patch
 only_export_public_symbols.patch
+0001-ndr-fix-push-pull-DATA_BLOB-with-NDR_NOALIGN.patch

Attachment: signature.asc
Description: Digital signature


Reply to: