[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Fri May 6 00:51:03 MDT 2011
The branch, master has been updated
via 8aae59a lib/util don't use enum protocol_types in ms_fnmatch_protocol
via e3b8584 libcli/smb Move cifs posix helper functions and headers in common
via 8f18103 lib/util Use lib/util/ms_fnmatch.c in common for gen_fnmatch()
via 3892112 lib/util Rename ms_fnmatch() to ms_fnmatch_protocol() to avoid dup symbol
via cad704e errors: Remove unused unix_to_werror()
via db74cad libcli/util Move NTSTATUS table to the top level
via 344eb08 nterr: Add mem_ctx for return string from get_nt_error_c_code()
via c83aed2 s3-smbd ntstatus_to_dos() pulls the DOS error codes out internally
via f1ec288 libcli/util Merge ntstatus_to_dos() ntstatus_to_werror() to the top level
via 2b0de5b errors: Merge source3/ werror_to_ntstatus() code to source4/
via 865a937 errors: Merge ntstatus -> DOS error table between Samba3 and Samba4.
via fa289e8 s3-lib Remove unused dos error codes from errmap_unix
via 1475013 lib/util Move source3 tdb_wrap_open() into the common code.
from f455772 s3-winbind: another strlcpy()/fstring fix
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8aae59a277fe4bf5a1a84cb4730e5772c9ffca8c
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 21:20:57 2011 +1000
lib/util don't use enum protocol_types in ms_fnmatch_protocol
This makes it easier to compile this in the top level with s3 and s4
headers.
Andrew Bartlett
Autobuild-User: Andrew Bartlett <abartlet at samba.org>
Autobuild-Date: Fri May 6 08:50:52 CEST 2011 on sn-devel-104
commit e3b858496ffe213f66387e4f11b311543af4dc54
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 21:19:46 2011 +1000
libcli/smb Move cifs posix helper functions and headers in common
unix_perms_to_wire() was a duplicate symbol in the top level build.
Andrew Bartlett
commit 8f1810362df7ef9e5c394a9cba83cf0e7c04bd9e
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 20:57:12 2011 +1000
lib/util Use lib/util/ms_fnmatch.c in common for gen_fnmatch()
gen_fnmatch was a duplicate symbol in the top level build.
gen_fnmatch() used for simple non-CIFS pattern matching, so selecting
the lib/util implementation should not be a concern.
Andrew Bartlett
commit 3892112e7b3143f808932771a7b71f4fd335f8cb
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 20:53:33 2011 +1000
lib/util Rename ms_fnmatch() to ms_fnmatch_protocol() to avoid dup symbol
This verison of the function takes a protcol as argument to determine
matching rules.
Andrew Bartlett
commit cad704e8368f6aba28889966a7382afc8b738928
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 17:00:23 2011 +1000
errors: Remove unused unix_to_werror()
commit db74cad1c638ae2142b89757397b50009ea0678a
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 15:50:07 2011 +1000
libcli/util Move NTSTATUS table to the top level
commit 344eb08ee4e444c1fc1beac26e50c6a85b942885
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 15:30:01 2011 +1000
nterr: Add mem_ctx for return string from get_nt_error_c_code()
It is clearer to avoid the implicit return on talloc_tos()
Andrew Bartlett
commit c83aed2568761adda5f4f09e044788557767347e
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 16:16:13 2011 +1000
s3-smbd ntstatus_to_dos() pulls the DOS error codes out internally
This means we don't need to duplicate that logic here.
Andrew Bartlett
commit f1ec28827f61fcb168249aa9855e7f19c65780ae
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 13:59:57 2011 +1000
libcli/util Merge ntstatus_to_dos() ntstatus_to_werror() to the top level
This takes the Samba4 version, with the NT_STATUS_IS_DOS() check.
This will be used in smbd/error.c shortly.
Andrew Bartlett
commit 2b0de5b5ca1196a39379dcd86a25b6e73c52cf3c
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 16:51:23 2011 +1000
errors: Merge source3/ werror_to_ntstatus() code to source4/
commit 865a93767159be087ec78f56687c4d3ba24a3756
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 13:47:26 2011 +1000
errors: Merge ntstatus -> DOS error table between Samba3 and Samba4.
They are now identical
Andrew Bartlett
commit fa289e8982ea260a87548c145ef061e7eb64acf6
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 11:39:21 2011 +1000
s3-lib Remove unused dos error codes from errmap_unix
This also makes unix_nt_errmap private to errmap_unix.c and errormap.c
so the tables themselves cannot be duplicate symbols until merged.
Andrew Bartlett
commit 14750139639b3531e57a3ca3f9e481d6e458dc06
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed May 4 10:28:15 2011 +1000
lib/util Move source3 tdb_wrap_open() into the common code.
This #if _SAMBA_BUILD == 3 is very unfortunate, as it means that in
the top level build, these options are not available for these
databases. However, having two different tdb_wrap lists is a worse
fate, so this will do for now.
Andrew Bartlett
-----------------------------------------------------------------------
Summary of changes:
lib/util/ms_fnmatch.c | 6 +-
lib/util/tdb_wrap.c | 194 +++++
{source4/lib => lib/util}/tdb_wrap.h | 3 -
lib/util/util.h | 5 +-
lib/util/util_tdb.h | 1 -
lib/util/wscript_build | 14 +-
libcli/auth/schannel_state_tdb.c | 4 +-
libcli/smb/smb_common.h | 1 +
libcli/smb/smb_unix_ext.h | 452 +++++++++++
libcli/smb/smb_util.h | 3 +
libcli/smb/util.c | 96 +++
libcli/util/error.h | 5 -
{source4/libcli => libcli}/util/errormap.c | 203 +----
{source4/libcli => libcli}/util/nterr.c | 70 +--
libcli/util/ntstatus.h | 8 +-
libcli/util/wscript_build | 2 +-
source3/Makefile.in | 7 +-
source3/include/proto.h | 2 -
source3/include/smb.h | 7 -
source3/include/trans2.h | 429 ----------
source3/include/util_tdb.h | 8 -
source3/lib/dbwrap_tdb.c | 1 +
source3/lib/errmap_unix.c | 97 ++--
source3/lib/messages_local.c | 1 +
source3/lib/ms_fnmatch.c | 7 -
source3/lib/server_mutex.c | 1 +
source3/lib/serverid.c | 1 +
source3/lib/util_tdb.c | 159 ----
source3/libsmb/clifile.c | 94 ---
source3/libsmb/errormap.c | 1213 ----------------------------
source3/libsmb/nterr.c | 729 +-----------------
source3/smbd/error.c | 12 +-
source3/smbd/notify_internal.c | 1 +
source3/torture/torture.c | 6 +-
source3/wscript_build | 4 +-
source4/client/client.c | 4 +-
source4/cluster/local.c | 2 +-
source4/lib/messaging/messaging.c | 2 +-
source4/lib/tdb_wrap.c | 117 ---
source4/lib/wscript_build | 9 -
source4/libcli/clifile.c | 28 -
source4/libcli/raw/interfaces.h | 4 +-
source4/libcli/raw/trans2.h | 157 ----
source4/libcli/util/errormap.c | 683 +---------------
source4/libcli/util/nterr.c | 890 +--------------------
source4/ntvfs/cifs_posix_cli/svfs_util.c | 2 +-
source4/ntvfs/common/brlock_tdb.c | 2 +-
source4/ntvfs/common/notify.c | 2 +-
source4/ntvfs/common/opendb_tdb.c | 2 +-
source4/ntvfs/nbench/vfs_nbench.c | 39 +-
source4/ntvfs/posix/pvfs_dirlist.c | 8 +-
source4/ntvfs/posix/python/pyxattr_tdb.c | 2 +-
source4/ntvfs/posix/vfs_posix.c | 2 +-
source4/ntvfs/posix/xattr_tdb.c | 2 +-
source4/ntvfs/simple/svfs_util.c | 2 +-
source4/param/secrets.c | 2 +-
source4/torture/local/dbspeed.c | 2 +-
source4/torture/masktest.c | 2 +-
source4/torture/unix/whoami.c | 4 -
59 files changed, 931 insertions(+), 4884 deletions(-)
create mode 100644 lib/util/tdb_wrap.c
rename {source4/lib => lib/util}/tdb_wrap.h (96%)
create mode 100644 libcli/smb/smb_unix_ext.h
copy {source4/libcli => libcli}/util/errormap.c (91%)
copy {source4/libcli => libcli}/util/nterr.c (96%)
delete mode 100644 source4/lib/tdb_wrap.c
Changeset truncated at 500 lines:
diff --git a/lib/util/ms_fnmatch.c b/lib/util/ms_fnmatch.c
index 73fb0e0..1ba5888 100644
--- a/lib/util/ms_fnmatch.c
+++ b/lib/util/ms_fnmatch.c
@@ -154,7 +154,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
return -1;
}
-int ms_fnmatch(const char *pattern, const char *string, enum protocol_types protocol)
+int ms_fnmatch_protocol(const char *pattern, const char *string, int protocol)
{
int ret, count, i;
struct max_n *max_n = NULL;
@@ -192,7 +192,7 @@ int ms_fnmatch(const char *pattern, const char *string, enum protocol_types prot
p[i] = '<';
}
}
- ret = ms_fnmatch(p, string, PROTOCOL_NT1);
+ ret = ms_fnmatch_protocol(p, string, PROTOCOL_NT1);
talloc_free(p);
return ret;
}
@@ -217,5 +217,5 @@ int ms_fnmatch(const char *pattern, const char *string, enum protocol_types prot
/** a generic fnmatch function - uses for non-CIFS pattern matching */
int gen_fnmatch(const char *pattern, const char *string)
{
- return ms_fnmatch(pattern, string, PROTOCOL_NT1);
+ return ms_fnmatch_protocol(pattern, string, PROTOCOL_NT1);
}
diff --git a/lib/util/tdb_wrap.c b/lib/util/tdb_wrap.c
new file mode 100644
index 0000000..c9562c6
--- /dev/null
+++ b/lib/util/tdb_wrap.c
@@ -0,0 +1,194 @@
+/*
+ Unix SMB/CIFS implementation.
+ TDB wrap functions
+
+ Copyright (C) Andrew Tridgell 2004
+ Copyright (C) Jelmer Vernooij <jelmer at samba.org> 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 "includes.h"
+#include <tdb.h>
+#include "lib/util/dlinklist.h"
+#include "lib/util/tdb_wrap.h"
+#include <tdb.h>
+
+/*
+ Log tdb messages via DEBUG().
+*/
+static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level,
+ const char *format, ...) PRINTF_ATTRIBUTE(3,4);
+
+static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level,
+ const char *format, ...)
+{
+ va_list ap;
+ char *ptr = NULL;
+ int debuglevel = 0;
+ int ret;
+
+ switch (level) {
+ case TDB_DEBUG_FATAL:
+ debuglevel = 0;
+ break;
+ case TDB_DEBUG_ERROR:
+ debuglevel = 1;
+ break;
+ case TDB_DEBUG_WARNING:
+ debuglevel = 2;
+ break;
+ case TDB_DEBUG_TRACE:
+ debuglevel = 5;
+ break;
+ default:
+ debuglevel = 0;
+ }
+
+ va_start(ap, format);
+ ret = vasprintf(&ptr, format, ap);
+ va_end(ap);
+
+ if (ret != -1) {
+ const char *name = tdb_name(tdb);
+ DEBUG(debuglevel, ("tdb(%s): %s", name ? name : "unnamed", ptr));
+ free(ptr);
+ }
+}
+
+struct tdb_wrap_private {
+ struct tdb_context *tdb;
+ const char *name;
+ struct tdb_wrap_private *next, *prev;
+};
+
+static struct tdb_wrap_private *tdb_list;
+
+/* destroy the last connection to a tdb */
+static int tdb_wrap_private_destructor(struct tdb_wrap_private *w)
+{
+ tdb_close(w->tdb);
+ DLIST_REMOVE(tdb_list, w);
+ return 0;
+}
+
+static struct tdb_wrap_private *tdb_wrap_private_open(TALLOC_CTX *mem_ctx,
+ const char *name,
+ int hash_size,
+ int tdb_flags,
+ int open_flags,
+ mode_t mode)
+{
+ struct tdb_wrap_private *result;
+ struct tdb_logging_context log_ctx;
+
+ result = talloc(mem_ctx, struct tdb_wrap_private);
+ if (result == NULL) {
+ return NULL;
+ }
+ result->name = talloc_strdup(result, name);
+ if (result->name == NULL) {
+ goto fail;
+ }
+
+ log_ctx.log_fn = tdb_wrap_log;
+
+#if _SAMBA_BUILD_ == 3
+ /* This #if _SAMBA_BUILD == 3 is very unfortunate, as it means
+ * that in the top level build, these options are not
+ * available for these databases. However, having two
+ * different tdb_wrap lists is a worse fate, so this will do
+ * for now */
+
+ if (!lp_use_mmap()) {
+ tdb_flags |= TDB_NOMMAP;
+ }
+
+ if ((hash_size == 0) && (name != NULL)) {
+ const char *base;
+ base = strrchr_m(name, '/');
+
+ if (base != NULL) {
+ base += 1;
+ } else {
+ base = name;
+ }
+ hash_size = lp_parm_int(-1, "tdb_hashsize", base, 0);
+ }
+#endif
+
+ result->tdb = tdb_open_ex(name, hash_size, tdb_flags,
+ open_flags, mode, &log_ctx, NULL);
+ if (result->tdb == NULL) {
+ goto fail;
+ }
+ talloc_set_destructor(result, tdb_wrap_private_destructor);
+ DLIST_ADD(tdb_list, result);
+ return result;
+
+fail:
+ TALLOC_FREE(result);
+ return NULL;
+}
+
+/*
+ wrapped connection to a tdb database
+ to close just talloc_free() the tdb_wrap pointer
+ */
+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)
+{
+ struct tdb_wrap *result;
+ struct tdb_wrap_private *w;
+
+ result = talloc(mem_ctx, struct tdb_wrap);
+ if (result == NULL) {
+ return NULL;
+ }
+
+ for (w=tdb_list;w;w=w->next) {
+ if (strcmp(name, w->name) == 0) {
+ break;
+ }
+ }
+
+ if (w == NULL) {
+ w = tdb_wrap_private_open(result, name, hash_size, tdb_flags,
+ open_flags, mode);
+ } else {
+ /*
+ * Correctly use talloc_reference: The tdb will be
+ * closed when "w" is being freed. The caller never
+ * sees "w", so an incorrect use of talloc_free(w)
+ * instead of calling talloc_unlink is not possible.
+ * To avoid having to refcount ourselves, "w" will
+ * have multiple parents that hang off all the
+ * tdb_wrap's being returned from here. Those parents
+ * can be freed without problem.
+ */
+ if (talloc_reference(result, w) == NULL) {
+ goto fail;
+ }
+ }
+ if (w == NULL) {
+ goto fail;
+ }
+ result->tdb = w->tdb;
+ return result;
+fail:
+ TALLOC_FREE(result);
+ return NULL;
+}
+
diff --git a/source4/lib/tdb_wrap.h b/lib/util/tdb_wrap.h
similarity index 96%
rename from source4/lib/tdb_wrap.h
rename to lib/util/tdb_wrap.h
index 94035c1..1be2bb0 100644
--- a/source4/lib/tdb_wrap.h
+++ b/lib/util/tdb_wrap.h
@@ -33,9 +33,6 @@
struct tdb_wrap {
struct tdb_context *tdb;
-
- const char *name;
- struct tdb_wrap *next, *prev;
};
struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx,
diff --git a/lib/util/util.h b/lib/util/util.h
index 6479302..93b181b 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -777,11 +777,12 @@ enum protocol_types {
PROTOCOL_SMB2
};
-int ms_fnmatch(const char *pattern, const char *string, enum protocol_types protocol);
+#endif
+
+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);
-#endif
/* The following definitions come from lib/util/idtree.c */
diff --git a/lib/util/util_tdb.h b/lib/util/util_tdb.h
index d2f6648..c11a347 100644
--- a/lib/util/util_tdb.h
+++ b/lib/util/util_tdb.h
@@ -1,7 +1,6 @@
#ifndef _____LIB_UTIL_UTIL_TDB_H__
#define _____LIB_UTIL_UTIL_TDB_H__
-
/***************************************************************
Make a TDB_DATA and keep the const warning in one place
****************************************************************/
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index abdedb5..fc5f4b5 100755
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -5,11 +5,11 @@ common_util_sources = '''talloc_stack.c smb_threads.c xfile.c data_blob.c
genrand.c fsusage.c blocking.c become_daemon.c
signal.c system.c params.c util.c util_id.c util_net.c
util_strlist.c idtree.c debug.c fault.c base64.c
- util_str.c util_str_common.c substitute.c'''
+ util_str.c util_str_common.c substitute.c ms_fnmatch.c'''
common_util_headers = 'debug.h'
common_util_public_deps = 'talloc pthread LIBCRYPTO'
-s4_util_sources = '''dprintf.c ms_fnmatch.c parmlist.c'''
+s4_util_sources = '''dprintf.c parmlist.c'''
s4_util_deps = 'DYNCONFIG'
s4_util_public_deps = 'talloc CHARSET execinfo uid_wrapper'
s4_util_public_headers = 'attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h util.h string_wrappers.h'
@@ -108,3 +108,13 @@ bld.SAMBA_SUBSYSTEM('UTIL_PW',
local_include=False,
public_deps='talloc'
)
+
+
+bld.SAMBA_LIBRARY('tdb-wrap',
+ source='tdb_wrap.c',
+ deps='tdb talloc samba-util',
+ public_headers='tdb_wrap.h',
+ private_library=True,
+ local_include=False
+ )
+
diff --git a/libcli/auth/schannel_state_tdb.c b/libcli/auth/schannel_state_tdb.c
index c332bae..ca35a11 100644
--- a/libcli/auth/schannel_state_tdb.c
+++ b/libcli/auth/schannel_state_tdb.c
@@ -27,9 +27,7 @@
#include "../lib/util/util_tdb.h"
#include "../libcli/auth/schannel.h"
#include "../librpc/gen_ndr/ndr_schannel.h"
-#if _SAMBA_BUILD_ == 4
-#include "tdb_wrap.h"
-#endif
+#include "lib/util/tdb_wrap.h"
#define SECRETS_SCHANNEL_STATE "SECRETS/SCHANNEL"
diff --git a/libcli/smb/smb_common.h b/libcli/smb/smb_common.h
index ca04eb3..d8339cb 100644
--- a/libcli/smb/smb_common.h
+++ b/libcli/smb/smb_common.h
@@ -26,5 +26,6 @@
#include "../libcli/smb/smb2_create_blob.h"
#include "../libcli/smb/smb_constants.h"
#include "../libcli/smb/smb_util.h"
+#include "../libcli/smb/smb_unix_ext.h"
#endif
diff --git a/libcli/smb/smb_unix_ext.h b/libcli/smb/smb_unix_ext.h
new file mode 100644
index 0000000..9516d31
--- /dev/null
+++ b/libcli/smb/smb_unix_ext.h
@@ -0,0 +1,452 @@
+/*
+ Unix SMB/CIFS implementation.
+ SMB transaction2 handling
+
+ Copyright (C) James Peach 2007
+ Copyright (C) Jeremy Allison 1994-2002.
+
+ Extensively modified by Andrew Tridgell, 1995
+
+ 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/>.
+*/
+
+/* UNIX CIFS Extensions - created by HP */
+/*
+ * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved.
+ * Supposedly Microsoft have agreed to this.
+ */
+
+#define MIN_UNIX_INFO_LEVEL 0x200
+#define MAX_UNIX_INFO_LEVEL 0x2FF
+
+#define INFO_LEVEL_IS_UNIX(level) (((level) >= MIN_UNIX_INFO_LEVEL) && ((level) <= MAX_UNIX_INFO_LEVEL))
+
+#define SMB_QUERY_FILE_UNIX_BASIC 0x200 /* UNIX File Info*/
+#define SMB_SET_FILE_UNIX_BASIC 0x200
+#define SMB_SET_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */
+
+#define SMB_MODE_NO_CHANGE 0xFFFFFFFF /* file mode value which */
+ /* means "don't change it" */
+#define SMB_UID_NO_CHANGE 0xFFFFFFFF
+#define SMB_GID_NO_CHANGE 0xFFFFFFFF
+
+#define SMB_SIZE_NO_CHANGE_LO 0xFFFFFFFF
+#define SMB_SIZE_NO_CHANGE_HI 0xFFFFFFFF
+
+#define SMB_TIME_NO_CHANGE_LO 0xFFFFFFFF
+#define SMB_TIME_NO_CHANGE_HI 0xFFFFFFFF
+
+/*
+Offset Size Name
+0 LARGE_INTEGER EndOfFile File size
+8 LARGE_INTEGER Blocks Number of bytes used on disk (st_blocks).
+16 LARGE_INTEGER CreationTime Creation time
+24 LARGE_INTEGER LastAccessTime Last access time
+32 LARGE_INTEGER LastModificationTime Last modification time
+40 LARGE_INTEGER Uid Numeric user id for the owner
+48 LARGE_INTEGER Gid Numeric group id of owner
+56 ULONG Type Enumeration specifying the pathname type:
+ 0 -- File
+ 1 -- Directory
+ 2 -- Symbolic link
+ 3 -- Character device
+ 4 -- Block device
+ 5 -- FIFO (named pipe)
+ 6 -- Unix domain socket
+
+60 LARGE_INTEGER devmajor Major device number if type is device
+68 LARGE_INTEGER devminor Minor device number if type is device
+76 LARGE_INTEGER uniqueid This is a server-assigned unique id for the file. The client
+ will typically map this onto an inode number. The scope of
+ uniqueness is the share.
+84 LARGE_INTEGER permissions Standard UNIX file permissions - see below.
+92 LARGE_INTEGER nlinks The number of directory entries that map to this entry
+ (number of hard links)
+
+100 - end.
+*/
+
+#define SMB_FILE_UNIX_BASIC_SIZE 100
+
+/* UNIX filetype mappings. */
+
+#define UNIX_TYPE_FILE 0
+#define UNIX_TYPE_DIR 1
+#define UNIX_TYPE_SYMLINK 2
+#define UNIX_TYPE_CHARDEV 3
+#define UNIX_TYPE_BLKDEV 4
+#define UNIX_TYPE_FIFO 5
+#define UNIX_TYPE_SOCKET 6
+#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF
+
+/*
+ * Oh this is fun. "Standard UNIX permissions" has no
+ * meaning in POSIX. We need to define the mapping onto
+ * and off the wire as this was not done in the original HP
+ * spec. JRA.
+ */
+
+#define UNIX_X_OTH 0000001
+#define UNIX_W_OTH 0000002
+#define UNIX_R_OTH 0000004
+#define UNIX_X_GRP 0000010
+#define UNIX_W_GRP 0000020
+#define UNIX_R_GRP 0000040
+#define UNIX_X_USR 0000100
+#define UNIX_W_USR 0000200
+#define UNIX_R_USR 0000400
+#define UNIX_STICKY 0001000
+#define UNIX_SET_GID 0002000
+#define UNIX_SET_UID 0004000
+
+/* Masks for the above */
+#define UNIX_OTH_MASK 0000007
+#define UNIX_GRP_MASK 0000070
+#define UNIX_USR_MASK 0000700
+#define UNIX_PERM_MASK 0000777
+#define UNIX_EXTRA_MASK 0007000
+#define UNIX_ALL_MASK 0007777
+
+/* Flags for chflags (CIFS_UNIX_EXTATTR_CAP capability) and
+ * SMB_QUERY_FILE_UNIX_INFO2.
+ */
+#define EXT_SECURE_DELETE 0x00000001
+#define EXT_ENABLE_UNDELETE 0x00000002
+#define EXT_SYNCHRONOUS 0x00000004
+#define EXT_IMMUTABLE 0x00000008
+#define EXT_OPEN_APPEND_ONLY 0x00000010
+#define EXT_DO_NOT_BACKUP 0x00000020
+#define EXT_NO_UPDATE_ATIME 0x00000040
+#define EXT_HIDDEN 0x00000080
+
+#define SMB_QUERY_FILE_UNIX_LINK 0x201
+#define SMB_SET_FILE_UNIX_LINK 0x201
+#define SMB_SET_FILE_UNIX_HLINK 0x203
+/* SMB_QUERY_POSIX_ACL 0x204 see below */
+#define SMB_QUERY_XATTR 0x205 /* need for non-user XATTRs */
+#define SMB_QUERY_ATTR_FLAGS 0x206 /* chflags, chattr */
+#define SMB_SET_ATTR_FLAGS 0x206
+#define SMB_QUERY_POSIX_PERMISSION 0x207
+/* Only valid for qfileinfo */
+#define SMB_QUERY_POSIX_LOCK 0x208
+/* Only valid for setfileinfo */
+#define SMB_SET_POSIX_LOCK 0x208
+
+/* The set info levels for POSIX path operations. */
+#define SMB_POSIX_PATH_OPEN 0x209
+#define SMB_POSIX_PATH_UNLINK 0x20A
+
+#define SMB_QUERY_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */
+#define SMB_SET_FILE_UNIX_INFO2 0x20B
+
+/*
+SMB_QUERY_FILE_UNIX_INFO2 is SMB_QUERY_FILE_UNIX_BASIC with create
+time and file flags appended. The corresponding info level for
+findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2.
+ Size Offset Value
+ ---------------------
+ 0 LARGE_INTEGER EndOfFile File size
--
Samba Shared Repository
More information about the samba-cvs
mailing list