The branch, master has been updated
       via  a3b333a s3:locking: remove dead code from brl_get_locks_readonly()
       via  151b9ca s3:locking: Change from ndr_pull_struct_blob() to 
ndr_pull_struct_blob_all() so we fail if not all bytes are consumed.
       via  8334428 s4:torture/smb2: test rename dir deny with open files
       via  035fd72 s3:smbd: Don't rename a dir with files open underneath
       via  5f60dcc selftest:Samba3: use "strict rename = yes"
       via  b0a4343 s3:param: Add new option "strict rename".
       via  9010bbe s3:locking: allow early return for share_entry_forall()
       via  48926b7 s3:locking: Introduce share_mode_forall
       via  0d4f7bf s3:locking: Rename share_mode_forall->share_entry_forall
       via  c3b00b9 libcli: Make sure status is initialized.
       via  c98f8ce torture: Make sure server_type isn't used uninitialized.
       via  56ee6a2 s3-libsmb: Make sure the stat structure is initialized.
       via  69d6d62 s3-rpcclient: Make sure current_nt_hash is initialized.
      from  d558281 ctdb-includes: Reorder includes.h more logically

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


- Log -----------------------------------------------------------------
commit a3b333a1a2ab23ba0c59be1fc65c730e2b53e8c5
Author: Stefan Metzmacher <[email protected]>
Date:   Wed Oct 29 17:29:06 2014 +0100

    s3:locking: remove dead code from brl_get_locks_readonly()
    
    struct byte_range_lock *rw = NULL; will never change...
    
    commit 105724073300af03eb0835b3c93d9b2e2bfacb07 removed the
    possible assigment of 'rw'.
    
    So we can remove all code under if (rw != NULL) { ...
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Fri Oct 31 06:07:43 CET 2014 on sn-devel-104

commit 151b9caeef7dc4fa4816035a406acb9f1c5812c3
Author: Volker Lendecke <[email protected]>
Date:   Tue Oct 28 15:20:26 2014 -0700

    s3:locking: Change from ndr_pull_struct_blob() to 
ndr_pull_struct_blob_all() so we fail if not all bytes are consumed.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 8334428666b8282d2cfbcfd411acab0c338ae390
Author: Volker Lendecke <[email protected]>
Date:   Thu Sep 25 01:32:00 2014 +0200

    s4:torture/smb2: test rename dir deny with open files
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 035fd7200d8a025cdb8bfae30c264757aa3cb193
Author: Volker Lendecke <[email protected]>
Date:   Thu Sep 25 01:30:33 2014 +0200

    s3:smbd: Don't rename a dir with files open underneath
    
    This is an EXPENSIVE check. We'll have to guard this with an option
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 5f60dcc38ca275aedeb1d67611b5acf9b26361d5
Author: Jeremy Allison <[email protected]>
Date:   Fri Oct 24 13:57:04 2014 -0700

    selftest:Samba3: use "strict rename = yes"
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit b0a434386dc2f77df89811bc3f56c4cc7fb7b16c
Author: Jeremy Allison <[email protected]>
Date:   Fri Oct 24 13:57:04 2014 -0700

    s3:param: Add new option "strict rename".
    
    Control whether smbd can rename directories containing
    open files. Defaults to "no" (meaning we *can* do
    such renames).
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 9010bbeb00264f4476c3be7d2e8c8420c695cfbb
Author: Volker Lendecke <[email protected]>
Date:   Wed Sep 24 20:46:15 2014 +0200

    s3:locking: allow early return for share_entry_forall()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 48926b761975a7d9cb6daf30d64d6a4f0a34f38a
Author: Volker Lendecke <[email protected]>
Date:   Tue Sep 23 05:45:49 2014 +0200

    s3:locking: Introduce share_mode_forall
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 0d4f7bfdb995a239508457cd433bc8001c0e8279
Author: Volker Lendecke <[email protected]>
Date:   Tue Sep 23 05:18:54 2014 +0200

    s3:locking: Rename share_mode_forall->share_entry_forall
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit c3b00b99449c7d19de81a2b9e1b8ef776e8cbb20
Author: Andreas Schneider <[email protected]>
Date:   Thu Oct 30 16:12:19 2014 +0100

    libcli: Make sure status is initialized.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit c98f8ce0740f66ec467f945b638c6f2ede43dc85
Author: Andreas Schneider <[email protected]>
Date:   Thu Oct 30 16:12:18 2014 +0100

    torture: Make sure server_type isn't used uninitialized.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 56ee6a2074dd7700c64f41f97d202ee3851e1c1c
Author: Andreas Schneider <[email protected]>
Date:   Thu Oct 30 16:12:17 2014 +0100

    s3-libsmb: Make sure the stat structure is initialized.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 69d6d62a4ca6c727f0d22ce3e51b684ffa764c0d
Author: Andreas Schneider <[email protected]>
Date:   Thu Oct 30 16:12:16 2014 +0100

    s3-rpcclient: Make sure current_nt_hash is initialized.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 docs-xml/smbdotconf/tuning/strictrename.xml |   25 ++++++
 lib/param/param_table.c                     |    9 ++
 libcli/cldap/cldap.c                        |    2 +-
 selftest/knownfail                          |    1 +
 selftest/target/Samba3.pm                   |    1 +
 source3/libsmb/clirap.c                     |    2 +-
 source3/locking/brlock.c                    |   78 ++++++-----------
 source3/locking/proto.h                     |    6 +-
 source3/locking/share_mode_lock.c           |  105 ++++++++++++++++-------
 source3/param/loadparm.c                    |    1 +
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c   |   54 +++++++-----
 source3/rpcclient/rpcclient.c               |    4 +-
 source3/smbd/dir.c                          |  121 ++++++++++++++++++++++++++-
 source3/utils/status.c                      |   14 ++--
 source4/torture/ldap/netlogon.c             |    2 +-
 source4/torture/smb2/rename.c               |   97 +++++++++++++++++++++
 16 files changed, 404 insertions(+), 118 deletions(-)
 create mode 100644 docs-xml/smbdotconf/tuning/strictrename.xml


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/tuning/strictrename.xml 
b/docs-xml/smbdotconf/tuning/strictrename.xml
new file mode 100644
index 0000000..5478863
--- /dev/null
+++ b/docs-xml/smbdotconf/tuning/strictrename.xml
@@ -0,0 +1,25 @@
+<samba:parameter name="strict rename"
+                 context="S"
+                                type="boolean"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc";>
+<description>
+    <para>By default a Windows SMB server prevents directory
+    renames when there are open file or directory handles below
+    it in the filesystem hierarchy. Historically Samba has always
+    allowed this as POSIX filesystem semantics require it.</para>
+
+    <para>This boolean parameter allows Samba to match the Windows
+    behavior. Setting this to "yes" is a very expensive change,
+    as it forces Samba to travers the entire open file handle
+    database on every directory rename request. In a clustered
+    Samba system the cost is even greater than the non-clustered
+    case.</para>
+
+    <para>For this reason the default is "no", and it is recommended
+    to be left that way unless a specific Windows application requires
+    it to be changed.</para>
+
+</description>
+
+<value type="default">no</value>
+</samba:parameter>
diff --git a/lib/param/param_table.c b/lib/param/param_table.c
index 15ffa8c..7a13e6f 100644
--- a/lib/param/param_table.c
+++ b/lib/param/param_table.c
@@ -1884,6 +1884,15 @@ struct parm_struct parm_table[] = {
                .flags          = FLAG_ADVANCED | FLAG_SHARE,
        },
        {
+               .label          = "strict rename",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(strict_rename),
+               .special        = NULL,
+               .enum_list      = NULL,
+               .flags          = FLAG_ADVANCED | FLAG_SHARE,
+       },
+       {
                .label          = "strict sync",
                .type           = P_BOOL,
                .p_class        = P_LOCAL,
diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c
index df81767..964cb0a 100644
--- a/libcli/cldap/cldap.c
+++ b/libcli/cldap/cldap.c
@@ -1020,7 +1020,7 @@ NTSTATUS cldap_netlogon_recv(struct tevent_req *req,
 {
        struct cldap_netlogon_state *state = tevent_req_data(req,
                                             struct cldap_netlogon_state);
-       NTSTATUS status;
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
        DATA_BLOB *data;
 
        if (tevent_req_is_nterror(req, &status)) {
diff --git a/selftest/knownfail b/selftest/knownfail
index 3d73495..6cca3dd 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -112,6 +112,7 @@
 ^samba4.smb2.rename.no_share_delete_no_delete_access\(.*\)$
 ^samba4.smb2.rename.msword
 ^samba4.smb2.rename.rename_dir_bench\(dc\)
+^samba4.smb2.rename.rename_dir_openfile\(.*\)$
 ^samba4.smb2.oplock.doc
 ^samba4.smb2.compound.related3
 ^samba4.smb2.compound.compound-break
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 1963321..48b8164 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1076,6 +1076,7 @@ sub provision($$$$$$)
        store dos attributes = yes
        create mask = 755
        dos filemode = yes
+       strict rename = yes
        vfs objects = acl_xattr fake_acls xattr_tdb streams_depot
 
        printing = vlp
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 64e3767..08f8ba2 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -1424,7 +1424,7 @@ NTSTATUS cli_qpathinfo3(struct cli_state *cli, const char 
*fname,
                        SMB_INO_T *ino)
 {
        NTSTATUS status = NT_STATUS_OK;
-       SMB_STRUCT_STAT st;
+       SMB_STRUCT_STAT st = { 0 };
        uint32_t attr;
        uint64_t pos;
 
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 295e147..1c4c4d0 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -2026,7 +2026,8 @@ static void brl_get_locks_readonly_parser(TDB_DATA key, 
TDB_DATA data,
 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp)
 {
        struct byte_range_lock *br_lock = NULL;
-       struct byte_range_lock *rw = NULL;
+       struct brl_get_locks_readonly_state state;
+       NTSTATUS status;
 
        DEBUG(10, ("seqnum=%d, fsp->brlock_seqnum=%d\n",
                   dbwrap_get_seqnum(brlock_db), fsp->brlock_seqnum));
@@ -2040,60 +2041,39 @@ struct byte_range_lock 
*brl_get_locks_readonly(files_struct *fsp)
                return fsp->brlock_rec;
        }
 
-       if (rw != NULL) {
-               size_t lock_data_size;
+       /*
+        * Parse the record fresh from the database
+        */
+
+       state.mem_ctx = fsp;
+       state.br_lock = &br_lock;
 
+       status = dbwrap_parse_record(
+               brlock_db,
+               make_tdb_data((uint8_t *)&fsp->file_id,
+                             sizeof(fsp->file_id)),
+               brl_get_locks_readonly_parser, &state);
+
+       if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_FOUND)) {
                /*
-                * Make a copy of the already retrieved and sanitized rw record
+                * No locks on this file. Return an empty br_lock.
                 */
-               lock_data_size = rw->num_locks * sizeof(struct lock_struct);
-               br_lock = talloc_pooled_object(
-                       fsp, struct byte_range_lock, 1, lock_data_size);
+               br_lock = talloc(fsp, struct byte_range_lock);
                if (br_lock == NULL) {
-                       goto fail;
+                       return NULL;
                }
-               br_lock->have_read_oplocks = rw->have_read_oplocks;
-               br_lock->num_locks = rw->num_locks;
-               br_lock->lock_data = (struct lock_struct *)talloc_memdup(
-                       br_lock, rw->lock_data, lock_data_size);
-       } else {
-               struct brl_get_locks_readonly_state state;
-               NTSTATUS status;
-
-               /*
-                * Parse the record fresh from the database
-                */
 
-               state.mem_ctx = fsp;
-               state.br_lock = &br_lock;
-
-               status = dbwrap_parse_record(
-                       brlock_db,
-                       make_tdb_data((uint8_t *)&fsp->file_id,
-                                     sizeof(fsp->file_id)),
-                       brl_get_locks_readonly_parser, &state);
-
-               if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_FOUND)) {
-                       /*
-                        * No locks on this file. Return an empty br_lock.
-                        */
-                       br_lock = talloc(fsp, struct byte_range_lock);
-                       if (br_lock == NULL) {
-                               goto fail;
-                       }
-
-                       br_lock->have_read_oplocks = false;
-                       br_lock->num_locks = 0;
-                       br_lock->lock_data = NULL;
+               br_lock->have_read_oplocks = false;
+               br_lock->num_locks = 0;
+               br_lock->lock_data = NULL;
 
-               } else if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(3, ("Could not parse byte range lock record: "
-                                 "%s\n", nt_errstr(status)));
-                       goto fail;
-               }
-               if (br_lock == NULL) {
-                       goto fail;
-               }
+       } else if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(3, ("Could not parse byte range lock record: "
+                         "%s\n", nt_errstr(status)));
+               return NULL;
+       }
+       if (br_lock == NULL) {
+               return NULL;
        }
 
        br_lock->fsp = fsp;
@@ -2117,8 +2097,6 @@ struct byte_range_lock 
*brl_get_locks_readonly(files_struct *fsp)
                fsp->brlock_seqnum = dbwrap_get_seqnum(brlock_db);
        }
 
-fail:
-       TALLOC_FREE(rw);
        return br_lock;
 }
 
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 46eec2a..44f3ba1 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -190,7 +190,11 @@ bool is_delete_on_close_set(struct share_mode_lock *lck, 
uint32_t name_hash);
 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
 bool set_write_time(struct file_id fileid, struct timespec write_time);
 struct timespec get_share_mode_write_time(struct share_mode_lock *lck);
-int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
+int share_mode_forall(int (*fn)(struct file_id fid,
+                               const struct share_mode_data *data,
+                               void *private_data),
+                     void *private_data);
+int share_entry_forall(int (*fn)(const struct share_mode_entry *, const char *,
                                 const char *, void *),
                      void *private_data);
 bool share_mode_cleanup_disconnected(struct file_id id,
diff --git a/source3/locking/share_mode_lock.c 
b/source3/locking/share_mode_lock.c
index 12f499b..65409ac 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -133,7 +133,7 @@ static struct share_mode_data *parse_share_modes(TALLOC_CTX 
*mem_ctx,
        blob.data = dbuf.dptr;
        blob.length = dbuf.dsize;
 
-       ndr_err = ndr_pull_struct_blob(
+       ndr_err = ndr_pull_struct_blob_all(
                &blob, d, d, (ndr_pull_flags_fn_t)ndr_pull_share_mode_data);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                DEBUG(1, ("ndr_pull_share_mode_lock failed: %s\n",
@@ -440,30 +440,33 @@ struct share_mode_lock 
*fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
        return lck;
 }
 
-struct forall_state {
-       void (*fn)(const struct share_mode_entry *entry,
-                  const char *sharepath,
-                  const char *fname,
-                  void *private_data);
+struct share_mode_forall_state {
+       int (*fn)(struct file_id fid, const struct share_mode_data *data,
+                 void *private_data);
        void *private_data;
 };
 
-static int traverse_fn(struct db_record *rec, void *_state)
+static int share_mode_traverse_fn(struct db_record *rec, void *_state)
 {
-       struct forall_state *state = (struct forall_state *)_state;
+       struct share_mode_forall_state *state =
+               (struct share_mode_forall_state *)_state;
        uint32_t i;
        TDB_DATA key;
        TDB_DATA value;
        DATA_BLOB blob;
        enum ndr_err_code ndr_err;
        struct share_mode_data *d;
+       struct file_id fid;
+       int ret;
 
        key = dbwrap_record_get_key(rec);
        value = dbwrap_record_get_value(rec);
 
        /* Ensure this is a locking_key record. */
-       if (key.dsize != sizeof(struct file_id))
+       if (key.dsize != sizeof(fid)) {
                return 0;
+       }
+       memcpy(&fid, key.dptr, sizeof(fid));
 
        d = talloc(talloc_tos(), struct share_mode_data);
        if (d == NULL) {
@@ -473,7 +476,7 @@ static int traverse_fn(struct db_record *rec, void *_state)
        blob.data = value.dptr;
        blob.length = value.dsize;
 
-       ndr_err = ndr_pull_struct_blob(
+       ndr_err = ndr_pull_struct_blob_all(
                &blob, d, d, (ndr_pull_flags_fn_t)ndr_pull_share_mode_data);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                DEBUG(1, ("ndr_pull_share_mode_lock failed\n"));
@@ -485,42 +488,80 @@ static int traverse_fn(struct db_record *rec, void 
*_state)
        }
        for (i=0; i<d->num_share_modes; i++) {
                d->share_modes[i].stale = false; /* [skip] in idl */
-               state->fn(&d->share_modes[i],
-                         d->servicepath, d->base_name,
-                         state->private_data);
        }
-       TALLOC_FREE(d);
 
-       return 0;
-}
+       ret = state->fn(fid, d, state->private_data);
 
-/*******************************************************************
- Call the specified function on each entry under management by the
- share mode system.
-********************************************************************/
+       TALLOC_FREE(d);
+       return ret;
+}
 
-int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
-                                const char *, void *),
+int share_mode_forall(int (*fn)(struct file_id fid,
+                               const struct share_mode_data *data,
+                               void *private_data),
                      void *private_data)
 {
-       struct forall_state state;
+       struct share_mode_forall_state state = {
+               .fn = fn,
+               .private_data = private_data
+       };
        NTSTATUS status;
        int count;
 
-       if (lock_db == NULL)
+       if (lock_db == NULL) {
                return 0;
+       }
 
-       state.fn = fn;
-       state.private_data = private_data;
-
-       status = dbwrap_traverse_read(lock_db, traverse_fn, (void *)&state,
-                                     &count);
-
+       status = dbwrap_traverse_read(lock_db, share_mode_traverse_fn,
+                                     &state, &count);
        if (!NT_STATUS_IS_OK(status)) {
                return -1;
-       } else {
-               return count;
        }
+
+       return count;
+}
+
+struct share_entry_forall_state {
+       int (*fn)(const struct share_mode_entry *e,
+                 const char *service_path, const char *base_name,
+                 void *private_data);
+       void *private_data;
+};
+
+static int share_entry_traverse_fn(struct file_id fid,
+                                  const struct share_mode_data *data,
+                                  void *private_data)
+{
+       struct share_entry_forall_state *state = private_data;
+       uint32_t i;
+
+       for (i=0; i<data->num_share_modes; i++) {
+               int ret;
+
+               ret = state->fn(&data->share_modes[i],
+                               data->servicepath, data->base_name,
+                               state->private_data);
+               if (ret != 0) {
+                       return ret;
+               }
+       }
+
+       return 0;
+}
+
+/*******************************************************************
+ Call the specified function on each entry under management by the
+ share mode system.
+********************************************************************/
+
+int share_entry_forall(int (*fn)(const struct share_mode_entry *,
+                                const char *, const char *, void *),
+                      void *private_data)
+{
+       struct share_entry_forall_state state = {
+               .fn = fn, .private_data = private_data };
+
+       return share_mode_forall(share_entry_traverse_fn, &state);
 }
 
 bool share_mode_cleanup_disconnected(struct file_id fid,
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index f68c001..d6ba8fb 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -206,6 +206,7 @@ static struct loadparm_service sDefault =
        .follow_symlinks = true,
        .sync_always = false,
        .strict_allocate = false,
+       .strict_rename = false,
        .strict_sync = false,
        .mangling_char = '~',
        .copymap = NULL,
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c 
b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index 855b8c7..eaa70e7 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -79,9 +79,9 @@ struct share_conn_stat {
 /*******************************************************************
 ********************************************************************/
 
-static void enum_file_fn( const struct share_mode_entry *e,
-                          const char *sharepath, const char *fname,
-                         void *private_data )
+static int enum_file_fn(const struct share_mode_entry *e,
+                       const char *sharepath, const char *fname,
+                       void *private_data)
 {
        struct file_enum_count *fenum =
                (struct file_enum_count *)private_data;
@@ -98,21 +98,21 @@ static void enum_file_fn( const struct share_mode_entry *e,
        /* If the pid was not found delete the entry from connections.tdb */
 
        if ( !process_exists(e->pid) ) {
-               return;
+               return 0;
        }
 
        username = uidtoname(e->uid);
 
        if ((fenum->username != NULL)
            && !strequal(username, fenum->username)) {
-               return;
+               return 0;
        }
 
        f = talloc_realloc(fenum->ctx, fenum->ctr3->array,
                                 struct srvsvc_NetFileInfo3, i+1);
        if ( !f ) {
                DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
-               return;
+               return 0;
        }
        fenum->ctr3->array = f;
 
@@ -133,7 +133,7 @@ static void enum_file_fn( const struct share_mode_entry *e,
                                sharepath, fname );
        }
        if (!fullpath) {
-               return;
+               return 0;
        }
        string_replace( fullpath, '/', '\\' );
 
@@ -150,6 +150,8 @@ static void enum_file_fn( const struct share_mode_entry *e,
        fenum->ctr3->array[i].user              = username;
 
        fenum->ctr3->count++;
+
+       return 0;
 }
 
 /*******************************************************************
@@ -166,7 +168,7 @@ static WERROR net_enum_files(TALLOC_CTX *ctx,
        f_enum_cnt.username = username;
        f_enum_cnt.ctr3 = *ctr3;
 
-       share_mode_forall( enum_file_fn, (void *)&f_enum_cnt );
+       share_entry_forall( enum_file_fn, (void *)&f_enum_cnt );
 
        *ctr3 = f_enum_cnt.ctr3;
 
@@ -826,9 +828,9 @@ static WERROR init_srv_sess_info_0(struct pipes_struct *p,
  * find out the session on which this file is open and bump up its count
  **********************************************************************/
 
-static void count_sess_files_fn(const struct share_mode_entry *e,
-                               const char *sharepath, const char *fname,
-                               void *data)
+static int count_sess_files_fn(const struct share_mode_entry *e,
+                              const char *sharepath, const char *fname,
+                              void *data)
 {
        struct sess_file_info *info = data;
        uint32_t rh = info->resume_handle;
@@ -846,9 +848,10 @@ static void count_sess_files_fn(const struct 
share_mode_entry *e,
                     serverid_equal(&e->pid, &sess->pid)) {
 
                        info->ctr->array[i].num_open++;
-                       return;
+                       return 0;
                }
        }
+       return 0;
 }
 


-- 
Samba Shared Repository

Reply via email to