smbd: use lp_smbd_getinfo_ask_sharemode()
authorRalph Boehme <slow@samba.org>
Mon, 3 Dec 2018 10:30:51 +0000 (11:30 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 6 Dec 2018 00:43:14 +0000 (01:43 +0100)
Counterpart for "smbd:search ask sharemode" for getinfo.

Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_getinfo.c
source3/smbd/trans2.c

index 7bded422520ddcbc98096874fc21922005a050c8..314f44e858cf00a3b957c10d532067834e6c7bcc 100644 (file)
@@ -353,10 +353,13 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx,
                                return tevent_req_post(req, ev);
                        }
 
-                       fileid = vfs_file_id_from_sbuf(conn,
-                                                      &fsp->fsp_name->st);
-                       get_file_infos(fileid, fsp->name_hash,
-                               &delete_pending, &write_time_ts);
+                       if (lp_smbd_getinfo_ask_sharemode(SNUM(conn))) {
+                               fileid = vfs_file_id_from_sbuf(
+                                       conn, &fsp->fsp_name->st);
+                               get_file_infos(fileid, fsp->name_hash,
+                                              &delete_pending,
+                                              &write_time_ts);
+                       }
                } else {
                        /*
                         * Original code - this is an open file.
@@ -370,10 +373,13 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx,
                                tevent_req_nterror(req, status);
                                return tevent_req_post(req, ev);
                        }
-                       fileid = vfs_file_id_from_sbuf(conn,
-                                                      &fsp->fsp_name->st);
-                       get_file_infos(fileid, fsp->name_hash,
-                               &delete_pending, &write_time_ts);
+                       if (lp_smbd_getinfo_ask_sharemode(SNUM(conn))) {
+                               fileid = vfs_file_id_from_sbuf(
+                                       conn, &fsp->fsp_name->st);
+                               get_file_infos(fileid, fsp->name_hash,
+                                              &delete_pending,
+                                              &write_time_ts);
+                       }
                }
 
                status = smbd_do_qfilepathinfo(conn, state,
index 306174e597d85538b0ff30a3e0cbd68d9d557ba3..d3497fed0b497f7df53cc7f95ee2c3c6fe281098 100644 (file)
@@ -5785,8 +5785,13 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                return;
                        }
 
-                       fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st);
-                       get_file_infos(fileid, fsp->name_hash, &delete_pending, &write_time_ts);
+                       if (lp_smbd_getinfo_ask_sharemode(SNUM(conn))) {
+                               fileid = vfs_file_id_from_sbuf(
+                                       conn, &smb_fname->st);
+                               get_file_infos(fileid, fsp->name_hash,
+                                              &delete_pending,
+                                              &write_time_ts);
+                       }
                } else {
                        /*
                         * Original code - this is an open file.
@@ -5798,8 +5803,13 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                        map_nt_error_from_unix(errno));
                                return;
                        }
-                       fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st);
-                       get_file_infos(fileid, fsp->name_hash, &delete_pending, &write_time_ts);
+                       if (lp_smbd_getinfo_ask_sharemode(SNUM(conn))) {
+                               fileid = vfs_file_id_from_sbuf(
+                                       conn, &smb_fname->st);
+                               get_file_infos(fileid, fsp->name_hash,
+                                              &delete_pending,
+                                              &write_time_ts);
+                       }
                }
 
        } else {
@@ -5967,8 +5977,12 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                        return;
                }
 
-               fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st);
-               get_file_infos(fileid, name_hash, &delete_pending, &write_time_ts);
+               if (lp_smbd_getinfo_ask_sharemode(SNUM(conn))) {
+                       fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st);
+                       get_file_infos(fileid, name_hash, &delete_pending,
+                                      &write_time_ts);
+               }
+
                if (delete_pending) {
                        reply_nterror(req, NT_STATUS_DELETE_PENDING);
                        return;