Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/smbd/proto.h

    r860 r988  
    4949/* The following definitions come from smbd/signing.c  */
    5050
    51 struct smbd_server_connection;
    52 bool srv_check_sign_mac(struct smbd_server_connection *conn,
     51struct smbXsrv_connection;
     52
     53bool srv_check_sign_mac(struct smbXsrv_connection *conn,
    5354                        const char *inbuf, uint32_t *seqnum, bool trusted_channel);
    54 void srv_calculate_sign_mac(struct smbd_server_connection *conn,
     55void srv_calculate_sign_mac(struct smbXsrv_connection *conn,
    5556                            char *outbuf, uint32_t seqnum);
    56 void srv_cancel_sign_response(struct smbd_server_connection *conn);
    57 bool srv_init_signing(struct smbd_server_connection *conn);
    58 void srv_set_signing_negotiated(struct smbd_server_connection *conn);
    59 bool srv_is_signing_active(struct smbd_server_connection *conn);
    60 bool srv_is_signing_negotiated(struct smbd_server_connection *conn);
    61 void srv_set_signing(struct smbd_server_connection *conn,
     57void srv_cancel_sign_response(struct smbXsrv_connection *conn);
     58bool srv_init_signing(struct smbXsrv_connection *conn);
     59void srv_set_signing_negotiated(struct smbXsrv_connection *conn,
     60                                bool allowed, bool mandatory);
     61bool srv_is_signing_active(struct smbXsrv_connection *conn);
     62bool srv_is_signing_negotiated(struct smbXsrv_connection *conn);
     63void srv_set_signing(struct smbXsrv_connection *conn,
    6264                     const DATA_BLOB user_session_key,
    6365                     const DATA_BLOB response);
     
    6567/* The following definitions come from smbd/aio.c  */
    6668
     69int get_outstanding_aio_calls(void);
     70void increment_outstanding_aio_calls(void);
     71void decrement_outstanding_aio_calls(void);
     72struct aio_extra;
     73bool aio_write_through_requested(struct aio_extra *aio_ex);
    6774NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
    6875                             struct smb_request *req,
    69                              files_struct *fsp, SMB_OFF_T startpos,
     76                             files_struct *fsp, off_t startpos,
    7077                             size_t smb_maxcnt);
    7178NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
    7279                              struct smb_request *req,
    73                               files_struct *fsp, char *data,
    74                               SMB_OFF_T startpos,
     80                              files_struct *fsp, const char *data,
     81                              off_t startpos,
    7582                              size_t numtowrite);
    7683NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
     
    7986                                TALLOC_CTX *ctx,
    8087                                DATA_BLOB *preadbuf,
    81                                 SMB_OFF_T startpos,
     88                                off_t startpos,
    8289                                size_t smb_maxcnt);
    8390NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
     
    8794                                DATA_BLOB in_data,
    8895                                bool write_through);
    89 int wait_for_aio_completion(files_struct *fsp);
    90 void cancel_aio_by_fsp(files_struct *fsp);
    91 void smbd_aio_complete_aio_ex(struct aio_extra *aio_ex);
     96bool cancel_smb2_aio(struct smb_request *smbreq);
     97bool aio_add_req_to_fsp(files_struct *fsp, struct tevent_req *req);
    9298
    9399/* The following definitions come from smbd/blocking.c  */
    94100
    95 void brl_timeout_fn(struct event_context *event_ctx,
    96                 struct timed_event *te,
     101void brl_timeout_fn(struct tevent_context *event_ctx,
     102                struct tevent_timer *te,
    97103                struct timeval now,
    98104                void *private_data);
     
    111117                uint64_t count,
    112118                uint64_t blocking_smblctx);
     119void smbd_cancel_pending_lock_requests_by_fid(files_struct *fsp,
     120                        struct byte_range_lock *br_lck,
     121                        enum file_close_type close_type);
    113122void cancel_pending_lock_requests_by_fid(files_struct *fsp,
    114123                        struct byte_range_lock *br_lck,
     
    137146                    DATA_BLOB *data);
    138147NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
     148bool recursive_rmdir(TALLOC_CTX *ctx,
     149                     connection_struct *conn,
     150                     struct smb_filename *smb_dname);
    139151
    140152/* The following definitions come from smbd/conn.c  */
    141153
    142 void conn_init(struct smbd_server_connection *sconn);
    143154int conn_num_open(struct smbd_server_connection *sconn);
    144 bool conn_snum_used(int snum);
    145 connection_struct *conn_find(struct smbd_server_connection *sconn,
    146                              unsigned cnum);
     155bool conn_snum_used(struct smbd_server_connection *sconn, int snum);
    147156connection_struct *conn_new(struct smbd_server_connection *sconn);
    148 bool conn_close_all(struct smbd_server_connection *sconn);
    149157bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
    150 void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint16 vuid);
     158void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint64_t vuid);
    151159void conn_free(connection_struct *conn);
     160void conn_force_tdis(struct smbd_server_connection *sconn, const char *sharename);
    152161void msg_force_tdis(struct messaging_context *msg,
    153162                    void *private_data,
     
    158167/* The following definitions come from smbd/connection.c  */
    159168
    160 bool yield_connection(connection_struct *conn, const char *name);
    161 int count_current_connections( const char *sharename, bool clear  );
    162 bool claim_connection(connection_struct *conn, const char *name);
     169int count_current_connections(const char *sharename, bool verify);
     170bool connections_snum_used(struct smbd_server_connection *unused, int snum);
    163171
    164172/* The following definitions come from smbd/dfree.c  */
    165173
    166 uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_query,
     174uint64_t sys_disk_free(connection_struct *conn, const char *path,
    167175                              uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    168176uint64_t get_dfree_info(connection_struct *conn,
    169177                        const char *path,
    170                         bool small_query,
    171178                        uint64_t *bsize,
    172179                        uint64_t *dfree,
     
    175182/* The following definitions come from smbd/dir.c  */
    176183
    177 bool make_dir_struct(TALLOC_CTX *ctx,
    178                         char *buf,
    179                         const char *mask,
    180                         const char *fname,
    181                         SMB_OFF_T size,
    182                         uint32 mode,
    183                         time_t date,
    184                         bool uc);
    185184bool init_dptrs(struct smbd_server_connection *sconn);
    186 char *dptr_path(struct smbd_server_connection *sconn, int key);
    187 char *dptr_wcard(struct smbd_server_connection *sconn, int key);
    188 uint16 dptr_attr(struct smbd_server_connection *sconn, int key);
     185const char *dptr_path(struct smbd_server_connection *sconn, int key);
     186const char *dptr_wcard(struct smbd_server_connection *sconn, int key);
     187uint16_t dptr_attr(struct smbd_server_connection *sconn, int key);
    189188void dptr_close(struct smbd_server_connection *sconn, int *key);
    190189void dptr_closecnum(connection_struct *conn);
    191190void dptr_idlecnum(connection_struct *conn);
    192191void dptr_closepath(struct smbd_server_connection *sconn,
    193                     char *path,uint16 spid);
    194 NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
    195                 const char *path, bool old_handle, bool expect_close,uint16 spid,
    196                 const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
     192                    char *path,uint16_t spid);
     193NTSTATUS dptr_create(connection_struct *conn,
     194                struct smb_request *req,
     195                files_struct *fsp,
     196                const char *path, bool old_handle, bool expect_close,uint16_t spid,
     197                const char *wcard, bool wcard_has_wild, uint32_t attr, struct dptr_struct **dptr_ret);
    197198void dptr_CloseDir(files_struct *fsp);
    198199void dptr_SeekDir(struct dptr_struct *dptr, long offset);
     
    200201bool dptr_has_wild(struct dptr_struct *dptr);
    201202int dptr_dnum(struct dptr_struct *dptr);
    202 char *dptr_ReadDirName(TALLOC_CTX *ctx,
    203                         struct dptr_struct *dptr,
    204                         long *poffset,
    205                         SMB_STRUCT_STAT *pst);
     203bool dptr_get_priv(struct dptr_struct *dptr);
     204void dptr_set_priv(struct dptr_struct *dptr);
    206205bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
    207 void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset);
    208206void dptr_init_search_op(struct dptr_struct *dptr);
    209207bool dptr_fill(struct smbd_server_connection *sconn,
     
    213211struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
    214212                                       int dptr_num);
    215 bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype);
    216213bool get_dir_entry(TALLOC_CTX *ctx,
    217214                struct dptr_struct *dirptr,
    218215                const char *mask,
    219                 uint32 dirtype,
     216                uint32_t dirtype,
    220217                char **pp_fname_out,
    221                 SMB_OFF_T *size,
    222                 uint32 *mode,
     218                off_t *size,
     219                uint32_t *mode,
    223220                struct timespec *date,
    224221                bool check_descend,
     
    226223bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
    227224struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
    228                         const char *name, const char *mask, uint32 attr);
     225                        const char *name, const char *mask, uint32_t attr);
    229226const char *ReadDirName(struct smb_Dir *dirp, long *poffset,
    230227                        SMB_STRUCT_STAT *sbuf, char **talloced);
     
    232229void SeekDir(struct smb_Dir *dirp, long offset);
    233230long TellDir(struct smb_Dir *dirp);
    234 void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
    235231bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
    236232NTSTATUS can_delete_directory(struct connection_struct *conn,
    237233                                const char *dirname);
     234bool have_file_open_below(connection_struct *conn,
     235                        const struct smb_filename *name);
    238236
    239237/* The following definitions come from smbd/dmapi.c  */
     
    243241bool dmapi_new_session(void);
    244242bool dmapi_destroy_session(void);
    245 uint32 dmapi_file_flags(const char * const path);
     243uint32_t dmapi_file_flags(const char * const path);
    246244
    247245/* The following definitions come from smbd/dnsregister.c  */
     
    256254                 const struct smb_filename *smb_fname,
    257255                 const char *inherit_from_dir);
    258 uint32 dos_mode_msdfs(connection_struct *conn,
     256uint32_t dos_mode_msdfs(connection_struct *conn,
    259257                      const struct smb_filename *smb_fname);
    260258int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
    261 uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
     259uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
    262260int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
    263                      uint32 dosmode, const char *parent_dir, bool newfile);
     261                     uint32_t dosmode, const char *parent_dir, bool newfile);
    264262NTSTATUS file_set_sparse(connection_struct *conn,
    265263                         struct files_struct *fsp,
     
    286284
    287285bool use_nt_status(void);
    288 void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
    289 int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
     286void error_packet_set(char *outbuf, uint8_t eclass, uint32_t ecode, NTSTATUS ntstatus, int line, const char *file);
     287int error_packet(char *outbuf, uint8_t eclass, uint32_t ecode, NTSTATUS ntstatus, int line, const char *file);
    290288void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus,
    291289                    int line, const char *file);
    292 void reply_force_dos_error(struct smb_request *req, uint8 eclass, uint32 ecode,
     290void reply_force_dos_error(struct smb_request *req, uint8_t eclass, uint32_t ecode,
    293291                    int line, const char *file);
    294 void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode,
     292void reply_both_error(struct smb_request *req, uint8_t eclass, uint32_t ecode,
    295293                      NTSTATUS status, int line, const char *file);
    296294void reply_openerror(struct smb_request *req, NTSTATUS status);
     
    298296/* The following definitions come from smbd/file_access.c  */
    299297
    300 bool can_access_file_acl(struct connection_struct *conn,
    301                          const struct smb_filename *smb_fname,
    302                          uint32_t access_mask);
    303298bool can_delete_file_in_directory(connection_struct *conn,
    304299                                  const struct smb_filename *smb_fname);
    305 bool can_access_file_data(connection_struct *conn,
    306                           const struct smb_filename *smb_fname,
    307                           uint32 access_mask);
    308300bool can_write_to_file(connection_struct *conn,
    309301                       const struct smb_filename *smb_fname);
    310302bool directory_has_default_acl(connection_struct *conn, const char *fname);
     303NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode);
    311304
    312305/* The following definitions come from smbd/fileio.c  */
    313306
    314 ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n);
    315 void update_write_time_handler(struct event_context *ctx,
    316                                       struct timed_event *te,
     307ssize_t read_file(files_struct *fsp,char *data,off_t pos,size_t n);
     308void update_write_time_handler(struct tevent_context *ctx,
     309                                      struct tevent_timer *te,
    317310                                      struct timeval now,
    318311                                      void *private_data);
    319312void trigger_write_time_update(struct files_struct *fsp);
    320313void trigger_write_time_update_immediate(struct files_struct *fsp);
     314void mark_file_modified(files_struct *fsp);
    321315ssize_t write_file(struct smb_request *req,
    322316                        files_struct *fsp,
    323317                        const char *data,
    324                         SMB_OFF_T pos,
     318                        off_t pos,
    325319                        size_t n);
    326320void delete_write_cache(files_struct *fsp);
    327 void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size);
     321void set_filelen_write_cache(files_struct *fsp, off_t file_size);
    328322ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason);
    329323NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through);
     
    337331                      struct smb_filename **smb_fname,
    338332                      uint32_t ucf_flags);
    339 NTSTATUS check_veto_path(connection_struct *conn, const char *name);
    340333NTSTATUS check_name(connection_struct *conn, const char *name);
    341334int get_real_filename(connection_struct *conn, const char *path,
     
    349342                        bool *ppath_contains_wcard,
    350343                        struct smb_filename **pp_smb_fname);
     344NTSTATUS filename_convert_with_privilege(TALLOC_CTX *mem_ctx,
     345                        connection_struct *conn,
     346                        struct smb_request *smbreq,
     347                        const char *name_in,
     348                        uint32_t ucf_flags,
     349                        bool *ppath_contains_wcard,
     350                        struct smb_filename **pp_smb_fname);
    351351
    352352/* The following definitions come from smbd/files.c  */
    353353
     354NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx,
     355                 files_struct **result);
    354356NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
    355357                  files_struct **result);
    356358void file_close_conn(connection_struct *conn);
    357 void file_close_pid(struct smbd_server_connection *sconn, uint16 smbpid,
    358                     int vuid);
     359void file_close_pid(struct smbd_server_connection *sconn, uint16_t smbpid,
     360                    uint64_t vuid);
     361bool file_init_global(void);
    359362bool file_init(struct smbd_server_connection *sconn);
    360 void file_close_user(struct smbd_server_connection *sconn, int vuid);
     363void file_close_user(struct smbd_server_connection *sconn, uint64_t vuid);
    361364struct files_struct *files_forall(
    362365        struct smbd_server_connection *sconn,
     
    370373                                 struct file_id id);
    371374files_struct *file_find_di_next(files_struct *start_fsp);
     375struct files_struct *file_find_one_fsp_from_lease_key(
     376        struct smbd_server_connection *sconn,
     377        const struct smb2_lease_key *lease_key);
    372378bool file_find_subpath(files_struct *dir_fsp);
    373379void file_sync_all(connection_struct *conn);
     380void fsp_free(files_struct *fsp);
    374381void file_free(struct smb_request *req, files_struct *fsp);
    375 files_struct *file_fsp(struct smb_request *req, uint16 fid);
    376 uint64_t fsp_persistent_id(const struct files_struct *fsp);
     382files_struct *file_fsp(struct smb_request *req, uint16_t fid);
     383struct files_struct *file_fsp_get(struct smbd_smb2_request *smb2req,
     384                                  uint64_t persistent_id,
     385                                  uint64_t volatile_id);
    377386struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req,
    378387                                   uint64_t persistent_id,
    379388                                   uint64_t volatile_id);
    380389NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
    381                       uint32 access_mask, uint32 share_access,
    382                       uint32 create_options, files_struct *to);
     390                      uint32_t access_mask, uint32_t share_access,
     391                      uint32_t create_options, files_struct *to);
    383392NTSTATUS file_name_hash(connection_struct *conn,
    384393                        const char *name, uint32_t *p_name_hash);
    385394NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
    386395                           const struct smb_filename *smb_fname_in);
     396const struct GUID *fsp_client_guid(const files_struct *fsp);
     397uint32_t fsp_lease_type(struct files_struct *fsp);
    387398
    388399/* The following definitions come from smbd/ipc.c  */
    389400
     401NTSTATUS nt_status_np_pipe(NTSTATUS status);
    390402void send_trans_reply(connection_struct *conn,
    391403                      struct smb_request *req,
     
    398410/* The following definitions come from smbd/lanman.c  */
    399411
    400 void api_reply(connection_struct *conn, uint16 vuid,
     412void api_reply(connection_struct *conn, uint64_t vuid,
    401413               struct smb_request *req,
    402414               char *data, char *params,
     
    448460NTSTATUS get_referred_path(TALLOC_CTX *ctx,
    449461                        const char *dfs_path,
     462                        bool allow_broken_path,
    450463                        struct junction_map *jucn,
    451464                        int *consumedcntp,
     
    457470bool create_junction(TALLOC_CTX *ctx,
    458471                const char *dfs_path,
     472                bool allow_broken_path,
    459473                struct junction_map *jucn);
    460474bool create_msdfs_link(const struct junction_map *jucn);
    461475bool remove_msdfs_link(const struct junction_map *jucn);
    462476struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
    463 NTSTATUS resolve_dfspath(TALLOC_CTX *ctx,
    464                         connection_struct *conn,
    465                         bool dfs_pathnames,
    466                         const char *name_in,
    467                         char **pp_name_out);
    468477NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
    469478                                connection_struct *conn,
     
    471480                                const char *name_in,
    472481                                bool allow_wcards,
     482                                bool allow_broken_path,
    473483                                char **pp_name_out,
    474484                                bool *ppath_contains_wcard);
    475485NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
     486                            struct tevent_context *ev,
     487                            struct messaging_context *msg,
     488                            connection_struct **pconn,
     489                            int snum,
     490                            const char *path,
     491                            const struct auth_session_info *session_info);
     492NTSTATUS create_conn_struct_cwd(TALLOC_CTX *ctx,
     493                                struct tevent_context *ev,
     494                                struct messaging_context *msg,
    476495                                connection_struct **pconn,
    477496                                int snum,
    478497                                const char *path,
    479                                 const struct auth_serversupplied_info *session_info,
     498                                const struct auth_session_info *session_info,
    480499                                char **poldcwd);
    481500
     
    486505/* The following definitions come from smbd/notify.c  */
    487506
     507bool change_notify_fsp_has_changes(struct files_struct *fsp);
    488508void change_notify_reply(struct smb_request *req,
    489509                         NTSTATUS error_code,
     
    493513                                          NTSTATUS error_code,
    494514                                          uint8_t *buf, size_t len));
    495 NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
     515NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter,
    496516                              bool recursive);
    497517NTSTATUS change_notify_add_request(struct smb_request *req,
    498                                 uint32 max_param,
    499                                 uint32 filter, bool recursive,
     518                                uint32_t max_param,
     519                                uint32_t filter, bool recursive,
    500520                                struct files_struct *fsp,
    501521                                void (*reply_fn)(struct smb_request *req,
    502522                                        NTSTATUS error_code,
    503523                                        uint8_t *buf, size_t len));
     524void smbd_notify_cancel_deleted(struct messaging_context *msg,
     525                                void *private_data, uint32_t msg_type,
     526                                struct server_id server_id, DATA_BLOB *data);
    504527void remove_pending_change_notify_requests_by_mid(
    505528        struct smbd_server_connection *sconn, uint64_t mid);
    506529void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
    507530                                                  NTSTATUS status);
    508 void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
     531void notify_fname(connection_struct *conn, uint32_t action, uint32_t filter,
    509532                  const char *path);
    510 char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter);
    511 struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
    512                                                      TALLOC_CTX *mem_ctx,
    513                                                      struct event_context *ev);
    514 NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
    515                           struct notify_entry *e,
    516                           void (*callback)(struct sys_notify_context *ctx,
    517                                            void *private_data,
    518                                            struct notify_event *ev),
    519                           void *private_data, void *handle);
     533char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32_t filter);
     534struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx,
     535                                                     struct tevent_context *ev);
    520536
    521537/* The following definitions come from smbd/notify_inotify.c  */
    522538
    523 NTSTATUS inotify_watch(struct sys_notify_context *ctx,
    524                        struct notify_entry *e,
    525                        void (*callback)(struct sys_notify_context *ctx,
    526                                         void *private_data,
    527                                         struct notify_event *ev),
    528                        void *private_data,
    529                        void *handle_p);
     539int inotify_watch(TALLOC_CTX *mem_ctx,
     540                  struct sys_notify_context *ctx,
     541                  const char *path,
     542                  uint32_t *filter,
     543                  uint32_t *subdir_filter,
     544                  void (*callback)(struct sys_notify_context *ctx,
     545                                   void *private_data,
     546                                   struct notify_event *ev),
     547                  void *private_data,
     548                  void *handle_p);
     549
     550int _fam_watch(TALLOC_CTX *mem_ctx,
     551              struct sys_notify_context *ctx,
     552              const char *path,
     553              uint32_t *filter,
     554              uint32_t *subdir_filter,
     555              void (*callback)(struct sys_notify_context *ctx,
     556                               void *private_data,
     557                               struct notify_event *ev),
     558              void *private_data,
     559              void *handle_p);
     560
    530561
    531562/* The following definitions come from smbd/notify_internal.c  */
    532563
    533 struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
     564struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
    534565                                   struct messaging_context *messaging_ctx,
    535                                    struct event_context *ev,
    536                                    connection_struct *conn);
    537 bool notify_internal_parent_init(TALLOC_CTX *mem_ctx);
    538 NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
    539                     void (*callback)(void *, const struct notify_event *),
     566                                   struct tevent_context *ev);
     567NTSTATUS notify_add(struct notify_context *notify,
     568                    const char *path, uint32_t filter, uint32_t subdir_filter,
     569                    void (*callback)(void *, struct timespec,
     570                                    const struct notify_event *),
    540571                    void *private_data);
    541572NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
    542 NTSTATUS notify_remove_onelevel(struct notify_context *notify,
    543                                 const struct file_id *fid,
    544                                 void *private_data);
    545 void notify_onelevel(struct notify_context *notify, uint32_t action,
    546                      uint32_t filter, struct file_id fid, const char *name);
    547573void notify_trigger(struct notify_context *notify,
    548                     uint32_t action, uint32_t filter, const char *path);
     574                    uint32_t action, uint32_t filter,
     575                    const char *dir, const char *path);
     576
     577struct notify_instance;
     578NTSTATUS notify_walk(struct notify_context *notify,
     579                     bool (*fn)(const char *path, struct server_id server,
     580                                const struct notify_instance *instance,
     581                                void *private_data),
     582                     void *private_data);
    549583
    550584/* The following definitions come from smbd/ntquotas.c  */
     
    557591/* The following definitions come from smbd/nttrans.c  */
    558592
    559 void send_nt_replies(connection_struct *conn,
    560                         struct smb_request *req, NTSTATUS nt_error,
    561                      char *params, int paramsize,
    562                      char *pdata, int datasize);
    563593void reply_ntcreate_and_X(struct smb_request *req);
    564594NTSTATUS set_sd(files_struct *fsp, struct security_descriptor *psd,
     
    566596NTSTATUS set_sd_blob(files_struct *fsp, uint8_t *data, uint32_t sd_len,
    567597                       uint32_t security_info_sent);
    568 NTSTATUS smb_fsctl(struct files_struct *fsp,
    569                        TALLOC_CTX *ctx,
    570                        uint32_t function,
    571                        uint16_t req_flags,  /* Needed for UNICODE ... */
    572                        const uint8_t *_in_data,
    573                        uint32_t in_len,
    574                        uint8_t **_out_data,
    575                        uint32_t max_out_len,
    576                        uint32_t *out_len);
    577598struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
    578599void reply_ntcancel(struct smb_request *req);
     
    590611/* The following definitions come from smbd/open.c  */
    591612
    592 NTSTATUS smb1_file_se_access_check(connection_struct *conn,
    593                                 const struct security_descriptor *sd,
    594                                 const struct security_token *token,
    595                                 uint32_t access_desired,
    596                                 uint32_t *access_granted);
     613NTSTATUS smbd_check_access_rights(struct connection_struct *conn,
     614                                const struct smb_filename *smb_fname,
     615                                bool use_privs,
     616                                uint32_t access_mask);
     617NTSTATUS fd_open(struct connection_struct *conn, files_struct *fsp,
     618                 int flags, mode_t mode);
    597619NTSTATUS fd_close(files_struct *fsp);
    598620void change_file_owner_to_parent(connection_struct *conn,
     
    603625                                    const char *fname,
    604626                                    SMB_STRUCT_STAT *psbuf);
    605 bool is_stat_open(uint32 access_mask);
    606 bool request_timed_out(struct timeval request_time,
    607                        struct timeval timeout);
    608 bool open_match_attributes(connection_struct *conn,
    609                            uint32 old_dos_attr,
    610                            uint32 new_dos_attr,
    611                            mode_t existing_unx_mode,
    612                            mode_t new_unx_mode,
    613                            mode_t *returned_unx_mode);
    614 NTSTATUS fcb_or_dos_open(struct smb_request *req,
    615                          connection_struct *conn,
    616                          files_struct *fsp_to_dup_into,
    617                          const struct smb_filename *smb_fname,
    618                          struct file_id id,
    619                          uint16 file_pid,
    620                          uint16 vuid,
    621                          uint32 access_mask,
    622                          uint32 share_access,
    623                          uint32 create_options);
    624 void remove_deferred_open_entry(struct file_id id, uint64_t mid,
    625                                 struct server_id pid);
    626 NTSTATUS open_file_fchmod(connection_struct *conn,
    627                           struct smb_filename *smb_fname,
    628                           files_struct **result);
    629 bool check_same_stat(const SMB_STRUCT_STAT *sbuf1,
    630                         const SMB_STRUCT_STAT *sbuf2);
     627bool is_stat_open(uint32_t access_mask);
     628NTSTATUS send_break_message(struct messaging_context *msg_ctx,
     629                                const struct share_mode_entry *exclusive,
     630                                uint16_t break_to);
     631struct deferred_open_record;
     632bool is_deferred_open_async(const struct deferred_open_record *rec);
    631633NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
    632634                          struct smb_filename *smb_dname);
     
    638640NTSTATUS open_streams_for_delete(connection_struct *conn,
    639641                                 const char *fname);
     642int find_share_mode_lease(struct share_mode_data *d,
     643                          const struct GUID *client_guid,
     644                          const struct smb2_lease_key *key);
     645struct share_mode_lease;
     646struct fsp_lease *find_fsp_lease(files_struct *new_fsp,
     647                                 const struct smb2_lease_key *key,
     648                                 const struct share_mode_lease *l);
    640649NTSTATUS create_file_default(connection_struct *conn,
    641650                             struct smb_request *req,
     
    648657                             uint32_t file_attributes,
    649658                             uint32_t oplock_request,
     659                             struct smb2_lease *lease,
    650660                             uint64_t allocation_size,
    651661                             uint32_t private_flags,
    652662                             struct security_descriptor *sd,
    653663                             struct ea_list *ea_list,
    654 
    655664                             files_struct **result,
    656                              int *pinfo);
     665                             int *pinfo,
     666                             const struct smb2_create_blobs *in_context_blobs,
     667                             struct smb2_create_blobs *out_context_blobs);
     668
    657669NTSTATUS get_relative_fid_filename(connection_struct *conn,
    658670                                   struct smb_request *req,
     
    663675/* The following definitions come from smbd/oplock.c  */
    664676
    665 int32 get_number_of_exclusive_open_oplocks(void);
     677uint32_t map_oplock_to_lease_type(uint16_t op_type);
     678uint32_t get_lease_type(struct share_mode_data *d, struct share_mode_entry *e);
     679bool update_num_read_oplocks(files_struct *fsp, struct share_mode_lock *lck);
     680
    666681void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
    667 bool set_file_oplock(files_struct *fsp, int oplock_type);
    668 void release_file_oplock(files_struct *fsp);
     682NTSTATUS set_file_oplock(files_struct *fsp);
    669683bool remove_oplock(files_struct *fsp);
    670684bool downgrade_oplock(files_struct *fsp);
    671 bool should_notify_deferred_opens(void);
    672 void break_level2_to_none_async(files_struct *fsp);
    673 void reply_to_oplock_break_requests(files_struct *fsp);
    674 void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
    675                                                       void *private_data,
    676                                                       uint32_t msg_type,
    677                                                       struct server_id src,
    678                                                       DATA_BLOB *data);
     685bool fsp_lease_update(struct share_mode_lock *lck,
     686                      const struct GUID *client_guid,
     687                      struct fsp_lease *lease);
     688NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
     689                        uint32_t num_file_ids,
     690                        const struct file_id *ids,
     691                        const struct smb2_lease_key *key,
     692                        uint32_t lease_state);
    679693void contend_level2_oplocks_begin(files_struct *fsp,
    680694                                  enum level2_contention_type type);
    681695void contend_level2_oplocks_end(files_struct *fsp,
    682696                                enum level2_contention_type type);
     697void smbd_contend_level2_oplocks_begin(files_struct *fsp,
     698                                  enum level2_contention_type type);
     699void smbd_contend_level2_oplocks_end(files_struct *fsp,
     700                                enum level2_contention_type type);
    683701void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
    684 void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
    685 bool init_oplocks(struct messaging_context *msg_ctx);
     702void message_to_share_mode_entry(struct share_mode_entry *e, const char *msg);
     703bool init_oplocks(struct smbd_server_connection *sconn);
     704void init_kernel_oplocks(struct smbd_server_connection *sconn);
    686705
    687706/* The following definitions come from smbd/oplock_irix.c  */
    688707
    689 struct kernel_oplocks *irix_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
     708struct kernel_oplocks *irix_init_kernel_oplocks(struct smbd_server_connection *sconn);
    690709
    691710/* The following definitions come from smbd/oplock_linux.c  */
     
    694713int linux_set_lease_sighandler(int fd);
    695714int linux_setlease(int fd, int leasetype);
    696 struct kernel_oplocks *linux_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
    697 
    698 /* The following definitions come from smbd/oplock_onefs.c  */
    699 
    700 struct kernel_oplocks *onefs_init_kernel_oplocks(TALLOC_CTX *mem_ctx);
     715struct kernel_oplocks *linux_init_kernel_oplocks(struct smbd_server_connection *sconn);
    701716
    702717/* The following definitions come from smbd/password.c  */
    703718
    704 user_struct *get_valid_user_struct(struct smbd_server_connection *sconn,
    705                                    uint16 vuid);
    706 bool is_partial_auth_vuid(struct smbd_server_connection *sconn, uint16 vuid);
    707 user_struct *get_partial_auth_user_struct(struct smbd_server_connection *sconn,
    708                                           uint16 vuid);
    709 void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid);
    710 void invalidate_all_vuids(struct smbd_server_connection *sconn);
    711 int register_initial_vuid(struct smbd_server_connection *sconn);
     719struct user_struct *get_valid_user_struct(struct smbd_server_connection *sconn,
     720                                          uint64_t vuid);
     721void invalidate_vuid(struct smbd_server_connection *sconn, uint64_t vuid);
    712722int register_homes_share(const char *username);
    713 int register_existing_vuid(struct smbd_server_connection *sconn,
    714                         uint16 vuid,
    715                         struct auth_serversupplied_info *session_info,
    716                         DATA_BLOB response_blob,
    717                         const char *smb_name);
    718 void add_session_user(struct smbd_server_connection *sconn, const char *user);
    719 void add_session_workgroup(struct smbd_server_connection *sconn,
    720                            const char *workgroup);
    721 const char *get_session_workgroup(struct smbd_server_connection *sconn);
    722 bool authorise_login(struct smbd_server_connection *sconn,
    723                      int snum, fstring user, DATA_BLOB password,
    724                      bool *guest);
    725723
    726724/* The following definitions come from smbd/pipes.c  */
     
    736734
    737735void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid, struct dom_sid *pgroup_sid);
    738 bool nt4_compatible_acls(void);
    739736uint32_t map_canon_ace_perms(int snum,
    740737                                enum security_ace_type *pacl_type,
    741738                                mode_t perms,
    742739                                bool directory_ace);
    743 NTSTATUS unpack_nt_owners(connection_struct *conn, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, const struct security_descriptor *psd);
     740NTSTATUS unpack_nt_owners(connection_struct *conn, uid_t *puser, gid_t *pgrp, uint32_t security_info_sent, const struct security_descriptor *psd);
    744741bool current_user_in_group(connection_struct *conn, gid_t gid);
    745742SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
    746743NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
     744                           TALLOC_CTX *mem_ctx,
    747745                           struct security_descriptor **ppdesc);
    748746NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
    749                           uint32_t security_info, struct security_descriptor **ppdesc);
     747                          uint32_t security_info,
     748                          TALLOC_CTX *mem_ctx,
     749                          struct security_descriptor **ppdesc);
    750750NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
    751 NTSTATUS append_parent_acl(files_struct *fsp,
    752                                 const struct security_descriptor *pcsd,
    753                                 struct security_descriptor **pp_new_sd);
    754 NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd);
     751NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct security_descriptor *psd);
    755752int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
    756753int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
     
    760757bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
    761758                                const SMB_STRUCT_STAT *psbuf,
    762                                 uint16 num_def_acls, const char *pdata);
    763 bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16 num_acls, const char *pdata);
    764 struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
     759                                uint16_t num_def_acls, const char *pdata);
     760bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16_t num_acls, const char *pdata);
     761NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname,
     762                             uint32_t security_info_wanted,
     763                             struct security_descriptor **sd);
    765764NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
    766765                                        const char *name,
    767766                                        SMB_STRUCT_STAT *psbuf,
    768767                                        struct security_descriptor **ppdesc);
     768int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
     769                                const char *path_p,
     770                                TALLOC_CTX *mem_ctx,
     771                                char **blob_description,
     772                                DATA_BLOB *blob);
     773int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle,
     774                              files_struct *fsp,
     775                              TALLOC_CTX *mem_ctx,
     776                              char **blob_description,
     777                              DATA_BLOB *blob);
    769778
    770779/* The following definitions come from smbd/process.c  */
    771780
    772 bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
     781void smbd_setup_sig_term_handler(struct smbd_server_connection *sconn);
     782void smbd_setup_sig_hup_handler(struct smbd_server_connection *sconn);
     783bool srv_send_smb(struct smbXsrv_connection *xconn, char *buffer,
    773784                  bool no_signing, uint32_t seqnum,
    774785                  bool do_encrypt,
     
    778789                        int num_bytes,
    779790                        bool zero);
    780 void remove_deferred_open_message_smb(uint64_t mid);
    781 void schedule_deferred_open_message_smb(uint64_t mid);
    782 bool open_was_deferred(uint64_t mid);
     791void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn,
     792                                      uint64_t mid);
     793bool schedule_deferred_open_message_smb(struct smbXsrv_connection *xconn,
     794                                        uint64_t mid);
     795bool open_was_deferred(struct smbXsrv_connection *xconn, uint64_t mid);
    783796bool get_deferred_open_message_state(struct smb_request *smbreq,
    784797                                struct timeval *p_request_time,
    785                                 void **pp_state);
     798                                struct deferred_open_record **open_rec);
    786799bool push_deferred_open_message_smb(struct smb_request *req,
    787                                 struct timeval request_time,
    788                                 struct timeval timeout,
    789                                 struct file_id id,
    790                                 char *private_data,
    791                                 size_t priv_len);
    792 struct idle_event *event_add_idle(struct event_context *event_ctx,
    793                                   TALLOC_CTX *mem_ctx,
    794                                   struct timeval interval,
    795                                   const char *name,
    796                                   bool (*handler)(const struct timeval *now,
    797                                                   void *private_data),
    798                                   void *private_data);
     800                               struct timeval request_time,
     801                               struct timeval timeout,
     802                               struct file_id id,
     803                               struct deferred_open_record *open_rec);
    799804NTSTATUS allow_new_trans(struct trans_state *list, uint64_t mid);
    800 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
     805void reply_outbuf(struct smb_request *req, uint8_t num_words, uint32_t num_bytes);
     806void smb_request_done(struct smb_request *req);
    801807const char *smb_fn_name(int type);
    802 void add_to_common_flags2(uint32 v);
    803 void remove_from_common_flags2(uint32 v);
     808void add_to_common_flags2(uint32_t v);
     809void remove_from_common_flags2(uint32_t v);
    804810void construct_reply_common_req(struct smb_request *req, char *outbuf);
    805 size_t req_wct_ofs(struct smb_request *req);
    806 void chain_reply(struct smb_request *req);
    807 bool req_is_in_chain(struct smb_request *req);
    808 void smbd_process(struct smbd_server_connection *sconn);
    809 bool fork_echo_handler(struct smbd_server_connection *sconn);
     811bool smb1_is_chain(const uint8_t *buf);
     812bool smb1_walk_chain(const uint8_t *buf,
     813                     bool (*fn)(uint8_t cmd,
     814                                uint8_t wct, const uint16_t *vwv,
     815                                uint16_t num_bytes, const uint8_t *bytes,
     816                                void *private_data),
     817                     void *private_data);
     818unsigned smb1_chain_length(const uint8_t *buf);
     819bool smb1_parse_chain(TALLOC_CTX *mem_ctx, const uint8_t *buf,
     820                      struct smbXsrv_connection *xconn,
     821                      bool encrypted, uint32_t seqnum,
     822                      struct smb_request ***reqs, unsigned *num_reqs);
     823bool req_is_in_chain(const struct smb_request *req);
     824void smbd_process(struct tevent_context *ev_ctx,
     825                  struct messaging_context *msg_ctx,
     826                  int sock_fd,
     827                  bool interactive);
     828bool fork_echo_handler(struct smbXsrv_connection *xconn);
    810829
    811830/* The following definitions come from smbd/quotas.c  */
    812831
    813 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    814 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    815 bool disk_quotas(const char *path,
    816                 uint64_t *bsize,
    817                 uint64_t *dfree,
    818                 uint64_t *dsize);
    819 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    820 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    821 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
     832bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
     833                 uint64_t *dfree, uint64_t *dsize);
    822834bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    823 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    824 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    825835
    826836/* The following definitions come from smbd/reply.c  */
     
    831841size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
    832842                        const char *inbuf,
    833                         uint16 smb_flags2,
     843                        uint16_t smb_flags2,
     844                        char **pp_dest,
     845                        const char *src,
     846                        size_t src_len,
     847                        int flags,
     848                        NTSTATUS *err,
     849                        bool *contains_wcard);
     850size_t srvstr_get_path_wcard_posix(TALLOC_CTX *ctx,
     851                        const char *inbuf,
     852                        uint16_t smb_flags2,
    834853                        char **pp_dest,
    835854                        const char *src,
     
    840859size_t srvstr_get_path(TALLOC_CTX *ctx,
    841860                        const char *inbuf,
    842                         uint16 smb_flags2,
     861                        uint16_t smb_flags2,
     862                        char **pp_dest,
     863                        const char *src,
     864                        size_t src_len,
     865                        int flags,
     866                        NTSTATUS *err);
     867size_t srvstr_get_path_posix(TALLOC_CTX *ctx,
     868                        const char *inbuf,
     869                        uint16_t smb_flags2,
    843870                        char **pp_dest,
    844871                        const char *src,
     
    852879                           char **pp_dest, const char *src, int flags,
    853880                           NTSTATUS *err);
     881size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req,
     882                              char **dest, const uint8_t *src, int flags);
    854883bool check_fsp_open(connection_struct *conn, struct smb_request *req,
    855884                    files_struct *fsp);
     
    858887bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
    859888                              files_struct *fsp);
    860 void reply_special(struct smbd_server_connection *sconn, char *inbuf, size_t inbuf_len);
     889void reply_special(struct smbXsrv_connection *xconn, char *inbuf, size_t inbuf_size);
    861890void reply_tcon(struct smb_request *req);
    862891void reply_tcon_and_X(struct smb_request *req);
    863 void reply_unknown_new(struct smb_request *req, uint8 type);
     892void reply_unknown_new(struct smb_request *req, uint8_t type);
    864893void reply_ioctl(struct smb_request *req);
    865894void reply_checkpath(struct smb_request *req);
     
    875904void reply_ctemp(struct smb_request *req);
    876905NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
    877                           uint32 dirtype, struct smb_filename *smb_fname,
     906                          uint32_t dirtype, struct smb_filename *smb_fname,
    878907                          bool has_wild);
    879908void reply_unlink(struct smb_request *req);
    880 ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, size_t nread);
    881 void sendfile_short_send(files_struct *fsp,
    882                                 ssize_t nread,
    883                                 size_t headersize,
    884                                 size_t smb_maxcnt);
     909ssize_t fake_sendfile(struct smbXsrv_connection *xconn, files_struct *fsp,
     910                      off_t startpos, size_t nread);
     911ssize_t sendfile_short_send(struct smbXsrv_connection *xconn,
     912                            files_struct *fsp,
     913                            ssize_t nread,
     914                            size_t headersize,
     915                            size_t smb_maxcnt);
    885916void reply_readbraw(struct smb_request *req);
    886917void reply_lockread(struct smb_request *req);
     
    891922void reply_writeunlock(struct smb_request *req);
    892923void reply_write(struct smb_request *req);
    893 bool is_valid_writeX_buffer(struct smbd_server_connection *sconn,
     924bool is_valid_writeX_buffer(struct smbXsrv_connection *xconn,
    894925                            const uint8_t *inbuf);
    895926void reply_write_and_X(struct smb_request *req);
     
    912943                        files_struct *fsp,
    913944                        const struct smb_filename *smb_fname_dst_in,
    914                         uint32 attrs,
     945                        uint32_t attrs,
    915946                        bool replace_if_exists);
    916947NTSTATUS rename_internals(TALLOC_CTX *ctx,
     
    919950                        struct smb_filename *smb_fname_src,
    920951                        struct smb_filename *smb_fname_dst,
    921                         uint32 attrs,
     952                        uint32_t attrs,
    922953                        bool replace_if_exists,
    923954                        bool src_has_wild,
     
    938969                        bool large_file_format);
    939970uint64_t get_lock_offset(const uint8_t *data, int data_offset,
    940                          bool large_file_format, bool *err);
     971                         bool large_file_format);
    941972void reply_lockingX(struct smb_request *req);
    942973void reply_readbmpx(struct smb_request *req);
     
    949980/* The following definitions come from smbd/seal.c  */
    950981
    951 uint16_t srv_enc_ctx(void);
    952982bool is_encrypted_packet(const uint8_t *inbuf);
    953 void srv_free_enc_buffer(char *buf);
    954 NTSTATUS srv_decrypt_buffer(char *buf);
    955 NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out);
     983void srv_free_enc_buffer(struct smbXsrv_connection *xconn, char *buf);
     984NTSTATUS srv_decrypt_buffer(struct smbXsrv_connection *xconn, char *buf);
     985NTSTATUS srv_encrypt_buffer(struct smbXsrv_connection *xconn, char *buf,
     986                            char **buf_out);
    956987NTSTATUS srv_request_encryption_setup(connection_struct *conn,
    957988                                        unsigned char **ppdata,
     
    960991                                        size_t *p_param_size);
    961992NTSTATUS srv_encryption_start(connection_struct *conn);
    962 void server_encryption_shutdown(void);
     993void server_encryption_shutdown(struct smbXsrv_connection *xconn);
    963994
    964995/* The following definitions come from smbd/sec_ctx.c  */
     
    9701001bool pop_sec_ctx(void);
    9711002void init_sec_ctx(void);
     1003const struct security_token *sec_ctx_active_token(void);
    9721004
    9731005/* The following definitions come from smbd/server.c  */
    9741006
    975 struct event_context *smbd_event_context(void);
    976 struct messaging_context *smbd_messaging_context(void);
    9771007struct memcache *smbd_memcache(void);
    978 void reload_printers(struct tevent_context *ev,
    979                      struct messaging_context *msg_ctx);
    980 void reload_printers_full(struct tevent_context *ev,
    981                           struct messaging_context *msg_ctx);
    982 bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
     1008bool snum_is_shared_printer(int snum);
     1009void delete_and_reload_printers(struct tevent_context *ev,
     1010                                struct messaging_context *msg_ctx);
     1011bool reload_services(struct smbd_server_connection *sconn,
     1012                     bool (*snumused) (struct smbd_server_connection *, int),
    9831013                     bool test);
    984 void exit_server(const char *const explanation);
    985 void exit_server_cleanly(const char *const explanation);
    986 void exit_server_fault(void);
     1014
     1015/* The following definitions come from smbd/server_exit.c  */
     1016
     1017void smbd_exit_server(const char *reason) _NORETURN_;
     1018void smbd_exit_server_cleanly(const char *const reason) _NORETURN_;
    9871019
    9881020/* The following definitions come from smbd/service.c  */
     
    9901022bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
    9911023NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
    992 bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
     1024bool set_current_service(connection_struct *conn, uint16_t flags, bool do_chdir);
    9931025void load_registry_shares(void);
    9941026int add_home_service(const char *service, const char *username, const char *homedir);
    9951027int find_service(TALLOC_CTX *ctx, const char *service, char **p_service_out);
    996 struct smbd_smb2_tcon;
    997 connection_struct *make_connection_smb2(struct smbd_server_connection *sconn,
    998                                         struct smbd_smb2_tcon *tcon,
    999                                         user_struct *vuser,
    1000                                         DATA_BLOB password,
     1028connection_struct *make_connection_smb2(struct smbd_smb2_request *req,
     1029                                        struct smbXsrv_tcon *tcon,
     1030                                        int snum,
     1031                                        struct user_struct *vuser,
    10011032                                        const char *pdev,
    10021033                                        NTSTATUS *pstatus);
    1003 connection_struct *make_connection(struct smbd_server_connection *sconn,
    1004                                    const char *service_in, DATA_BLOB password,
    1005                                    const char *pdev, uint16 vuid,
     1034connection_struct *make_connection(struct smb_request *req,
     1035                                   NTTIME now,
     1036                                   const char *service_in,
     1037                                   const char *pdev, uint64_t vuid,
    10061038                                   NTSTATUS *status);
    1007 void close_cnum(connection_struct *conn, uint16 vuid);
     1039void close_cnum(connection_struct *conn, uint64_t vuid);
    10081040
    10091041/* The following definitions come from smbd/session.c  */
    10101042struct sessionid;
     1043struct smbXsrv_session;
    10111044bool session_init(void);
    1012 bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser);
    1013 void session_yield(user_struct *vuser);
     1045bool session_claim(struct smbXsrv_session *session);
     1046void session_yield(struct smbXsrv_session *session);
    10141047int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
     1048int find_sessions(TALLOC_CTX *mem_ctx, const char *username,
     1049                  const char *machine, struct sessionid **session_list);
    10151050
    10161051/* The following definitions come from smbd/sesssetup.c  */
    10171052
    1018 NTSTATUS do_map_to_guest(NTSTATUS status,
    1019                 struct auth_serversupplied_info **session_info,
    1020                 const char *user, const char *domain);
    1021 
    1022 NTSTATUS parse_spnego_mechanisms(TALLOC_CTX *ctx,
    1023                 DATA_BLOB blob_in,
    1024                 DATA_BLOB *pblob_out,
    1025                 char **kerb_mechOID);
    10261053void reply_sesssetup_and_X(struct smb_request *req);
    10271054
     
    10421069/* The following definitions come from smbd/srvstr.c  */
    10431070
    1044 size_t srvstr_push_fn(const char *function, unsigned int line,
    1045                       const char *base_ptr, uint16 smb_flags2, void *dest,
    1046                       const char *src, int dest_len, int flags);
    1047 ssize_t message_push_string(uint8 **outbuf, const char *str, int flags);
     1071NTSTATUS srvstr_push_fn(const char *base_ptr, uint16_t smb_flags2, void *dest,
     1072                      const char *src, int dest_len, int flags, size_t *ret_len);
     1073ssize_t message_push_string(uint8_t **outbuf, const char *str, int flags);
    10481074
    10491075/* The following definitions come from smbd/statcache.c  */
     
    10581084                        char **pp_start,
    10591085                        SMB_STRUCT_STAT *pst);
     1086void smbd_send_stat_cache_delete_message(struct messaging_context *msg_ctx,
     1087                                    const char *name);
    10601088void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
    10611089                                    const char *name);
     
    10711099/* The following definitions come from smbd/trans2.c  */
    10721100
     1101NTSTATUS check_access_fsp(const struct files_struct *fsp,
     1102                          uint32_t access_mask);
     1103NTSTATUS check_access(connection_struct *conn,
     1104                                files_struct *fsp,
     1105                                const struct smb_filename *smb_fname,
     1106                                uint32_t access_mask);
    10731107uint64_t smb_roundup(connection_struct *conn, uint64_t val);
    10741108uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf);
     1109bool samba_private_attr_name(const char *unix_ea_name);
    10751110NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
    10761111                      files_struct *fsp, const char *fname,
     
    10841119void send_trans2_replies(connection_struct *conn,
    10851120                        struct smb_request *req,
     1121                        NTSTATUS status,
    10861122                         const char *params,
    10871123                         int paramsize,
     
    11091145
    11101146bool change_to_guest(void);
    1111 void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid);
    1112 bool change_to_user(connection_struct *conn, uint16 vuid);
    1113 bool change_to_user_by_session(connection_struct *conn,
    1114                                const struct auth_serversupplied_info *session_info);
    1115 bool change_to_root_user(void);
    1116 bool become_authenticated_pipe_user(struct auth_serversupplied_info *session_info);
    1117 bool unbecome_authenticated_pipe_user(void);
     1147NTSTATUS check_user_share_access(connection_struct *conn,
     1148                                const struct auth_session_info *session_info,
     1149                                uint32_t *p_share_access,
     1150                                bool *p_readonly_share);
     1151bool change_to_user(connection_struct *conn, uint64_t vuid);
     1152bool smbd_change_to_root_user(void);
     1153bool smbd_become_authenticated_pipe_user(struct auth_session_info *session_info);
     1154bool smbd_unbecome_authenticated_pipe_user(void);
    11181155void become_root(void);
    11191156void unbecome_root(void);
    1120 bool become_user(connection_struct *conn, uint16 vuid);
     1157void smbd_become_root(void);
     1158void smbd_unbecome_root(void);
     1159bool become_user(connection_struct *conn, uint64_t vuid);
    11211160bool become_user_by_session(connection_struct *conn,
    1122                             const struct auth_serversupplied_info *session_info);
     1161                            const struct auth_session_info *session_info);
    11231162bool unbecome_user(void);
    11241163uid_t get_current_uid(connection_struct *conn);
     
    11261165const struct security_unix_token *get_current_utok(connection_struct *conn);
    11271166const struct security_token *get_current_nttok(connection_struct *conn);
    1128 uint16_t get_current_vuid(connection_struct *conn);
     1167uint64_t get_current_vuid(connection_struct *conn);
    11291168
    11301169/* The following definitions come from smbd/utmp.c  */
    11311170
    11321171void sys_utmp_claim(const char *username, const char *hostname,
    1133                         const char *ip_addr_str,
    1134                         const char *id_str, int id_num);
     1172                    const char *id_str, int id_num);
    11351173void sys_utmp_yield(const char *username, const char *hostname,
    1136                         const char *ip_addr_str,
    1137                         const char *id_str, int id_num);
    1138 void sys_utmp_yield(const char *username, const char *hostname,
    1139                         const char *ip_addr_str,
    1140                         const char *id_str, int id_num);
    1141 void sys_utmp_claim(const char *username, const char *hostname,
    1142                         const char *ip_addr_str,
    1143                         const char *id_str, int id_num);
     1174                    const char *id_str, int id_num);
    11441175
    11451176/* The following definitions come from smbd/vfs.c  */
    11461177
    1147 NTSTATUS smb_register_vfs(int version, const char *name,
    1148                           const struct vfs_fn_pointers *fns);
    11491178bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
    1150 void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
    1151                                    files_struct *fsp, size_t ext_size,
    1152                                    void (*destroy_fn)(void *p_data));
    1153 void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    1154 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    1155 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    11561179bool smbd_vfs_init(connection_struct *conn);
    11571180NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
    11581181ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
    1159 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
    1160                 size_t byte_count, SMB_OFF_T offset);
    11611182ssize_t vfs_write_data(struct smb_request *req,
    11621183                        files_struct *fsp,
     
    11671188                        const char *buffer,
    11681189                        size_t N,
    1169                         SMB_OFF_T offset);
     1190                        off_t offset);
    11701191int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
    1171 int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len);
    1172 int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len);
    1173 int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len);
    1174 SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n);
     1192int vfs_set_filelen(files_struct *fsp, off_t len);
     1193int vfs_slow_fallocate(files_struct *fsp, off_t offset, off_t len);
     1194int vfs_fill_sparse(files_struct *fsp, off_t len);
     1195off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n);
    11751196const char *vfs_readdirname(connection_struct *conn, void *p,
    11761197                            SMB_STRUCT_STAT *sbuf, char **talloced);
     
    11781199char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
    11791200NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
    1180 int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
    1181                        SMB_STRUCT_STAT *psbuf);
    1182 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
     1201NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
     1202                        const char *fname,
     1203                        struct smb_request *smbreq);
     1204int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname,
    11831205                        SMB_STRUCT_STAT *psbuf);
    11841206NTSTATUS vfs_stat_fsp(files_struct *fsp);
     
    11961218                           uint16_t port);
    11971219
    1198 /* The following definitions come from smbd/msg_idmap.c */
    1199 
    1200 void msg_idmap_register_msgs(struct messaging_context *ctx);
     1220/* The following definitions come from smbd/smb2_create.c */
     1221
     1222NTSTATUS vfs_default_durable_cookie(struct files_struct *fsp,
     1223                                    TALLOC_CTX *mem_ctx,
     1224                                    DATA_BLOB *cookie_blob);
     1225NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
     1226                                        const DATA_BLOB old_cookie,
     1227                                        TALLOC_CTX *mem_ctx,
     1228                                        DATA_BLOB *new_cookie);
     1229NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
     1230                                       struct smb_request *smb1req,
     1231                                       struct smbXsrv_open *op,
     1232                                       const DATA_BLOB old_cookie,
     1233                                       TALLOC_CTX *mem_ctx,
     1234                                       files_struct **result,
     1235                                       DATA_BLOB *new_cookie);
    12011236
    12021237#endif /* _SMBD_PROTO_H_ */
Note: See TracChangeset for help on using the changeset viewer.