smbd: Make share_mode_do_locked() use a const uint8_t *
authorVolker Lendecke <vl@samba.org>
Fri, 24 Apr 2020 09:07:53 +0000 (11:07 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 5 May 2020 11:48:40 +0000 (11:48 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/locking/locking.c
source3/locking/proto.h
source3/locking/share_mode_lock.c
source3/smbd/reply.c

index f5426391c21d3cdb61887fc82f09bc523e1a14bb..a108ebba00d652e933e727d391f0c51931ec8df5 100644 (file)
@@ -250,7 +250,8 @@ struct do_lock_state {
 };
 
 static void do_lock_fn(
-       TDB_DATA value,
+       const uint8_t *buf,
+       size_t buflen,
        bool *modified_dependent,
        void *private_data)
 {
index b7098c1e788ca475abb134ac5b504522fa486487..f4c68bc5ca4467cb2256541833f0e3dc47fbc264 100644 (file)
@@ -144,7 +144,8 @@ bool file_has_read_lease(struct files_struct *fsp);
 struct db_record;
 NTSTATUS share_mode_do_locked(
        struct file_id id,
-       void (*fn)(TDB_DATA value,
+       void (*fn)(const uint8_t *buf,
+                  size_t buflen,
                   bool *modified_dependent,
                   void *private_data),
        void *private_data);
index c7940aa4c19f79d8e73a7eaafb11ca8cd84692cd..26f8da8cfb43ce82b9160a15dd91e76540a7c2f3 100644 (file)
@@ -228,13 +228,16 @@ struct fsp_update_share_mode_flags_state {
 };
 
 static void fsp_update_share_mode_flags_fn(
-       TDB_DATA value, bool *modified_dependent, void *private_data)
+       const uint8_t *buf,
+       size_t buflen,
+       bool *modified_dependent,
+       void *private_data)
 {
        struct fsp_update_share_mode_flags_state *state = private_data;
        uint64_t seq;
 
        state->ndr_err = get_share_mode_blob_header(
-               value.dptr, value.dsize, &seq, &state->share_mode_flags);
+               buf, buflen, &seq, &state->share_mode_flags);
 }
 
 static NTSTATUS fsp_update_share_mode_flags(struct files_struct *fsp)
@@ -723,7 +726,8 @@ static int share_mode_lock_destructor(struct share_mode_lock *lck)
 }
 
 struct share_mode_do_locked_state {
-       void (*fn)(TDB_DATA value,
+       void (*fn)(const uint8_t *buf,
+                  size_t buflen,
                   bool *modified_dependent,
                   void *private_data);
        void *private_data;
@@ -747,7 +751,10 @@ static void share_mode_do_locked_fn(
                SMB_ASSERT(static_share_mode_record == rec);
        }
 
-       state->fn(value, &modified_dependent, state->private_data);
+       state->fn(value.dptr,
+                 value.dsize,
+                 &modified_dependent,
+                 state->private_data);
 
        if (modified_dependent) {
                dbwrap_watched_wakeup(rec);
@@ -760,7 +767,8 @@ static void share_mode_do_locked_fn(
 
 NTSTATUS share_mode_do_locked(
        struct file_id id,
-       void (*fn)(TDB_DATA value,
+       void (*fn)(const uint8_t *buf,
+                  size_t buflen,
                   bool *modified_dependent,
                   void *private_data),
        void *private_data)
@@ -782,7 +790,8 @@ NTSTATUS share_mode_do_locked(
                        return NT_STATUS_INVALID_LOCK_SEQUENCE;
                }
 
-               fn(static_share_mode_record_value,
+               fn(static_share_mode_record_value.dptr,
+                  static_share_mode_record_value.dsize,
                   &modified_dependent,
                   private_data);
 
@@ -809,9 +818,11 @@ NTSTATUS share_mode_do_locked(
        return NT_STATUS_OK;
 }
 
-static void share_mode_wakeup_waiters_fn(TDB_DATA value,
-                                        bool *modified_dependent,
-                                        void *private_data)
+static void share_mode_wakeup_waiters_fn(
+       const uint8_t *buf,
+       size_t buflen,
+       bool *modified_dependent,
+       void *private_data)
 {
        *modified_dependent = true;
 }
@@ -834,7 +845,10 @@ struct share_mode_watch_state {
 };
 
 static void share_mode_watch_fn(
-       TDB_DATA value, bool *modified_dependent, void *private_data)
+       const uint8_t *buf,
+       size_t buflen,
+       bool *modified_dependent,
+       void *private_data)
 {
        struct share_mode_watch_state *state = talloc_get_type_abort(
                private_data, struct share_mode_watch_state);
index fd4434c900884d60607f23c604f8b65a4f3d8242..0344668e99fbcd5e29bf853bdea3650c626112b6 100644 (file)
@@ -9069,7 +9069,10 @@ struct smbd_do_unlocking_state {
 };
 
 static void smbd_do_unlocking_fn(
-       TDB_DATA value, bool *pmodified_dependent, void *private_data)
+       const uint8_t *buf,
+       size_t buflen,
+       bool *pmodified_dependent,
+       void *private_data)
 {
        struct smbd_do_unlocking_state *state = private_data;
        struct files_struct *fsp = state->fsp;