From 61cd1067efacd91e22b4acbdf0d1d92dc2efc162 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 30 Apr 2011 00:37:05 +0200 Subject: s3-smbd: avoid using pipes_struct when only session_info is needed. Guenther --- source3/smbd/proto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 36eea5e16e..86745f122d 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1051,7 +1051,7 @@ bool change_to_user(connection_struct *conn, uint16 vuid); bool change_to_user_by_session(connection_struct *conn, const struct auth_serversupplied_info *session_info); bool change_to_root_user(void); -bool become_authenticated_pipe_user(struct pipes_struct *p); +bool become_authenticated_pipe_user(struct auth_serversupplied_info *session_info); bool unbecome_authenticated_pipe_user(void); void become_root(void); void unbecome_root(void); -- cgit From 4f41be356a4e6b311d30de3b2e36e4c33aa72ca3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 5 May 2011 10:41:59 -0700 Subject: Fix many const compiler warnings. --- source3/smbd/proto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 86745f122d..2ea01c2a5e 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -23,7 +23,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn, size_t smb_maxcnt); NTSTATUS schedule_aio_write_and_X(connection_struct *conn, struct smb_request *req, - files_struct *fsp, char *data, + files_struct *fsp, const char *data, SMB_OFF_T startpos, size_t numtowrite); NTSTATUS schedule_smb2_aio_read(connection_struct *conn, -- cgit From d8cfca3a9bd2b6b6c562fd202377d95a98eb5472 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 5 May 2011 11:25:29 +0200 Subject: s3: only include tdb headers where needed. Guenther --- source3/smbd/proto.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 2ea01c2a5e..1f2b1a9cff 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -999,7 +999,8 @@ bool stat_cache_lookup(connection_struct *conn, void send_stat_cache_delete_message(struct messaging_context *msg_ctx, const char *name); void stat_cache_delete(const char *name); -unsigned int fast_string_hash(TDB_DATA *key); +struct TDB_DATA; +unsigned int fast_string_hash(struct TDB_DATA *key); bool reset_stat_cache( void ); /* The following definitions come from smbd/statvfs.c */ -- cgit From 8a2eff871f990aaaf1e11b333035097f5e6d3268 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 20 May 2011 13:07:17 +0200 Subject: s3: Fork the echo handler only after SMB1 negprot is done This enables activating the echo responder also if SMB2 is enabled, albeit it will only be used for SMB1 at this moment. Autobuild-User: Volker Lendecke Autobuild-Date: Fri May 20 15:06:03 CEST 2011 on sn-devel-104 --- source3/smbd/proto.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 1f2b1a9cff..589d45dade 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -750,6 +750,7 @@ size_t req_wct_ofs(struct smb_request *req); void chain_reply(struct smb_request *req); bool req_is_in_chain(struct smb_request *req); void smbd_process(struct smbd_server_connection *sconn); +bool fork_echo_handler(struct smbd_server_connection *sconn); /* The following definitions come from smbd/quotas.c */ -- cgit From 8524924a460349a9aa56db475d771b8884fbe517 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 25 May 2011 13:00:22 +1000 Subject: s3-smbd provide struct smbd_server_connection * to conn_snum_used This provides the 'sconn' parameter to this key functions, that is currently duplicated in dummysmbd.c, which causes duplicate symbol issues in the waf build. This has natrually caused a number of consequential changes across the codebase, includning not passing a messaging context into initial reload_services(): This causes problems because the global smbd_server_connection isn't yet set up, as there isn't a connection here, just the initial process. Andrew Bartlett --- source3/smbd/proto.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 589d45dade..5b45574bc5 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -94,7 +94,7 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname); void conn_init(struct smbd_server_connection *sconn); int conn_num_open(struct smbd_server_connection *sconn); -bool conn_snum_used(int snum); +bool conn_snum_used(struct smbd_server_connection *sconn, int snum); connection_struct *conn_find(struct smbd_server_connection *sconn, unsigned cnum); connection_struct *conn_new(struct smbd_server_connection *sconn); @@ -407,7 +407,8 @@ bool create_junction(TALLOC_CTX *ctx, struct junction_map *jucn); bool create_msdfs_link(const struct junction_map *jucn); bool remove_msdfs_link(const struct junction_map *jucn); -struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn); +struct junction_map *enum_msdfs_links(struct smbd_server_connection *sconn, + TALLOC_CTX *ctx, size_t *p_num_jn); NTSTATUS resolve_dfspath(TALLOC_CTX *ctx, connection_struct *conn, bool dfs_pathnames, -- cgit From ade01f083c502ecf7cba19303eb16d3c9a4be52a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 25 May 2011 14:58:24 +1000 Subject: s3-smbd Split conn.c into 3 files The idea with this split is to make it easier to handle dependencies, avoiding having the loadparm code depend on the global server variables, without resorting to dummy functions and linker tricks. conn_clear_vuid_cache() is brought in from uid.c to make it static Andrew Bartlett --- source3/smbd/proto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 5b45574bc5..b1ebf994cf 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -102,6 +102,7 @@ bool conn_close_all(struct smbd_server_connection *sconn); bool conn_idle_all(struct smbd_server_connection *sconn, time_t t); void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint16 vuid); void conn_free(connection_struct *conn); +void conn_force_tdis(struct smbd_server_connection *sconn, const char *sharename); void msg_force_tdis(struct messaging_context *msg, void *private_data, uint32_t msg_type, @@ -1049,7 +1050,6 @@ void reply_transs2(struct smb_request *req); /* The following definitions come from smbd/uid.c */ bool change_to_guest(void); -void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid); bool change_to_user(connection_struct *conn, uint16 vuid); bool change_to_user_by_session(connection_struct *conn, const struct auth_serversupplied_info *session_info); -- cgit From e1bad49f3e6490ac7ff28b7bf8ddb8fb1447c7bd Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 31 May 2011 00:12:27 +0200 Subject: s3:smbd/proto.h: add GPL/Copyright header --- source3/smbd/proto.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index b1ebf994cf..06ecf696c6 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1,3 +1,47 @@ +/* + * Unix SMB/CIFS implementation. + * Main SMB server routines + * + * Copyright (C) Andrew Tridgell 1992-2002,2006 + * Copyright (C) Jeremy Allison 1992-2010 + * Copyright (C) Volker Lendecke 1993-2009 + * Copyright (C) John H Terpstra 1995-1998 + * Copyright (C) Luke Kenneth Casson Leighton 1996-1998 + * Copyright (C) Paul Ashton 1997-1998 + * Copyright (C) Tim Potter 1999-2000 + * Copyright (C) T.D.Lee@durham.ac.uk 1999 + * Copyright (C) Ying Chen 2000 + * Copyright (C) Shirish Kalele 2000 + * Copyright (C) Andrew Bartlett 2001-2003 + * Copyright (C) Alexander Bokovoy 2002,2005 + * Copyright (C) Simo Sorce 2001-2002,2009 + * Copyright (C) Andreas Gruenbacher 2002 + * Copyright (C) Jim McDonough 2002 + * Copyright (C) Martin Pool 2002 + * Copyright (C) Luke Howard 2003 + * Copyright (C) Stefan (metze) Metzmacher 2003,2009 + * Copyright (C) Steve French 2005 + * Copyright (C) Gerald (Jerry) Carter 2006 + * Copyright (C) James Peach 2006-2007 + * Copyright (C) Jelmer Vernooij 2002-2003 + * Copyright (C) Michael Adam 2007 + * Copyright (C) Rishi Srivatsavai 2007 + * Copyright (C) Tim Prouty 2009 + * Copyright (C) Gregor Beck 2011 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /* The following definitions come from smbd/signing.c */ -- cgit From 2e6f8f7bdadd4b6e8b8c9ff2adf3dc1275c50430 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 31 May 2011 00:13:15 +0200 Subject: s3:smbd/proto.h: add _SMBD_PROTO_H_ guard --- source3/smbd/proto.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 06ecf696c6..486ff33598 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -43,6 +43,9 @@ * along with this program. If not, see . */ +#ifndef _SMBD_PROTO_H_ +#define _SMBD_PROTO_H_ + /* The following definitions come from smbd/signing.c */ struct smbd_server_connection; @@ -1177,3 +1180,5 @@ void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev, /* The following definitions come from smbd/msg_idmap.c */ void msg_idmap_register_msgs(struct messaging_context *ctx); + +#endif /* _SMBD_PROTO_H_ */ -- cgit From a4993f647cfc5b8e0cf4405cc1d8815770837310 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 18:40:32 +0930 Subject: ldb: replace 'struct TDB_DATA' with 'TDB_DATA' The typedef is TDB2 compatible, the struct isn't. Signed-off-by: Rusty Russell --- source3/smbd/proto.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 486ff33598..6e515278b4 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1049,8 +1049,13 @@ bool stat_cache_lookup(connection_struct *conn, void send_stat_cache_delete_message(struct messaging_context *msg_ctx, const char *name); void stat_cache_delete(const char *name); +#if BUILD_TDB2 +struct tdb_data; +unsigned int fast_string_hash(struct tdb_data *key); +#else struct TDB_DATA; unsigned int fast_string_hash(struct TDB_DATA *key); +#endif bool reset_stat_cache( void ); /* The following definitions come from smbd/statvfs.c */ -- cgit From b373d0e777df8770c24cfcc5cc80bf4808faa815 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 31 May 2011 13:18:37 +1000 Subject: s3-build: Provide a run-time shim to work around duplicate symbols The become_root() and similar 'smbd' functions that are used widely in Samba libraries had 'dummy' copies in dummysmbd.c and dummyroot.c. These have been replaced by a runtime plugin mechanim, which ensures that standlone binaries still do nothing, while in smbd the correct function is used. This avoids having these as duplicate symbols in the smbd binary, which can cause unpredictable behaviour. Andrew Bartlett Signed-off-by: Andrew Tridgell --- source3/smbd/proto.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source3/smbd/proto.h') diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 6e515278b4..adeaf68899 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -110,6 +110,9 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck, uint64_t offset, uint64_t count, uint64_t blocking_smblctx); +void smbd_cancel_pending_lock_requests_by_fid(files_struct *fsp, + struct byte_range_lock *br_lck, + enum file_close_type close_type); void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lock *br_lck, enum file_close_type close_type); @@ -236,6 +239,8 @@ void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset); bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset); NTSTATUS can_delete_directory(struct connection_struct *conn, const char *dirname); +NTSTATUS smbd_can_delete_directory(struct connection_struct *conn, + const char *dirname); /* The following definitions come from smbd/dmapi.c */ @@ -670,6 +675,10 @@ void contend_level2_oplocks_begin(files_struct *fsp, enum level2_contention_type type); void contend_level2_oplocks_end(files_struct *fsp, enum level2_contention_type type); +void smbd_contend_level2_oplocks_begin(files_struct *fsp, + enum level2_contention_type type); +void smbd_contend_level2_oplocks_end(files_struct *fsp, + enum level2_contention_type type); void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e); void message_to_share_mode_entry(struct share_mode_entry *e, char *msg); bool init_oplocks(struct messaging_context *msg_ctx); @@ -1046,6 +1055,8 @@ bool stat_cache_lookup(connection_struct *conn, char **pp_dirpath, char **pp_start, SMB_STRUCT_STAT *pst); +void smbd_send_stat_cache_delete_message(struct messaging_context *msg_ctx, + const char *name); void send_stat_cache_delete_message(struct messaging_context *msg_ctx, const char *name); void stat_cache_delete(const char *name); @@ -1106,10 +1117,13 @@ bool change_to_user(connection_struct *conn, uint16 vuid); bool change_to_user_by_session(connection_struct *conn, const struct auth_serversupplied_info *session_info); bool change_to_root_user(void); +bool smbd_change_to_root_user(void); bool become_authenticated_pipe_user(struct auth_serversupplied_info *session_info); bool unbecome_authenticated_pipe_user(void); void become_root(void); void unbecome_root(void); +void smbd_become_root(void); +void smbd_unbecome_root(void); bool become_user(connection_struct *conn, uint16 vuid); bool become_user_by_session(connection_struct *conn, const struct auth_serversupplied_info *session_info); -- cgit