s3-id_cache: Use better names for id cache management ops
[idra/samba.git] / source3 / smbd / proto.h
index 06ecf696c63dc09f7bdf6d776322db1611f2a41e..289c012b481731c01fd0706b683274cd06cd4d2e 100644 (file)
@@ -43,6 +43,9 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _SMBD_PROTO_H_
+#define _SMBD_PROTO_H_
+
 /* The following definitions come from smbd/signing.c  */
 
 struct smbd_server_connection;
@@ -107,6 +110,9 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
                uint64_t offset,
                uint64_t count,
                uint64_t blocking_smblctx);
+void smbd_cancel_pending_lock_requests_by_fid(files_struct *fsp,
+                       struct byte_range_lock *br_lck,
+                       enum file_close_type close_type);
 void cancel_pending_lock_requests_by_fid(files_struct *fsp,
                        struct byte_range_lock *br_lck,
                        enum file_close_type close_type);
@@ -233,6 +239,8 @@ void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
 bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
 NTSTATUS can_delete_directory(struct connection_struct *conn,
                                const char *dirname);
+NTSTATUS smbd_can_delete_directory(struct connection_struct *conn,
+                               const char *dirname);
 
 /* The following definitions come from smbd/dmapi.c  */
 
@@ -470,7 +478,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
                                connection_struct **pconn,
                                int snum,
                                const char *path,
-                               const struct auth_serversupplied_info *session_info,
+                               const struct auth_session_info *session_info,
                                char **poldcwd);
 
 /* The following definitions come from smbd/negprot.c  */
@@ -581,7 +589,6 @@ NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
                                    const char *inherit_from_dir,
                                    const char *fname,
                                    SMB_STRUCT_STAT *psbuf);
-bool is_executable(const char *fname);
 bool is_stat_open(uint32 access_mask);
 bool request_timed_out(struct timeval request_time,
                       struct timeval timeout);
@@ -601,13 +608,6 @@ NTSTATUS fcb_or_dos_open(struct smb_request *req,
                         uint32 access_mask,
                         uint32 share_access,
                         uint32 create_options);
-bool map_open_params_to_ntcreate(const struct smb_filename *smb_fname,
-                                int deny_mode, int open_func,
-                                uint32 *paccess_mask,
-                                uint32 *pshare_mode,
-                                uint32 *pcreate_disposition,
-                                uint32 *pcreate_options,
-                                uint32_t *pprivate_flags);
 void remove_deferred_open_entry(struct file_id id, uint64_t mid,
                                struct server_id pid);
 NTSTATUS open_file_fchmod(connection_struct *conn,
@@ -667,6 +667,10 @@ void contend_level2_oplocks_begin(files_struct *fsp,
                                  enum level2_contention_type type);
 void contend_level2_oplocks_end(files_struct *fsp,
                                enum level2_contention_type type);
+void smbd_contend_level2_oplocks_begin(files_struct *fsp,
+                                 enum level2_contention_type type);
+void smbd_contend_level2_oplocks_end(files_struct *fsp,
+                               enum level2_contention_type type);
 void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
 void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
 bool init_oplocks(struct messaging_context *msg_ctx);
@@ -699,9 +703,8 @@ int register_initial_vuid(struct smbd_server_connection *sconn);
 int register_homes_share(const char *username);
 int register_existing_vuid(struct smbd_server_connection *sconn,
                        uint16 vuid,
-                       struct auth_serversupplied_info *session_info,
-                       DATA_BLOB response_blob,
-                       const char *smb_name);
+                       struct auth_session_info *session_info,
+                       DATA_BLOB response_blob);
 void add_session_user(struct smbd_server_connection *sconn, const char *user);
 void add_session_workgroup(struct smbd_server_connection *sconn,
                           const char *workgroup);
@@ -767,9 +770,11 @@ int srv_set_message(char *buf,
                         int num_words,
                         int num_bytes,
                         bool zero);
-void remove_deferred_open_message_smb(uint64_t mid);
-void schedule_deferred_open_message_smb(uint64_t mid);
-bool open_was_deferred(uint64_t mid);
+void remove_deferred_open_message_smb(struct smbd_server_connection *sconn,
+                                     uint64_t mid);
+void schedule_deferred_open_message_smb(struct smbd_server_connection *sconn,
+                                       uint64_t mid);
+bool open_was_deferred(struct smbd_server_connection *sconn, uint64_t mid);
 bool get_deferred_open_message_state(struct smb_request *smbreq,
                                struct timeval *p_request_time,
                                void **pp_state);
@@ -779,13 +784,6 @@ bool push_deferred_open_message_smb(struct smb_request *req,
                                struct file_id id,
                                char *private_data,
                                size_t priv_len);
-struct idle_event *event_add_idle(struct event_context *event_ctx,
-                                 TALLOC_CTX *mem_ctx,
-                                 struct timeval interval,
-                                 const char *name,
-                                 bool (*handler)(const struct timeval *now,
-                                                 void *private_data),
-                                 void *private_data);
 NTSTATUS allow_new_trans(struct trans_state *list, uint64_t mid);
 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
 const char *smb_fn_name(int type);
@@ -795,7 +793,8 @@ void construct_reply_common_req(struct smb_request *req, char *outbuf);
 size_t req_wct_ofs(struct smb_request *req);
 void chain_reply(struct smb_request *req);
 bool req_is_in_chain(struct smb_request *req);
-void smbd_process(struct smbd_server_connection *sconn);
+void smbd_process(struct tevent_context *ev_ctx,
+                 struct smbd_server_connection *sconn);
 bool fork_echo_handler(struct smbd_server_connection *sconn);
 
 /* The following definitions come from smbd/quotas.c  */
@@ -938,7 +937,6 @@ void reply_getattrE(struct smb_request *req);
 
 /* The following definitions come from smbd/seal.c  */
 
-uint16_t srv_enc_ctx(void);
 bool is_encrypted_packet(const uint8_t *inbuf);
 void srv_free_enc_buffer(char *buf);
 NTSTATUS srv_decrypt_buffer(char *buf);
@@ -969,8 +967,6 @@ void reload_printers(struct tevent_context *ev,
                     struct messaging_context *msg_ctx);
 bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
                     bool test);
-void reload_pcap_change_notify(struct tevent_context *ev,
-                              struct messaging_context *msg_ctx);
 void exit_server(const char *const explanation);
 void exit_server_cleanly(const char *const explanation);
 void exit_server_fault(void);
@@ -1004,7 +1000,7 @@ int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
 /* The following definitions come from smbd/sesssetup.c  */
 
 NTSTATUS do_map_to_guest(NTSTATUS status,
-               struct auth_serversupplied_info **session_info,
+               struct auth_session_info **session_info,
                const char *user, const char *domain);
 
 NTSTATUS parse_spnego_mechanisms(TALLOC_CTX *ctx,
@@ -1043,11 +1039,18 @@ bool stat_cache_lookup(connection_struct *conn,
                        char **pp_dirpath,
                        char **pp_start,
                        SMB_STRUCT_STAT *pst);
+void smbd_send_stat_cache_delete_message(struct messaging_context *msg_ctx,
+                                   const char *name);
 void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
                                    const char *name);
 void stat_cache_delete(const char *name);
+#if BUILD_TDB2
+struct tdb_data;
+unsigned int fast_string_hash(struct tdb_data *key);
+#else
 struct TDB_DATA;
 unsigned int fast_string_hash(struct TDB_DATA *key);
+#endif
 bool reset_stat_cache( void );
 
 /* The following definitions come from smbd/statvfs.c  */
@@ -1096,15 +1099,18 @@ void reply_transs2(struct smb_request *req);
 bool change_to_guest(void);
 bool change_to_user(connection_struct *conn, uint16 vuid);
 bool change_to_user_by_session(connection_struct *conn,
-                              const struct auth_serversupplied_info *session_info);
+                              const struct auth_session_info *session_info);
 bool change_to_root_user(void);
-bool become_authenticated_pipe_user(struct auth_serversupplied_info *session_info);
+bool smbd_change_to_root_user(void);
+bool become_authenticated_pipe_user(struct auth_session_info *session_info);
 bool unbecome_authenticated_pipe_user(void);
 void become_root(void);
 void unbecome_root(void);
+void smbd_become_root(void);
+void smbd_unbecome_root(void);
 bool become_user(connection_struct *conn, uint16 vuid);
 bool become_user_by_session(connection_struct *conn,
-                           const struct auth_serversupplied_info *session_info);
+                           const struct auth_session_info *session_info);
 bool unbecome_user(void);
 uid_t get_current_uid(connection_struct *conn);
 gid_t get_current_gid(connection_struct *conn);
@@ -1176,4 +1182,6 @@ void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 
 /* The following definitions come from smbd/msg_idmap.c */
 
-void msg_idmap_register_msgs(struct messaging_context *ctx);
+void id_cache_register_kill_msg(struct messaging_context *ctx);
+
+#endif /* _SMBD_PROTO_H_ */