smbd: add simple noop smbd_impersonate_{conn_vuid,conn_sess,root,guest}_create()...
[kai/samba-autobuild/.git] / source3 / smbd / proto.h
index 86b655152891ce1ee39f336d821f1e5fff0375df..29121d5c49610972761e254152de79a5a211cae0 100644 (file)
@@ -173,6 +173,7 @@ uint64_t sys_disk_free(connection_struct *conn, struct smb_filename *fname,
                       uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
 uint64_t get_dfree_info(connection_struct *conn, struct smb_filename *fname,
                        uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+void flush_dfree_cache(void);
 
 /* The following definitions come from smbd/dir.c  */
 
@@ -319,10 +320,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode);
 /* The following definitions come from smbd/fileio.c  */
 
 ssize_t read_file(files_struct *fsp,char *data,off_t pos,size_t n);
-void update_write_time_handler(struct tevent_context *ctx,
-                                      struct tevent_timer *te,
-                                      struct timeval now,
-                                      void *private_data);
+void fsp_flush_write_time_update(struct files_struct *fsp);
 void trigger_write_time_update(struct files_struct *fsp);
 void trigger_write_time_update_immediate(struct files_struct *fsp);
 void mark_file_modified(files_struct *fsp);
@@ -498,21 +496,22 @@ NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
                                bool allow_broken_path,
                                char **pp_name_out,
                                bool *ppath_contains_wcard);
-NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
-                           struct tevent_context *ev,
-                           struct messaging_context *msg,
-                           connection_struct **pconn,
-                           int snum,
-                           const char *path,
-                           const struct auth_session_info *session_info);
-NTSTATUS create_conn_struct_cwd(TALLOC_CTX *ctx,
-                               struct tevent_context *ev,
-                               struct messaging_context *msg,
-                               connection_struct **pconn,
+struct connection_struct;
+struct smb_filename;
+struct conn_struct_tos {
+       struct connection_struct *conn;
+       struct smb_filename *oldcwd_fname;
+};
+NTSTATUS create_conn_struct_tos(struct messaging_context *msg,
                                int snum,
                                const char *path,
                                const struct auth_session_info *session_info,
-                               struct smb_filename **poldcwd_fname);
+                               struct conn_struct_tos **_c);
+NTSTATUS create_conn_struct_tos_cwd(struct messaging_context *msg,
+                                   int snum,
+                                   const char *path,
+                                   const struct auth_session_info *session_info,
+                                   struct conn_struct_tos **_c);
 
 /* The following definitions come from smbd/negprot.c  */
 
@@ -587,7 +586,6 @@ int fam_watch(TALLOC_CTX *mem_ctx,
 
 struct notify_context *notify_init(
        TALLOC_CTX *mem_ctx, struct messaging_context *msg,
-       struct tevent_context *ev,
        struct smbd_server_connection *sconn,
        void (*callback)(struct smbd_server_connection *sconn,
                         void *, struct timespec,
@@ -822,8 +820,6 @@ NTSTATUS make_default_filesystem_acl(
 
 /* The following definitions come from smbd/process.c  */
 
-void smbd_setup_sig_term_handler(struct smbd_server_connection *sconn);
-void smbd_setup_sig_hup_handler(struct smbd_server_connection *sconn);
 bool srv_send_smb(struct smbXsrv_connection *xconn, char *buffer,
                  bool no_signing, uint32_t seqnum,
                  bool do_encrypt,
@@ -1050,8 +1046,7 @@ const struct security_token *sec_ctx_active_token(void);
 
 struct memcache *smbd_memcache(void);
 bool snum_is_shared_printer(int snum);
-void delete_and_reload_printers(struct tevent_context *ev,
-                               struct messaging_context *msg_ctx);
+void delete_and_reload_printers(void);
 bool reload_services(struct smbd_server_connection *sconn,
                     bool (*snumused) (struct smbd_server_connection *, int),
                     bool test);
@@ -1065,7 +1060,8 @@ void smbd_exit_server_cleanly(const char *const reason) _NORETURN_;
 
 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
 NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
-bool set_current_service(connection_struct *conn, uint16_t flags, bool do_chdir);
+void set_current_case_sensitive(connection_struct *conn, uint16_t flags);
+bool chdir_current_service(connection_struct *conn);
 void load_registry_shares(void);
 int add_home_service(const char *service, const char *username, const char *homedir);
 int find_service(TALLOC_CTX *ctx, const char *service, char **p_service_out);
@@ -1193,12 +1189,19 @@ void reply_transs2(struct smb_request *req);
 
 /* The following definitions come from smbd/uid.c  */
 
+#define smbd_impersonate_debug_create(main_ev, name, dbg_lvl) \
+       _smbd_impersonate_debug_create(main_ev, name, dbg_lvl, __location__)
+struct tevent_context *_smbd_impersonate_debug_create(struct tevent_context *main_ev,
+                                                     const char *name,
+                                                     int dbg_lvl,
+                                                     const char *location);
 bool change_to_guest(void);
 NTSTATUS check_user_share_access(connection_struct *conn,
                                const struct auth_session_info *session_info,
                                uint32_t *p_share_access,
                                bool *p_readonly_share);
 bool change_to_user(connection_struct *conn, uint64_t vuid);
+bool change_to_user_by_fsp(struct files_struct *fsp);
 bool smbd_change_to_root_user(void);
 bool smbd_become_authenticated_pipe_user(struct auth_session_info *session_info);
 bool smbd_unbecome_authenticated_pipe_user(void);
@@ -1206,7 +1209,10 @@ void become_root(void);
 void unbecome_root(void);
 void smbd_become_root(void);
 void smbd_unbecome_root(void);
+bool become_guest(void);
+void unbecome_guest(void);
 bool become_user(connection_struct *conn, uint64_t vuid);
+bool become_user_by_fsp(struct files_struct *fsp);
 bool become_user_by_session(connection_struct *conn,
                            const struct auth_session_info *session_info);
 bool unbecome_user(void);
@@ -1216,6 +1222,17 @@ const struct security_unix_token *get_current_utok(connection_struct *conn);
 const struct security_token *get_current_nttok(connection_struct *conn);
 uint64_t get_current_vuid(connection_struct *conn);
 
+struct tevent_context *smbd_impersonate_conn_vuid_create(
+                               struct tevent_context *main_ev,
+                               struct connection_struct *conn,
+                               uint64_t vuid);
+struct tevent_context *smbd_impersonate_conn_sess_create(
+                               struct tevent_context *main_ev,
+                               struct connection_struct *conn,
+                               struct auth_session_info *session_info);
+struct tevent_context *smbd_impersonate_root_create(struct tevent_context *main_ev);
+struct tevent_context *smbd_impersonate_guest_create(struct tevent_context *main_ev);
+
 /* The following definitions come from smbd/utmp.c  */
 
 void sys_utmp_claim(const char *username, const char *hostname,