along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "system/select.h"
+
#if defined(WITH_AIO)
struct aio_extra;
extern struct aio_extra *aio_list_head;
/* how many write cache buffers have been allocated */
extern unsigned int allocated_write_caches;
-extern int real_max_open_files;
-extern struct bitmap *file_bmap;
-extern files_struct *Files;
-extern int files_used;
/* A singleton cache to speed up searching by dev/inode. */
struct fsp_singleton_cache {
files_struct *fsp;
struct file_id id;
};
-extern struct fsp_singleton_cache fsp_fi_cache;
-extern unsigned long file_gen_counter;
-extern int first_file;
extern const struct mangle_fns *mangle_fns;
extern unsigned char *chartest;
-extern TDB_CONTEXT *tdb_mangled_cache;
+struct tdb_context;
+extern struct tdb_context *tdb_mangled_cache;
-/* these tables are used to provide fast tests for characters */
-extern unsigned char char_flags[256];
/*
this determines how many characters are used from the original filename
in the 8.3 mangled name. A larger value leads to a weaker hash and more collisions.
The largest possible value is 6.
*/
extern unsigned mangle_prefix;
-extern unsigned char base_reverse[256];
struct msg_state;
extern struct msg_state *smbd_msg_state;
extern int trans_num;
-extern pid_t mypid;
extern time_t last_smb_conf_reload_time;
extern time_t last_printer_reload_time;
/****************************************************************************
extern struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx;
struct sec_ctx {
- UNIX_USER_TOKEN ut;
- NT_USER_TOKEN *token;
+ struct security_unix_token ut;
+ struct security_token *token;
};
/* A stack of security contexts. We include the current context as being
the first one, so there is room for another MAX_SEC_CTX_DEPTH more. */
extern struct kernel_oplocks *koplocks;
extern int am_parent;
-extern int server_fd;
extern struct event_context *smbd_event_ctx;
extern struct messaging_context *smbd_msg_ctx;
extern struct memcache *smbd_memcache_ctx;
int *_last_entry_off,
struct ea_list *name_list);
+NTSTATUS smbd_calculate_access_mask(connection_struct *conn,
+ const struct smb_filename *smb_fname,
+ bool file_existed,
+ uint32_t access_mask,
+ uint32_t *access_mask_out);
NTSTATUS smbd_check_open_rights(struct connection_struct *conn,
const struct smb_filename *smb_fname,
uint32_t access_mask,
NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req,
struct tevent_req *subreq);
-NTSTATUS smbd_smb2_request_check_session(struct smbd_smb2_request *req);
-NTSTATUS smbd_smb2_request_check_tcon(struct smbd_smb2_request *req);
-
struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req);
void remove_smb2_chained_fsp(files_struct *fsp);
NTSTATUS status;
uint64_t vuid;
struct auth_ntlmssp_state *auth_ntlmssp_state;
- struct auth_serversupplied_info *server_info;
+ struct auth_serversupplied_info *session_info;
DATA_BLOB session_key;
bool do_signing;
struct smbd_server_connection {
int sock;
- struct client_address client_id;
const struct tsocket_address *local_address;
const struct tsocket_address *remote_address;
+ const char *remote_hostname;
struct messaging_context *msg_ctx;
struct {
bool got_session;
} nbt;
bool using_smb2;
+ int trans_num;
+
+ /*
+ * Cache for calling poll(2) to avoid allocations in our
+ * central event loop
+ */
+ struct pollfd *pfds;
+
+ struct files_struct *files;
+ struct bitmap *file_bmap;
+ int real_max_open_files;
+ int files_used;
+ struct fsp_singleton_cache fsp_fi_cache;
+ unsigned long file_gen_counter;
+ int first_file;
+
+ /* number of open connections (tcons) */
+ int num_tcons_open;
+
+ /* open directory handles. */
+ struct {
+ struct bitmap *dptr_bmap;
+ struct dptr_struct *dirptrs;
+ int dirhandles_open;
+ } searches;
+
+ uint64_t num_requests;
+
struct {
struct fd_event *fde;
struct {
/*
- * fd for the fcntl lock mutexing access to smbd_server_fd
+ * fd for the fcntl lock mutexing access to our sock
*/
int socket_lock_fd;
int ref_count;
} echo_handler;
- uint64_t num_requests;
struct {
bool encrypted_passwords;
bool spnego;
connection_struct *Connections;
/* number of open connections */
struct bitmap *bmap;
- int num_open;
} tcons;
struct smb_signing_state *signing_state;
/* List to store partial SPNEGO auth fragments. */
struct notify_mid_map *notify_mid_maps;
- struct {
- struct bitmap *dptr_bmap;
- struct dptr_struct *dirptrs;
- int dirhandles_open;
- } searches;
struct {
/* dlink list we store pending lock records on. */
struct blocking_lock_record *blocking_lock_queue;
bool blocking_lock_unlock_state;
} locks;
struct smbd_smb2_request *requests;
- uint64_t credits_granted;
+ uint64_t seqnum_low;
+ uint32_t credits_granted;
+ uint32_t max_credits;
+ struct bitmap *credits_bitmap;
} smb2;
};
extern struct smbd_server_connection *smbd_server_conn;
+struct smbd_server_connection *msg_ctx_to_sconn(struct messaging_context *msg_ctx);
+
void smbd_init_globals(void);