The branch, master has been updated
       via  ecd0e86 Update the waf build system to link with the new PIDL 
locking code.
       via  1c46fb5 s3: Use autogenerated open_files.idl
       via  057e442 s3: Move ndr_file_id to LIBNDR_OBJ
       via  0c32546 s3: Add open_files.idl
       via  27d95cc librpc: Add support for struct timeval
       via  de1cd12 librpc: Add support for struct timespec
      from  46551d7 Fix bug #8644 - vfs_acl_xattr and vfs_acl_tdb modules can 
fail to add inheritable entries on a directory with no stored ACL.

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


- Log -----------------------------------------------------------------
commit ecd0e86928b6cbd17792d57e2fc755ab9cb61bcc
Author: Jeremy Allison <[email protected]>
Date:   Fri Dec 2 13:41:55 2011 -0800

    Update the waf build system to link with the new PIDL locking code.
    
    Autobuild-User: Jeremy Allison <[email protected]>
    Autobuild-Date: Sat Dec  3 00:14:54 CET 2011 on sn-devel-104

commit 1c46fb5c3e8a1b5ce0d61f39d934bb68074953cb
Author: Volker Lendecke <[email protected]>
Date:   Thu Nov 24 14:11:28 2011 +0100

    s3: Use autogenerated open_files.idl

commit 057e4422a7c0b54f32b698f0ef9c3507084501d9
Author: Volker Lendecke <[email protected]>
Date:   Thu Nov 24 10:02:44 2011 +0100

    s3: Move ndr_file_id to LIBNDR_OBJ

commit 0c325463a28e4415bb019bb1c11b23a580c53704
Author: Volker Lendecke <[email protected]>
Date:   Thu Nov 24 10:01:57 2011 +0100

    s3: Add open_files.idl

commit 27d95cc8a637a226a20eaac9da7c0dc4d8239f88
Author: Volker Lendecke <[email protected]>
Date:   Thu Nov 24 09:49:19 2011 +0100

    librpc: Add support for struct timeval

commit de1cd125ade49ab62c0585740e6af66c384d419b
Author: Volker Lendecke <[email protected]>
Date:   Thu Nov 24 09:48:40 2011 +0100

    librpc: Add support for struct timespec

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

Summary of changes:
 librpc/ndr/libndr.h                       |   20 ++
 librpc/ndr/ndr_basic.c                    |   62 +++++
 source3/Makefile.in                       |    7 +-
 source3/include/smb.h                     |   69 -----
 source3/librpc/idl/open_files.idl         |   48 ++++
 source3/librpc/idl/wscript_build          |    2 +-
 source3/librpc/wscript_build              |    5 +
 source3/libsmb/smb_share_modes.c          |   30 ++
 source3/locking/locking.c                 |  414 +++++------------------------
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c |    1 +
 source3/smbd/close.c                      |    1 +
 source3/smbd/open.c                       |    1 +
 source3/smbd/oplock.c                     |    1 +
 source3/smbd/reply.c                      |    1 +
 source3/smbd/trans2.c                     |    1 +
 source3/utils/status.c                    |    1 +
 source3/web/statuspage.c                  |    1 +
 source3/wscript_build                     |    3 +-
 18 files changed, 246 insertions(+), 422 deletions(-)
 create mode 100644 source3/librpc/idl/open_files.idl


Changeset truncated at 500 lines:

diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index 80b0ec9..9c26bef 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -627,4 +627,24 @@ _PUBLIC_ enum ndr_err_code ndr_push_enum_uint1632(struct 
ndr_push *ndr, int ndr_
 
 _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const 
bool b);
 
+_PUBLIC_ enum ndr_err_code ndr_push_timespec(struct ndr_push *ndr,
+                                            int ndr_flags,
+                                            const struct timespec *t);
+_PUBLIC_ enum ndr_err_code ndr_pull_timespec(struct ndr_pull *ndr,
+                                            int ndr_flags,
+                                            struct timespec *t);
+_PUBLIC_ void ndr_print_timespec(struct ndr_print *ndr, const char *name,
+                                const struct timespec *t);
+
+_PUBLIC_ enum ndr_err_code ndr_push_timeval(struct ndr_push *ndr,
+                                           int ndr_flags,
+                                           const struct timeval *t);
+_PUBLIC_ enum ndr_err_code ndr_pull_timeval(struct ndr_pull *ndr,
+                                           int ndr_flags,
+                                           struct timeval *t);
+_PUBLIC_ void ndr_print_timeval(struct ndr_print *ndr, const char *name,
+                               const struct timeval *t);
+
+
+
 #endif /* __LIBNDR_H__ */
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index ab234bf..7b16438 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -1338,3 +1338,65 @@ _PUBLIC_ NTSTATUS ndr_map_error2ntstatus(enum 
ndr_err_code ndr_err)
        /* we should map all error codes to different status codes */
        return NT_STATUS_INVALID_PARAMETER;
 }
+
+_PUBLIC_ enum ndr_err_code ndr_push_timespec(struct ndr_push *ndr,
+                                            int ndr_flags,
+                                            const struct timespec *t)
+{
+       NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+       NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t->tv_sec));
+       NDR_CHECK(ndr_push_uint32(ndr, ndr_flags, t->tv_nsec));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_timespec(struct ndr_pull *ndr,
+                                            int ndr_flags,
+                                            struct timespec *t)
+{
+       uint64_t secs;
+       uint32_t nsecs;
+       NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+       NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &secs));
+       NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &nsecs));
+       t->tv_sec = secs;
+       t->tv_nsec = nsecs;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_timespec(struct ndr_print *ndr, const char *name,
+                                const struct timespec *t)
+{
+       ndr->print(ndr, "%-25s: %s.%ld", name, timestring(ndr, t->tv_sec),
+                  (long)t->tv_nsec);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_timeval(struct ndr_push *ndr,
+                                           int ndr_flags,
+                                           const struct timeval *t)
+{
+       NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+       NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t->tv_sec));
+       NDR_CHECK(ndr_push_uint32(ndr, ndr_flags, t->tv_usec));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_timeval(struct ndr_pull *ndr,
+                                           int ndr_flags,
+                                           struct timeval *t)
+{
+       uint64_t secs;
+       uint32_t usecs;
+       NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+       NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &secs));
+       NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &usecs));
+       t->tv_sec = secs;
+       t->tv_usec = usecs;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_timeval(struct ndr_print *ndr, const char *name,
+                               const struct timeval *t)
+{
+       ndr->print(ndr, "%-25s: %s.%ld", name, timestring(ndr, t->tv_sec),
+                  (long)t->tv_usec);
+}
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 3531cec..62504fd 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -315,6 +315,7 @@ LIBNDR_OBJ = ../librpc/ndr/ndr_basic.o \
             ../librpc/ndr/uuid.o \
             ../librpc/ndr/util.o \
             librpc/gen_ndr/ndr_server_id.o \
+            librpc/gen_ndr/ndr_file_id.o \
             librpc/gen_ndr/ndr_dcerpc.o
 
 LIBNDR_GEN_OBJ0 = librpc/gen_ndr/ndr_samr.o \
@@ -792,7 +793,8 @@ RPC_SERVER_OBJ = $(RPC_LSARPC_OBJ) $(RPC_WINREG_OBJ) 
$(RPC_INITSHUTDOWN_OBJ) \
 
 RPC_CLIENT_SCHANNEL_OBJ = rpc_client/cli_pipe_schannel.o
 
-LOCKING_OBJ = locking/locking.o locking/brlock.o locking/posix.o
+LOCKING_OBJ = locking/locking.o locking/brlock.o locking/posix.o \
+               librpc/gen_ndr/ndr_open_files.o
 
 PRIVILEGES_BASIC_OBJ = ../libcli/security/privileges.o
 
@@ -825,7 +827,7 @@ OPLOCK_OBJ = smbd/oplock.o smbd/oplock_irix.o 
smbd/oplock_linux.o \
             smbd/oplock_onefs.o
 
 NOTIFY_OBJ = smbd/notify.o smbd/notify_inotify.o smbd/notify_internal.o \
-            librpc/gen_ndr/ndr_notify.o librpc/gen_ndr/ndr_file_id.o
+            librpc/gen_ndr/ndr_notify.o
 
 FNAME_UTIL_OBJ = lib/filename_util.o
 
@@ -1637,6 +1639,7 @@ IDL_FILES = librpc/idl/messaging.idl \
            librpc/idl/wbint.idl \
            librpc/idl/perfcount.idl \
            librpc/idl/secrets.idl \
+           librpc/idl/open_files.idl \
            librpc/idl/libnet_join.idl
 
 samba3-idl::
diff --git a/source3/include/smb.h b/source3/include/smb.h
index b46f498..d3a27e9 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -545,25 +545,6 @@ struct pending_message_list {
 
 #include "librpc/gen_ndr/server_id.h"
 
-/* struct returned by get_share_modes */
-struct share_mode_entry {
-       struct server_id pid;
-       uint64_t op_mid;        /* For compatibility with SMB2 opens. */
-       uint16 op_type;
-       uint32 access_mask;             /* NTCreateX access bits 
(FILE_READ_DATA etc.) */
-       uint32 share_access;            /* NTCreateX share constants 
(FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
-       uint32 private_options; /* NT Create options, but we only look at
-                                * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
-                                * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB for
-                                * smbstatus and swat */
-       struct timeval time;
-       struct file_id id;
-       unsigned long share_file_id;
-       uint32 uid;             /* uid of file opener. */
-       uint16 flags;           /* See SHARE_MODE_XX above. */
-       uint32_t name_hash;             /* Jenkins hash of full pathname. */
-};
-
 /* oplock break message definition - linearization of share_mode_entry.
 
 Offset  Data                   length.
@@ -605,56 +586,6 @@ Offset  Data                       length.
 #define OP_BREAK_MSG_VNN_OFFSET 72
 #define MSG_SMB_SHARE_MODE_ENTRY_SIZE 76
 
-struct delete_token {
-       uint32_t name_hash;
-       struct security_unix_token *delete_token;
-};
-
-struct share_mode_lock {
-       const char *servicepath; /* canonicalized. */
-       const char *base_name;
-       const char *stream_name;
-       struct file_id id;
-       int num_share_modes;
-       struct share_mode_entry *share_modes;
-       int num_delete_tokens;
-       struct delete_token *delete_tokens;
-       struct timespec old_write_time;
-       struct timespec changed_write_time;
-       bool fresh;
-       bool modified;
-       struct db_record *record;
-};
-
-/*
- * Internal structure of locking.tdb share mode db.
- * Used by locking.c and libsmbsharemodes.c
- */
-
-struct locking_data {
-       union {
-               struct {
-                       int num_share_mode_entries;
-                       struct timespec old_write_time;
-                       struct timespec changed_write_time;
-                       uint32 num_delete_token_entries;
-               } s;
-               struct share_mode_entry dummy; /* Needed for alignment. */
-       } u;
-       /* The following four entries are implicit
-
-          (1) struct share_mode_entry modes[num_share_mode_entries];
-
-          (2) A num_delete_token_entries of structs {
-               uint32_t len_delete_token;
-               char unix_token[len_delete_token] (divisible by 4).
-          };
-
-          (3) char share_name[];
-          (4) char file_name[];
-        */
-};
-
 #define NT_HASH_LEN 16
 #define LM_HASH_LEN 16
 
diff --git a/source3/librpc/idl/open_files.idl 
b/source3/librpc/idl/open_files.idl
new file mode 100644
index 0000000..c6f1627
--- /dev/null
+++ b/source3/librpc/idl/open_files.idl
@@ -0,0 +1,48 @@
+#include "idl_types.h"
+
+import "server_id.idl";
+import "security.idl";
+import "file_id.idl";
+
+[
+    pointer_default(unique)
+]
+
+interface open_files
+{
+    typedef [public] struct {
+       server_id       pid;
+       hyper           op_mid;
+       uint16          op_type;
+       uint32          access_mask;
+       uint32          share_access;
+       uint32          private_options;
+       timeval         time;
+       file_id         id;
+       udlong          share_file_id;
+       uint32          uid;
+       uint16          flags;
+       uint32          name_hash;
+    } share_mode_entry;
+
+    typedef [public] struct {
+       uint32          name_hash;
+       security_unix_token *delete_token;
+    } delete_token;
+
+    typedef [public] struct {
+       [string,charset(UTF8)] char *servicepath;
+       [string,charset(UTF8)] char *base_name;
+       [string,charset(UTF8)] char *stream_name;
+       file_id id;
+       uint32 num_share_modes;
+       [size_is(num_share_modes)] share_mode_entry share_modes[];
+       uint32 num_delete_tokens;
+       [size_is(num_delete_tokens)] delete_token delete_tokens[];
+       timespec old_write_time;
+       timespec changed_write_time;
+       uint8 fresh;
+       uint8 modified;
+       [ignore] db_record *record;
+    } share_mode_lock;
+}
diff --git a/source3/librpc/idl/wscript_build b/source3/librpc/idl/wscript_build
index 3e07542..949eecd 100644
--- a/source3/librpc/idl/wscript_build
+++ b/source3/librpc/idl/wscript_build
@@ -5,7 +5,7 @@ import os
 topinclude=os.path.join(bld.srcnode.abspath(), 'librpc/idl')
 
 bld.SAMBA_PIDL_LIST('PIDL',
-                    '''messaging.idl libnetapi.idl
+                    '''messaging.idl libnetapi.idl open_files.idl
                        perfcount.idl secrets.idl libnet_join.idl''',
                     options='--includedir=%s --header --ndr-parser' % 
topinclude,
                     output_dir='../gen_ndr')
diff --git a/source3/librpc/wscript_build b/source3/librpc/wscript_build
index a4af551..8aa0161 100644
--- a/source3/librpc/wscript_build
+++ b/source3/librpc/wscript_build
@@ -15,6 +15,11 @@ bld.SAMBA3_SUBSYSTEM('NDR_MESSAGING',
        public_deps='ndr NDR_SERVER_ID'
        )
 
+bld.SAMBA3_SUBSYSTEM('NDR_OPEN_FILES',
+       source='gen_ndr/ndr_open_files.c',
+       public_deps='ndr NDR_SERVER_ID NDR_FILE_ID NDR_SECURITY'
+       )
+
 bld.SAMBA3_SUBSYSTEM('NDR_SECRETS',
        source='gen_ndr/ndr_secrets.c',
        public_deps='ndr'
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index 42640e0..f6f8bf9 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -29,6 +29,7 @@
 #include "system/filesys.h"
 #include "smb_share_modes.h"
 #include "tdb_compat.h"
+#include "librpc/gen_ndr/open_files.h"
 #include <ccan/hash/hash.h>
 
 /* Database context handle. */
@@ -41,6 +42,35 @@ struct smbdb_ctx {
 #undef malloc
 #endif
 
+/*
+ * Internal structure of locking.tdb share mode db.
+ * Used by locking.c and libsmbsharemodes.c
+ */
+
+struct locking_data {
+       union {
+               struct {
+                       int num_share_mode_entries;
+                       struct timespec old_write_time;
+                       struct timespec changed_write_time;
+                       uint32 num_delete_token_entries;
+               } s;
+               struct share_mode_entry dummy; /* Needed for alignment. */
+       } u;
+       /* The following four entries are implicit
+
+          (1) struct share_mode_entry modes[num_share_mode_entries];
+
+          (2) A num_delete_token_entries of structs {
+               uint32_t len_delete_token;
+               char unix_token[len_delete_token] (divisible by 4).
+          };
+
+          (3) char share_name[];
+          (4) char file_name[];
+        */
+};
+
 int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx, uint64_t dev,
                                uint64_t ino, uint64_t extid,
                                const struct smb_share_mode_entry *new_entry,
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 611b2d2..caa2b5a 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -45,6 +45,7 @@
 #include "serverid.h"
 #include "messages.h"
 #include "util_tdb.h"
+#include "../librpc/gen_ndr/ndr_open_files.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_LOCKING
@@ -510,221 +511,35 @@ char *share_mode_str(TALLOC_CTX *ctx, int num, const 
struct share_mode_entry *e)
 }
 
 /*******************************************************************
- Print out a share mode table.
-********************************************************************/
-
-static void print_share_mode_table(struct locking_data *data)
-{
-       int num_share_modes = data->u.s.num_share_mode_entries;
-       struct share_mode_entry *shares =
-               (struct share_mode_entry *)(data + 1);
-       int i;
-
-       for (i = 0; i < num_share_modes; i++) {
-               struct share_mode_entry entry;
-               char *str;
-
-               /*
-                * We need to memcpy the entry here due to alignment
-                * restrictions that are not met when directly accessing
-                * shares[i]
-                */
-
-               memcpy(&entry, &shares[i], sizeof(struct share_mode_entry));
-               str = share_mode_str(talloc_tos(), i, &entry);
-
-               DEBUG(10,("print_share_mode_table: %s\n", str ? str : ""));
-               TALLOC_FREE(str);
-       }
-}
-
-static int parse_delete_tokens_list(struct share_mode_lock *lck,
-               struct locking_data *pdata,
-               const TDB_DATA dbuf)
-{
-       uint8_t *p = dbuf.dptr + sizeof(struct locking_data) +
-                       (lck->num_share_modes *
-                       sizeof(struct share_mode_entry));
-       uint8_t *end_ptr = dbuf.dptr + (dbuf.dsize - 2);
-       int delete_tokens_size = 0;
-       int i;
-
-       lck->num_delete_tokens = 0;
-       lck->delete_tokens = NULL;
-
-       for (i = 0; i < pdata->u.s.num_delete_token_entries; i++) {
-               uint32_t token_len;
-               struct delete_token *pdt;
-
-               if (end_ptr - p < (sizeof(uint32_t) + sizeof(uint32_t) +
-                                       sizeof(uid_t) + sizeof(gid_t))) {
-                       DEBUG(0,("parse_delete_tokens_list: "
-                               "corrupt token list (%u)",
-                               (unsigned int)(end_ptr - p)));
-                       smb_panic("corrupt token list");
-                       return -1;
-               }
-
-               memcpy(&token_len, p, sizeof(token_len));
-               delete_tokens_size += token_len;
-
-               if (p + token_len > end_ptr || token_len < sizeof(token_len) +
-                                               sizeof(pdt->name_hash) +
-                                               sizeof(uid_t) +
-                                               sizeof(gid_t)) {
-                       DEBUG(0,("parse_delete_tokens_list: "
-                               "invalid token length (%u)\n",
-                               (unsigned int)token_len ));
-                       smb_panic("invalid token length");
-                       return -1;
-               }
-
-               p += sizeof(token_len);
-
-               lck->delete_tokens = talloc_realloc(
-                       lck, lck->delete_tokens, struct delete_token,
-                       lck->num_delete_tokens+1);
-
-               if (lck->delete_tokens == NULL) {
-                       DEBUG(0, ("parse_delete_tokens_list: talloc failed"));
-                       return -1;
-               }
-               pdt = &lck->delete_tokens[lck->num_delete_tokens];
-
-               /* Copy out the name_hash. */
-               memcpy(&pdt->name_hash, p, sizeof(pdt->name_hash));
-               p += sizeof(pdt->name_hash);
-
-               pdt->delete_token = talloc_zero(
-                       lck->delete_tokens, struct security_unix_token);
-               if (pdt->delete_token == NULL) {
-                       DEBUG(0,("parse_delete_tokens_list: talloc failed"));
-                       return -1;
-               }
-
-               /* Copy out the uid and gid. */
-               memcpy(&pdt->delete_token->uid, p, sizeof(uid_t));
-               p += sizeof(uid_t);
-               memcpy(&pdt->delete_token->gid, p, sizeof(gid_t));
-               p += sizeof(gid_t);
-
-               token_len -= (sizeof(token_len) + sizeof(pdt->name_hash) +
-                               sizeof(uid_t) + sizeof(gid_t));
-
-               /* Any supplementary groups ? */
-               if (token_len) {
-                       int j;
-
-                       if (token_len % sizeof(gid_t) != 0) {
-                               DEBUG(0,("parse_delete_tokens_list: "
-                                       "corrupt group list (%u)",
-                                       (unsigned int)(token_len % 
sizeof(gid_t)) ));
-                               smb_panic("corrupt group list");
-                               return -1;
-                       }
-
-                       pdt->delete_token->ngroups = token_len / sizeof(gid_t);
-                       pdt->delete_token->groups = talloc_array(
-                               pdt->delete_token, gid_t,
-                               pdt->delete_token->ngroups);
-                       if (pdt->delete_token->groups == NULL) {
-                               DEBUG(0,("parse_delete_tokens_list: talloc 
failed"));
-                               return -1;
-                       }
-
-                       for (j = 0; j < pdt->delete_token->ngroups; j++) {
-                               memcpy(&pdt->delete_token->groups[j], p,
-                                      sizeof(gid_t));
-                               p += sizeof(gid_t);
-                       }
-               }


-- 
Samba Shared Repository

Reply via email to