[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Fri Sep 19 12:35:04 MDT 2014


The branch, master has been updated
       via  6d450b3 lib/util: Return some functions to util_str.c
       via  f3d50e5 lib/util: Move next_token* functions to util_str.c
       via  1bf36f1 lib/util: Move idr_get_new_random() to new source file idtree_random.c
       via  e0a5c43 debug: Standalone compile without includes.h
       via  f8bd892 tdb_wrap: Standalone compile without includes.h
       via  9f0f6bf tdb_wrap: tdb_wrap.h doesn't need struct loadparm_context
       via  8b2c280 tdb: tdb.h needs bool type
       via  5c5f631 lib/crypto: Protect crypto.h against multiple inclusion
       via  d55cdc3 charset: Avoid compiler warnings with --enable-developer
       via  2f7ba81 replace: Fix includes of unistd.h
       via  a757df9 dynconfig: Remove include of nsswitch/winbind_struct_protocol.h
       via  427afe2 util: Fix indentation
      from  7f59711 nsswitch: Skip groups we were not able to map.

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


- Log -----------------------------------------------------------------
commit 6d450b3b48bd51b7e244711e7c6f832e0e27d8ee
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 19 13:42:32 2014 +1000

    lib/util: Return some functions to util_str.c
    
    These were moved in commit 8e704e4107b284bfc1e43f4c698ac0e6c5ae1800
    when util_str.c was not shared.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Fri Sep 19 20:34:05 CEST 2014 on sn-devel-104

commit f3d50e5ff5382868f8e39ab9af07f43bfefd8303
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 19 13:30:26 2014 +1000

    lib/util: Move next_token* functions to util_str.c
    
    This is part of an attempt to untangle charset from util.c.
    
    Most of this was moved from util_str.c in commit
    55903e6f9120f1ec58a8554813229975c3028a09.  next_token() was moved from
    charset to util.c in commit 4be643d4ce33d5ce2bf9deacc3f6d0fde90cf626
    so that it would be alongside next_token_talloc().
    
    Now that util_str.c is in shared lib/util it is no longer necessary to
    have these in util.c.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 1bf36f177b09980badeddf2ece64b1f29cda7416
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 19 15:01:51 2014 +1000

    lib/util: Move idr_get_new_random() to new source file idtree_random.c
    
    This function depends on genrand.c, which depends on lib/crypto.  This
    way the other IDR tree code can be used without lib/crypto.
    
    While doing this, create idtree.h and idtree_random.h and clean up the
    includes.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit e0a5c43bd0ca097936604169177d5eb44a6e42a8
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Sep 8 16:32:46 2014 +1000

    debug: Standalone compile without includes.h
    
    Compiling utilities with includes.h is confusing because includes.h
    could come from source3, source4 or ctdb.  Utilities should be
    independent of such things.
    
    Add a minimal set of fined-grained includes that attempts to avoid the
    catch-all samba_util.h.  A comment indicates what is used from
    samba_util.h so that future clean-ups are easier.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit f8bd8924caf9f56666facfbe93778dd01288be6e
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Aug 19 12:22:00 2014 +1000

    tdb_wrap: Standalone compile without includes.h
    
    Compiling this generic code is confusing because it uses includes.h,
    which could come from source3, source4 or ctdb.  Generic code should
    be independent of such things.
    
    Drop include of param.h since nothing from that file is used.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 9f0f6bff225d1cbeaee62e3fd82147d1c21f8468
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Sep 16 14:01:19 2014 +1000

    tdb_wrap: tdb_wrap.h doesn't need struct loadparm_context
    
    Not since commit d6db35d7a564ee556b74131ef4c3a3cdb8097e14.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 8b2c28041001e0adb3cf136cbd3ad0e59037324e
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Sep 16 13:42:33 2014 +1000

    tdb: tdb.h needs bool type
    
    Due to introduction of tdb_runtime_check_for_robust_mutexes().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 5c5f6317106486cdf352462969ed3411d1340ec9
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Sep 10 13:42:00 2014 +1000

    lib/crypto: Protect crypto.h against multiple inclusion
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit d55cdc367d2048433c4862222d8b9f4ab419a35f
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Sep 10 11:10:09 2014 +1000

    charset: Avoid compiler warnings with --enable-developer
    
    These:
    
      [ 44/309] Compiling ../lib/util/charset/util_unistr_w.c
      ../../lib/util/charset/util_unistr_w.c: In function ‘strlower_w’:
      ../../lib/util/charset/util_unistr_w.c:182:127: warning: right-hand operand of comma expression has no effect [-Wunused-value]
          COPY_UCS2_CHAR(s,&v);
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 2f7ba8175e87fcb96ef07a7bf3ef99eb3dc4bc28
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Aug 29 21:13:47 2014 +1000

    replace: Fix includes of unistd.h
    
    This should always be conditional.  system/passwd.h wants it too so
    that uid_t is defined.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit a757df946930d578fe872820549311877521da00
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Aug 19 12:07:12 2014 +1000

    dynconfig: Remove include of nsswitch/winbind_struct_protocol.h
    
    Nothing declared in this file is used in dynconfig.c.  It appears that
    WINBINDD_SOCKET_DIR used to come from there.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 427afe26553d6d2d68466b39d509cf9eced71371
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Aug 6 11:57:06 2014 +1000

    util: Fix indentation
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>

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

Summary of changes:
 dynconfig/dynconfig.c                              |    1 -
 lib/crypto/crypto.h                                |    4 +
 lib/replace/system/filesys.h                       |    3 +
 lib/replace/system/network.h                       |    6 +-
 lib/replace/system/passwd.h                        |    4 +
 lib/tdb/include/tdb.h                              |    1 +
 lib/tdb_wrap/tdb_wrap.c                            |    6 +-
 lib/tdb_wrap/tdb_wrap.h                            |    5 +-
 lib/util/charset/util_unistr_w.c                   |    4 +-
 lib/util/debug.c                                   |   11 +-
 lib/util/debug.h                                   |    6 +
 lib/util/idtree.c                                  |   29 +---
 lib/util/idtree.h                                  |   68 +++++++
 lib/util/idtree_random.c                           |   60 ++++++
 .../schannel_proto.h => lib/util/idtree_random.h   |   25 ++-
 lib/util/samba_util.h                              |   38 +----
 lib/util/util.c                                    |  201 --------------------
 lib/util/util_str.c                                |  200 +++++++++++++++++++
 lib/util/wscript_build                             |    8 +-
 19 files changed, 390 insertions(+), 290 deletions(-)
 create mode 100644 lib/util/idtree.h
 create mode 100644 lib/util/idtree_random.c
 copy libcli/auth/schannel_proto.h => lib/util/idtree_random.h (50%)


Changeset truncated at 500 lines:

diff --git a/dynconfig/dynconfig.c b/dynconfig/dynconfig.c
index af9d735..cf35bdb 100644
--- a/dynconfig/dynconfig.c
+++ b/dynconfig/dynconfig.c
@@ -19,7 +19,6 @@
 */
 
 #include "includes.h"
-#include "nsswitch/winbind_struct_protocol.h"
 
 /**
  * @file dynconfig.c
diff --git a/lib/crypto/crypto.h b/lib/crypto/crypto.h
index 1f5a1b7..8355b61 100644
--- a/lib/crypto/crypto.h
+++ b/lib/crypto/crypto.h
@@ -17,6 +17,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#ifndef _SAMBA_CRYPTO_H
+#define _SAMBA_CRYPTO_H_
+
 #include "../lib/crypto/crc32.h"
 #include "../lib/crypto/md4.h"
 #include "../lib/crypto/md5.h"
@@ -28,3 +31,4 @@
 #include "../lib/crypto/aes_cmac_128.h"
 #include "../lib/crypto/aes_ccm_128.h"
 
+#endif /* _SAMBA_CRYPTO_H_ */
diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h
index b234f10..bd6e6a0 100644
--- a/lib/replace/system/filesys.h
+++ b/lib/replace/system/filesys.h
@@ -26,7 +26,10 @@
 
 */
 
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+
 #include <sys/stat.h>
 
 #ifdef HAVE_SYS_PARAM_H
diff --git a/lib/replace/system/network.h b/lib/replace/system/network.h
index 273cb71..4a3fd07 100644
--- a/lib/replace/system/network.h
+++ b/lib/replace/system/network.h
@@ -31,7 +31,9 @@
 #error "AC_LIBREPLACE_NETWORK_CHECKS missing in configure"
 #endif
 
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
@@ -77,10 +79,6 @@
 #include <net/if.h>
 #endif
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
diff --git a/lib/replace/system/passwd.h b/lib/replace/system/passwd.h
index f8b9a77..ecc9f60 100644
--- a/lib/replace/system/passwd.h
+++ b/lib/replace/system/passwd.h
@@ -27,6 +27,10 @@
 
 */
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #ifdef HAVE_PWD_H
 #include <pwd.h>
 #endif
diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h
index 5ea5e60..03e429c 100644
--- a/lib/tdb/include/tdb.h
+++ b/lib/tdb/include/tdb.h
@@ -31,6 +31,7 @@ extern "C" {
 #endif
 
 #include <signal.h>
+#include <stdbool.h>
 
 /**
  * @defgroup tdb The tdb API
diff --git a/lib/tdb_wrap/tdb_wrap.c b/lib/tdb_wrap/tdb_wrap.c
index 970c91f..f2f32d1 100644
--- a/lib/tdb_wrap/tdb_wrap.c
+++ b/lib/tdb_wrap/tdb_wrap.c
@@ -19,11 +19,11 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include "replace.h"
 #include "lib/util/dlinklist.h"
-#include "lib/tdb_wrap/tdb_wrap.h"
-#include "lib/param/param.h"
 #include "ccan/str/str.h"
+#include "lib/util/debug.h"
+#include "tdb_wrap.h"
 
 /*
  Log tdb messages via DEBUG().
diff --git a/lib/tdb_wrap/tdb_wrap.h b/lib/tdb_wrap/tdb_wrap.h
index e44aed6..de7e332 100644
--- a/lib/tdb_wrap/tdb_wrap.h
+++ b/lib/tdb_wrap/tdb_wrap.h
@@ -29,14 +29,13 @@
 #ifndef _TDB_WRAP_H_
 #define _TDB_WRAP_H_
 
-#include "tdb.h"
+#include <talloc.h>
+#include <tdb.h>
 
 struct tdb_wrap {
 	struct tdb_context *tdb;
 };
 
-struct loadparm_context;
-
 struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx,
 			       const char *name, int hash_size, int tdb_flags,
 			       int open_flags, mode_t mode);
diff --git a/lib/util/charset/util_unistr_w.c b/lib/util/charset/util_unistr_w.c
index 5225267..db8a8dd 100644
--- a/lib/util/charset/util_unistr_w.c
+++ b/lib/util/charset/util_unistr_w.c
@@ -177,7 +177,7 @@ bool strlower_w(smb_ucs2_t *s)
 	while (*(COPY_UCS2_CHAR(&cp,s))) {
 		smb_ucs2_t v = tolower_m(cp);
 		if (v != cp) {
-			COPY_UCS2_CHAR(s,&v);
+			(void)COPY_UCS2_CHAR(s,&v);
 			ret = true;
 		}
 		s++;
@@ -199,7 +199,7 @@ bool strupper_w(smb_ucs2_t *s)
 	while (*(COPY_UCS2_CHAR(&cp,s))) {
 		smb_ucs2_t v = toupper_m(cp);
 		if (v != cp) {
-			COPY_UCS2_CHAR(s,&v);
+			(void)COPY_UCS2_CHAR(s,&v);
 			ret = true;
 		}
 		s++;
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 2779dd3..0059595 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -19,11 +19,16 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include <talloc.h>
+#include "replace.h"
 #include "system/filesys.h"
 #include "system/syslog.h"
-#include "lib/util/time_basic.h"
-#include "lib/util/close_low_fd.h"
+#include "system/locale.h"
+#include "time_basic.h"
+#include "close_low_fd.h"
+#include "memory.h"
+#include "samba_util.h" /* LIST_SEP */
+#include "debug.h"
 
 /* define what facility to use for syslog */
 #ifndef SYSLOG_FACILITY
diff --git a/lib/util/debug.h b/lib/util/debug.h
index a560c5e..27c319b 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -23,6 +23,12 @@
 #ifndef _DEBUG_H
 #define _DEBUG_H
 
+#include <stdbool.h>
+#include <stddef.h>
+
+#include "attr.h"
+
+
 /* -------------------------------------------------------------------------- **
  * Debugging code.  See also debug.c
  */
diff --git a/lib/util/idtree.c b/lib/util/idtree.c
index 3648761..6f1a4ac 100644
--- a/lib/util/idtree.c
+++ b/lib/util/idtree.c
@@ -32,7 +32,10 @@
  * @file
  */
 
-#include "includes.h"
+#include <talloc.h>
+#include "replace.h"
+#include "debug.h"
+#include "idtree.h"
 
 #define IDR_BITS 5
 #define IDR_FULL 0xfffffffful
@@ -139,7 +142,7 @@ restart:
 			 */
 			sh = IDR_BITS * (l + 1);
 			if (oid >> sh == id >> sh)
-			continue;
+				continue;
 			else
 				goto restart;
 		}
@@ -366,28 +369,6 @@ _PUBLIC_ int idr_get_new_above(struct idr_context *idp, void *ptr, int starting_
 }
 
 /**
-  allocate a new id randomly in the given range
-*/
-_PUBLIC_ int idr_get_new_random(struct idr_context *idp, void *ptr, int limit)
-{
-	int id;
-
-	/* first try a random starting point in the whole range, and if that fails,
-	   then start randomly in the bottom half of the range. This can only
-	   fail if the range is over half full, and finally fallback to any
-	   free id */
-	id = idr_get_new_above(idp, ptr, 1+(generate_random() % limit), limit);
-	if (id == -1) {
-		id = idr_get_new_above(idp, ptr, 1+(generate_random()%(limit/2)), limit);
-	}
-	if (id == -1) {
-		id = idr_get_new_above(idp, ptr, 1, limit);
-	}
-
-	return id;
-}
-
-/**
   find a pointer value previously set with idr_get_new given an id
 */
 _PUBLIC_ void *idr_find(struct idr_context *idp, int id)
diff --git a/lib/util/idtree.h b/lib/util/idtree.h
new file mode 100644
index 0000000..e7864a8
--- /dev/null
+++ b/lib/util/idtree.h
@@ -0,0 +1,68 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   very efficient functions to manage mapping a id (such as a fnum) to
+   a pointer. This is used for fnum and search id allocation.
+
+   Copyright (C) Andrew Tridgell 2004
+
+   This code is derived from lib/idr.c in the 2.6 Linux kernel, which was
+   written by Jim Houston jim.houston at ccur.com, and is
+   Copyright (C) 2002 by Concurrent Computer Corporation
+
+   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 2 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/>.
+*/
+
+#ifndef _SAMBA_IDTREE_H_
+#define _SAMBA_IDTREE_H_
+
+#include <talloc.h>
+
+struct idr_context;
+
+/**
+  initialise a idr tree. The context return value must be passed to
+  all subsequent idr calls. To destroy the idr tree use talloc_free()
+  on this context
+ */
+struct idr_context *idr_init(TALLOC_CTX *mem_ctx);
+
+/**
+  allocate the next available id, and assign 'ptr' into its slot.
+  you can retrieve later this pointer using idr_find()
+*/
+int idr_get_new(struct idr_context *idp, void *ptr, int limit);
+
+/**
+   allocate a new id, giving the first available value greater than or
+   equal to the given starting id
+*/
+int idr_get_new_above(struct idr_context *idp, void *ptr, int starting_id, int limit);
+
+/**
+  allocate a new id randomly in the given range
+*/
+int idr_get_new_random(struct idr_context *idp, void *ptr, int limit);
+
+/**
+  find a pointer value previously set with idr_get_new given an id
+*/
+void *idr_find(struct idr_context *idp, int id);
+
+/**
+  remove an id from the idr tree
+*/
+int idr_remove(struct idr_context *idp, int id);
+
+#endif /* _SAMBA_IDTREE_H_ */
diff --git a/lib/util/idtree_random.c b/lib/util/idtree_random.c
new file mode 100644
index 0000000..80758e7
--- /dev/null
+++ b/lib/util/idtree_random.c
@@ -0,0 +1,60 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   very efficient functions to manage mapping a id (such as a fnum) to
+   a pointer. This is used for fnum and search id allocation.
+
+   Copyright (C) Andrew Tridgell 2004
+
+   This code is derived from lib/idr.c in the 2.6 Linux kernel, which was
+   written by Jim Houston jim.houston at ccur.com, and is
+   Copyright (C) 2002 by Concurrent Computer Corporation
+
+   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 2 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/>.
+*/
+
+/*
+  see the section marked "public interface" below for documentation
+*/
+
+/**
+ * @file
+ */
+
+#include "replace.h"
+#include "samba_util.h" /* generate_random() */
+#include "idtree.h"
+#include "idtree_random.h"
+
+/**
+  allocate a new id randomly in the given range
+*/
+_PUBLIC_ int idr_get_new_random(struct idr_context *idp, void *ptr, int limit)
+{
+	int id;
+
+	/* first try a random starting point in the whole range, and if that fails,
+	   then start randomly in the bottom half of the range. This can only
+	   fail if the range is over half full, and finally fallback to any
+	   free id */
+	id = idr_get_new_above(idp, ptr, 1+(generate_random() % limit), limit);
+	if (id == -1) {
+		id = idr_get_new_above(idp, ptr, 1+(generate_random()%(limit/2)), limit);
+	}
+	if (id == -1) {
+		id = idr_get_new_above(idp, ptr, 1, limit);
+	}
+
+	return id;
+}
diff --git a/libcli/auth/schannel_proto.h b/lib/util/idtree_random.h
similarity index 50%
copy from libcli/auth/schannel_proto.h
copy to lib/util/idtree_random.h
index bce37c8..4d3b61c 100644
--- a/libcli/auth/schannel_proto.h
+++ b/lib/util/idtree_random.h
@@ -1,14 +1,18 @@
 /*
    Unix SMB/CIFS implementation.
 
-   dcerpc schannel operations
+   very efficient functions to manage mapping a id (such as a fnum) to
+   a pointer. This is used for fnum and search id allocation.
 
    Copyright (C) Andrew Tridgell 2004
-   Copyright (C) Andrew Bartlett <abartlet at samba.org> 2004-2005
+
+   This code is derived from lib/idr.c in the 2.6 Linux kernel, which was
+   written by Jim Houston jim.houston at ccur.com, and is
+   Copyright (C) 2002 by Concurrent Computer Corporation
 
    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
+   the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -20,12 +24,15 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LIBCLI_AUTH_SCHANNEL_PROTO_H__
-#define _LIBCLI_AUTH_SCHANNEL_PROTO_H__
+#ifndef _SAMBA_IDTREE_RANDOM_H_
+#define _SAMBA_IDTREE_RANDOM_H_
 
-struct schannel_state;
+#include <talloc.h>
+#include "idtree.h"
 
-struct db_context *open_schannel_session_store(TALLOC_CTX *mem_ctx,
-					       struct loadparm_context *lp_ctx);
+/**
+  allocate a new id randomly in the given range
+*/
+int idr_get_new_random(struct idr_context *idp, void *ptr, int limit);
 
-#endif
+#endif /* _SAMBA_IDTREE_RANDOM_H_ */
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index ec939cc..9da61fa 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -793,42 +793,8 @@ int ms_fnmatch_protocol(const char *pattern, const char *string, int protocol);
 /** a generic fnmatch function - uses for non-CIFS pattern matching */
 int gen_fnmatch(const char *pattern, const char *string);
 
-/* The following definitions come from lib/util/idtree.c  */
-
-
-/**
-  initialise a idr tree. The context return value must be passed to
-  all subsequent idr calls. To destroy the idr tree use talloc_free()
-  on this context
- */
-_PUBLIC_ struct idr_context *idr_init(TALLOC_CTX *mem_ctx);
-
-/**
-  allocate the next available id, and assign 'ptr' into its slot.
-  you can retrieve later this pointer using idr_find()
-*/
-_PUBLIC_ int idr_get_new(struct idr_context *idp, void *ptr, int limit);
-
-/**
-   allocate a new id, giving the first available value greater than or
-   equal to the given starting id
-*/
-_PUBLIC_ int idr_get_new_above(struct idr_context *idp, void *ptr, int starting_id, int limit);
-
-/**
-  allocate a new id randomly in the given range
-*/
-_PUBLIC_ int idr_get_new_random(struct idr_context *idp, void *ptr, int limit);
-
-/**
-  find a pointer value previously set with idr_get_new given an id
-*/
-_PUBLIC_ void *idr_find(struct idr_context *idp, int id);
-
-/**
-  remove an id from the idr tree
-*/
-_PUBLIC_ int idr_remove(struct idr_context *idp, int id);
+#include "idtree.h"
+#include "idtree_random.h"
 
 /**
  Close the low 3 fd's and open dev/null in their place
diff --git a/lib/util/util.c b/lib/util/util.c
index ec70c34..1dc1f1d 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -988,207 +988,6 @@ _PUBLIC_ size_t ascii_len_n(const char *src, size_t n)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list