[Pkg-samba-maint] [samba] 07/08: Really move bitmap.c (work around jessie patch util differences)
Andrew Bartlett
abartlet-guest at moszumanska.debian.org
Wed Apr 13 01:33:25 UTC 2016
This is an automated email from the git hooks/post-receive script.
abartlet-guest pushed a commit to branch wheezy
in repository samba.
commit fb4d747e3e585ee3020647107ddc07426aa0587e
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Apr 11 14:36:25 2016 +1200
Really move bitmap.c (work around jessie patch util differences)
---
debian/patches/CVE-preparation-v3-6.patch | 103 ---------------------
debian/patches/really-move-bitmap.c.patch | 145 ++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 146 insertions(+), 103 deletions(-)
diff --git a/debian/patches/CVE-preparation-v3-6.patch b/debian/patches/CVE-preparation-v3-6.patch
index a74d1c3..75e27fd 100644
--- a/debian/patches/CVE-preparation-v3-6.patch
+++ b/debian/patches/CVE-preparation-v3-6.patch
@@ -1254,109 +1254,6 @@ index c7a2c11..2ce2dc3 100644
2.8.1
-From 59461493d5e0fedaadad73d66afe06c606ac6155 Mon Sep 17 00:00:00 2001
-From: Andrew Bartlett <abartlet at samba.org>
-Date: Thu, 7 Jul 2011 21:04:31 +1000
-Subject: [PATCH 11/40] lib/util Move bitmap.c to lib/util
-
----
- {source3/lib => lib/util}/bitmap.c | 21 +++++++++++----------
- lib/util/bitmap.h | 32 ++++++++++++++++++++++++++++++++
- lib/util/wscript_build | 8 +++++++-
- source3/Makefile.in | 2 +-
- source3/include/proto.h | 9 ---------
- source3/include/smb.h | 6 ------
- source3/modules/vfs_acl_common.c | 1 +
- source3/modules/vfs_full_audit.c | 1 +
- source3/param/loadparm.c | 1 +
- source3/passdb/pdb_get_set.c | 1 +
- source3/smbd/conn.c | 1 +
- source3/smbd/dir.c | 1 +
- source3/smbd/files.c | 1 +
- source3/smbd/smb2_server.c | 1 +
- 14 files changed, 59 insertions(+), 27 deletions(-)
- rename {source3/lib => lib/util}/bitmap.c (91%)
- create mode 100644 lib/util/bitmap.h
-
-diff --git a/source3/lib/bitmap.c b/lib/util/bitmap.c
-similarity index 91%
-rename from source3/lib/bitmap.c
-rename to lib/util/bitmap.c
-index bd56b4a..4748f8b 100644
---- a/source3/lib/bitmap.c
-+++ b/lib/util/bitmap.c
-@@ -18,6 +18,7 @@
- */
-
- #include "includes.h"
-+#include "lib/util/bitmap.h"
-
- /* these functions provide a simple way to allocate integers from a
- pool without repetition */
-@@ -29,12 +30,12 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n)
- {
- struct bitmap *bm;
-
-- bm = TALLOC_P(mem_ctx, struct bitmap);
-+ bm = talloc_zero(mem_ctx, struct bitmap);
-
- if (!bm) return NULL;
-
- bm->n = n;
-- bm->b = TALLOC_ZERO_ARRAY(bm, uint32, (n+31)/32);
-+ bm->b = talloc_zero_array(bm, uint32_t, (n+31)/32);
- if (!bm->b) {
- TALLOC_FREE(bm);
- return NULL;
-@@ -51,7 +52,7 @@ int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src)
- int count = MIN(dst->n, src->n);
-
- SMB_ASSERT(dst->b != src->b);
-- memcpy(dst->b, src->b, sizeof(uint32)*((count+31)/32));
-+ memcpy(dst->b, src->b, sizeof(uint32_t)*((count+31)/32));
-
- return count;
- }
-@@ -64,10 +65,10 @@ bool bitmap_set(struct bitmap *bm, unsigned i)
- if (i >= bm->n) {
- DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n",
- i, bm->n));
-- return False;
-+ return false;
- }
- bm->b[i/32] |= (1<<(i%32));
-- return True;
-+ return true;
- }
-
- /****************************************************************************
-@@ -78,10 +79,10 @@ bool bitmap_clear(struct bitmap *bm, unsigned i)
- if (i >= bm->n) {
- DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n",
- i, bm->n));
-- return False;
-+ return false;
- }
- bm->b[i/32] &= ~(1<<(i%32));
-- return True;
-+ return true;
- }
-
- /****************************************************************************
-@@ -89,11 +90,11 @@ query a bit in a bitmap
- ****************************************************************************/
- bool bitmap_query(struct bitmap *bm, unsigned i)
- {
-- if (i >= bm->n) return False;
-+ if (i >= bm->n) return false;
- if (bm->b[i/32] & (1<<(i%32))) {
-- return True;
-+ return true;
- }
-- return False;
-+ return false;
- }
-
/****************************************************************************
diff --git a/lib/util/bitmap.h b/lib/util/bitmap.h
new file mode 100644
diff --git a/debian/patches/really-move-bitmap.c.patch b/debian/patches/really-move-bitmap.c.patch
new file mode 100644
index 0000000..1629e76
--- /dev/null
+++ b/debian/patches/really-move-bitmap.c.patch
@@ -0,0 +1,145 @@
+#
+# The CVE-preparation-v3-6.patch patch tries to move bitmap.c via diff
+# header rename, but this does not work with the patch tools in
+# jessie, so we re-add it with this patch.
+#
+--- /dev/null 2016-04-01 11:56:32.547807718 +1300
++++ samba/lib/util/bitmap.c 2016-04-11 14:26:58.635157377 +1200
+@@ -0,0 +1,137 @@
++/*
++ Unix SMB/CIFS implementation.
++ simple bitmap functions
++ Copyright (C) Andrew Tridgell 1992-1998
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>.
++*/
++
++#include "includes.h"
++#include "lib/util/bitmap.h"
++
++/* these functions provide a simple way to allocate integers from a
++ pool without repetition */
++
++/****************************************************************************
++talloc a bitmap
++****************************************************************************/
++struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n)
++{
++ struct bitmap *bm;
++
++ bm = talloc_zero(mem_ctx, struct bitmap);
++
++ if (!bm) return NULL;
++
++ bm->n = n;
++ bm->b = talloc_zero_array(bm, uint32_t, (n+31)/32);
++ if (!bm->b) {
++ TALLOC_FREE(bm);
++ return NULL;
++ }
++ return bm;
++}
++
++/****************************************************************************
++copy as much of the source bitmap as will fit in the destination bitmap.
++****************************************************************************/
++
++int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src)
++{
++ int count = MIN(dst->n, src->n);
++
++ SMB_ASSERT(dst->b != src->b);
++ memcpy(dst->b, src->b, sizeof(uint32_t)*((count+31)/32));
++
++ return count;
++}
++
++/****************************************************************************
++set a bit in a bitmap
++****************************************************************************/
++bool bitmap_set(struct bitmap *bm, unsigned i)
++{
++ if (i >= bm->n) {
++ DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n",
++ i, bm->n));
++ return false;
++ }
++ bm->b[i/32] |= (1<<(i%32));
++ return true;
++}
++
++/****************************************************************************
++clear a bit in a bitmap
++****************************************************************************/
++bool bitmap_clear(struct bitmap *bm, unsigned i)
++{
++ if (i >= bm->n) {
++ DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n",
++ i, bm->n));
++ return false;
++ }
++ bm->b[i/32] &= ~(1<<(i%32));
++ return true;
++}
++
++/****************************************************************************
++query a bit in a bitmap
++****************************************************************************/
++bool bitmap_query(struct bitmap *bm, unsigned i)
++{
++ if (i >= bm->n) return false;
++ if (bm->b[i/32] & (1<<(i%32))) {
++ return true;
++ }
++ return false;
++}
++
++/****************************************************************************
++find a zero bit in a bitmap starting at the specified offset, with
++wraparound
++****************************************************************************/
++int bitmap_find(struct bitmap *bm, unsigned ofs)
++{
++ unsigned int i, j;
++
++ if (ofs > bm->n) ofs = 0;
++
++ i = ofs;
++ while (i < bm->n) {
++ if (~(bm->b[i/32])) {
++ j = i;
++ do {
++ if (!bitmap_query(bm, j)) return j;
++ j++;
++ } while (j & 31 && j < bm->n);
++ }
++ i += 32;
++ i &= ~31;
++ }
++
++ i = 0;
++ while (i < ofs) {
++ if (~(bm->b[i/32])) {
++ j = i;
++ do {
++ if (!bitmap_query(bm, j)) return j;
++ j++;
++ } while (j & 31 && j < bm->n);
++ }
++ i += 32;
++ i &= ~31;
++ }
++
++ return -1;
++}
diff --git a/debian/patches/series b/debian/patches/series
index c5131ed..418d22c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -40,6 +40,7 @@ s3-smbd-fix-a-corner-case-of-the-symlink-verificatio.patch
CVE-2015-7560-v3-6.patch
0001-s4-torture-let-torture_suite_add_ndr_pull_test-alway.patch
CVE-preparation-v3-6.patch
+really-move-bitmap.c.patch
CVE-2016-2110-v3-6.patch
CVE-2016-2111-v3-6.patch
CVE-2016-2112-v3-6.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-samba/samba.git
More information about the Pkg-samba-maint
mailing list