[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-43-g2762205

Jelmer Vernooij jelmer at samba.org
Sat Oct 13 22:18:43 GMT 2007


The branch, v3-2-test has been updated
       via  2762205ee7bcf5da71f433f86e9c667fd65ee228 (commit)
       via  9394d0cc16537ae8ee207528c2e74cb8a420c64d (commit)
       via  84660aaab02338f22669bdf20af0f98607b6db17 (commit)
       via  3072b11ac42a7d89252599bdbbf9d8515b034a8d (commit)
       via  ec804f18eda896b2bda3682bf68becfc0d3ee92b (commit)
       via  9703aa291290c42762e8505e076b7aae92fbf8c0 (commit)
       via  06bbcd72d8b5a7a53e79e029818944298ad03e64 (commit)
       via  c711f33a918433f171b9711ae0db6678e4d6badc (commit)
      from  5e95c548864bc8b075b8343e69a69e1a22c92456 (commit)

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


- Log -----------------------------------------------------------------
commit 2762205ee7bcf5da71f433f86e9c667fd65ee228
Merge: 9394d0cc16537ae8ee207528c2e74cb8a420c64d 5e95c548864bc8b075b8343e69a69e1a22c92456
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Oct 14 00:18:01 2007 +0200

    Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into 3.2-trivial

commit 9394d0cc16537ae8ee207528c2e74cb8a420c64d
Merge: 84660aaab02338f22669bdf20af0f98607b6db17 ec804f18eda896b2bda3682bf68becfc0d3ee92b
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Oct 13 23:52:11 2007 +0200

    Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/jelmer/samba into 3.2-trivial

commit 84660aaab02338f22669bdf20af0f98607b6db17
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Oct 13 23:39:46 2007 +0200

    Ignore vim backup files.

commit 3072b11ac42a7d89252599bdbbf9d8515b034a8d
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Oct 13 23:36:16 2007 +0200

    Fix typo.

commit ec804f18eda896b2bda3682bf68becfc0d3ee92b
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Oct 13 18:33:43 2007 +0200

    Update copy of lib/util, fix remove some duplicates.

commit 9703aa291290c42762e8505e076b7aae92fbf8c0
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Oct 13 18:26:35 2007 +0200

    Fix typo.

commit 06bbcd72d8b5a7a53e79e029818944298ad03e64
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Oct 12 20:37:27 2007 +0200

    Remove some Samba 3 code, now provided by lib/util

commit c711f33a918433f171b9711ae0db6678e4d6badc
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Oct 12 19:47:06 2007 +0200

    Import lib/util from Samba 4

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

Summary of changes:
 .gitignore                      |    1 +
 source/Makefile.in              |   27 +-
 source/include/includes.h       |   18 +-
 source/include/smb.h            |   18 -
 source/include/smb_macros.h     |   12 -
 source/include/util_tdb.h       |   86 --
 source/lib/data_blob.c          |  146 --
 source/lib/genrand.c            |  223 ---
 source/lib/ms_fnmatch.c         |  225 ---
 source/lib/util/Doxyfile        |   24 +
 source/lib/util/attr.h          |   92 ++
 source/lib/util/become_daemon.c |   93 ++
 source/lib/util/byteorder.h     |  229 +++
 source/lib/util/capability.c    |  103 ++
 source/lib/util/capability.m4   |   17 +
 source/lib/util/config.mk       |   60 +
 source/lib/util/data_blob.c     |  232 +++
 source/lib/util/data_blob.h     |  119 ++
 source/lib/util/debug.c         |  239 ++++
 source/lib/util/debug.h         |   70 +
 source/lib/util/dlinklist.h     |  113 ++
 source/lib/util/dprintf.c       |  123 ++
 source/lib/util/fault.c         |  225 +++
 source/lib/util/fault.m4        |    5 +
 source/lib/util/fsusage.c       |  154 ++
 source/lib/util/fsusage.m4      |  190 +++
 source/lib/util/genrand.c       |  333 +++++
 source/lib/util/idtree.c        |  391 ++++++
 source/lib/util/mainpage.dox    |   11 +
 source/lib/util/ms_fnmatch.c    |  221 +++
 source/lib/util/mutex.c         |   56 +
 source/lib/util/mutex.h         |   75 +
 source/lib/util/safe_string.h   |   44 +
 source/lib/util/signal.c        |  144 ++
 source/lib/util/signal.m4       |    1 +
 source/lib/util/system.c        |   90 ++
 source/lib/util/tests/file.c    |   97 ++
 source/lib/util/tests/genrand.c |   65 +
 source/lib/util/tests/idtree.c  |  121 ++
 source/lib/util/tests/str.c     |  121 ++
 source/lib/util/tests/strlist.c |   79 ++
 source/lib/util/time.c          |  614 ++++++++
 source/lib/util/time.h          |  231 +++
 source/lib/util/time.m4         |    9 +
 source/lib/util/unix_privs.c    |   77 +
 source/lib/util/unix_privs.h    |   43 +
 source/lib/util/util.c          |  530 +++++++
 source/lib/util/util.h          |  831 +++++++++++
 source/lib/util/util.m4         |    1 +
 source/lib/util/util_file.c     |  404 ++++++
 source/lib/util/util_getent.c   |  283 ++++
 source/lib/util/util_pw.c       |   77 +
 source/lib/util/util_str.c      |  790 +++++++++++
 source/lib/util/util_strlist.c  |  302 ++++
 source/lib/util/util_tdb.c      |  541 ++++++++
 source/lib/util/util_tdb.h      |  148 ++
 source/lib/util/wrap_xattr.c    |  120 ++
 source/lib/util/wrap_xattr.h    |   41 +
 source/lib/util/xattr.m4        |   32 +
 source/lib/util/xfile.c         |  389 ++++++
 source/lib/util/xfile.h         |   99 ++
 source/lib/util_file.c          |  424 ------
 source/lib/util_sock.c          |   52 -
 source/lib/util_str.c           | 2929 ---------------------------------------
 source/lib/util_tdb.c           | 1487 --------------------
 source/library-versions.in      |    2 +-
 source/librpc/ndr/ndr_misc.c    |   15 -
 67 files changed, 9521 insertions(+), 5643 deletions(-)
 delete mode 100644 source/include/util_tdb.h
 delete mode 100644 source/lib/data_blob.c
 delete mode 100644 source/lib/genrand.c
 delete mode 100644 source/lib/ms_fnmatch.c
 create mode 100644 source/lib/util/Doxyfile
 create mode 100644 source/lib/util/attr.h
 create mode 100644 source/lib/util/become_daemon.c
 create mode 100644 source/lib/util/byteorder.h
 create mode 100644 source/lib/util/capability.c
 create mode 100644 source/lib/util/capability.m4
 create mode 100644 source/lib/util/config.mk
 create mode 100644 source/lib/util/data_blob.c
 create mode 100644 source/lib/util/data_blob.h
 create mode 100644 source/lib/util/debug.c
 create mode 100644 source/lib/util/debug.h
 create mode 100644 source/lib/util/dlinklist.h
 create mode 100644 source/lib/util/dprintf.c
 create mode 100644 source/lib/util/fault.c
 create mode 100644 source/lib/util/fault.m4
 create mode 100644 source/lib/util/fsusage.c
 create mode 100644 source/lib/util/fsusage.m4
 create mode 100644 source/lib/util/genrand.c
 create mode 100644 source/lib/util/idtree.c
 create mode 100644 source/lib/util/mainpage.dox
 create mode 100644 source/lib/util/ms_fnmatch.c
 create mode 100644 source/lib/util/mutex.c
 create mode 100644 source/lib/util/mutex.h
 create mode 100644 source/lib/util/safe_string.h
 create mode 100644 source/lib/util/signal.c
 create mode 100644 source/lib/util/signal.m4
 create mode 100644 source/lib/util/system.c
 create mode 100644 source/lib/util/tests/file.c
 create mode 100644 source/lib/util/tests/genrand.c
 create mode 100644 source/lib/util/tests/idtree.c
 create mode 100644 source/lib/util/tests/str.c
 create mode 100644 source/lib/util/tests/strlist.c
 create mode 100644 source/lib/util/time.c
 create mode 100644 source/lib/util/time.h
 create mode 100644 source/lib/util/time.m4
 create mode 100644 source/lib/util/unix_privs.c
 create mode 100644 source/lib/util/unix_privs.h
 create mode 100644 source/lib/util/util.c
 create mode 100644 source/lib/util/util.h
 create mode 100644 source/lib/util/util.m4
 create mode 100644 source/lib/util/util_file.c
 create mode 100644 source/lib/util/util_getent.c
 create mode 100644 source/lib/util/util_pw.c
 create mode 100644 source/lib/util/util_str.c
 create mode 100644 source/lib/util/util_strlist.c
 create mode 100644 source/lib/util/util_tdb.c
 create mode 100644 source/lib/util/util_tdb.h
 create mode 100644 source/lib/util/wrap_xattr.c
 create mode 100644 source/lib/util/wrap_xattr.h
 create mode 100644 source/lib/util/xattr.m4
 create mode 100644 source/lib/util/xfile.c
 create mode 100644 source/lib/util/xfile.h
 delete mode 100644 source/lib/util_file.c
 delete mode 100644 source/lib/util_str.c
 delete mode 100644 source/lib/util_tdb.c


Changeset truncated at 500 lines:

diff --git a/.gitignore b/.gitignore
index d5e5177..36a7f18 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,4 @@ source/library-versions
 source/nsswitch/*.so
 source/proto_exists
 source/winbindd/winbindd_proto.h
+*~
diff --git a/source/Makefile.in b/source/Makefile.in
index 4d261d3..94804e8 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -214,7 +214,7 @@ TDBBASE_OBJ = lib/tdb/common/tdb.o lib/tdb/common/dump.o lib/tdb/common/error.o
 	lib/tdb/common/open.o lib/tdb/common/transaction.o \
 	lib/tdb/common/traverse.o
 
-TDB_OBJ = $(TDBBASE_OBJ) lib/util_tdb.o\
+TDB_OBJ = $(TDBBASE_OBJ) \
 	lib/dbwrap.o lib/dbwrap_tdb.o lib/dbwrap_ctdb.o
 
 SMBLDAP_OBJ = @SMBLDAP@ @SMBLDAPUTIL@
@@ -272,18 +272,19 @@ LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(TALLOC_OBJ) \
 	lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o
 
 LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
+					 $(LIB_UTIL_OBJ) \
 	  lib/interface.o lib/md4.o \
 	  lib/interfaces.o lib/pidfile.o \
-	  lib/signal.o lib/system.o lib/sendfile.o lib/time.o \
-	  lib/ufc.o lib/genrand.o lib/username.o \
+	  lib/system.o lib/sendfile.o \
+	  lib/ufc.o lib/username.o \
 	  lib/util_pw.o lib/access.o lib/smbrun.o \
 	  lib/bitmap.o lib/crc32.o lib/dprintf.o \
-	  lib/xfile.o lib/wins_srv.o $(UTIL_REG_OBJ) \
-	  lib/util_str.o lib/clobber.o lib/util_sid.o lib/util_uuid.o \
-	  lib/util_unistr.o lib/util_file.o lib/data_blob.o \
-	  lib/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \
+	  lib/wins_srv.o $(UTIL_REG_OBJ) \
+	  lib/clobber.o lib/util_sid.o lib/util_uuid.o \
+	  lib/util_unistr.o \
+	  lib/util_sock.o lib/sock_exec.o lib/util_sec.o \
 	  lib/substitute.o lib/fsusage.o \
-	  lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \
+	  lib/select.o lib/errmap_unix.o \
 	  lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \
 	  lib/md5.o lib/hmacmd5.o lib/arc4.o lib/iconv.o \
 	  nsswitch/wb_client.o $(WBCOMMON_OBJ) \
@@ -491,6 +492,16 @@ PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o
 
 SLCACHE_OBJ = libsmb/samlogon_cache.o
 
+LIB_UTIL_OBJ = lib/util/become_daemon.o lib/util/capability.o \
+			   lib/util/data_blob.o lib/util/dprintf.o \
+			   lib/util/fsusage.o lib/util/genrand.o \
+			   lib/util/idtree.o lib/util/ms_fnmatch.o lib/util/mutex.o \
+			   lib/util/signal.o lib/util/system.o lib/util/time.o \
+			   lib/util/unix_privs.o lib/util/util.o lib/util/util_file.o \
+			   lib/util/util_getent.o lib/util/util_pw.o lib/util/util_str.o \
+			   lib/util/util_strlist.o lib/util/util_tdb.o \
+			   lib/util/wrap_xattr.o lib/util/xfile.o
+
 DCUTIL_OBJ  = libsmb/namequery_dc.o libsmb/trustdom_cache.o libsmb/trusts_util.o libsmb/dsgetdcname.o
 
 AUTH_BUILTIN_OBJ = auth/auth_builtin.o
diff --git a/source/include/includes.h b/source/include/includes.h
index a57891b..63c51dd 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -71,22 +71,6 @@
 #undef HAVE_TERMIOS_H
 #endif
 
-#ifndef _PUBLIC_
-#ifdef HAVE_VISIBILITY_ATTR
-#  define _PUBLIC_ __attribute__((visibility("default")))
-#else
-#  define _PUBLIC_
-#endif
-#endif
-
-#if defined(__GNUC__) && !defined(__cplusplus)
-/** gcc attribute used on function parameters so that it does not emit
- * warnings about them being unused. **/
-#  define UNUSED(param) param __attribute__ ((unused))
-#else
-#  define UNUSED(param) param
-/** Feel free to add definitions for other compilers here. */
-#endif
 
 #ifdef RELIANTUNIX
 /*
@@ -623,6 +607,7 @@ typedef int BOOL;
 #define NGROUPS_MAX 32 /* Guess... */
 #endif
 
+#include "lib/util/util.h"
 /* Our own pstrings and fstrings */
 #include "pstring.h"
 
@@ -631,7 +616,6 @@ typedef int BOOL;
 #include "intl.h"
 #include "dlinklist.h"
 #include "tdb.h"
-#include "util_tdb.h"
 
 #include "lib/talloc/talloc.h"
 /* And a little extension. Abort on type mismatch */
diff --git a/source/include/smb.h b/source/include/smb.h
index 7386613..441872d 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -207,10 +207,6 @@ typedef uint32 codepoint_t;
 #define PI_NTSVCS		13
 #define PI_MAX_PIPES		14
 
-/* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
-typedef uint64_t NTTIME;
-
-
 /* Allowable account control bits */
 #define ACB_DISABLED			0x00000001  /* 1 = User account disabled */
 #define ACB_HOMDIRREQ			0x00000002  /* 1 = Home directory required */
@@ -517,13 +513,6 @@ typedef struct files_struct {
 #include "ntquotas.h"
 #include "sysquotas.h"
 
-/* used to hold an arbitrary blob of data */
-typedef struct data_blob {
-	uint8 *data;
-	size_t length;
-	void (*free)(struct data_blob *data_blob);
-} DATA_BLOB;
-
 extern const DATA_BLOB data_blob_null;
 
 /*
@@ -1517,13 +1506,6 @@ char *strdup(char *s);
 #define CAP_UNIX             0x800000 /* Capabilities for UNIX extensions. Created by HP. */
 #define CAP_EXTENDED_SECURITY 0x80000000
 
-/* protocol types. It assumes that higher protocols include lower protocols
-   as subsets */
-enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1};
-
-/* security levels */
-enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER,SEC_DOMAIN,SEC_ADS};
-
 /* server roles */
 enum server_types {
 	ROLE_STANDALONE,
diff --git a/source/include/smb_macros.h b/source/include/smb_macros.h
index aea429d..8cfc1e0 100644
--- a/source/include/smb_macros.h
+++ b/source/include/smb_macros.h
@@ -45,18 +45,6 @@
 #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
 #endif
 
-/* assert macros */
-#ifdef DEVELOPER
-#define SMB_ASSERT(b) ( (b) ? (void)0 : \
-        (DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \
-		 __FILE__, __LINE__, #b)), smb_panic("assert failed: " #b)))
-#else
-/* redefine the assert macro for non-developer builds */
-#define SMB_ASSERT(b) ( (b) ? (void)0 : \
-        (DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \
-	    __FILE__, __LINE__, #b))))
-#endif
-
 #define SMB_WARN(condition, message) \
     ((condition) ? (void)0 : \
      DEBUG(0, ("WARNING: %s: %s\n", #condition, message)))
diff --git a/source/include/util_tdb.h b/source/include/util_tdb.h
deleted file mode 100644
index cb12842..0000000
--- a/source/include/util_tdb.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   tdb utility functions
-   Copyright (C) Andrew Tridgell 1999
-   
-   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/>.
-*/
-
-#ifndef __TDBUTIL_H__
-#define __TDBUTIL_H__
-
-#include "tdb.h"
-
-#ifndef _BOOL
-typedef int BOOL;
-#define _BOOL
-#endif
-
-/* single node of a list returned by tdb_search_keys */
-typedef struct keys_node 
-{
-	struct keys_node *prev, *next;
-	TDB_DATA node_key;
-} TDB_LIST_NODE;
-
-struct tdb_wrap {
-	struct tdb_context *tdb;
-	const char *name;
-	struct tdb_wrap *next, *prev;
-};
-
-struct tdb_validation_status {
-	BOOL tdb_error;
-	BOOL bad_freelist;
-	BOOL bad_entry;
-	BOOL unknown_key;
-	BOOL success;
-};
-
-typedef int (*tdb_validate_data_func)(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state);
-
-TDB_LIST_NODE *tdb_search_keys(struct tdb_context*, const char*);
-void tdb_search_list_free(TDB_LIST_NODE*);
-int32 tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int32 *oldval, int32 change_val);
-int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval);
-int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
-				   int timeout);
-void tdb_unlock_bystring(struct tdb_context *tdb, const char *keyval);
-int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
-					unsigned int timeout);
-void tdb_read_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval);
-int32 tdb_fetch_int32(struct tdb_context *tdb, const char *keystr);
-int tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32 value);
-int tdb_store_int32(struct tdb_context *tdb, const char *keystr, int32 v);
-int tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32 *value);
-int tdb_traverse_delete_fn(struct tdb_context *the_tdb, TDB_DATA key, TDB_DATA dbuf,
-                     void *state);
-int tdb_store_bystring(struct tdb_context *tdb, const char *keystr, TDB_DATA data, int flags);
-TDB_DATA tdb_fetch_bystring(struct tdb_context *tdb, const char *keystr);
-int tdb_delete_bystring(struct tdb_context *tdb, const char *keystr);
-struct tdb_context *tdb_open_log(const char *name, int hash_size,
-				 int tdb_flags, int open_flags, mode_t mode);
-int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...);
-size_t tdb_pack(uint8 *buf, int bufsize, const char *fmt, ...);
-TDB_DATA make_tdb_data(const uint8 *dptr, size_t dsize);
-TDB_DATA string_tdb_data(const char *string);
-TDB_DATA string_term_tdb_data(const char *string);
-int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
-		    int flag);
-BOOL tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr,
-			      uint32 *oldval, uint32 change_val);
-int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key,
-				unsigned int timeout);
-
-#endif /* __TDBUTIL_H__ */
diff --git a/source/lib/data_blob.c b/source/lib/data_blob.c
deleted file mode 100644
index e64e6a1..0000000
--- a/source/lib/data_blob.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Easy management of byte-length data
-   Copyright (C) Andrew Tridgell 2001
-   Copyright (C) Andrew Bartlett 2001
-   
-   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"
-
-const DATA_BLOB data_blob_null = { NULL, 0, NULL };
-
-/*******************************************************************
- Free() a data blob.
-*******************************************************************/
-
-static void free_data_blob(DATA_BLOB *d)
-{
-	if ((d) && (d->free)) {
-		SAFE_FREE(d->data);
-	}
-}
-
-/*******************************************************************
- Construct a data blob, must be freed with data_blob_free().
- You can pass NULL for p and get a blank data blob
-*******************************************************************/
-
-DATA_BLOB data_blob(const void *p, size_t length)
-{
-	DATA_BLOB ret;
-
-	if (!length) {
-		ZERO_STRUCT(ret);
-		return ret;
-	}
-
-	if (p) {
-		ret.data = (uint8 *)smb_xmemdup(p, length);
-	} else {
-		ret.data = SMB_XMALLOC_ARRAY(uint8, length);
-	}
-	ret.length = length;
-	ret.free = free_data_blob;
-	return ret;
-}
-
-/*******************************************************************
- Construct a data blob, using supplied TALLOC_CTX.
-*******************************************************************/
-
-DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length)
-{
-	DATA_BLOB ret;
-
-	if (!length) {
-		ZERO_STRUCT(ret);
-		return ret;
-	}
-
-	if (p) {
-		ret.data = (uint8 *)TALLOC_MEMDUP(mem_ctx, p, length);
-		if (ret.data == NULL)
-			smb_panic("data_blob_talloc: TALLOC_MEMDUP failed");
-	} else {
-		ret.data = (uint8 *)TALLOC(mem_ctx, length);
-		if (ret.data == NULL)
-			smb_panic("data_blob_talloc: TALLOC failed");
-	}
-
-	ret.length = length;
-	ret.free = NULL;
-	return ret;
-}
-
-/*******************************************************************
- Free a data blob.
-*******************************************************************/
-
-void data_blob_free(DATA_BLOB *d)
-{
-	if (d) {
-		if (d->free) {
-			(d->free)(d);
-		}
-		d->length = 0;
-	}
-}
-
-/*******************************************************************
- Clear a DATA_BLOB's contents
-*******************************************************************/
-
-void data_blob_clear(DATA_BLOB *d)
-{
-	if (d->data) {
-		memset(d->data, 0, d->length);
-	}
-}
-
-/*******************************************************************
- Free a data blob and clear its contents
-*******************************************************************/
-
-void data_blob_clear_free(DATA_BLOB *d)
-{
-	data_blob_clear(d);
-	data_blob_free(d);
-}
-
-/**
-  useful for constructing data blobs in test suites, while
-  avoiding const warnings
-**/
-DATA_BLOB data_blob_string_const(const char *str)
-{
-	DATA_BLOB blob;
-	blob.data = CONST_DISCARD(uint8 *, str);
-	blob.length = strlen(str);
-	blob.free = NULL;
-	return blob;
-}
-
-/**
- * Create a new data blob from const data 
- */
-DATA_BLOB data_blob_const(const void *p, size_t length)
-{
-	DATA_BLOB blob;
-	blob.data = CONST_DISCARD(uint8 *, p);
-	blob.length = length;
-	blob.free = NULL;
-	return blob;
-}
diff --git a/source/lib/genrand.c b/source/lib/genrand.c
deleted file mode 100644
index a08fe67..0000000
--- a/source/lib/genrand.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-
-   Functions to create reasonable random numbers for crypto use.
-
-   Copyright (C) Jeremy Allison 2001
-   
-   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"
-
-static unsigned char smb_arc4_state[258];
-static uint32 counter;
-
-static BOOL done_reseed = False;
-static void (*reseed_callback)(int *newseed);
-
-/**************************************************************** 
- Copy any user given reseed data.
-*****************************************************************/
-
-void set_rand_reseed_callback(void (*fn)(int *))
-{
-	reseed_callback = fn;
-	set_need_random_reseed();
-}
-
-void set_need_random_reseed(void)
-{
-	done_reseed = False;
-}
-
-static void get_rand_reseed_data(int *reseed_data)
-{
-	if (reseed_callback) {
-		reseed_callback(reseed_data);
-	} else {
-		*reseed_data = 0;
-	}
-}
-
-/****************************************************************
- Get a 16 byte hash from the contents of a file.
- Note that the hash is not initialised.
-*****************************************************************/
-
-static void do_filehash(const char *fname, unsigned char *the_hash)
-{
-	unsigned char buf[1011]; /* deliberate weird size */
-	unsigned char tmp_md4[16];
-	int fd, n;
-
-	fd = sys_open(fname,O_RDONLY,0);
-	if (fd == -1)
-		return;
-
-	while ((n = read(fd, (char *)buf, sizeof(buf))) > 0) {
-		mdfour(tmp_md4, buf, n);
-		for (n=0;n<16;n++)
-			the_hash[n] ^= tmp_md4[n];
-	}
-	close(fd);
-}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list