Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

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

    r414 r740  
    33   smbd globals
    44   Copyright (C) Stefan Metzmacher 2009
     5   Copyright (C) Jeremy Allison 2010
    56
    67   This program is free software; you can redistribute it and/or modify
     
    1718   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1819*/
     20
     21#include "system/select.h"
    1922
    2023#if defined(WITH_AIO)
     
    2629#endif
    2730
    28 /* dlink list we store pending lock records on. */
    29 extern struct blocking_lock_record *blocking_lock_queue;
    30 
    31 /* dlink list we move cancelled lock records onto. */
    32 extern struct blocking_lock_record *blocking_lock_cancelled_queue;
    33 
    34 /* The event that makes us process our blocking lock queue */
    35 extern struct timed_event *brl_timeout;
    36 
    37 extern bool blocking_lock_unlock_state;
    38 extern bool blocking_lock_cancel_state;
    39 
    4031#ifdef USE_DMAPI
    4132struct smbd_dmapi_context;
     
    4839extern unsigned int allocated_write_caches;
    4940
    50 extern int real_max_open_files;
    51 extern struct bitmap *file_bmap;
    52 extern files_struct *Files;
    53 extern int files_used;
    5441/* A singleton cache to speed up searching by dev/inode. */
    5542struct fsp_singleton_cache {
     
    5744        struct file_id id;
    5845};
    59 extern struct fsp_singleton_cache fsp_fi_cache;
    60 extern unsigned long file_gen_counter;
    61 extern int first_file;
    6246
    6347extern const struct mangle_fns *mangle_fns;
    6448
    6549extern unsigned char *chartest;
    66 extern TDB_CONTEXT *tdb_mangled_cache;
    67 
    68 /* these tables are used to provide fast tests for characters */
    69 extern unsigned char char_flags[256];
     50struct tdb_context;
     51extern struct tdb_context *tdb_mangled_cache;
     52
    7053/*
    7154  this determines how many characters are used from the original filename
     
    7457*/
    7558extern unsigned mangle_prefix;
    76 extern unsigned char base_reverse[256];
    77 
    78 extern char *last_from;
    79 extern char *last_to;
    8059
    8160struct msg_state;
     
    8665extern int trans_num;
    8766
    88 extern pid_t mypid;
    8967extern time_t last_smb_conf_reload_time;
    9068extern time_t last_printer_reload_time;
     
    10280
    10381struct sec_ctx {
    104         UNIX_USER_TOKEN ut;
    105         NT_USER_TOKEN *token;
     82        struct security_unix_token ut;
     83        struct security_token *token;
    10684};
    10785/* A stack of security contexts.  We include the current context as being
     
    11593extern uint16_t last_flags;
    11694
    117 extern struct db_context *session_db_ctx_ptr;
    118 
    11995extern uint32_t global_client_caps;
    12096
     
    137113extern int32_t exclusive_oplocks_open;
    138114extern int32_t level_II_oplocks_open;
    139 extern bool global_client_failed_oplock_break;
    140115extern struct kernel_oplocks *koplocks;
    141116
    142117extern int am_parent;
    143 extern int server_fd;
    144118extern struct event_context *smbd_event_ctx;
    145119extern struct messaging_context *smbd_msg_ctx;
     
    155129struct smbd_smb2_tcon;
    156130
    157 DATA_BLOB negprot_spnego(void);
     131DATA_BLOB negprot_spnego(TALLOC_CTX *ctx, struct smbd_server_connection *sconn);
     132
     133void smbd_lock_socket(struct smbd_server_connection *sconn);
     134void smbd_unlock_socket(struct smbd_server_connection *sconn);
    158135
    159136NTSTATUS smb2_signing_sign_pdu(DATA_BLOB session_key,
     
    163140                                const struct iovec *vector,
    164141                                int count);
    165 
    166 struct smbd_lock_element {
    167         uint32_t smbpid;
    168         enum brl_type brltype;
    169         uint64_t offset;
    170         uint64_t count;
    171 };
    172142
    173143NTSTATUS smbd_do_locking(struct smb_request *req,
     
    188158                               bool delete_pending,
    189159                               struct timespec write_time_ts,
    190                                bool ms_dfs_link,
    191160                               struct ea_list *ea_list,
    192161                               int lock_data_count,
     
    256225                               struct ea_list *name_list);
    257226
     227NTSTATUS smbd_calculate_access_mask(connection_struct *conn,
     228                                    const struct smb_filename *smb_fname,
     229                                    bool file_existed,
     230                                    uint32_t access_mask,
     231                                    uint32_t *access_mask_out);
    258232NTSTATUS smbd_check_open_rights(struct connection_struct *conn,
    259233                                const struct smb_filename *smb_fname,
     
    261235                                uint32_t *access_granted);
    262236
    263 void smbd_notify_cancel_by_smbreq(struct smbd_server_connection *sconn,
    264                                   const struct smb_request *smbreq);
     237void smbd_notify_cancel_by_smbreq(const struct smb_request *smbreq);
    265238
    266239void smbd_server_connection_terminate_ex(struct smbd_server_connection *sconn,
     
    270243        smbd_server_connection_terminate_ex(sconn, reason, __location__)
    271244
     245struct server_id sconn_server_id(const struct smbd_server_connection *sconn);
     246
     247const char *smb2_opcode_name(uint16_t opcode);
    272248bool smbd_is_smb2_header(const uint8_t *inbuf, size_t size);
    273249
     
    301277
    302278struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req);
     279void remove_smb2_chained_fsp(files_struct *fsp);
    303280
    304281NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req);
     
    311288NTSTATUS smbd_smb2_request_process_flush(struct smbd_smb2_request *req);
    312289NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req);
     290NTSTATUS smb2_read_complete(struct tevent_req *req, ssize_t nread, int err);
    313291NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req);
     292NTSTATUS smb2_write_complete(struct tevent_req *req, ssize_t nwritten, int err);
    314293NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req);
    315294NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req);
     
    320299NTSTATUS smbd_smb2_request_process_setinfo(struct smbd_smb2_request *req);
    321300NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req);
     301NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req);
     302void smbd_smb2_request_dispatch_immediate(struct tevent_context *ctx,
     303                                struct tevent_immediate *im,
     304                                void *private_data);
     305
     306/* SMB1 -> SMB2 glue. */
     307void send_break_message_smb2(files_struct *fsp, int level);
     308struct blocking_lock_record *get_pending_smb2req_blr(struct smbd_smb2_request *smb2req);
     309bool push_blocking_lock_request_smb2( struct byte_range_lock *br_lck,
     310                                struct smb_request *req,
     311                                files_struct *fsp,
     312                                int lock_timeout,
     313                                int lock_num,
     314                                uint64_t smblctx,
     315                                enum brl_type lock_type,
     316                                enum brl_flavour lock_flav,
     317                                uint64_t offset,
     318                                uint64_t count,
     319                                uint64_t blocking_smblctx);
     320void process_blocking_lock_queue_smb2(
     321        struct smbd_server_connection *sconn, struct timeval tv_curr);
     322void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp,
     323                        struct byte_range_lock *br_lck,
     324                        enum file_close_type close_type);
     325/* From smbd/smb2_create.c */
     326int map_smb2_oplock_levels_to_samba(uint8_t in_oplock_level);
     327bool get_deferred_open_message_state_smb2(struct smbd_smb2_request *smb2req,
     328                        struct timeval *p_request_time,
     329                        void **pp_state);
     330bool open_was_deferred_smb2(struct smbd_server_connection *sconn,
     331                            uint64_t mid);
     332void remove_deferred_open_message_smb2(
     333        struct smbd_server_connection *sconn, uint64_t mid);
     334void schedule_deferred_open_message_smb2(
     335        struct smbd_server_connection *sconn, uint64_t mid);
     336bool push_deferred_open_message_smb2(struct smbd_smb2_request *smb2req,
     337                        struct timeval request_time,
     338                        struct timeval timeout,
     339                        struct file_id id,
     340                        char *private_data,
     341                        size_t priv_len);
    322342
    323343struct smbd_smb2_request {
     
    337357        int current_idx;
    338358        bool do_signing;
    339 
     359        bool async;
     360        bool cancelled;
     361
     362        /* fake smb1 request. */
     363        struct smb_request *smb1req;
    340364        struct files_struct *compat_chain_fsp;
    341365
     
    401425        NTSTATUS status;
    402426        uint64_t vuid;
    403         AUTH_NTLMSSP_STATE *auth_ntlmssp_state;
    404         struct auth_serversupplied_info *server_info;
     427        struct auth_ntlmssp_state *auth_ntlmssp_state;
     428        struct auth_serversupplied_info *session_info;
    405429        DATA_BLOB session_key;
    406430        bool do_signing;
     
    430454
    431455struct smbd_server_connection {
     456        int sock;
     457        struct client_address client_id;
     458        const struct tsocket_address *local_address;
     459        const struct tsocket_address *remote_address;
     460        struct messaging_context *msg_ctx;
    432461        struct {
    433462                bool got_session;
    434463        } nbt;
    435         bool allow_smb2;
     464        bool using_smb2;
     465        int trans_num;
     466
     467        /*
     468         * Cache for calling poll(2) to avoid allocations in our
     469         * central event loop
     470         */
     471        struct pollfd *pfds;
     472
     473        struct files_struct *files;
     474        struct bitmap *file_bmap;
     475        int real_max_open_files;
     476        int files_used;
     477        struct fsp_singleton_cache fsp_fi_cache;
     478        unsigned long file_gen_counter;
     479        int first_file;
     480
     481        /* number of open connections (tcons) */
     482        int num_tcons_open;
     483
     484        /* open directory handles. */
     485        struct {
     486                struct bitmap *dptr_bmap;
     487                struct dptr_struct *dirptrs;
     488                int dirhandles_open;
     489        } searches;
     490
     491        uint64_t num_requests;
     492
    436493        struct {
    437494                struct fd_event *fde;
    438                 uint64_t num_requests;
     495
     496                struct {
     497                        /*
     498                         * fd for the fcntl lock mutexing access to our sock
     499                         */
     500                        int socket_lock_fd;
     501
     502                        /*
     503                         * fd for the trusted pipe from
     504                         * echo handler child
     505                         */
     506                        int trusted_fd;
     507
     508                        /*
     509                         * fde for the trusted_fd
     510                         */
     511                        struct fd_event *trusted_fde;
     512
     513                        /*
     514                         * Reference count for the fcntl lock to
     515                         * allow recursive locks.
     516                         */
     517                        int ref_count;
     518                } echo_handler;
     519
    439520                struct {
    440521                        bool encrypted_passwords;
     
    470551                        uint16_t next_vuid;
    471552                        int num_validated_vuids;
    472 #ifdef HAVE_NETGROUP
    473                         char *my_yp_domain;
    474 #endif
    475553                } sessions;
    476554                struct {
     
    478556                        /* number of open connections */
    479557                        struct bitmap *bmap;
    480                         int num_open;
    481558                } tcons;
    482559                struct smb_signing_state *signing_state;
     
    487564
    488565                struct {
    489                         struct bitmap *dptr_bmap;
    490                         struct dptr_struct *dirptrs;
    491                         int dirhandles_open;
    492                 } searches;
     566                        /* dlink list we store pending lock records on. */
     567                        struct blocking_lock_record *blocking_lock_queue;
     568                        /* dlink list we move cancelled lock records onto. */
     569                        struct blocking_lock_record *blocking_lock_cancelled_queue;
     570
     571                        /* The event that makes us process our blocking lock queue */
     572                        struct timed_event *brl_timeout;
     573
     574                        bool blocking_lock_unlock_state;
     575                        bool blocking_lock_cancel_state;
     576                } locks;
    493577        } smb1;
    494578        struct {
     
    508592                        struct smbd_smb2_session *list;
    509593                } sessions;
     594                struct {
     595                        /* The event that makes us process our blocking lock queue */
     596                        struct timed_event *brl_timeout;
     597                        bool blocking_lock_unlock_state;
     598                } locks;
    510599                struct smbd_smb2_request *requests;
     600                uint64_t seqnum_low;
     601                uint32_t credits_granted;
     602                uint32_t max_credits;
     603                struct bitmap *credits_bitmap;
    511604        } smb2;
    512605};
     
    514607extern struct smbd_server_connection *smbd_server_conn;
    515608
     609struct smbd_server_connection *msg_ctx_to_sconn(struct messaging_context *msg_ctx);
     610
    516611void smbd_init_globals(void);
Note: See TracChangeset for help on using the changeset viewer.