smbd: Pass in "file_id" into share_mode_str()
authorVolker Lendecke <vl@samba.org>
Wed, 7 Feb 2018 10:05:33 +0000 (11:05 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 12 Feb 2018 23:26:43 +0000 (00:26 +0100)
This used to directly access share_entry->id, which will go

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/locking.c
source3/locking/proto.h
source3/rpc_server/srvsvc/srv_srvsvc_nt.c
source3/smbd/close.c
source3/smbd/open.c

index 8e63bfc4a69a303e7a67c61ed21f99f223b015d0..6311cda276a1e4aa69576d7a6ce1a7e5f38e8636 100644 (file)
@@ -425,7 +425,9 @@ void locking_close_file(struct messaging_context *msg_ctx,
  Print out a share mode.
 ********************************************************************/
 
-char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e)
+char *share_mode_str(TALLOC_CTX *ctx, int num,
+                    const struct file_id *id,
+                    const struct share_mode_entry *e)
 {
        struct server_id_buf tmp;
 
@@ -439,7 +441,7 @@ char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e)
                 e->access_mask, (unsigned long long)e->op_mid,
                 e->op_type, (unsigned long long)e->share_file_id,
                 (unsigned int)e->uid, (unsigned int)e->flags,
-                file_id_string_tos(&e->id),
+                file_id_string_tos(id),
                 (unsigned int)e->name_hash);
 }
 
index 671b8327e494f53a71c95f171d0ef047f92e3546..afd5373772acecec454d045eb313d842b56ccf02 100644 (file)
@@ -140,7 +140,9 @@ void locking_close_file(struct messaging_context *msg_ctx,
 bool locking_init(void);
 bool locking_init_readonly(void);
 bool locking_end(void);
-char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
+char *share_mode_str(TALLOC_CTX *ctx, int num,
+                    const struct file_id *id,
+                    const struct share_mode_entry *e);
 struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx,
                                                     struct file_id id);
 struct share_mode_lock *get_share_mode_lock(
index 0d15381e31c46545e290484d1330a8e2a92dc772..8e830ff9112ec07f79c5fa69909c5dee02ee2d11 100644 (file)
@@ -2722,9 +2722,8 @@ static int enum_file_close_fn(const struct share_mode_entry *e,
        }
 
        /* Ok - send the close message. */
-       DEBUG(10,("enum_file_close_fn: request to close file %s, %s\n",
-               sharepath,
-               share_mode_str(talloc_tos(), 0, e) ));
+       DBG_DEBUG("request to close file %s, %s\n", sharepath,
+                 share_mode_str(talloc_tos(), 0, &e->id, e));
 
        share_mode_entry_to_message(msg, e);
 
index 2f6cc4f0aadf6dcf8eafcadc48dc08529db36da2..0d60a2258e2dafc63e82afe213baf8e9fdbadc77 100644 (file)
@@ -1288,7 +1288,7 @@ void msg_close_file(struct messaging_context *msg_ctx,
        message_to_share_mode_entry(&e, (char *)data->data);
 
        if(DEBUGLVL(10)) {
-               char *sm_str = share_mode_str(NULL, 0, &e);
+               char *sm_str = share_mode_str(NULL, 0, &e.id, &e);
                if (!sm_str) {
                        smb_panic("talloc failed");
                }
index 5817bdbe9ae238406aec80a4a8cdaacfd6e94fc1..57497bcbcd65056960803a0dda63f81c06bd5b1b 100644 (file)
@@ -1566,8 +1566,9 @@ static void validate_my_share_entries(struct smbd_server_connection *sconn,
        fsp = file_find_dif(sconn, share_entry->id,
                            share_entry->share_file_id);
        if (!fsp) {
-               DEBUG(0,("validate_my_share_entries: PANIC : %s\n",
-                        share_mode_str(talloc_tos(), num, share_entry) ));
+               DBG_ERR("PANIC : %s\n",
+                       share_mode_str(talloc_tos(), num, &share_entry->id,
+                                      share_entry));
                smb_panic("validate_my_share_entries: Cannot match a "
                          "share entry with an open file\n");
        }
@@ -1581,8 +1582,9 @@ static void validate_my_share_entries(struct smbd_server_connection *sconn,
  panic:
        {
                char *str;
-               DEBUG(0,("validate_my_share_entries: PANIC : %s\n",
-                        share_mode_str(talloc_tos(), num, share_entry) ));
+               DBG_ERR("validate_my_share_entries: PANIC : %s\n",
+                       share_mode_str(talloc_tos(), num, &share_entry->id,
+                                      share_entry));
                str = talloc_asprintf(talloc_tos(),
                        "validate_my_share_entries: "
                        "file %s, oplock_type = 0x%x, op_type = 0x%x\n",