[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Tue Apr 17 21:40:03 MDT 2012


The branch, master has been updated
       via  538893d s3fs: Use xattr_tdb format for xattr storage
       via  628a241 s4-python: Add python wrapper for xattr_tdb format xattr storage
       via  44b6bf9 s3-xattr_tdb: Use talloc_stackframe() more to allow calling from common code
       via  492942a s3-xattr_tdb: Be nice to xattr_tdb_getxattr callers, return the full blob
       via  351c78f s3-xattr_tdb: make xattr_tdb a private library, for use outside vfs_xattr_tdb
       via  ce96768 s3-lib: Add file_id_string()
       via  ea5a9b2 s3-build: move file_id.c into samba3-util and create a private header
       via  19fb796 dbwrap: Add dbwrap_tdb to private dbwrap library
       via  ee695de s3-build: Add missing samba3-util dep to tdb-wrap3
       via  cc86f8e lib/util: Move map_nt_error_from_tdb to the top level
       via  338e5a1 s3-dbwrap: push lp_ctx up another layer in the stack
       via  235016b s3-dbwrap: Add talloc_stackframe() calls
       via  99caee5 build: Remove more of the s3 special cases in waf: only pidfile.c needs -DCONFIGFILE
      from  9e9887d s4:samdb:rootdse: implement the schemaUpgradeInProgress operation in ldap modify

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


- Log -----------------------------------------------------------------
commit 538893d183e967448df5aeb41b99a8af5116c5b7
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 19:01:15 2012 +1000

    s3fs: Use xattr_tdb format for xattr storage
    
    Autobuild-User: Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date: Wed Apr 18 05:39:01 CEST 2012 on sn-devel-104

commit 628a24172f3bb759324582c439ba9d081aa4d392
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 18:59:34 2012 +1000

    s4-python: Add python wrapper for xattr_tdb format xattr storage
    
    This uses the format used by the vfs_xattr_tdb module.  The s4
    posix:eadb format is kept, just in a new file and module.
    
    Andrew Bartlett

commit 44b6bf9130ec5207da148af0f56a660ce9e08c32
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 22:18:14 2012 +1000

    s3-xattr_tdb: Use talloc_stackframe() more to allow calling from common code

commit 492942a66ad89172135512cd433b50c13726f777
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 17:14:06 2012 +1000

    s3-xattr_tdb: Be nice to xattr_tdb_getxattr callers, return the full blob
    
    In this case, the blob is already in memory, so it is easier to return the full
    blob to the caller, and let the caller decide if some interface restriction
    stops the full blob from being passed all the way up the stack.
    
    This allows us to quickly write a python wrapper for this xattr storage
    mechanism.
    
    Andrew Bartlett

commit 351c78fc670d5e26ebc2deea7ef930a94b116697
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 15:49:13 2012 +1000

    s3-xattr_tdb: make xattr_tdb a private library, for use outside vfs_xattr_tdb

commit ce9676839b50ad34cead8f7f02488272a2bb3c85
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 15:36:15 2012 +1000

    s3-lib: Add file_id_string()

commit ea5a9b21fb384524c8370c6d7a712b35e170fd06
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 15:34:40 2012 +1000

    s3-build: move file_id.c into samba3-util and create a private header

commit 19fb796960da0e6101a520036a2e610baa4515fd
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 14:21:33 2012 +1000

    dbwrap: Add dbwrap_tdb to private dbwrap library
    
    Andrew Bartlett

commit ee695de1b4f47f1c2fddc35f713a21a0413f1fdf
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 14:20:46 2012 +1000

    s3-build: Add missing samba3-util dep to tdb-wrap3

commit cc86f8e9858ed49074e0d159bdcfb14d18859562
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 14:18:49 2012 +1000

    lib/util: Move map_nt_error_from_tdb to the top level
    
    This will help with making dbwrap available as a top level library.
    
    Andrew Bartlett

commit 338e5a1d35574dbd96bbbcf2a74fe33adc95cb8c
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 13:37:39 2012 +1000

    s3-dbwrap: push lp_ctx up another layer in the stack
    
    This will allow db_open_tdb() to be called from common code, which may
    already have a loadparm context loaded.
    
    It also slowly moves the lp_ctx up the stack, as required to remove
    the library loop between smbconf and the registry.
    
    Andrew Bartlett

commit 235016bcf9c332f88d3aae68d0726d8bb2a64246
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 16 13:36:01 2012 +1000

    s3-dbwrap: Add talloc_stackframe() calls
    
    This is in preperation for calling dbwrap from common code, where we may not
    have a stackframe set up.
    
    Andrew Bartlett

commit 99caee5eef6e054ad6c94a00e3de869f764954f7
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Apr 17 11:25:40 2012 +1000

    build: Remove more of the s3 special cases in waf: only pidfile.c needs -DCONFIGFILE

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

Summary of changes:
 buildtools/wafsamba/samba3.py                      |    6 -
 file_server/file_server.c                          |    6 +-
 lib/util/util_tdb.c                                |   65 +++-
 lib/util/util_tdb.h                                |    6 +
 selftest/target/Samba4.pm                          |    2 +-
 source3/Makefile.in                                |    2 +-
 source3/include/locking.h                          |    2 +-
 source3/include/proto.h                            |    5 -
 source3/lib/dbwrap/dbwrap.c                        |   26 +-
 source3/lib/dbwrap/dbwrap_open.c                   |    5 +-
 source3/lib/dbwrap/dbwrap_tdb.c                    |    5 +-
 source3/lib/dbwrap/dbwrap_tdb.h                    |    1 +
 source3/lib/file_id.c                              |   16 +-
 .../libnet/groupinfo.h => source3/lib/file_id.h    |   51 +--
 source3/lib/util_tdb.c                             |   58 ---
 source3/lib/xattr_tdb.c                            |  468 ++++++++++++++++++++
 source3/lib/xattr_tdb.h                            |   41 ++
 source3/modules/vfs_xattr_tdb.c                    |  464 ++------------------
 source3/modules/wscript_build                      |    2 +-
 source3/smbd/notify_internal.c                     |    5 +-
 source3/wscript_build                              |   24 +-
 .../posix/python/{pyxattr_tdb.c => pyposix_eadb.c} |   11 +-
 source4/ntvfs/posix/python/pyxattr_tdb.c           |   72 +++-
 source4/ntvfs/posix/wscript_build                  |    8 +-
 source4/scripting/python/samba/ntacls.py           |   36 +-
 .../scripting/python/samba/provision/__init__.py   |   25 +-
 26 files changed, 810 insertions(+), 602 deletions(-)
 copy source4/libnet/groupinfo.h => source3/lib/file_id.h (51%)
 create mode 100644 source3/lib/xattr_tdb.c
 create mode 100644 source3/lib/xattr_tdb.h
 copy source4/ntvfs/posix/python/{pyxattr_tdb.c => pyposix_eadb.c} (96%)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
index fef8152..369285c 100644
--- a/buildtools/wafsamba/samba3.py
+++ b/buildtools/wafsamba/samba3.py
@@ -100,12 +100,6 @@ def s3_fix_kwargs(bld, kwargs):
         includes += TO_LIST(kwargs['includes'])
     kwargs['includes'] = includes
 
-    # some S3 code assumes that CONFIGFILE is set
-    cflags = ['-DCONFIGFILE="%s"' % bld.env['CONFIGFILE']]
-    if 'cflags' in kwargs:
-        cflags += TO_LIST(kwargs['cflags'])
-    kwargs['cflags'] = cflags
-
 # these wrappers allow for mixing of S3 and S4 build rules in the one build
 
 def SAMBA3_LIBRARY(bld, name, *args, **kwargs):
diff --git a/file_server/file_server.c b/file_server/file_server.c
index d3eb53c..ad05fca 100644
--- a/file_server/file_server.c
+++ b/file_server/file_server.c
@@ -57,8 +57,10 @@ static const char *generate_smb_conf(struct task_server *task)
 	fdprintf(fd, "rpc_daemon:spoolssd = disabled\n");
 	fdprintf(fd, "rpc_server:tcpip = no\n");
 
-	/* If we are using posix:eadb then we need to load another VFS object */
-	if (lpcfg_parm_string(lp_ctx, NULL, "posix", "eadb")) {
+	/* If we are using xattr_tdb:file or posix:eadb then we need to load another VFS object */
+	if (lpcfg_parm_string(lp_ctx, NULL, "xattr_tdb", "file")) {
+		fdprintf(fd, "vfs objects = acl_xattr xattr_tdb\n");
+	} else if (lpcfg_parm_string(lp_ctx, NULL, "posix", "eadb")) {
 		fdprintf(fd, "vfs objects = acl_xattr posix_eadb\n");
 	} else {
 		fdprintf(fd, "vfs objects = acl_xattr\n");
diff --git a/lib/util/util_tdb.c b/lib/util/util_tdb.c
index f239797..2096769 100644
--- a/lib/util/util_tdb.c
+++ b/lib/util/util_tdb.c
@@ -4,7 +4,8 @@
    tdb utility functions
 
    Copyright (C) Andrew Tridgell 1992-2006
-   
+   Copyright (C) Volker Lendecke 2007-2011
+
    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
@@ -351,3 +352,65 @@ int tdb_traverse_delete_fn(struct tdb_context *the_tdb, TDB_DATA key, TDB_DATA d
 {
     return tdb_delete(the_tdb, key);
 }
+
+/****************************************************************************
+ Return an NTSTATUS from a TDB_ERROR
+****************************************************************************/
+
+NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err)
+{
+	NTSTATUS result = NT_STATUS_INTERNAL_ERROR;
+
+	switch (err) {
+	case TDB_SUCCESS:
+		result = NT_STATUS_OK;
+		break;
+	case TDB_ERR_CORRUPT:
+		result = NT_STATUS_INTERNAL_DB_CORRUPTION;
+		break;
+	case TDB_ERR_IO:
+		result = NT_STATUS_UNEXPECTED_IO_ERROR;
+		break;
+	case TDB_ERR_OOM:
+		result = NT_STATUS_NO_MEMORY;
+		break;
+	case TDB_ERR_EXISTS:
+		result = NT_STATUS_OBJECT_NAME_COLLISION;
+		break;
+
+	case TDB_ERR_LOCK:
+		/*
+		 * TDB_ERR_LOCK is very broad, we could for example
+		 * distinguish between fcntl locks and invalid lock
+		 * sequences. So NT_STATUS_FILE_LOCK_CONFLICT is a
+		 * compromise.
+		 */
+		result = NT_STATUS_FILE_LOCK_CONFLICT;
+		break;
+
+#ifndef BUILD_TDB2
+	case TDB_ERR_NOLOCK:
+	case TDB_ERR_LOCK_TIMEOUT:
+		/*
+		 * These two ones in the enum are not actually used
+		 */
+		result = NT_STATUS_FILE_LOCK_CONFLICT;
+		break;
+#endif
+	case TDB_ERR_NOEXIST:
+		result = NT_STATUS_NOT_FOUND;
+		break;
+	case TDB_ERR_EINVAL:
+		result = NT_STATUS_INVALID_PARAMETER;
+		break;
+	case TDB_ERR_RDONLY:
+		result = NT_STATUS_ACCESS_DENIED;
+		break;
+#ifndef BUILD_TDB2
+	case TDB_ERR_NESTING:
+		result = NT_STATUS_INTERNAL_ERROR;
+		break;
+#endif
+	};
+	return result;
+}
diff --git a/lib/util/util_tdb.h b/lib/util/util_tdb.h
index 3d03b99..0b6f3f1 100644
--- a/lib/util/util_tdb.h
+++ b/lib/util/util_tdb.h
@@ -132,5 +132,11 @@ bool tdb_change_uint32_atomic(struct tdb_context *tdb, const char *keystr, uint3
 int tdb_traverse_delete_fn(struct tdb_context *the_tdb, TDB_DATA key, TDB_DATA dbuf,
                      void *state);
 
+/****************************************************************************
+ Return an NTSTATUS from a TDB_ERROR
+****************************************************************************/
+
+NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err);
+
 #endif /* _____LIB_UTIL_UTIL_TDB_H__ */
 
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index bc94d7c..bc469d7 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -1268,7 +1268,7 @@ sub provision_plugin_s4_dc($$)
 	my $extra_smbconf_options = "
 server services = -smb +s3fs
 dcerpc endpoint servers = -unixinfo -spoolss -winreg -wkssvc -srvsvc
-
+xattr_tdb:file = $prefix/statedir/xattr.tdb
 ";
 
 	print "PROVISIONING PLUGIN S4 DC...";
diff --git a/source3/Makefile.in b/source3/Makefile.in
index d48ce37..21b41df 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -853,7 +853,7 @@ VFS_EXPAND_MSDFS_OBJ = modules/vfs_expand_msdfs.o
 VFS_SHADOW_COPY_OBJ = modules/vfs_shadow_copy.o
 VFS_SHADOW_COPY2_OBJ = modules/vfs_shadow_copy2.o
 VFS_AFSACL_OBJ = modules/vfs_afsacl.o
-VFS_XATTR_TDB_OBJ = modules/vfs_xattr_tdb.o
+VFS_XATTR_TDB_OBJ = modules/vfs_xattr_tdb.o lib/xattr_tdb.o
 VFS_POSIXACL_OBJ = modules/vfs_posixacl.o
 VFS_AIXACL_OBJ = modules/vfs_aixacl.o modules/vfs_aixacl_util.o
 VFS_AIXACL2_OBJ = modules/vfs_aixacl2.o modules/vfs_aixacl_util.o modules/nfs4_acls.o
diff --git a/source3/include/locking.h b/source3/include/locking.h
index 77a04ee..b003b55 100644
--- a/source3/include/locking.h
+++ b/source3/include/locking.h
@@ -45,7 +45,7 @@ struct lock_context {
 
 struct files_struct;
 
-#include "../librpc/gen_ndr/file_id.h"
+#include "lib/file_id.h"
 
 struct byte_range_lock {
 	struct files_struct *fsp;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 14fe730..8392b68 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -122,11 +122,6 @@ int map_errno_from_nt_status(NTSTATUS status);
 /* The following definitions come from lib/file_id.c  */
 
 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
-bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
-const char *file_id_string_tos(const struct file_id *id);
-void push_file_id_16(char *buf, const struct file_id *id);
-void push_file_id_24(char *buf, const struct file_id *id);
-void pull_file_id_24(char *buf, struct file_id *id);
 
 /* The following definitions come from lib/gencache.c  */
 
diff --git a/source3/lib/dbwrap/dbwrap.c b/source3/lib/dbwrap/dbwrap.c
index cfd15a9..80bd09b 100644
--- a/source3/lib/dbwrap/dbwrap.c
+++ b/source3/lib/dbwrap/dbwrap.c
@@ -148,17 +148,23 @@ static struct db_record *dbwrap_fetch_locked_internal(
 {
 	struct db_record *rec;
 	struct dbwrap_lock_order_state *lock_order;
+	TALLOC_CTX *frame = talloc_stackframe();
+	if (!frame) {
+		return NULL;
+	}
 
-	lock_order = dbwrap_check_lock_order(db, talloc_tos());
+	lock_order = dbwrap_check_lock_order(db, frame);
 	if (lock_order == NULL) {
+		TALLOC_FREE(frame);
 		return NULL;
 	}
 	rec = db_fn(db, mem_ctx, key);
 	if (rec == NULL) {
-		TALLOC_FREE(lock_order);
+		TALLOC_FREE(frame);
 		return NULL;
 	}
 	(void)talloc_steal(rec, lock_order);
+	TALLOC_FREE(frame);
 	return rec;
 }
 
@@ -235,14 +241,19 @@ NTSTATUS dbwrap_store(struct db_context *db, TDB_DATA key,
 {
 	struct db_record *rec;
 	NTSTATUS status;
+	TALLOC_CTX *frame = talloc_stackframe();
+	if (!frame) {
+		return NT_STATUS_NO_MEMORY;
+	}
 
-	rec = dbwrap_fetch_locked(db, talloc_tos(), key);
+	rec = dbwrap_fetch_locked(db, frame, key);
 	if (rec == NULL) {
+		TALLOC_FREE(frame);
 		return NT_STATUS_NO_MEMORY;
 	}
 
 	status = dbwrap_record_store(rec, data, flags);
-	TALLOC_FREE(rec);
+	TALLOC_FREE(frame);
 	return status;
 }
 
@@ -250,13 +261,18 @@ NTSTATUS dbwrap_delete(struct db_context *db, TDB_DATA key)
 {
 	struct db_record *rec;
 	NTSTATUS status;
+	TALLOC_CTX *frame = talloc_stackframe();
+	if (!frame) {
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	rec = dbwrap_fetch_locked(db, talloc_tos(), key);
 	if (rec == NULL) {
+		TALLOC_FREE(frame);
 		return NT_STATUS_NO_MEMORY;
 	}
 	status = dbwrap_record_delete(rec);
-	TALLOC_FREE(rec);
+	TALLOC_FREE(frame);
 	return status;
 }
 
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index 5491a1f..b7e6bd5 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -24,6 +24,7 @@
 #include "dbwrap/dbwrap_open.h"
 #include "dbwrap/dbwrap_tdb.h"
 #include "dbwrap/dbwrap_ctdb.h"
+#include "lib/param/param.h"
 #include "util_tdb.h"
 #ifdef CLUSTER_SUPPORT
 #include "ctdb_private.h"
@@ -117,9 +118,11 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 #endif
 
 	if (result == NULL) {
-		result = db_open_tdb(mem_ctx, name, hash_size,
+		struct loadparm_context *lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context());
+		result = db_open_tdb(mem_ctx, lp_ctx, name, hash_size,
 				     tdb_flags, open_flags, mode,
 				     lock_order);
+		talloc_unlink(mem_ctx, lp_ctx);
 	}
 	return result;
 }
diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c
index ffad39b..2041613 100644
--- a/source3/lib/dbwrap/dbwrap_tdb.c
+++ b/source3/lib/dbwrap/dbwrap_tdb.c
@@ -22,7 +22,6 @@
 #include "dbwrap/dbwrap_private.h"
 #include "dbwrap/dbwrap_tdb.h"
 #include "lib/tdb_wrap/tdb_wrap.h"
-#include "lib/param/param.h"
 #include "util_tdb.h"
 
 struct db_tdb_ctx {
@@ -363,6 +362,7 @@ static int db_tdb_transaction_cancel(struct db_context *db)
 }
 
 struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
+			       struct loadparm_context *lp_ctx,
 			       const char *name,
 			       int hash_size, int tdb_flags,
 			       int open_flags, mode_t mode,
@@ -370,14 +370,12 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
 {
 	struct db_context *result = NULL;
 	struct db_tdb_ctx *db_tdb;
-	struct loadparm_context *lp_ctx;
 
 	result = talloc_zero(mem_ctx, struct db_context);
 	if (result == NULL) {
 		DEBUG(0, ("talloc failed\n"));
 		goto fail;
 	}
-	lp_ctx = loadparm_init_s3(result, loadparm_s3_context());
 
 	result->private_data = db_tdb = talloc(result, struct db_tdb_ctx);
 	if (db_tdb == NULL) {
@@ -388,7 +386,6 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
 
 	db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, tdb_flags,
 				     open_flags, mode, lp_ctx);
-	talloc_unlink(result, lp_ctx);
 	if (db_tdb->wtdb == NULL) {
 		DEBUG(3, ("Could not open tdb: %s\n", strerror(errno)));
 		goto fail;
diff --git a/source3/lib/dbwrap/dbwrap_tdb.h b/source3/lib/dbwrap/dbwrap_tdb.h
index 1f7a223..6a6da45 100644
--- a/source3/lib/dbwrap/dbwrap_tdb.h
+++ b/source3/lib/dbwrap/dbwrap_tdb.h
@@ -25,6 +25,7 @@
 struct db_context;
 
 struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
+			       struct loadparm_context *lp_ctx,
 			       const char *name,
 			       int hash_size, int tdb_flags,
 			       int open_flags, mode_t mode,
diff --git a/source3/lib/file_id.c b/source3/lib/file_id.c
index 67c1dd0..1640708 100644
--- a/source3/lib/file_id.c
+++ b/source3/lib/file_id.c
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "lib/file_id.h"
 
 /*
   return True if two file_id structures are equal
@@ -31,7 +32,7 @@ bool file_id_equal(const struct file_id *id1, const struct file_id *id2)
 }
 
 /*
-  a static string for a file_id structure
+  a static-like (on talloc_tos()) string for a file_id structure
  */
 const char *file_id_string_tos(const struct file_id *id)
 {
@@ -44,6 +45,19 @@ const char *file_id_string_tos(const struct file_id *id)
 }
 
 /*
+  an allocated string for a file_id structure
+ */
+const char *file_id_string(TALLOC_CTX *mem_ctx, const struct file_id *id)
+{
+	char *result = talloc_asprintf(mem_ctx, "%llx:%llx:%llx",
+				       (unsigned long long)id->devid,
+				       (unsigned long long)id->inode,
+				       (unsigned long long)id->extid);
+	SMB_ASSERT(result != NULL);
+	return result;
+}
+
+/*
   push a 16 byte version of a file id into a buffer.  This ignores the extid
   and is needed when dev/inodes are stored in persistent storage (tdbs).
  */
diff --git a/source4/libnet/groupinfo.h b/source3/lib/file_id.h
similarity index 51%
copy from source4/libnet/groupinfo.h
copy to source3/lib/file_id.h
index ad13840..2ca8390 100644
--- a/source4/libnet/groupinfo.h
+++ b/source3/lib/file_id.h
@@ -1,54 +1,37 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
 
-   Copyright (C) Rafal Szczesniak 2007
-   
+   file_id structure handling
+
+   Copyright (C) Andrew Tridgell 2007
+
    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 "librpc/gen_ndr/file_id.h"
 
-#include "librpc/gen_ndr/samr.h"
+/* The following definitions come from lib/file_id.c  */
 
+bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
 /*
- * IO structures for groupinfo.c functions
+  a static-like (on talloc_tos()) string for a file_id structure
  */
-
-struct libnet_rpc_groupinfo {
-	struct {
-		struct policy_handle domain_handle;
-		const char *groupname;
-		const char *sid;
-		uint16_t level;
-	} in;
-	struct {
-		union samr_GroupInfo info;
-	} out;
-};
-
-
+const char *file_id_string_tos(const struct file_id *id);
 /*
- * Monitor messages sent from groupinfo.c functions
+  an allocated string for a file_id structure
  */
-
-struct msg_rpc_open_group {
-	uint32_t rid, access_mask;
-};
-
-struct msg_rpc_query_group {
-	uint16_t level;
-};
-
-struct msg_rpc_close_group {
-	uint32_t rid;
-};
+const char *file_id_string(TALLOC_CTX *mem_ctx, const struct file_id *id);
+void push_file_id_16(char *buf, const struct file_id *id);
+void push_file_id_24(char *buf, const struct file_id *id);
+void pull_file_id_24(char *buf, struct file_id *id);
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index aea5c74..e9965ed 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -584,64 +584,6 @@ int tdb_trans_delete(struct tdb_context *tdb, TDB_DATA key)
 	return res;
 }
 
-NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err)
-{
-	NTSTATUS result = NT_STATUS_INTERNAL_ERROR;
-
-	switch (err) {
-	case TDB_SUCCESS:
-		result = NT_STATUS_OK;
-		break;
-	case TDB_ERR_CORRUPT:
-		result = NT_STATUS_INTERNAL_DB_CORRUPTION;
-		break;
-	case TDB_ERR_IO:
-		result = NT_STATUS_UNEXPECTED_IO_ERROR;
-		break;
-	case TDB_ERR_OOM:
-		result = NT_STATUS_NO_MEMORY;
-		break;
-	case TDB_ERR_EXISTS:
-		result = NT_STATUS_OBJECT_NAME_COLLISION;
-		break;
-
-	case TDB_ERR_LOCK:
-		/*
-		 * TDB_ERR_LOCK is very broad, we could for example
-		 * distinguish between fcntl locks and invalid lock
-		 * sequences. So NT_STATUS_FILE_LOCK_CONFLICT is a
-		 * compromise.
-		 */
-		result = NT_STATUS_FILE_LOCK_CONFLICT;
-		break;
-
-#ifndef BUILD_TDB2
-	case TDB_ERR_NOLOCK:
-	case TDB_ERR_LOCK_TIMEOUT:
-		/*


-- 
Samba Shared Repository


More information about the samba-cvs mailing list