Changeset 740 for vendor/current/source3/smbd/globals.h
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/smbd/globals.h
r414 r740 3 3 smbd globals 4 4 Copyright (C) Stefan Metzmacher 2009 5 Copyright (C) Jeremy Allison 2010 5 6 6 7 This program is free software; you can redistribute it and/or modify … … 17 18 along with this program. If not, see <http://www.gnu.org/licenses/>. 18 19 */ 20 21 #include "system/select.h" 19 22 20 23 #if defined(WITH_AIO) … … 26 29 #endif 27 30 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 40 31 #ifdef USE_DMAPI 41 32 struct smbd_dmapi_context; … … 48 39 extern unsigned int allocated_write_caches; 49 40 50 extern int real_max_open_files;51 extern struct bitmap *file_bmap;52 extern files_struct *Files;53 extern int files_used;54 41 /* A singleton cache to speed up searching by dev/inode. */ 55 42 struct fsp_singleton_cache { … … 57 44 struct file_id id; 58 45 }; 59 extern struct fsp_singleton_cache fsp_fi_cache;60 extern unsigned long file_gen_counter;61 extern int first_file;62 46 63 47 extern const struct mangle_fns *mangle_fns; 64 48 65 49 extern 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]; 50 struct tdb_context; 51 extern struct tdb_context *tdb_mangled_cache; 52 70 53 /* 71 54 this determines how many characters are used from the original filename … … 74 57 */ 75 58 extern unsigned mangle_prefix; 76 extern unsigned char base_reverse[256];77 78 extern char *last_from;79 extern char *last_to;80 59 81 60 struct msg_state; … … 86 65 extern int trans_num; 87 66 88 extern pid_t mypid;89 67 extern time_t last_smb_conf_reload_time; 90 68 extern time_t last_printer_reload_time; … … 102 80 103 81 struct sec_ctx { 104 UNIX_USER_TOKENut;105 NT_USER_TOKEN*token;82 struct security_unix_token ut; 83 struct security_token *token; 106 84 }; 107 85 /* A stack of security contexts. We include the current context as being … … 115 93 extern uint16_t last_flags; 116 94 117 extern struct db_context *session_db_ctx_ptr;118 119 95 extern uint32_t global_client_caps; 120 96 … … 137 113 extern int32_t exclusive_oplocks_open; 138 114 extern int32_t level_II_oplocks_open; 139 extern bool global_client_failed_oplock_break;140 115 extern struct kernel_oplocks *koplocks; 141 116 142 117 extern int am_parent; 143 extern int server_fd;144 118 extern struct event_context *smbd_event_ctx; 145 119 extern struct messaging_context *smbd_msg_ctx; … … 155 129 struct smbd_smb2_tcon; 156 130 157 DATA_BLOB negprot_spnego(void); 131 DATA_BLOB negprot_spnego(TALLOC_CTX *ctx, struct smbd_server_connection *sconn); 132 133 void smbd_lock_socket(struct smbd_server_connection *sconn); 134 void smbd_unlock_socket(struct smbd_server_connection *sconn); 158 135 159 136 NTSTATUS smb2_signing_sign_pdu(DATA_BLOB session_key, … … 163 140 const struct iovec *vector, 164 141 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 };172 142 173 143 NTSTATUS smbd_do_locking(struct smb_request *req, … … 188 158 bool delete_pending, 189 159 struct timespec write_time_ts, 190 bool ms_dfs_link,191 160 struct ea_list *ea_list, 192 161 int lock_data_count, … … 256 225 struct ea_list *name_list); 257 226 227 NTSTATUS 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); 258 232 NTSTATUS smbd_check_open_rights(struct connection_struct *conn, 259 233 const struct smb_filename *smb_fname, … … 261 235 uint32_t *access_granted); 262 236 263 void smbd_notify_cancel_by_smbreq(struct smbd_server_connection *sconn, 264 const struct smb_request *smbreq); 237 void smbd_notify_cancel_by_smbreq(const struct smb_request *smbreq); 265 238 266 239 void smbd_server_connection_terminate_ex(struct smbd_server_connection *sconn, … … 270 243 smbd_server_connection_terminate_ex(sconn, reason, __location__) 271 244 245 struct server_id sconn_server_id(const struct smbd_server_connection *sconn); 246 247 const char *smb2_opcode_name(uint16_t opcode); 272 248 bool smbd_is_smb2_header(const uint8_t *inbuf, size_t size); 273 249 … … 301 277 302 278 struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req); 279 void remove_smb2_chained_fsp(files_struct *fsp); 303 280 304 281 NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req); … … 311 288 NTSTATUS smbd_smb2_request_process_flush(struct smbd_smb2_request *req); 312 289 NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req); 290 NTSTATUS smb2_read_complete(struct tevent_req *req, ssize_t nread, int err); 313 291 NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req); 292 NTSTATUS smb2_write_complete(struct tevent_req *req, ssize_t nwritten, int err); 314 293 NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req); 315 294 NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req); … … 320 299 NTSTATUS smbd_smb2_request_process_setinfo(struct smbd_smb2_request *req); 321 300 NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req); 301 NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req); 302 void smbd_smb2_request_dispatch_immediate(struct tevent_context *ctx, 303 struct tevent_immediate *im, 304 void *private_data); 305 306 /* SMB1 -> SMB2 glue. */ 307 void send_break_message_smb2(files_struct *fsp, int level); 308 struct blocking_lock_record *get_pending_smb2req_blr(struct smbd_smb2_request *smb2req); 309 bool 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); 320 void process_blocking_lock_queue_smb2( 321 struct smbd_server_connection *sconn, struct timeval tv_curr); 322 void 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 */ 326 int map_smb2_oplock_levels_to_samba(uint8_t in_oplock_level); 327 bool get_deferred_open_message_state_smb2(struct smbd_smb2_request *smb2req, 328 struct timeval *p_request_time, 329 void **pp_state); 330 bool open_was_deferred_smb2(struct smbd_server_connection *sconn, 331 uint64_t mid); 332 void remove_deferred_open_message_smb2( 333 struct smbd_server_connection *sconn, uint64_t mid); 334 void schedule_deferred_open_message_smb2( 335 struct smbd_server_connection *sconn, uint64_t mid); 336 bool 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); 322 342 323 343 struct smbd_smb2_request { … … 337 357 int current_idx; 338 358 bool do_signing; 339 359 bool async; 360 bool cancelled; 361 362 /* fake smb1 request. */ 363 struct smb_request *smb1req; 340 364 struct files_struct *compat_chain_fsp; 341 365 … … 401 425 NTSTATUS status; 402 426 uint64_t vuid; 403 AUTH_NTLMSSP_STATE*auth_ntlmssp_state;404 struct auth_serversupplied_info *se rver_info;427 struct auth_ntlmssp_state *auth_ntlmssp_state; 428 struct auth_serversupplied_info *session_info; 405 429 DATA_BLOB session_key; 406 430 bool do_signing; … … 430 454 431 455 struct 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; 432 461 struct { 433 462 bool got_session; 434 463 } 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 436 493 struct { 437 494 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 439 520 struct { 440 521 bool encrypted_passwords; … … 470 551 uint16_t next_vuid; 471 552 int num_validated_vuids; 472 #ifdef HAVE_NETGROUP473 char *my_yp_domain;474 #endif475 553 } sessions; 476 554 struct { … … 478 556 /* number of open connections */ 479 557 struct bitmap *bmap; 480 int num_open;481 558 } tcons; 482 559 struct smb_signing_state *signing_state; … … 487 564 488 565 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; 493 577 } smb1; 494 578 struct { … … 508 592 struct smbd_smb2_session *list; 509 593 } 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; 510 599 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; 511 604 } smb2; 512 605 }; … … 514 607 extern struct smbd_server_connection *smbd_server_conn; 515 608 609 struct smbd_server_connection *msg_ctx_to_sconn(struct messaging_context *msg_ctx); 610 516 611 void smbd_init_globals(void);
Note:
See TracChangeset
for help on using the changeset viewer.