s3:vfs_gpfs: Export disk_norm function
[obnox/samba/samba-obnox.git] / source3 / smbd / proto.h
index 22eeae988ee285c1af1cd5a19b057fd7bf0fef15..07cfef5b5e080f9066c72b88dc16146f07a6ea46 100644 (file)
@@ -169,6 +169,7 @@ bool claim_connection(connection_struct *conn, const char *name);
 
 /* The following definitions come from smbd/dfree.c  */
 
+void disk_norm(bool small_query, uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
 uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_query,
                               uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
 uint64_t get_dfree_info(connection_struct *conn,
@@ -189,15 +190,17 @@ bool make_dir_struct(TALLOC_CTX *ctx,
                        time_t date,
                        bool uc);
 bool init_dptrs(struct smbd_server_connection *sconn);
-char *dptr_path(struct smbd_server_connection *sconn, int key);
-char *dptr_wcard(struct smbd_server_connection *sconn, int key);
+const char *dptr_path(struct smbd_server_connection *sconn, int key);
+const char *dptr_wcard(struct smbd_server_connection *sconn, int key);
 uint16 dptr_attr(struct smbd_server_connection *sconn, int key);
 void dptr_close(struct smbd_server_connection *sconn, int *key);
 void dptr_closecnum(connection_struct *conn);
 void dptr_idlecnum(connection_struct *conn);
 void dptr_closepath(struct smbd_server_connection *sconn,
                    char *path,uint16 spid);
-NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
+NTSTATUS dptr_create(connection_struct *conn,
+               struct smb_request *req,
+               files_struct *fsp,
                const char *path, bool old_handle, bool expect_close,uint16 spid,
                const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
 void dptr_CloseDir(files_struct *fsp);
@@ -205,6 +208,8 @@ void dptr_SeekDir(struct dptr_struct *dptr, long offset);
 long dptr_TellDir(struct dptr_struct *dptr);
 bool dptr_has_wild(struct dptr_struct *dptr);
 int dptr_dnum(struct dptr_struct *dptr);
+bool dptr_get_priv(struct dptr_struct *dptr);
+void dptr_set_priv(struct dptr_struct *dptr);
 char *dptr_ReadDirName(TALLOC_CTX *ctx,
                        struct dptr_struct *dptr,
                        long *poffset,
@@ -349,6 +354,13 @@ NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
                        uint32_t ucf_flags,
                        bool *ppath_contains_wcard,
                        struct smb_filename **pp_smb_fname);
+NTSTATUS filename_convert_with_privilege(TALLOC_CTX *mem_ctx,
+                       connection_struct *conn,
+                       struct smb_request *smbreq,
+                       const char *name_in,
+                       uint32_t ucf_flags,
+                       bool *ppath_contains_wcard,
+                       struct smb_filename **pp_smb_fname);
 
 /* The following definitions come from smbd/files.c  */
 
@@ -508,11 +520,12 @@ void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
 void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
                  const char *path);
 char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter);
-struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
-                                                    TALLOC_CTX *mem_ctx,
+struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx,
                                                     struct event_context *ev);
 NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
+                         connection_struct *conn,
                          struct notify_entry *e,
+                         const char *path,
                          void (*callback)(struct sys_notify_context *ctx,
                                           void *private_data,
                                           struct notify_event *ev),
@@ -522,6 +535,7 @@ NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
 
 NTSTATUS inotify_watch(struct sys_notify_context *ctx,
                       struct notify_entry *e,
+                      const char *path,
                       void (*callback)(struct sys_notify_context *ctx,
                                        void *private_data,
                                        struct notify_event *ev),
@@ -530,12 +544,12 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
 
 /* The following definitions come from smbd/notify_internal.c  */
 
-struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
+struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
                                   struct messaging_context *messaging_ctx,
-                                  struct event_context *ev,
-                                  connection_struct *conn);
+                                  struct event_context *ev);
 bool notify_internal_parent_init(TALLOC_CTX *mem_ctx);
-NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
+NTSTATUS notify_add(struct notify_context *notify, connection_struct *conn,
+                   struct notify_entry *e0,
                    void (*callback)(void *, const struct notify_event *),
                    void *private_data);
 NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
@@ -654,11 +668,6 @@ bool downgrade_oplock(files_struct *fsp);
 bool should_notify_deferred_opens(void);
 void break_level2_to_none_async(files_struct *fsp);
 void reply_to_oplock_break_requests(files_struct *fsp);
-void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
-                                                     void *private_data,
-                                                     uint32_t msg_type,
-                                                     struct server_id src,
-                                                     DATA_BLOB *data);
 void contend_level2_oplocks_begin(files_struct *fsp,
                                  enum level2_contention_type type);
 void contend_level2_oplocks_end(files_struct *fsp,
@@ -684,7 +693,7 @@ struct kernel_oplocks *linux_init_kernel_oplocks(struct smbd_server_connection *
 
 /* The following definitions come from smbd/oplock_onefs.c  */
 
-struct kernel_oplocks *onefs_init_kernel_oplocks(TALLOC_CTX *mem_ctx);
+struct kernel_oplocks *onefs_init_kernel_oplocks(struct smbd_server_connection *sconn);
 
 /* The following definitions come from smbd/password.c  */
 
@@ -701,13 +710,6 @@ int register_existing_vuid(struct smbd_server_connection *sconn,
                        uint16 vuid,
                        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);
-const char *get_session_workgroup(struct smbd_server_connection *sconn);
-bool authorise_login(struct smbd_server_connection *sconn,
-                    int snum, fstring user, DATA_BLOB password,
-                    bool *guest);
 
 /* The following definitions come from smbd/pipes.c  */
 
@@ -755,9 +757,8 @@ NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
 
 /* The following definitions come from smbd/process.c  */
 
-void smbd_setup_sig_term_handler(void);
-void smbd_setup_sig_hup_handler(struct tevent_context *ev,
-                               struct messaging_context *msg_ctx);
+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 smbd_server_connection *sconn, char *buffer,
                  bool no_signing, uint32_t seqnum,
                  bool do_encrypt,
@@ -782,12 +783,23 @@ bool push_deferred_open_message_smb(struct smb_request *req,
                                size_t priv_len);
 NTSTATUS allow_new_trans(struct trans_state *list, uint64_t mid);
 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
+void smb_request_done(struct smb_request *req);
 const char *smb_fn_name(int type);
 void add_to_common_flags2(uint32 v);
 void remove_from_common_flags2(uint32 v);
 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 smb1_is_chain(const uint8_t *buf);
+bool smb1_walk_chain(const uint8_t *buf,
+                    bool (*fn)(uint8_t cmd,
+                               uint8_t wct, const uint16_t *vwv,
+                               uint16_t num_bytes, const uint8_t *bytes,
+                               void *private_data),
+                    void *private_data);
+unsigned smb1_chain_length(const uint8_t *buf);
+bool smb1_parse_chain(TALLOC_CTX *mem_ctx, const uint8_t *buf,
+                     struct smbd_server_connection *sconn,
+                     bool encrypted, uint32_t seqnum,
+                     struct smb_request ***reqs, unsigned *num_reqs);
 bool req_is_in_chain(struct smb_request *req);
 void smbd_process(struct tevent_context *ev_ctx,
                  struct smbd_server_connection *sconn);
@@ -958,11 +970,11 @@ void init_sec_ctx(void);
 
 /* The following definitions come from smbd/server.c  */
 
-struct messaging_context *smbd_messaging_context(void);
 struct memcache *smbd_memcache(void);
 void delete_and_reload_printers(struct tevent_context *ev,
                                struct messaging_context *msg_ctx);
-bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
+bool reload_services(struct smbd_server_connection *sconn,
+                    bool (*snumused) (struct smbd_server_connection *, int),
                     bool test);
 void exit_server(const char *const explanation);
 void exit_server_cleanly(const char *const explanation);
@@ -977,13 +989,14 @@ 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,
-                                       DATA_BLOB password,
+struct smbd_smb2_tcon;
+connection_struct *make_connection_smb2(struct smbd_server_connection *sconn,
+                                       struct smbd_smb2_tcon *tcon,
+                                       user_struct *vuser,
                                        const char *pdev,
                                        NTSTATUS *pstatus);
 connection_struct *make_connection(struct smbd_server_connection *sconn,
-                                  const char *service_in, DATA_BLOB password,
+                                  const char *service_in,
                                   const char *pdev, uint16 vuid,
                                   NTSTATUS *status);
 void close_cnum(connection_struct *conn, uint16 vuid);
@@ -997,14 +1010,6 @@ 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_session_info **session_info,
-               const char *user, const char *domain);
-
-NTSTATUS parse_spnego_mechanisms(TALLOC_CTX *ctx,
-               DATA_BLOB blob_in,
-               DATA_BLOB *pblob_out,
-               char **kerb_mechOID);
 void reply_sesssetup_and_X(struct smb_request *req);
 
 /* The following definitions come from smbd/share_access.c  */
@@ -1101,8 +1106,6 @@ 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_session_info *session_info);
 bool change_to_root_user(void);
 bool smbd_change_to_root_user(void);
 bool become_authenticated_pipe_user(struct auth_session_info *session_info);
@@ -1171,6 +1174,9 @@ const char *vfs_readdirname(connection_struct *conn, void *p,
 int vfs_ChDir(connection_struct *conn, const char *path);
 char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
 NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
+NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
+                       const char *fname,
+                       struct smb_request *smbreq);
 int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
                       SMB_STRUCT_STAT *psbuf);
 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
@@ -1189,8 +1195,4 @@ NTSTATUS vfs_streaminfo(connection_struct *conn,
 void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                           uint16_t port);
 
-/* The following definitions come from smbd/msg_idmap.c */
-
-void msg_idmap_register_msg(struct messaging_context *ctx);
-
 #endif /* _SMBD_PROTO_H_ */