smbd: Remove unused "pcd" arg from smb1_srv_send()
[samba.git] / source3 / smbd / proto.h
index 9917562d1def05f21420ee1a4e2d57e648b64cb8..11c5f3a22722022a0f8111adf96061746a9abada 100644 (file)
@@ -187,8 +187,6 @@ NTSTATUS dptr_create(connection_struct *conn,
                struct smb_request *req,
                files_struct *fsp,
                bool old_handle,
-               bool expect_close,
-               uint16_t spid,
                const char *wcard,
                uint32_t attr,
                struct dptr_struct **dptr_ret);
@@ -287,7 +285,7 @@ bool set_sticky_write_time_fsp(struct files_struct *fsp,
 NTSTATUS fget_ea_dos_attribute(struct files_struct *fsp,
                              uint32_t *pattr);
 NTSTATUS set_ea_dos_attribute(connection_struct *conn,
-                             const struct smb_filename *smb_fname,
+                             struct smb_filename *smb_fname,
                              uint32_t dosmode);
 
 NTSTATUS set_create_timespec_ea(struct files_struct *fsp,
@@ -350,21 +348,9 @@ NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_throug
 
 uint32_t ucf_flags_from_smb_request(struct smb_request *req);
 uint32_t filename_create_ucf_flags(struct smb_request *req, uint32_t create_disposition);
-NTSTATUS unix_convert(TALLOC_CTX *ctx,
-                     connection_struct *conn,
-                     const char *orig_path,
-                     NTTIME twrp,
-                     struct smb_filename **smb_fname,
-                     uint32_t ucf_flags);
 NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname,
                                    uint32_t ucf_flags,
                                    NTTIME twrp);
-NTSTATUS get_real_filename_full_scan(connection_struct *conn,
-                                    const char *path,
-                                    const char *name,
-                                    bool mangled,
-                                    TALLOC_CTX *mem_ctx,
-                                    char **found_name);
 NTSTATUS get_real_filename_full_scan_at(struct files_struct *dirfsp,
                                        const char *name,
                                        bool mangled,
@@ -374,18 +360,17 @@ char *get_original_lcomp(TALLOC_CTX *ctx,
                        connection_struct *conn,
                        const char *filename_in,
                        uint32_t ucf_flags);
-NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
-                       connection_struct *conn,
-                       const char *name_in,
-                       uint32_t ucf_flags,
-                       NTTIME twrp,
-                       struct smb_filename **pp_smb_fname);
 NTSTATUS filename_convert_smb1_search_path(TALLOC_CTX *ctx,
                                           connection_struct *conn,
-                                          const char *name_in,
+                                          char *name_in,
                                           uint32_t ucf_flags,
+                                          struct files_struct **_dirfsp,
                                           struct smb_filename **_smb_fname_out,
                                           char **_mask_out);
+NTSTATUS get_real_filename_at(struct files_struct *dirfsp,
+                             const char *name,
+                             TALLOC_CTX *mem_ctx,
+                             char **found_name);
 
 /* The following definitions come from smbd/files.c  */
 
@@ -395,7 +380,7 @@ void fsp_set_gen_id(files_struct *fsp);
 NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
                  files_struct **result);
 NTSTATUS fsp_bind_smb(struct files_struct *fsp, struct smb_request *req);
-void file_close_conn(connection_struct *conn);
+void file_close_conn(connection_struct *conn, enum file_close_type close_type);
 bool file_init_global(void);
 bool file_init(struct smbd_server_connection *sconn);
 void file_close_user(struct smbd_server_connection *sconn, uint64_t vuid);
@@ -437,6 +422,8 @@ size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen);
 void fsp_set_base_fsp(struct files_struct *fsp, struct files_struct *base_fsp);
 bool fsp_is_alternate_stream(const struct files_struct *fsp);
 struct files_struct *metadata_fsp(struct files_struct *fsp);
+bool fsp_search_ask_sharemode(struct files_struct *fsp);
+bool fsp_getinfo_ask_sharemode(struct files_struct *fsp);
 
 NTSTATUS create_internal_fsp(connection_struct *conn,
                             const struct smb_filename *smb_fname,
@@ -457,15 +444,31 @@ NTSTATUS openat_internal_dir_from_pathref(
 NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
                            struct smb_filename *smb_fname);
 NTSTATUS open_stream_pathref_fsp(
-       const struct files_struct *dirfsp,
        struct files_struct **_base_fsp,
        struct smb_filename *smb_fname);
+NTSTATUS openat_pathref_dirfsp_nosymlink(
+       TALLOC_CTX *mem_ctx,
+       struct connection_struct *conn,
+       const char *path_in,
+       NTTIME twrp,
+       bool posix,
+       struct smb_filename **_smb_fname,
+       size_t *unparsed,
+       char **substitute);
+NTSTATUS readlink_talloc(
+       TALLOC_CTX *mem_ctx,
+       struct files_struct *dirfsp,
+       struct smb_filename *smb_relname,
+       char **_substitute);
 
 void smb_fname_fsp_unlink(struct smb_filename *smb_fname);
 
 NTSTATUS move_smb_fname_fsp_link(struct smb_filename *smb_fname_dst,
                                 struct smb_filename *smb_fname_src);
 
+NTSTATUS reference_smb_fname_fsp_link(struct smb_filename *smb_fname_dst,
+                                     const struct smb_filename *smb_fname_src);
+
 NTSTATUS synthetic_pathref(TALLOC_CTX *mem_ctx,
                           struct files_struct *dirfsp,
                           const char *base_name,
@@ -529,9 +532,8 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
                           const char *dfs_path,
                           const struct tsocket_address *remote_address,
                           const struct tsocket_address *local_address,
-                          bool allow_broken_path,
                           struct junction_map *jucn,
-                          int *consumedcntp,
+                          size_t *consumedcntp,
                           bool *self_referralp);
 int setup_dfs_referral(connection_struct *orig_conn,
                        const char *dfs_path,
@@ -539,7 +541,6 @@ int setup_dfs_referral(connection_struct *orig_conn,
                        char **ppdata, NTSTATUS *pstatus);
 bool create_junction(TALLOC_CTX *ctx,
                const char *dfs_path,
-               bool allow_broken_path,
                struct junction_map *jucn);
 struct referral;
 char *msdfs_link_string(TALLOC_CTX *ctx,
@@ -553,13 +554,6 @@ bool remove_msdfs_link(const struct junction_map *jucn,
 struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx,
                                      struct auth_session_info *session_info,
                                      size_t *p_num_jn);
-NTSTATUS dfs_redirect(TALLOC_CTX *ctx,
-                       connection_struct *conn,
-                       const char *name_in,
-                       uint32_t ucf_flags,
-                       bool allow_broken_path,
-                       NTTIME *twrp,
-                       char **pp_name_out);
 struct connection_struct;
 struct smb_filename;
 
@@ -686,7 +680,9 @@ NTSTATUS set_sd_blob(files_struct *fsp, uint8_t *data, uint32_t sd_len,
 NTSTATUS copy_internals(TALLOC_CTX *ctx,
                        connection_struct *conn,
                        struct smb_request *req,
+                       struct files_struct *src_dirfsp,
                        struct smb_filename *smb_fname_src,
+                       struct files_struct *dst_dirfsp,
                        struct smb_filename *smb_fname_dst,
                        uint32_t attrs);
 NTSTATUS smbd_do_query_security_desc(connection_struct *conn,
@@ -722,7 +718,7 @@ NTSTATUS check_parent_access_fsp(struct files_struct *fsp,
 NTSTATUS fd_openat(const struct files_struct *dirfsp,
                   struct smb_filename *smb_fname,
                   files_struct *fsp,
-                  int flags, mode_t mode);
+                  const struct vfs_open_how *how);
 NTSTATUS fd_close(files_struct *fsp);
 bool is_oplock_stat_open(uint32_t access_mask);
 bool is_lease_stat_open(uint32_t access_mask);
@@ -733,7 +729,9 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx,
 struct deferred_open_record;
 bool is_deferred_open_async(const struct deferred_open_record *rec);
 bool defer_smb1_sharing_violation(struct smb_request *req);
-NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
+NTSTATUS create_directory(connection_struct *conn,
+                         struct smb_request *req,
+                         struct files_struct *dirfsp,
                          struct smb_filename *smb_dname);
 void msg_file_was_renamed(struct messaging_context *msg,
                          void *private_data,
@@ -771,6 +769,7 @@ uint32_t get_lease_type(struct share_mode_entry *e, struct file_id id);
 
 void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
 NTSTATUS set_file_oplock(files_struct *fsp);
+void release_file_oplock(files_struct *fsp);
 bool remove_oplock(files_struct *fsp);
 bool downgrade_oplock(files_struct *fsp);
 bool fsp_lease_update(struct files_struct *fsp);
@@ -819,13 +818,14 @@ uint32_t map_canon_ace_perms(int snum,
                                 enum security_ace_type *pacl_type,
                                 mode_t perms,
                                 bool directory_ace);
-NTSTATUS unpack_nt_owners(connection_struct *conn, uid_t *puser, gid_t *pgrp, uint32_t security_info_sent, const struct security_descriptor *psd);
 bool current_user_in_group(connection_struct *conn, gid_t gid);
 SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
 NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
                           TALLOC_CTX *mem_ctx,
                           struct security_descriptor **ppdesc);
-NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
+NTSTATUS chown_if_needed(files_struct *fsp, uint32_t security_info_sent,
+                        const struct security_descriptor *psd,
+                        bool *did_chown);
 NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct security_descriptor *psd);
 int get_acl_group_bits(connection_struct *conn,
                       struct files_struct *fsp,
@@ -864,15 +864,12 @@ NTSTATUS make_default_filesystem_acl(
 
 /* The following definitions come from smbd/smb2_process.c  */
 
-bool smb2_srv_send(struct smbXsrv_connection *xconn, char *buffer,
-                  bool no_signing, uint32_t seqnum,
-                  bool do_encrypt,
-                  struct smb_perfcount_data *pcd);
 #if !defined(WITH_SMB1SERVER)
-bool smb1_srv_send(struct smbXsrv_connection *xconn, char *buffer,
-                  bool do_signing, uint32_t seqnum,
-                  bool do_encrypt,
-                  struct smb_perfcount_data *pcd);
+bool smb1_srv_send(struct smbXsrv_connection *xconn,
+                  char *buffer,
+                  bool do_signing,
+                  uint32_t seqnum,
+                  bool do_encrypt);
 #endif
 size_t srv_smb1_set_message(char *buf,
                       size_t num_words,
@@ -928,8 +925,11 @@ bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
 
 /* The following definitions come from smbd/smb2_reply.c  */
 
-NTSTATUS check_path_syntax(char *path);
-NTSTATUS check_path_syntax_posix(char *path);
+NTSTATUS check_path_syntax(char *path, bool posix);
+NTSTATUS smb1_strip_dfs_path(TALLOC_CTX *mem_ctx,
+                            uint32_t *ucf_flags,
+                            char **in_path);
+NTSTATUS smb2_strip_dfs_path(const char *in_path, const char **out_path);
 size_t srvstr_get_path(TALLOC_CTX *ctx,
                        const char *inbuf,
                        uint16_t smb_flags2,
@@ -961,6 +961,7 @@ void reply_special(struct smbXsrv_connection *xconn, char *inbuf, size_t inbuf_s
 NTSTATUS unlink_internals(connection_struct *conn,
                        struct smb_request *req,
                        uint32_t dirtype,
+                       struct files_struct *dirfsp,
                        struct smb_filename *smb_fname);
 ssize_t fake_sendfile(struct smbXsrv_connection *xconn, files_struct *fsp,
                      off_t startpos, size_t nread);
@@ -971,6 +972,7 @@ ssize_t sendfile_short_send(struct smbXsrv_connection *xconn,
                            size_t smb_maxcnt);
 NTSTATUS rename_internals_fsp(connection_struct *conn,
                        files_struct *fsp,
+                       struct files_struct *dst_dirfsp,
                        struct smb_filename *smb_fname_dst_in,
                        const char *dst_original_lcomp,
                        uint32_t attrs,
@@ -978,7 +980,9 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
 NTSTATUS rename_internals(TALLOC_CTX *ctx,
                        connection_struct *conn,
                        struct smb_request *req,
+                       struct files_struct *src_dirfsp,
                        struct smb_filename *smb_fname_src,
+                       struct files_struct *dst_dirfsp,
                        struct smb_filename *smb_fname_dst,
                        const char *dst_original_lcomp,
                        uint32_t attrs,
@@ -1036,7 +1040,6 @@ void smbd_exit_server_cleanly(const char *const reason) _NORETURN_;
 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
 bool canonicalize_connect_path(connection_struct *conn);
 NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
-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);
@@ -1051,7 +1054,9 @@ NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
                              int snum,
                              struct smbXsrv_session *session,
                              const char *pdev);
-void close_cnum(connection_struct *conn, uint64_t vuid);
+void close_cnum(connection_struct *conn,
+               uint64_t vuid,
+               enum file_close_type close_type);
 
 /* The following definitions come from smbd/session.c  */
 struct sessionid;
@@ -1081,33 +1086,26 @@ bool is_share_read_only_for_token(const char *username,
 
 NTSTATUS srvstr_push_fn(const char *base_ptr, uint16_t smb_flags2, void *dest,
                      const char *src, int dest_len, int flags, size_t *ret_len);
-ssize_t message_push_string(uint8_t **outbuf, const char *str, int flags);
-
-/* The following definitions come from smbd/statcache.c  */
-
-void stat_cache_add( const char *full_orig_name,
-               const char *translated_path,
-               NTTIME twrp,
-               bool case_sensitive);
-bool stat_cache_lookup(connection_struct *conn,
-                       char **pp_name,
-                       char **pp_dirpath,
-                       char **pp_start,
-                       NTTIME twrp,
-                       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);
-bool reset_stat_cache( void );
 
 /* The following definitions come from smbd/statvfs.c  */
 
-int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
+int sys_statvfs(const char *path, struct vfs_statvfs_struct *statbuf);
 
 /* The following definitions come from smbd/trans2.c  */
 
+char *store_file_unix_basic(connection_struct *conn,
+                           char *pdata,
+                           files_struct *fsp,
+                           const SMB_STRUCT_STAT *psbuf);
+char *store_file_unix_basic_info2(connection_struct *conn,
+                                 char *pdata,
+                                 files_struct *fsp,
+                                 const SMB_STRUCT_STAT *psbuf);
+NTSTATUS smb_set_file_disposition_info(connection_struct *conn,
+                                      const char *pdata,
+                                      int total_data,
+                                      files_struct *fsp,
+                                      struct smb_filename *smb_fname);
 NTSTATUS refuse_symlink_fsp(const struct files_struct *fsp);
 NTSTATUS check_access_fsp(struct files_struct *fsp,
                          uint32_t access_mask);
@@ -1128,13 +1126,27 @@ NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
                connection_struct *conn,
                struct smb_request *req,
                bool overwrite_if_exists,
+               struct files_struct *old_dirfsp,
                const struct smb_filename *smb_fname_old,
+               struct files_struct *new_dirfsp,
                struct smb_filename *smb_fname_new);
 NTSTATUS smb_set_file_time(connection_struct *conn,
                           files_struct *fsp,
                           struct smb_filename *smb_fname,
                           struct smb_file_time *ft,
                           bool setting_write_time);
+NTSTATUS smb_set_file_size(connection_struct *conn,
+                          struct smb_request *req,
+                          files_struct *fsp,
+                          struct smb_filename *smb_fname,
+                          const SMB_STRUCT_STAT *psbuf,
+                          off_t size,
+                          bool fail_after_createfile);
+
+bool map_info2_flags_to_sbuf(const SMB_STRUCT_STAT *psbuf,
+                            const uint32_t smb_fflags,
+                            const uint32_t smb_fmask,
+                            int *stat_fflags);
 
 enum perm_type {
        PERM_NEW_FILE,
@@ -1215,9 +1227,6 @@ const char *vfs_readdirname(connection_struct *conn,
 int vfs_ChDir(connection_struct *conn,
                        const struct smb_filename *smb_fname);
 struct smb_filename *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
-NTSTATUS check_reduced_name(connection_struct *conn,
-                       const struct smb_filename *cwd_fname,
-                       const struct smb_filename *smb_fname);
 int vfs_stat(struct connection_struct *conn,
             struct smb_filename *smb_fname);
 int vfs_stat_smb_basename(struct connection_struct *conn,
@@ -1255,14 +1264,20 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
                                       DATA_BLOB *new_cookie);
 
 /* The following definitions come from smbd/smb2_posix.c */
-DATA_BLOB smb2_posix_cc_info(TALLOC_CTX *mem_ctx,
-                               connection_struct *conn,
-                               uint32_t reparse_tag,
-                               const SMB_STRUCT_STAT *psbuf);
-DATA_BLOB store_smb2_posix_info(TALLOC_CTX *mem_ctx,
-                               connection_struct *conn,
-                               const SMB_STRUCT_STAT *psbuf,
-                               uint32_t reparse_tag,
-                               uint32_t dos_attributes);
+ssize_t smb2_posix_cc_info(
+       connection_struct *conn,
+       uint32_t reparse_tag,
+       const SMB_STRUCT_STAT *psbuf,
+       const struct dom_sid *owner,
+       const struct dom_sid *group,
+       uint8_t *buf,
+       size_t buflen);
+ssize_t store_smb2_posix_info(
+       connection_struct *conn,
+       const SMB_STRUCT_STAT *psbuf,
+       uint32_t reparse_tag,
+       uint32_t dos_attributes,
+       uint8_t *buf,
+       size_t buflen);
 
 #endif /* _SMBD_PROTO_H_ */