s3:smbd: add file_fsp_smb2()
[ddiss/samba.git] / source3 / smbd / proto.h
index f5f65d1ad9290c9c626e70b6136650fd538599e4..929387b21939636e48740a85557a19676e87bc52 100644 (file)
@@ -1,3 +1,50 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Main SMB server routines
+ *
+ *  Copyright (C) Andrew Tridgell                      1992-2002,2006
+ *  Copyright (C) Jeremy Allison                       1992-2010
+ *  Copyright (C) Volker Lendecke                      1993-2009
+ *  Copyright (C) John H Terpstra                      1995-1998
+ *  Copyright (C) Luke Kenneth Casson Leighton         1996-1998
+ *  Copyright (C) Paul Ashton                          1997-1998
+ *  Copyright (C) Tim Potter                           1999-2000
+ *  Copyright (C) T.D.Lee@durham.ac.uk                 1999
+ *  Copyright (C) Ying Chen                            2000
+ *  Copyright (C) Shirish Kalele                       2000
+ *  Copyright (C) Andrew Bartlett                      2001-2003
+ *  Copyright (C) Alexander Bokovoy                    2002,2005
+ *  Copyright (C) Simo Sorce                           2001-2002,2009
+ *  Copyright (C) Andreas Gruenbacher                  2002
+ *  Copyright (C) Jim McDonough <jmcd@us.ibm.com>      2002
+ *  Copyright (C) Martin Pool                          2002
+ *  Copyright (C) Luke Howard                          2003
+ *  Copyright (C) Stefan (metze) Metzmacher            2003,2009
+ *  Copyright (C) Steve French                         2005
+ *  Copyright (C) Gerald (Jerry) Carter                        2006
+ *  Copyright (C) James Peach                          2006-2007
+ *  Copyright (C) Jelmer Vernooij                      2002-2003
+ *  Copyright (C) Michael Adam                         2007
+ *  Copyright (C) Rishi Srivatsavai                    2007
+ *  Copyright (C) Tim Prouty                           2009
+ *  Copyright (C) Gregor Beck                          2011
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  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  */
 
@@ -289,6 +336,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                      const char *orig_path,
                      struct smb_filename **smb_fname,
                      uint32_t ucf_flags);
+NTSTATUS check_veto_path(connection_struct *conn, const char *name);
 NTSTATUS check_name(connection_struct *conn, const char *name);
 int get_real_filename(connection_struct *conn, const char *path,
                      const char *name, TALLOC_CTX *mem_ctx,
@@ -325,6 +373,9 @@ bool file_find_subpath(files_struct *dir_fsp);
 void file_sync_all(connection_struct *conn);
 void file_free(struct smb_request *req, files_struct *fsp);
 files_struct *file_fsp(struct smb_request *req, uint16 fid);
+struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req,
+                                  uint64_t persistent_id,
+                                  uint64_t volatile_id);
 NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
                      uint32 access_mask, uint32 share_access,
                      uint32 create_options, files_struct *to);
@@ -511,6 +562,15 @@ void send_nt_replies(connection_struct *conn,
 void reply_ntcreate_and_X(struct smb_request *req);
 NTSTATUS set_sd(files_struct *fsp, uint8_t *data, uint32_t sd_len,
                        uint32_t security_info_sent);
+NTSTATUS smb_fsctl(struct files_struct *fsp,
+                      TALLOC_CTX *ctx,
+                      uint32_t function,
+                      uint16_t req_flags,  /* Needed for UNICODE ... */
+                      const uint8_t *_in_data,
+                      uint32_t in_len,
+                      uint8_t **_out_data,
+                      uint32_t max_out_len,
+                      uint32_t *out_len);
 struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
 void reply_ntcancel(struct smb_request *req);
 void reply_ntrename(struct smb_request *req);
@@ -539,7 +599,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);
@@ -559,18 +618,13 @@ 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,
                          struct smb_filename *smb_fname,
                          files_struct **result);
+bool check_same_stat(const SMB_STRUCT_STAT *sbuf1,
+                       const SMB_STRUCT_STAT *sbuf2);
 NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
                          struct smb_filename *smb_dname);
 void msg_file_was_renamed(struct messaging_context *msg,
@@ -752,6 +806,7 @@ 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);
+bool fork_echo_handler(struct smbd_server_connection *sconn);
 
 /* The following definitions come from smbd/quotas.c  */
 
@@ -910,7 +965,7 @@ void server_encryption_shutdown(void);
 
 bool unix_token_equal(const struct security_unix_token *t1, const struct security_unix_token *t2);
 bool push_sec_ctx(void);
-void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, struct security_token *token);
+void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, const struct security_token *token);
 void set_root_sec_ctx(void);
 bool pop_sec_ctx(void);
 void init_sec_ctx(void);
@@ -938,8 +993,10 @@ bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
 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);
-connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
-                                       int snum, user_struct *vuser,
+struct smbd_smb2_tcon;
+connection_struct *make_connection_smb2(struct smbd_server_connection *sconn,
+                                       struct smbd_smb2_tcon *tcon,
+                                       user_struct *vuser,
                                        DATA_BLOB password,
                                        const char *pdev,
                                        NTSTATUS *pstatus);
@@ -995,6 +1052,7 @@ void stat_cache_add( const char *full_orig_name,
                char *translated_path,
                bool case_sensitive);
 bool stat_cache_lookup(connection_struct *conn,
+                       bool posix_paths,
                        char **pp_name,
                        char **pp_dirpath,
                        char **pp_start,
@@ -1002,7 +1060,8 @@ bool stat_cache_lookup(connection_struct *conn,
 void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
                                    const char *name);
 void stat_cache_delete(const char *name);
-unsigned int fast_string_hash(TDB_DATA *key);
+struct TDB_DATA;
+unsigned int fast_string_hash(struct TDB_DATA *key);
 bool reset_stat_cache( void );
 
 /* The following definitions come from smbd/statvfs.c  */
@@ -1054,11 +1113,13 @@ 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);
 bool change_to_root_user(void);
-bool become_authenticated_pipe_user(struct pipes_struct *p);
+bool become_authenticated_pipe_user(struct auth_serversupplied_info *session_info);
 bool unbecome_authenticated_pipe_user(void);
 void become_root(void);
 void 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);
 bool unbecome_user(void);
 uid_t get_current_uid(connection_struct *conn);
 gid_t get_current_gid(connection_struct *conn);
@@ -1122,6 +1183,12 @@ int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
                        SMB_STRUCT_STAT *psbuf);
 NTSTATUS vfs_stat_fsp(files_struct *fsp);
 NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
+NTSTATUS vfs_streaminfo(connection_struct *conn,
+                       struct files_struct *fsp,
+                       const char *fname,
+                       TALLOC_CTX *mem_ctx,
+                       unsigned int *num_streams,
+                       struct stream_struct **streams);
 
 /* The following definitions come from smbd/avahi_register.c */
 
@@ -1131,3 +1198,5 @@ 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);
+
+#endif /* _SMBD_PROTO_H_ */